From 6304f5bdea8a84a3b1feab12cb24309cd5152a6a Mon Sep 17 00:00:00 2001 From: Chase Coleman Date: Tue, 20 Feb 2024 19:34:59 +0000 Subject: [PATCH 1/2] Add Across v3 events --- src/adapters/across/index.ts | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/adapters/across/index.ts b/src/adapters/across/index.ts index 1812791e..af50bd4d 100644 --- a/src/adapters/across/index.ts +++ b/src/adapters/across/index.ts @@ -38,6 +38,45 @@ const contracts = { type SupportedChains = keyof typeof contracts; +const depositParamsv3: PartialContractEventParams = { + target: "", + topic: "V3FundsDeposited(address,address,uint256,uint256,uint256,uint32,uint32,uint32,uint32,address,address,address,bytes)", + abi: [ + "event V3FundsDeposited(address inputToken,address outputToken,uint256 inputAmount,uint256 outputAmount,uint256 indexed destinationChainId,uint32 indexed depositId,uint32 quoteTimestamp,uint32 fillDeadline,uint32 exclusivityDeadline,address indexed depositor,address recipient,address exclusiveRelayer,bytes message)" + ], + logKeys: { + blockNumber: "blockNumber", + txHash: "transactionHash", + }, + argKeys: { + amount: "inputAmount", + to: "recipient", + from: "depositor", + token: "inputToken", + }, + isDeposit: true, +}; + +const relaysParamsv3: PartialContractEventParams = { + target: "", + topic: + "FilledV3Relay(address,address,uint256,uint256,uint256,uint256,uint32,uint32,uint32,address,address,address,address,bytes,(address,bytes,uint256,uint8))", + abi: [ + "event FilledV3Relay(address inputToken, address outputToken, uint256 inputAmount, uint256 outputAmount, uint256 repaymentChainId, uint256 indexed originChainId, uint32 indexed depositId, uint32 fillDeadline, uint32 exclusivityDeadline, address exclusiveRelayer, address indexed relayer, address depositor, address recipient, bytes message, tuple(address updatedRecipient, bytes updatedMessage, uint256 updatedOutputAmount, int8 fillType) relayExecutionInfo)" + ], + logKeys: { + blockNumber: "blockNumber", + txHash: "transactionHash", + }, + argKeys: { + amount: "outputAmount", + to: "recipient", + from: "depositor", + token: "outputToken", + }, + isDeposit: false, +}; + const depositParamsv2p5: PartialContractEventParams = { target: "", topic: "FundsDeposited(uint256,uint256,uint256,int64,uint32,uint32,address,address,address,bytes)", @@ -138,6 +177,7 @@ const constructParams = (chain: SupportedChains) => { // New Spoke Pools if ("spokePoolv2p5" in chainConfig) { + // "Version 2.5" events const finalDepositParamsv2p5 = { ...depositParamsv2p5, target: chainConfig.spokePoolv2p5, @@ -149,6 +189,21 @@ const constructParams = (chain: SupportedChains) => { target: chainConfig.spokePoolv2p5, }; eventParams.push(finalRelaysParamsv2p5); + + // "Version 3" events + // The v2.5 spoke pools are ProxyContracts that can be upgraded -- Across + // reuses these spoke addresses for v3 with the modified events + const finalDepositParamsv3 = { + ...depositParamsv3, + target: chainConfig.spokePoolv2p5, + }; + eventParams.push(finalDepositParamsv3); + + const finalRelaysParamsv3 = { + ...relaysParamsv3, + target: chainConfig.spokePoolv2p5, + }; + eventParams.push(finalRelaysParamsv3); } return async (fromBlock: number, toBlock: number) => From 6cb73bf46536952f40bcded6dfbf36c6a597030c Mon Sep 17 00:00:00 2001 From: Chase Coleman Date: Thu, 22 Feb 2024 14:59:06 +0000 Subject: [PATCH 2/2] Dumb typo -- int8 -> uint8 --- src/adapters/across/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adapters/across/index.ts b/src/adapters/across/index.ts index af50bd4d..3dc44df4 100644 --- a/src/adapters/across/index.ts +++ b/src/adapters/across/index.ts @@ -62,7 +62,7 @@ const relaysParamsv3: PartialContractEventParams = { topic: "FilledV3Relay(address,address,uint256,uint256,uint256,uint256,uint32,uint32,uint32,address,address,address,address,bytes,(address,bytes,uint256,uint8))", abi: [ - "event FilledV3Relay(address inputToken, address outputToken, uint256 inputAmount, uint256 outputAmount, uint256 repaymentChainId, uint256 indexed originChainId, uint32 indexed depositId, uint32 fillDeadline, uint32 exclusivityDeadline, address exclusiveRelayer, address indexed relayer, address depositor, address recipient, bytes message, tuple(address updatedRecipient, bytes updatedMessage, uint256 updatedOutputAmount, int8 fillType) relayExecutionInfo)" + "event FilledV3Relay(address inputToken, address outputToken, uint256 inputAmount, uint256 outputAmount, uint256 repaymentChainId, uint256 indexed originChainId, uint32 indexed depositId, uint32 fillDeadline, uint32 exclusivityDeadline, address exclusiveRelayer, address indexed relayer, address depositor, address recipient, bytes message, tuple(address updatedRecipient, bytes updatedMessage, uint256 updatedOutputAmount, uint8 fillType) relayExecutionInfo)" ], logKeys: { blockNumber: "blockNumber",