Vault & shares
YieldVaultV4 is the only contract user funds touch. It issues YLD shares and tracks yield rate.
Interface
YieldVaultV4 issues ymMATIC shares against MATIC deposits, tracks totalAssets() and a public yieldRate() in basis points. Conversions are deterministic and on-chain.
solidity
function deposit(uint256 assets, address receiver) external returns (uint256 shares);
function withdraw(uint256 shares, address receiver) external returns (uint256 assets);
function totalAssets() external view returns (uint256);
function yieldRate() external view returns (uint256); // basis points
function asset() external view returns (address);Share math
Shares are minted in proportion to your deposit relative to the live totalAssets() and totalSupply(). The first depositor receives 1:1 shares; later depositors get assets * supply / totalAssets.
ts
const sharesOut =
totalSupply === 0n
? assetsIn
: (assetsIn * totalSupply) / totalAssetsEvents
Deposit(caller, owner, assets, shares)Withdraw(caller, receiver, owner, assets, shares)Rebalanced(strategyHash, blockNumber)