feat(staking): integrate real DeFindex vault yield (USDC, testnet)#77
Merged
Conversation
Replace the synthetic-APY staking_pool with a DeFindex vault-backed single liquid deposit (apartado) that earns real yield from share appreciation. Contract (backend/contracts/staking_pool): - Pool-custody model: deposit routes USDC into the DeFindex vault as from=contract; per-user Shares(user) ledger; authorize_as_current_contract for the vault's nested token.transfer. - get_position(user) returns live redeemable value via get_asset_amounts_per_shares. - Configurable vault address via init(token, vault); re-init guarded. - ContractError-based handling replaces all unwrap()/assert!/panic!. - Score-support getters: get_total_deposited / get_total_withdrawn / get_tx_count. - Removed stake/unstake, StakeInfo and all synthetic APY math. - 9 unit tests with a mock DeFindex vault (deposit/yield/withdraw/errors/auth). Frontend (USDC + real yield): - queries: get_balance -> get_position (+ total_deposited/withdrawn). - Retiros: removed staking section; balance from get_position; XLM -> USDC. - AppContext: removed STAKING_APY/StakePosition/addStake. Scoring data source (loop intact, no new SBT): - get-user-data / evaluate-and-mint read get_position + get_total_deposited. - calculate-score logic unchanged (hybrid formula deferred). Tooling: - CI workflow (fmt/clippy on staking_pool; build+test all three contracts). - deploy_contracts.sh: staking_pool init now takes --token and --vault. - smoke_test_staking.sh for the testnet deposit/withdraw round-trip.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Replace the synthetic-APY staking_pool with a DeFindex vault-backed single liquid deposit (apartado) that earns real yield from share appreciation.
Contract (backend/contracts/staking_pool):
Frontend (USDC + real yield):
Scoring data source (loop intact, no new SBT):
Tooling: