Skip to content

feat(staking): integrate real DeFindex vault yield (USDC, testnet)#77

Merged
Kalebtron1 merged 1 commit into
mainfrom
feat/defindex-yield-integration
Jun 24, 2026
Merged

feat(staking): integrate real DeFindex vault yield (USDC, testnet)#77
Kalebtron1 merged 1 commit into
mainfrom
feat/defindex-yield-integration

Conversation

@Kalebtron1

Copy link
Copy Markdown
Owner

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.

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.
Copilot AI review requested due to automatic review settings June 24, 2026 05:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vyn-oficial Ready Ready Preview, Comment Jun 24, 2026 5:24am

@Kalebtron1 Kalebtron1 merged commit 9dba9dc into main Jun 24, 2026
3 checks passed
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.

2 participants