Skip to content

Commit

Permalink
fix: disable showing approve cost for arbitrum (Uniswap#7594)
Browse files Browse the repository at this point in the history
disable showing approve cost for arbitrum
  • Loading branch information
tinaszheng authored Nov 15, 2023
1 parent 52dc441 commit 79e74e1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/state/routing/gas.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MaxUint256, PERMIT2_ADDRESS } from '@uniswap/permit2-sdk'
import { Currency } from '@uniswap/sdk-core'
import { ChainId, Currency } from '@uniswap/sdk-core'
import ERC20_ABI from 'abis/erc20.json'
import { Erc20, Weth } from 'abis/types'
import WETH_ABI from 'abis/weth.json'
Expand All @@ -26,6 +26,12 @@ export async function getApproveInfo(
// If any of these arguments aren't provided, then we cannot generate approval cost info
if (!account || !usdCostPerGas) return { needsApprove: false }

// routing-api under estimates gas for Arbitrum swaps so it inflates cost per gas by a lot
// so disable showing approves for Arbitrum until routing-api gives more accurate gas estimates
if (currency.chainId === ChainId.ARBITRUM_ONE || currency.chainId === ChainId.ARBITRUM_GOERLI) {
return { needsApprove: false }
}

const provider = DEPRECATED_RPC_PROVIDERS[currency.chainId as SupportedInterfaceChain]
const tokenContract = getContract(currency.address, ERC20_ABI, provider) as Erc20

Expand Down

0 comments on commit 79e74e1

Please sign in to comment.