Submitted by cmichel
The two BaseVaultAdaptor.calculateShare functions compute share = amount.mul(uint256(10)**decimals).div(sharePrice)
This assumes that the sharePrice is always in token decimals and that token decimals is the same as vault decimals.
Both these assumptions happen to be correct for Yearn vaults, but that will not necessarily be the case for other protocols.
As this functionality is in the BaseVaultAdaptor, and not in the specific VaultAdaptorYearnV2_032, consider generalizing the conversion.
Integrating a token where the token or price is reported in a different precision will lead to potential losses as more shares are computed.
Because the conversion seems highly protocol-specific, it is recommended that calculateShare should be an abstract function (like _getVaultSharePrice) that is implemented in the specific adaptors.
- kristian-gro (Gro) confirmed
