coordinape / coordinape-protocol

🏆 Coordinape contracts
MIT License
32 stars 12 forks source link

Code Review - Wrapper to integrate with yVaults #3

Open saltyfacu opened 3 years ago

saltyfacu commented 3 years ago

Message by @cesarsld

So an apeVault owner, now, can only deposit funds into the vault via the apeRouter. Once it is done, the router, calls the yearn vault assigned to the apeVault and deposits the want token. By doing so it also emits an event saying which apeVault was funded and what yearn vault was used, and how many vault shares were minted

From now on, there's only 2 ways to have funds being taken away from the apeVault.

1) apeVault owner withdraws some or all vault shares from the vault. This would emit an event saying how many yearn vault shares were redeemed and removed

2) apeDistributor (circle using the funds) would take the funds to the distributor contract. An event would say how many yearn vault shares were used by which apevault so you can easily track tvl across all coordinape vaults Would this suffice to help you track the TVL for the yearn partnership program?

Scope

https://github.com/coordinape/coordinape-protocol/blob/feat/V1/contracts/ApeRouter.sol For deposits

https://github.com/coordinape/coordinape-protocol/blob/feat/V1/contracts/wrapper/ApeVault.sol For withdrawals

https://github.com/coordinape/coordinape-protocol/blob/feat/V1/contracts/ApeDistributor.sol For Withdrawal via circles

pandadefi commented 3 years ago

Its possible tokens were present before the delegateDeposit function was called, this will give ownership of the tokens to the person calling transfer.

https://github.com/coordinape/coordinape-protocol/blob/feat/V1/contracts/ApeRouter.sol#L42

pandadefi commented 3 years ago

Is it expected to be the yearn governance that set the registry?

https://github.com/coordinape/coordinape-protocol/blob/feat/V1/contracts/ApeRouter.sol#L57

pandadefi commented 3 years ago

Could you add a test with a vault that gets loss? I can see something like this line breaking: https://github.com/coordinape/coordinape-protocol/blob/feat/V1/contracts/wrapper/ApeVault.sol#L55