sherlock-audit / 2022-09-notional-judging

4 stars 2 forks source link

0x52 - Deployments.sol uses the wrong address for UNIV2 router which causes all Uniswap V2 calls to fail #32

Open rcstanciu opened 2 years ago

rcstanciu commented 2 years ago

0x52

medium

Deployments.sol uses the wrong address for UNIV2 router which causes all Uniswap V2 calls to fail

Summary

Deployments.sol accidentally uses the Uniswap V3 router address for UNIV2_ROUTER which causes all Uniswap V2 calls to fail

Vulnerability Detail

IUniV2Router2 internal constant UNIV2_ROUTER = IUniV2Router2(0xE592427A0AEce92De3Edee1F18E0157C05861564);

The constant UNIV2_ROUTER contains the address for the Uniswap V3 router, which doesn't contain the "swapExactTokensForTokens" or "swapTokensForExactTokens" methods. As a result, all calls made to Uniswap V2 will revert.

Impact

Uniswap V2 is totally unusable

Code Snippet

Deployments.sol#L25

Tool used

Manual Review

Recommendation

Change UNIV2_ROUTER to the address of the V2 router:

IUniV2Router2 internal constant UNIV2_ROUTER = IUniV2Router2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
jeffywu commented 2 years ago

@weitianjie2000 I believe this has been fixed subsequently

rayn731 commented 1 year ago

Fixed, replace Uniswap v3 router address with v2 router address.