Skip to content

feat(token): Integrate Stellar Asset Contract (SAC) Standard for Yield-Bearing Pool Shares #171

Description

@grantfox-oss

Context and Motivation

When liquidity providers deposit standard assets (like USDC or XLM) into the TradeFlow factoring pools, their position is currently tracked via internal state mapping. To maximize composability within the broader Stellar DeFi ecosystem, these deposits should be tokenized.

We need to implement a Soroban Token Interface so that when a user provides liquidity, they are minted a yield-bearing LP token (e.g., tfUSDC). As the pool earns revenue from factoring discounts, the underlying value of the LP token increases relative to the underlying asset.

Technical Specification

  1. SAC Interface Implementation: The Vault/AMM contract must implement the standard Soroban Token interface to become a recognizable token contract itself.
  2. Minting & Burning Logic:
    • On deposit(), calculate the correct amount of shares to mint based on the current total_assets / total_shares ratio.
    • On withdraw(), burn the shares and release the proportional underlying assets.
  3. Inflation Attack Protection: Implement mitigation for the standard ERC-4626/Vault "first depositor inflation attack" (e.g., permanently locking the first 1000 minimum units of shares).

Acceptance Criteria

  • The Liquidity Vault contract fully implements standard token read/write functions (balance, transfer, allowance, etc.).
  • deposit and withdraw mechanisms correctly compute fractional shares to prevent rounding loss extraction.
  • Thorough unit testing simulating multiple depositors, varying yield accruals over time, and verifying proportional withdrawal mathematics.

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions