Skip to content

Commit 1f1cf27

Browse files
committed
add lighter
1 parent 39641d0 commit 1f1cf27

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

src/adapters/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ import eclipse from "./eclipse";
8282
import layerzero from "./layerzero";
8383
import train from "./train";
8484
import fuel from "./fuel";
85+
import lighter from "./lighter";
8586

8687
export default {
8788
polygon,
@@ -167,6 +168,7 @@ export default {
167168
layerzero,
168169
train,
169170
fuel,
171+
lighter,
170172
} as {
171173
[bridge: string]: BridgeAdapter | AsyncBridgeAdapter;
172174
};

src/adapters/lighter/index.ts

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

src/data/bridgeNetworkData.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,4 +2087,14 @@ export default [
20872087
chains: ["Ethereum", "Fuel Ignition"],
20882088
destinationChain: "Fuel Ignition",
20892089
},
2090+
{
2091+
id: 87,
2092+
displayName: "Lighter",
2093+
bridgeDbName: "lighter",
2094+
iconLink: "icons:lighter",
2095+
largeTxThreshold: 10000,
2096+
url: "https://lighter.xyz/",
2097+
chains: ["Ethereum", "Lighter"],
2098+
destinationChain: "Lighter",
2099+
},
20902100
] as BridgeNetwork[];

0 commit comments

Comments
 (0)