Submitted by jonah1005
For a dai vault that pairs with NativeStrategyCurve3Crv, every time earn() is called, shareholders would lose money. (about 2%)
There are two issues involved. The Vault contract and the controller contract doesnt handle the price difference between the want token and other tokens.
At Vault.sol L293, when a vault calculates its value, it sums up all tokens balance. However, when the controller calculates vaults value (at Controller.sol L410-L436), it only adds the amount of strategy.want it received. (in this case, its t3crv).
Under the current design, users who deposit dai to the vault would not get yield. Instead, they would keep losing money. I consider this a high-risk issue
I trigger the bug with the following web3.py script:
Hardhat
The protocol should decide what the balance sheet in each contract stands for and make it consistent in all cases. Take, for example, if _vaultDetails[_vault].balance; stands for the amount of want token the vault owns, there shouldnt exist two different want in all the strategies the vault has. Also, when the vault queries controllers function balanceOf(), they should always multiply it by the price.
transferAndCall (yAxis) acknowledged
gpersoon commented:
GalloDaSballo (judge) commented:
BobbyYaxis (yAxis) noted:
