Integrate real Blend pool calls for index rate and supply - #198
Merged
soomtochukwu merged 15 commits intoMay 29, 2026
Merged
Conversation
Introduce a Soroban contract client so production code can call the Blend pool interface instead of duplicating index-rate math locally. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the TotalDeposits storage fallback with a get_index_rate invocation so yield math tracks the live pool state. Co-authored-by: Cursor <cursoragent@cursor.com>
Document that calculate_blend_yield and get_blend_position_value depend on live pool index data rather than local mock storage. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop the testing-only wording now that production code reads index rates from the configured Blend pool contract. Co-authored-by: Cursor <cursoragent@cursor.com>
Align the BlendPoolInterface docs with INDEX_RATE_PRECISION so integrators know how pool rates map to bToken math. Co-authored-by: Cursor <cursoragent@cursor.com>
Production callers should read index rates via the configured Blend pool instead of a router-local mock getter. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace set_mock_index_rate with mock pool set_index_rate so tests exercise the same external index rate path as production. Co-authored-by: Cursor <cursoragent@cursor.com>
Clarify that index rate manipulation for yield scenarios belongs on the mock Blend pool used in unit tests, not on SmasageYieldRouter. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the mock implementation inside the test module so production wasm builds never ship test-only Blend pool logic. Co-authored-by: Cursor <cursoragent@cursor.com>
Tests now adjust index rates on the mock Blend pool contract, keeping yield simulation out of the production router interface. Co-authored-by: Cursor <cursoragent@cursor.com>
Authorize the configured Blend pool to pull USDC from the router contract prior to invoking pool supply. Co-authored-by: Cursor <cursoragent@cursor.com>
Delegate bToken minting to the pool contract so supply matches live Blend accounting rather than duplicating index-rate formulas. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace local underlying redemption math with BlendPoolClient::withdraw so redemptions stay consistent with pool state. Co-authored-by: Cursor <cursoragent@cursor.com>
Clarify that withdraw redeems bTokens to a recipient and returns the underlying asset amount from the pool contract. Co-authored-by: Cursor <cursoragent@cursor.com>
Document that the router holds user USDC and approves the pool to pull funds immediately before the on-chain supply invocation. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@codellins Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
BlendPoolClient::get_index_rateinstead of router-local mock storage ([Contract 01] Replace public mock Blend index rate with real pool call #148).get_mock_index_rate/set_mock_index_rate; tests adjust rates on the mock Blend pool contract only ([Contract 02] Move set_mock_index_rate behind test-only code #149).BlendPoolClientwith router USDC approval before poolsupply([Contract 03] Implement real Blend supply invocation #150).Verification
cargo testincontracts/— 13 tests passed.git log 473500c..HEAD --formatconfirms author and committercodellins <codellins@gmail.com>on all 15 commits.Closes #148
Closes #149
Closes #150
Made with Cursor