Skip to content

Commit

Permalink
add hyperliquid
Browse files Browse the repository at this point in the history
  • Loading branch information
vrtnd committed Dec 16, 2024
1 parent 2e5163a commit 4d0ce02
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/adapters/hyperliquid/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Chain } from "@defillama/sdk/build/general";
import { BridgeAdapter, PartialContractEventParams } from "../../helpers/bridgeAdapter.type";
import { constructTransferParams } from "../../helpers/eventParams";
import { getTxDataFromEVMEventLogs } from "../../helpers/processTransactions";

const HYPERLIQUID_BRIDGE_ADDRESS = "0x2Df1c51E09aECF9cacB7bc98cB1742757f163dF7";

const erc20WithdrawalEventParams: PartialContractEventParams = constructTransferParams(
HYPERLIQUID_BRIDGE_ADDRESS,
false
);

const erc20DepositEventParams: PartialContractEventParams = constructTransferParams(HYPERLIQUID_BRIDGE_ADDRESS, true);

const constructParams = (chain: string) => {
let eventParams = [] as PartialContractEventParams[];
eventParams.push(erc20WithdrawalEventParams, erc20DepositEventParams);
return async (fromBlock: number, toBlock: number) =>
getTxDataFromEVMEventLogs("hyperliquid", chain as Chain, fromBlock, toBlock, eventParams);
};

const adapter: BridgeAdapter = {
arbitrum: constructParams("arbitrum"),
};

export default adapter;
2 changes: 2 additions & 0 deletions src/adapters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import hyperlane from "./hyperlane";
import wormhole from "./wormhole";
import thresholdnetwork from "./threshold-network";
import zircuit from "./zircuit";
import hyperliquid from "./hyperliquid";

export default {
polygon,
Expand Down Expand Up @@ -153,6 +154,7 @@ export default {
wormhole,
thresholdnetwork,
zircuit,
hyperliquid,
} as {
[bridge: string]: BridgeAdapter | AsyncBridgeAdapter;
};
12 changes: 11 additions & 1 deletion src/data/bridgeNetworkData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ export default [
iconLink: "icons:threshold-network",
largeTxThreshold: 10000,
url: "https://threshold.network/",
chains: ["Ethereum", "Bitcoin"],
chains: ["Ethereum", "Bitcoin"],
destinationChain: "Bitcoin",
},
{
Expand All @@ -1752,4 +1752,14 @@ export default [
chains: ["Ethereum", "Zircuit"],
destinationChain: "Zircuit",
},
{
id: 80,
displayName: "Hyperliquid",
bridgeDbName: "hyperliquid",
iconLink: "icons:hyperliquid",
largeTxThreshold: 10000,
url: "https://app.hyperliquid.xyz/trade",
chains: ["Arbitrum", "Hyperliquid"],
destinationChain: "Hyperliquid",
},
] as BridgeNetwork[];

0 comments on commit 4d0ce02

Please sign in to comment.