Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fewensa authored Sep 25, 2024
1 parent c4aac95 commit df4b381
Showing 1 changed file with 4 additions and 29 deletions.
33 changes: 4 additions & 29 deletions src/adapters/helixbridge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { BridgeAdapter, PartialContractEventParams } from "../../helpers/br
import { getTxDataFromEVMEventLogs } from "../../helpers/processTransactions";
import type { Chain } from "@defillama/sdk/build/general";

const depositParams = (chain: Chain, contractAddress: string): PartialContractEventParams => {
const depositParams = (contractAddress: string): PartialContractEventParams => {
return {
target: contractAddress,
topic: "TokenLocked((uint256,address,address,address,uint112,uint112,address,uint256),bytes32,uint112,uint112)",
Expand All @@ -18,26 +18,14 @@ const depositParams = (chain: Chain, contractAddress: string): PartialContractEv
amount: "params.amount",
to: "params.receiver",
},
argGetters: {
token: (args: any) => {
if (chain !== 'darwinia') return undefined;

const sourceToken = args.params?.sourceToken;
if (sourceToken != '0x0000000000000000000000000000000000000000') {
return undefined;
}

return '0xe7578598aac020abfb918f33a20fad5b71d670b4';
},
},
txKeys: {
from: "from",
},
isDeposit: true,
};
}

const withdrawalParams = (chain: Chain, contractAddress: string): PartialContractEventParams => {
const withdrawalParams = (contractAddress: string): PartialContractEventParams => {
return {
target: contractAddress,
topic: "TransferFilledExt(bytes32,(uint256,address,address,address,uint112,uint112,address,uint256))",
Expand All @@ -57,19 +45,6 @@ const withdrawalParams = (chain: Chain, contractAddress: string): PartialContrac
amount: "params.targetAmount",
to: "params.receiver",
},
argGetters: {
token: (args: any) => {
console.log(chain);
if (chain !== 'darwinia') return undefined;

const targetToken = args.params?.targetToken;
if (targetToken != '0x0000000000000000000000000000000000000000') {
return undefined;
}

return '0xe7578598aac020abfb918f33a20fad5b71d670b4';
},
},
isDeposit: false,
};
}
Expand All @@ -82,8 +57,8 @@ const constructParams = (chain: Chain) => {
}

const eventParams: PartialContractEventParams[] = [
depositParams(chain, contractAddress),
withdrawalParams(chain, contractAddress),
depositParams(contractAddress),
withdrawalParams(contractAddress),
];

return async (fromBlock: number, toBlock: number) =>
Expand Down

0 comments on commit df4b381

Please sign in to comment.