4626 uses _asset.decimals() to calculate initial share/asset conversions
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC4626.sol#L167
EIP4626 states:
All ERC-4626 tokenized Vaults MUST implement ERC-20’s optional metadata extensions.
But EIP20 states for decimals:
OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.
So even if the vault exposes decimals for shares, the 20 spec says not to expect assets to expose decimals.
Even if both tokens expose decimals the method is for usability, not for onchain calculations.
Maybe a virtual _initialShareRatio() function could be exposed that implementing contracts can override without needing to override the entire conversion process
4626 uses
_asset.decimals()to calculate initial share/asset conversionshttps://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC4626.sol#L167
EIP4626 states:
But EIP20 states for
decimals:So even if the vault exposes
decimalsfor shares, the 20 spec says not to expect assets to exposedecimals.Even if both tokens expose
decimalsthe method is for usability, not for onchain calculations.Maybe a virtual
_initialShareRatio()function could be exposed that implementing contracts can override without needing to override the entire conversion process