Pull Request: [Feature] Streaming-to-Staking Direct Pipeline (#53, #43)#74
Merged
JerryIdoko merged 2 commits intoGrant-Stream:mainfrom Feb 25, 2026
Merged
Conversation
This was referenced Feb 25, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces the "Direct Pipeline" feature, allowing grantees to automate their savings by redirecting streamed funds directly into a staking pool or a secondary secure address. This bypasses the need for manual withdrawals to a hot wallet, reducing gas costs and improving security for the user.
🎯 Key Changes
field to the Grant struct.Data Structure Update: Added an optional redirect_address: Option
Logic Enhancement: Updated the withdraw() function to check for a redirect_address. If present, the unlocked funds are transferred directly to that target instead of the caller's address.
Permissioning: Ensured that only the grantee can set or update the redirect_address to prevent unauthorized diversion of funds.
💻 Implementation Snippet (Soroban/Rust)
The core logic shift in the withdrawal process:
Rust
pub fn withdraw(e: Env, grant_id: Symbol) {
let mut grant: Grant = e.storage().persistent().get(&grant_id).unwrap();
grant.grantee.require_auth();
}
✅ Acceptance Criteria Checklist
[x] Grant Struct: Added redirect_address to the Grant definition.
[x] Withdraw Logic: The withdraw() function now respects the redirect target.
[x] State Management: Properly handles cases where no redirect is set (defaults to standard withdrawal).
[x] Security: Verified that redirection does not bypass require_auth() from the grantee.
🚀 How to Test
Initialize Grant: Create a grant with a redirect_address set to a mock staking contract.
Advance Ledger: Move the ledger time forward to unlock funds.
Withdraw: Call withdraw from the grantee's account.
Verify: Assert that the mock staking contract's balance increased, while the grantee's balance remained the same.
🔗 Linked Issues
Closes #43
Closes #53