Skip to content

fix(contracts): add TTL management to mUSDC token - #1247

Open
ocakciomursel-pixel wants to merge 1 commit into
drydocs:mainfrom
ocakciomursel-pixel:fix/musdc-ttl-management-1037
Open

ocakciomursel-pixel wants to merge 1 commit into
drydocs:mainfrom
ocakciomursel-pixel:fix/musdc-ttl-management-1037

Conversation

@ocakciomursel-pixel

Copy link
Copy Markdown

Closes #1037

Summary

Adds complete Soroban storage TTL management to the meridian-musdc-token contract so neither the token instance nor individual holder share balances silently archive while backing active vault positions.

Changes

  • Instance storage TTL (30d bump / 29d threshold, matching adapter-common):
    • Extends instance TTL during initialization (init_state, shared by __constructor and initialize) and on every public entry point (mint, total_supply, admin, extend_ttl, and the full SEP-41 TokenInterface surface: allowance, approve, balance, transfer, transfer_from, burn, burn_from, decimals, name, symbol).
  • Persistent balance storage TTL (120d bump / 113d threshold, matching MeridianVault POSITION_BUMP / POSITION_THRESHOLD):
    • Extends DataKey::Balance(addr) on every write (write_balance) and on existing-key reads (read_balance via if let Some(balance)), ensuring share balances share the exact 120-day lifetime window of the Entry/Principal records they back.
    • Guards missing keys before calling persistent().extend_ttl so balance() continues returning 0 for never-funded addresses and first-time mints/transfers never trap in soroban-env-host.
  • Temporary allowance storage TTL:
    • Extends DataKey::Allowance(from, spender) for expiration_ledger - env.ledger().sequence() ledgers when recording positive allowances so multi-day approvals live through expiration_ledger instead of archiving after the network minimum temporary TTL.
  • Permissionless keeper entry point (extend_ttl(env, holder: Option<Address>)):
    • Mirrors MeridianVault::extend_position_ttl so off-chain keepers or dormant holders can refresh instance storage and an optional Balance(holder) entry without authorization, safely skipping persistent extension when holder has no balance record.
  • Operations / migration docs (apps/docs/operations/mainnet-deployment.md):
    • Documents the mUSDC TTL constants, why mUSDC and MeridianVault redeploy as an atomic pair (mUSDC exposes no upgrade entry point and MeridianVault fixes share_token at initialization), and how keepers pair vault.extend_position_ttl with musdc.extend_ttl. (packages/shared/deployed-contracts.json is intentionally untouched until an on-chain redeploy occurs.)

Verification

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test -p meridian-musdc-token --lib (32 unit tests passing, including 200-day multi-phase ledger archival survival, unbumped persistent entry archival trap verification, missing-key guards, permissionless extend_ttl, and temporary allowance TTL tests)
  • cargo build --target wasm32v1-none --release
  • prettier --check apps/docs/operations/mainnet-deployment.md

@vercel

vercel Bot commented Nov 11, 2026

Copy link
Copy Markdown

@ocakciomursel-pixel is attempting to deploy a commit to the Collins' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

[Bug] mUSDC has no TTL management, so balances and the token itself can archive

1 participant