Open hats-bug-reporter[bot] opened 3 months ago
hey this comment is the correction for the typo of the issue I submitted above
the function meant to be convertToShares
reported which contains the issue
The current implementation of convertToShares
function will round down the number of shares returned due to how solidity handles Integer Division. ERC4626 expects the returned value of convertToShares to be rounded down. Thus, this function behaves as expected.
and issue is in convertToShares
not in convertToAsset
The ERC-4626 standard states: “If (1) it’s calculating how many shares to issue to a user for a certain amount of the underlying tokens they provide, it should round down.” Our function convertToShares
correctly rounds down as intended, complying with the standard.
Therefore, this issue is invalid.
Github username: -- Twitter username: -- Submission hash (on-chain): 0x69efd6ce9145587679c855fec3375f417e24c61d707caf6028a4b896a4842f0d Severity: medium
Description: Description
Per EIP 4626's Security Considerations (https://eips.ethereum.org/EIPS/eip-4626)
so as the docs said the
convertToAssets
should roundUpImpact
Other protocols that integrate with intuition and might wrongly assume that the functions handle rounding as per ERC4626 expectation. Thus, it might cause some integration problem in the future that can lead to wide range of issues for both parties.
Proof of Concept (PoC) File
as we see here this will calculate the amount of assets that would user get in exchange for amount of given share supply and doesnt roundup
Reccomendation
so as the docs said the
convertToAssets
should roundUp so usemulDivUp
instead ofmulDiv