Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkqs90 - AMO contracts does not work with high decimal stablecoins. #316

Open
sherlock-admin3 opened this issue Oct 29, 2024 · 0 comments
Open

Comments

@sherlock-admin3
Copy link

sherlock-admin3 commented Oct 29, 2024

pkqs90

Medium

AMO contracts does not work with high decimal stablecoins.

Summary

AMO contracts does not work with high decimal stablecoins, specifically, tokens with decimals larger than 18.

Root Cause

In the contest readme, it is noted all stablecoins (except FoT) is supported:

Q: If you are integrating tokens, are you allowing only whitelisted tokens to work with the codebase or any complying with the standard? Are they assumed to have certain properties, e.g. be non-reentrant? Are there any types of weird tokens you want to integrate?

Yes, the AMO are deployed by the team, with a specific stablecoin as a pair! In the the scope of this audit would be any USD-pegged token, beside fee-on-transfer ones.

In MasterAMO, both toBoostAmount() and toUsdAmount() function would underflow for such token. These two functions are used within SolidlyV2AMO and SolidlyV3AMO, thus the entire contract won't work.

    function toBoostAmount(uint256 usdAmount) internal view returns (uint256) {
        return usdAmount * 10 ** (boostDecimals - usdDecimals);
    }

    function toUsdAmount(uint256 boostAmount) internal view returns (uint256) {
        return boostAmount / 10 ** (boostDecimals - usdDecimals);
    }

Internal pre-conditions

N/A

External pre-conditions

N/A

Attack Path

N/A

Impact

AMO contracts does not work with high decimal stablecoins.

PoC

N/A

Mitigation

Handle the case toBoostAmount() and toUsdAmount where usdDecimals > 18.

@sherlock-admin2 sherlock-admin2 changed the title Fast Lemonade Hawk - AMO contracts does not work with high decimal stablecoins. pkqs90 - AMO contracts does not work with high decimal stablecoins. Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant