Skip to content

Comments

(feat): implement grant contract with flow rate management and error …#37

Merged
JerryIdoko merged 4 commits intoGrant-Stream:mainfrom
Obiajulu-gif:dynamic_flow_rate
Feb 23, 2026
Merged

(feat): implement grant contract with flow rate management and error …#37
JerryIdoko merged 4 commits intoGrant-Stream:mainfrom
Obiajulu-gif:dynamic_flow_rate

Conversation

@Obiajulu-gif
Copy link
Contributor

This pull request introduces a major refactor of the GrantContract to implement streaming/linear vesting grants with flow rates, replacing the previous milestone-based grant logic. The contract now supports dynamic updates to grant flow rates, cancellation, withdrawal, and status tracking, and includes a comprehensive suite of tests for these new behaviors. The previous milestone logic and associated tests have been removed. Below are the most important changes:

Core Contract Refactor and New Features

  • Replaced milestone-based grant logic with a streaming/flow-rate-based grant system, introducing the Grant, GrantStatus, and related data structures. Grants now accrue claimable balances over time according to a flow rate, and can be updated, cancelled, or completed. (contracts/grant_contracts/src/lib.rs)
  • Implemented core contract methods: initialize, create_grant, cancel_grant, get_grant, claimable, withdraw, and update_rate, each with appropriate authorization and error handling. (contracts/grant_contracts/src/lib.rs)
  • Added robust error handling and validation for grant operations, including checks for authorization, invalid states, math overflows, and invalid parameters. (contracts/grant_contracts/src/lib.rs)

Testing Overhaul

  • Replaced all milestone-based tests with new tests covering flow-rate grants: updating rates (including edge cases), withdrawals, pausing/resuming, admin authorization, and status transitions (active, cancelled, completed). (contracts/grant_contracts/src/test.rs)

Other

  • Removed the old grant math utility and milestone logic, as well as the associated simulation and overflow tests, since they are no longer relevant to the new flow-rate model. (contracts/grant_contracts/src/lib.rs, contracts/grant_contracts/src/test.rs) [1] [2]
  • Updated the Rust toolchain info and added a note about a lock file parse error (likely unrelated to contract logic). (target/.rustc_info.json, target/flycheck0/stderr) [1] [2]
    Closes # Issue: [Logic] Dynamic Flow Rate Adjustment #6

@JerryIdoko JerryIdoko merged commit a2a6a9c into Grant-Stream:main Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

# Issue: [Logic] Dynamic Flow Rate Adjustment

2 participants