Repository navigation
Feature/spend save yield integration - #46
Open
Peolite001 wants to merge 2 commits into
Open
Peolite001 wants to merge 2 commits into
Peolite001 wants to merge 2 commits into
Conversation
|
@Peolite001 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 branch has not been deployed
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.
Title
feat(spend_save): implement yield integration (#42)
Description
This PR integrates the
spend_savecontract with theloktin-yieldpool (#37), ensuring that idle saved balances can now actively earn yield while they sit in the contract. It ports the yield integration pattern already established in thelocked_inandtarget_savingscontracts and implements a full share-based accounting system for positions.Key Changes
PoolClientinterface inlib.rsand wired it intodeposit_to_blend,withdraw_from_blend, andblend_position.env.authorize_as_current_contractto correctly process USDC transfers.set_poolandpooladmin functions for configuration.SpendSavePositionto holdsharesalongsidesaved_balance.Error::ZeroShares).total_spent_lifetimeto accumulate the actualtotal_amountpulled from the user (previously under-reported by only counting the forwardedsentamount).usdc_token()panicking on.unwrap()to properly return a typedResult<Address, Error>, maintaining consistency withadmin().test_zero_share_mint_rejectedto explicitly verify protections against zero-share inflation vulnerabilities.test_multi_user_spend_and_withdrawusing the standard harness to simulate multiple users interacting, earning simulated yield, and withdrawing on the 28th, ensuring the contract never runs short on liquidity.Related Issues
Closes #42
Acceptance Criteria
deposit_to_blendactually supplies USDC to the pool.withdraw_from_blendactually withdraws from the pool.blend_positionreports the real aggregate position.set_pool/poolpresent and admin-gated.usdc_token()helper.total_spent_lifetimenow accurately reflects total spent.cargo test --workspacepasses cleanly.Deployment Notes
set_poolmust be called by the admin after deploying to set the target pool address beforedeposit_to_blendorwithdraw_from_blendcan be utilized.