diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 49508b541..88c1a84e7 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -551,3 +551,10 @@ export const defaultSwapSlippage = Number( export const indexerApiBaseUrl = process.env.REACT_APP_INDEXER_BASE_URL || undefined; + +export const hyperLiquidBridge2Address = + "0x2Df1c51E09aECF9cacB7bc98cB1742757f163dF7"; + +export const acrossPlusMulticallHandler: Record = { + [CHAIN_IDs.ARBITRUM]: "0x924a9f036260DdD5808007E1AA95f08eD08aA569", +}; diff --git a/src/utils/hyperliquid.ts b/src/utils/hyperliquid.ts index 990318a6c..2e75d1e25 100644 --- a/src/utils/hyperliquid.ts +++ b/src/utils/hyperliquid.ts @@ -1,6 +1,8 @@ import { Deposit } from "hooks/useDeposits"; import { CHAIN_IDs } from "@across-protocol/constants"; import { utils } from "ethers"; +import { compareAddressesSimple } from "./sdk"; +import { hyperLiquidBridge2Address } from "./constants"; export function isHyperLiquidBoundDeposit(deposit: Deposit) { if (deposit.destinationChainId !== CHAIN_IDs.ARBITRUM || !deposit.message) { @@ -22,9 +24,9 @@ export function isHyperLiquidBoundDeposit(deposit: Deposit) { } // Check if second call is to HyperLiquid Bridge2 contract - return ( - decoded[0].calls[1].target.toLowerCase() === - "0x2Df1c51E09aECF9cacB7bc98cB1742757f163dF7".toLowerCase() + return compareAddressesSimple( + decoded[0].calls[1].target, + hyperLiquidBridge2Address ); } catch { return false; diff --git a/src/views/Bridge/hooks/useBridgeAction.ts b/src/views/Bridge/hooks/useBridgeAction.ts index 27a027fe3..7875d8a7f 100644 --- a/src/views/Bridge/hooks/useBridgeAction.ts +++ b/src/views/Bridge/hooks/useBridgeAction.ts @@ -25,6 +25,8 @@ import { sendSwapAndBridgeTx, compareAddressesSimple, getToken, + acrossPlusMulticallHandler, + hyperLiquidBridge2Address, } from "utils"; import { TransferQuote } from "./useTransferQuote"; import { SelectedRoute } from "../utils"; @@ -163,7 +165,7 @@ export function useBridgeAction( value: 0, }, { - target: "0x2Df1c51E09aECF9cacB7bc98cB1742757f163dF7", // Bridge2 contract + target: hyperLiquidBridge2Address, callData: hyperLiquidPayload, value: 0, }, @@ -271,7 +273,7 @@ export function useBridgeAction( fillDeadline: frozenFeeQuote.fillDeadline, message: externalPayload, toAddress: externalProjectIsHyperLiquid - ? "0x924a9f036260DdD5808007E1AA95f08eD08aA569" // Default multicall handler + ? acrossPlusMulticallHandler[frozenRoute.toChain] : frozenDepositArgs.toAddress, }, spokePool, @@ -472,7 +474,7 @@ export async function generateHyperLiquidPayload( const permitValue = { owner: source, - spender: "0x2Df1c51E09aECF9cacB7bc98cB1742757f163dF7", // Bridge2 contract address + spender: hyperLiquidBridge2Address, value: amount, nonce: await usdcContract.nonces(source), deadline,