From 7086c434107b28e36ecd7a12376e0eb7025965b0 Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Thu, 16 Nov 2023 15:01:18 -0700 Subject: [PATCH 1/2] add arb one native swap --- src/hooks/useSwapAdjustedAmounts.ts | 8 +++++++- src/references/index.ts | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/hooks/useSwapAdjustedAmounts.ts b/src/hooks/useSwapAdjustedAmounts.ts index 1a908a44fc7..3843f6c414e 100644 --- a/src/hooks/useSwapAdjustedAmounts.ts +++ b/src/hooks/useSwapAdjustedAmounts.ts @@ -7,6 +7,7 @@ import { WETH_ADDRESS, WMATIC_POLYGON_ADDRESS, WBNB_BSC_ADDRESS, + ARBITRUM_ONE_ETH_ADDRESS, } from '@/references'; import { fromWei, updatePrecisionToDisplay } from '@/helpers/utilities'; import { ethereumUtils } from '@/utils'; @@ -57,7 +58,12 @@ export default function useSwapAdjustedAmounts(tradeDetails: Quote) { (tradeDetails.buyTokenAddress === ETH_ADDRESS && tradeDetails.sellTokenAddress === WBNB_BSC_ADDRESS) || (tradeDetails.sellTokenAddress === ETH_ADDRESS && - tradeDetails.buyTokenAddress === WBNB_BSC_ADDRESS) + tradeDetails.buyTokenAddress === WBNB_BSC_ADDRESS) || + // arb one <-> weth arb one swap + (tradeDetails.buyTokenAddress === ETH_ADDRESS && + tradeDetails.sellTokenAddress === ARBITRUM_ONE_ETH_ADDRESS) || + (tradeDetails.sellTokenAddress === ETH_ADDRESS && + tradeDetails.buyTokenAddress === ARBITRUM_ONE_ETH_ADDRESS) ) { amountReceivedSold = fromWei(amountReceivedSold.toString()); } diff --git a/src/references/index.ts b/src/references/index.ts index 27bddc984cc..0496593d955 100644 --- a/src/references/index.ts +++ b/src/references/index.ts @@ -65,6 +65,8 @@ export const ETH_ADDRESS = 'eth'; export const ETH_SYMBOL = 'ETH'; export const ARBITRUM_ETH_ADDRESS = '0x0000000000000000000000000000000000000000'; +export const ARBITRUM_ONE_ETH_ADDRESS = + '0x82af49447d8a07e3bd95bd0d56f35241523fbab1'; export const OPTIMISM_ETH_ADDRESS = '0x0000000000000000000000000000000000000000'; export const ZORA_ETH_ADDRESS = '0x0000000000000000000000000000000000000000'; From 3b813651da70ed2c233262a79d20268fb2fe1f29 Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Thu, 16 Nov 2023 15:13:16 -0700 Subject: [PATCH 2/2] change name to make more sense --- src/hooks/useSwapAdjustedAmounts.ts | 6 +++--- src/references/index.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hooks/useSwapAdjustedAmounts.ts b/src/hooks/useSwapAdjustedAmounts.ts index 3843f6c414e..6f08c53ce75 100644 --- a/src/hooks/useSwapAdjustedAmounts.ts +++ b/src/hooks/useSwapAdjustedAmounts.ts @@ -7,7 +7,7 @@ import { WETH_ADDRESS, WMATIC_POLYGON_ADDRESS, WBNB_BSC_ADDRESS, - ARBITRUM_ONE_ETH_ADDRESS, + WETH_ARBITRUM_ADDRESS, } from '@/references'; import { fromWei, updatePrecisionToDisplay } from '@/helpers/utilities'; import { ethereumUtils } from '@/utils'; @@ -61,9 +61,9 @@ export default function useSwapAdjustedAmounts(tradeDetails: Quote) { tradeDetails.buyTokenAddress === WBNB_BSC_ADDRESS) || // arb one <-> weth arb one swap (tradeDetails.buyTokenAddress === ETH_ADDRESS && - tradeDetails.sellTokenAddress === ARBITRUM_ONE_ETH_ADDRESS) || + tradeDetails.sellTokenAddress === WETH_ARBITRUM_ADDRESS) || (tradeDetails.sellTokenAddress === ETH_ADDRESS && - tradeDetails.buyTokenAddress === ARBITRUM_ONE_ETH_ADDRESS) + tradeDetails.buyTokenAddress === WETH_ARBITRUM_ADDRESS) ) { amountReceivedSold = fromWei(amountReceivedSold.toString()); } diff --git a/src/references/index.ts b/src/references/index.ts index 0496593d955..c026988c705 100644 --- a/src/references/index.ts +++ b/src/references/index.ts @@ -65,8 +65,6 @@ export const ETH_ADDRESS = 'eth'; export const ETH_SYMBOL = 'ETH'; export const ARBITRUM_ETH_ADDRESS = '0x0000000000000000000000000000000000000000'; -export const ARBITRUM_ONE_ETH_ADDRESS = - '0x82af49447d8a07e3bd95bd0d56f35241523fbab1'; export const OPTIMISM_ETH_ADDRESS = '0x0000000000000000000000000000000000000000'; export const ZORA_ETH_ADDRESS = '0x0000000000000000000000000000000000000000'; @@ -81,6 +79,8 @@ export const MATIC_POLYGON_ADDRESS = export const WETH_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; export const WETH_POLYGON_ADDRESS = '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'; +export const WETH_ARBITRUM_ADDRESS = + '0x82af49447d8a07e3bd95bd0d56f35241523fbab1'; export const DAI_POLYGON_ADDRESS = '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063'; export const WMATIC_POLYGON_ADDRESS = '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270';