Skip to content

Commit

Permalink
Merge pull request #285 from DefiLlama/helix-bridge/master
Browse files Browse the repository at this point in the history
Helix bridge/master
  • Loading branch information
vrtnd authored Oct 3, 2024
2 parents b5a0c15 + 3c8d51f commit d1a5d54
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 26 deletions.
35 changes: 18 additions & 17 deletions src/adapters/helixbridge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const depositParams = (contractAddress: string): PartialContractEventParams => {
},
argKeys: {
token: "params.sourceToken",
amount: "targetAmount",
amount: "params.amount",
to: "params.receiver",
},
txKeys: {
Expand All @@ -28,40 +28,37 @@ const depositParams = (contractAddress: string): PartialContractEventParams => {
const withdrawalParams = (contractAddress: string): PartialContractEventParams => {
return {
target: contractAddress,
topic: "TransferFilled(bytes32,address)",
topic: "TransferFilledExt(bytes32,(uint256,address,address,address,uint112,uint112,address,uint256))",
abi: [
"event TransferFilled(bytes32 transferId, address provider)",
"event TransferFilledExt(bytes32 transferId, (uint256 remoteChainId,address provider,address sourceToken, address targetToken, uint112 sourceAmount, uint112 targetAmount, address receiver, uint256 timestamp) params)",
],
logKeys: {
blockNumber: "blockNumber",
txHash: "transactionHash",
},
txKeys: {
from: "from",
to: "to",
},
inputDataExtraction: {
inputDataABI: [
"function relay((uint256 remoteChainId, address provider, address sourceToken, address targetToken, uint112 sourceAmount, uint112 targetAmount, address receiver, uint256 timestamp) params, bytes32 expectedTransferId, bool relayBySelf)",
],
inputDataFnName: "relay",
inputDataKeys: {
token: "params.targetToken",
amount: "params.targetAmount",
},
},
fixedEventData: {
from: contractAddress,
argKeys: {
token: "params.targetToken",
amount: "params.targetAmount",
to: "params.receiver",
},
isDeposit: false,
};
}

const constructParams = (chain: Chain) => {
const contractAddress = "0xbA5D580B18b6436411562981e02c8A9aA1776D10"
let contractAddress = '0xbA5D580B18b6436411562981e02c8A9aA1776D10';

if (chain === 'blast') {
contractAddress = '0xB180D7DcB5CC161C862aD60442FA37527546cAFC';
}

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

return async (fromBlock: number, toBlock: number) =>
Expand All @@ -78,6 +75,10 @@ const adapter: BridgeAdapter = {
scroll: constructParams("scroll"),
optimism: constructParams("optimism"),
gnosis: constructParams("xdai"),
blast: constructParams("blast"),
moonbeam: constructParams("moonbeam"),
base: constructParams("base"),
avalanche: constructParams("avax"),
};

export default adapter;
27 changes: 18 additions & 9 deletions src/data/bridgeNetworkData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1265,10 +1265,25 @@ export default [
bridgeDbName: "helixbridge",
iconLink: "icons:helixbridge",
largeTxThreshold: 10000,
url: "https://helixbridge.app/",
chains: ["Arbitrum", "Darwinia", "Polygon", "BSC", "Linea", "Mantle", "Scroll", "Optimism", "Gnosis"],
url: "https://helixbridge.app",
chains: [
"Arbitrum",
"Darwinia",
"Polygon",
"BSC",
"Linea",
"Mantle",
"Scroll",
"Optimism",
"Gnosis",
"Blast",
"Moonbeam",
"Base",
"Avalanche",
],
chainMapping: {
gnosis: "xdai",
avalanche: "avax",
},
},
{
Expand Down Expand Up @@ -1467,12 +1482,6 @@ export default [
iconLink: "icons:crowdswap",
largeTxThreshold: 10000,
url: "https://scanner.crowdswap.org/",
chains: [
"Ethereum",
"Arbitrum",
"Optimism",
"BSC",
"Polygon"
]
chains: ["Ethereum", "Arbitrum", "Optimism", "BSC", "Polygon"],
},
] as BridgeNetwork[];

0 comments on commit d1a5d54

Please sign in to comment.