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
- SAC Interface Implementation: The Vault/AMM contract must implement the standard Soroban Token interface to become a recognizable token contract itself.
- 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.
- 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
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
deposit(), calculate the correct amount of shares to mint based on the currenttotal_assets / total_sharesratio.withdraw(), burn the shares and release the proportional underlying assets.Acceptance Criteria
balance,transfer,allowance, etc.).depositandwithdrawmechanisms correctly compute fractional shares to prevent rounding loss extraction.