SAYV is a savings account that earns yield on digital dollars (stablecoins) via Aave and offers users optional cash advances against their future yield. It plugs directly into YieldWield's Yield Advance for yield advance logic and TokenRegistry for token permissions.
SAYV handles the vault logic for:
- Accepting stablecoin deposits from users
- Supplying those funds to Aave v3 to earn yield
- Tracking user balances using Aave’s liquidity index and share math
- Allowing users to take advances against future yield via YieldWield's Yield Advance
- Managing an allowlist of tokens via TokenRegistry
- Claiming protocol revenue automatically from Yield Advance fees
To install SAYV into your Foundry project:
forge install X-O1/sayv
Then add your remappings to foundry.toml
:
[profile.default]
src = 'contracts'
out = 'out'
libs = ['lib']
remappings = [
'@sayv/=lib/sayv/contracts/',
'@yield-advance/=lib/yield-advance/contracts/',
'@token-registry/=lib/token-registry/src/'
]
new Sayv(
addressProviderAddress, // Aave PoolAddressesProvider
yieldAdvanceAddress, // YieldWield's Yield Advance contract
tokenRegistryAddress // TokenRegistry contract
);
Make sure Aave and token registry contracts are deployed before initializing SAYV.
sayv.depositToVault(token, amount);
User deposits stablecoins → SAYV supplies to Aave → mints yield shares for the user.
sayv.withdrawFromVault(token, amount);
User burns yield shares → SAYV withdraws from Aave → sends stablecoins to user.
sayv.getYieldAdvance(token, collateralAmount, requestedAdvance);
User redeems part of their shares → YieldAdvance calculates advance + fee → SAYV withdraws and sends advance.
sayv.repayYieldAdvanceWithDeposit(token, amount);
User sends stablecoins to repay their debt → SAYV re-supplies to Aave.
sayv.withdrawYieldAdvanceCollateral(token);
Once debt is repaid → user gets collateral back → shares are re-minted.
SAYV uses share-based accounting to represent user balances:
s_yieldShares
— user’s share balances_totalYieldShares
— total protocol shares- Shares convert to real token value via Aave’s
liquidityIndex
- Revenue shares are claimed from YieldWield's Yield Advance and added to
s_totalRevenueShares
sayv.managePermittedTokens(token, true); // Add
sayv.managePermittedTokens(token, false); // Remove
- Automatically approves token for Aave supply
- TokenRegistry is used for permissioning
forge test
MIT