This repository has been archived by the owner on Sep 17, 2023. It is now read-only.
HonorLt - Hardcoded WETH #288
Labels
Duplicate
Escalation Resolved
This issue's escalations have been approved/rejected
Medium
Reward
A payout will be made for this issue
HonorLt
medium
Hardcoded WETH
Summary
The address of
WETH
is hardcoded but it differs on other chains.Vulnerability Detail
The swap library has
WETH
hardcoded:It is used when performing a multi-token swap (tokenA -> WETH -> tokenB).
The scope mentions these deployment environments:
DEPLOYMENT: Mainnet, Arbitrum, Optimism, Polygon, Binance Smart Chain
This hardcoded
WETH
address does not match other chains. For example, on Arbitrum the address is: https://arbiscan.io/token/0x82af49447d8a07e3bd95bd0d56f35241523fbab1What is more, the next variable (
gasUsedForSwap
) is not used anywhere so I was not sure what is the purpose of it:Impact
The current code of the swap library will only work on mainnet and needs to be manually adjusted before deploying on other chains. If accidentally deployed as it is, then when the time comes to perform the multi-swap, it will throw a runtime error.
Code Snippet
https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/libraries/Swap.sol#L28
Tool used
Manual Review
Recommendation
Inject the
WETH
address as a parameter.Duplicate of #308
The text was updated successfully, but these errors were encountered: