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

use require instead if/else #121

Open
code423n4 opened this issue Feb 1, 2022 · 0 comments
Open

use require instead if/else #121

code423n4 opened this issue Feb 1, 2022 · 0 comments
Labels
bug Something isn't working G (Gas Optimization) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

Handle

rfa

Vulnerability details

Impact

expensive gas

Proof of Concept

https://github.com/code-423n4/2022-01-openleverage/blob/main/openleverage-contracts/contracts/dex/eth/EthDexAggregatorV1.sol#L151-L158
better use require() here

Tools Used

Recommended Mitigation Steps

    function calSellAmount(address buyToken, address sellToken, uint24 buyTax, uint24 sellTax, uint buyAmount, bytes memory data) external view override returns (uint sellAmount){
        require(data.isUniV2Class(), 'Unsupported dex'); 
            sellAmount = uniV2CalSellAmount(dexInfo[data.toDex()], buyToken, sellToken, buyAmount, buyTax, sellTax);
    }
@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Feb 1, 2022
code423n4 added a commit that referenced this issue Feb 1, 2022
@ColaM12 ColaM12 added the sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons label Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working G (Gas Optimization) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

2 participants