Uniswap / universal-router

Uniswap's Universal Router for NFT and ERC20 swapping
GNU General Public License v3.0
396 stars 204 forks source link

Possible optimizations by avoiding `extcodesize` #292

Open shuhuiluo opened 1 year ago

shuhuiluo commented 1 year ago

Consider using low level call or inline assembly for calling balanceOf, ownerOf, getReserves, swap, etc.

For example for command BALANCE_CHECK_ERC20, https://github.com/Uniswap/universal-router/blob/b01e71f8ea6458ce86cb94ad68b5d4d92d3a7382/contracts/base/Dispatcher.sol#L203-L204

it isn't necessary to invoke extcodesize by using the interface. This also applies to all calls made to PERMIT2.