Skip to content

Commit 4d0ce02

Browse files
committed
add hyperliquid
1 parent 2e5163a commit 4d0ce02

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

src/adapters/hyperliquid/index.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { Chain } from "@defillama/sdk/build/general";
2+
import { BridgeAdapter, PartialContractEventParams } from "../../helpers/bridgeAdapter.type";
3+
import { constructTransferParams } from "../../helpers/eventParams";
4+
import { getTxDataFromEVMEventLogs } from "../../helpers/processTransactions";
5+
6+
const HYPERLIQUID_BRIDGE_ADDRESS = "0x2Df1c51E09aECF9cacB7bc98cB1742757f163dF7";
7+
8+
const erc20WithdrawalEventParams: PartialContractEventParams = constructTransferParams(
9+
HYPERLIQUID_BRIDGE_ADDRESS,
10+
false
11+
);
12+
13+
const erc20DepositEventParams: PartialContractEventParams = constructTransferParams(HYPERLIQUID_BRIDGE_ADDRESS, true);
14+
15+
const constructParams = (chain: string) => {
16+
let eventParams = [] as PartialContractEventParams[];
17+
eventParams.push(erc20WithdrawalEventParams, erc20DepositEventParams);
18+
return async (fromBlock: number, toBlock: number) =>
19+
getTxDataFromEVMEventLogs("hyperliquid", chain as Chain, fromBlock, toBlock, eventParams);
20+
};
21+
22+
const adapter: BridgeAdapter = {
23+
arbitrum: constructParams("arbitrum"),
24+
};
25+
26+
export default adapter;

src/adapters/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ import hyperlane from "./hyperlane";
7575
import wormhole from "./wormhole";
7676
import thresholdnetwork from "./threshold-network";
7777
import zircuit from "./zircuit";
78+
import hyperliquid from "./hyperliquid";
7879

7980
export default {
8081
polygon,
@@ -153,6 +154,7 @@ export default {
153154
wormhole,
154155
thresholdnetwork,
155156
zircuit,
157+
hyperliquid,
156158
} as {
157159
[bridge: string]: BridgeAdapter | AsyncBridgeAdapter;
158160
};

src/data/bridgeNetworkData.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,7 @@ export default [
17391739
iconLink: "icons:threshold-network",
17401740
largeTxThreshold: 10000,
17411741
url: "https://threshold.network/",
1742-
chains: ["Ethereum", "Bitcoin"],
1742+
chains: ["Ethereum", "Bitcoin"],
17431743
destinationChain: "Bitcoin",
17441744
},
17451745
{
@@ -1752,4 +1752,14 @@ export default [
17521752
chains: ["Ethereum", "Zircuit"],
17531753
destinationChain: "Zircuit",
17541754
},
1755+
{
1756+
id: 80,
1757+
displayName: "Hyperliquid",
1758+
bridgeDbName: "hyperliquid",
1759+
iconLink: "icons:hyperliquid",
1760+
largeTxThreshold: 10000,
1761+
url: "https://app.hyperliquid.xyz/trade",
1762+
chains: ["Arbitrum", "Hyperliquid"],
1763+
destinationChain: "Hyperliquid",
1764+
},
17551765
] as BridgeNetwork[];

0 commit comments

Comments
 (0)