yearn / audit

37 stars 21 forks source link

yswap impermanent loss protection on buy/sell #2

Open sirpy opened 3 years ago

sirpy commented 3 years ago

How does yswap protect if the protection only happens on withdrawing liquidity and not during every buy/sell? https://github.com/yearn/audit/blob/4b07283c80fc005e899afa8b5fb2bb949fe11f28/contracts/ySwap/StableAMMv3.sol#L473

sirpy commented 3 years ago

@andrecronje can you explain why yswap protect from impermanent loss? it needs to know how much of asset A i deposited originally, to compare their value today vs the value I get when withdrawing my LP. In the code I see only calculation of using current amount of asset A i'm entitled too from the pool, but if asset A relative amount in the pool has shrunk (because of drainage by arbitragers), it will not correctly calculate impermanent loss