hats-finance / Tokemak-0x4a2d708ea6b0c04186ecb774cfad1e50fb5efc0b

0 stars 0 forks source link

Unsafe call to decimals() #3

Open hats-bug-reporter[bot] opened 5 months ago

hats-bug-reporter[bot] commented 5 months ago

Github username: @https://github.com/Pavel2202 Twitter username: https://twitter.com/timenov_pavel Submission hash (on-chain): 0x27da7f4ff2a68cff41196f705cbe820c03bfb92b96b196520ce50d2b618a6d6b Severity: low

Description: Description\ The decimals function is optional in the initial ERC20 and might fail for old tokens that do not implement it.

Attachments

https://github.com/Tokemak/v2-core-hats/blob/74b397ce988a418a1bd02a45716cfc964922be26/src/strategy/LMPStrategy.sol#L370-L371

https://github.com/Tokemak/v2-core-hats/blob/74b397ce988a418a1bd02a45716cfc964922be26/src/strategy/LMPStrategy.sol#L786

https://github.com/Tokemak/v2-core-hats/blob/74b397ce988a418a1bd02a45716cfc964922be26/src/strategy/LMPStrategy.sol#L821

  1. Revised Code File (Optional) Use this as an example of how to fix this issue.
codenutt commented 5 months ago

If there was a token used in the system that didn't support decimals() then reverting is the desired behavior. Making it work by using a default of 18 would risk improperly calculating our results.