Skip to content

Commit a0de362

Browse files
Kaspa bridge (#445)
* kaspabridge added * updated logo * fixed starkgate data entery * fixed id order as mentioned in comment * logo link updated from global repo of defilama icons * update kaspa bridge like aribtrum * defilama sdk used as mentioned in comment * updated zeor addresses conditionally * fildted events without from and to addresses * fix kasplex --------- Co-authored-by: muhammad abubakar <[email protected]>
1 parent 64625e4 commit a0de362

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

src/adapters/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ import teleswap from "./teleswap";
9797
import agglayer from "./agglayer";
9898
import fxrp from "./flare/fxrp";
9999
import snowbridge from "./snowbridge";
100+
import kaspabridge from "./kaspabridge";
100101
import hyperbridge from "./hyperbridge";
101102
import starkgate from "./starkgate";
102103
import onesec from "./1sec";
@@ -200,6 +201,7 @@ export default {
200201
agglayer,
201202
fxrp,
202203
snowbridge,
204+
kaspabridge,
203205
hyperbridge,
204206
starkgate,
205207
"1sec": onesec,

src/adapters/kaspabridge/index.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { BridgeAdapter, PartialContractEventParams } from "../../helpers/bridgeAdapter.type";
2+
import { Chain } from "@defillama/sdk/build/general";
3+
import { getTxDataFromEVMEventLogs } from "../../helpers/processTransactions";
4+
5+
const MAILBOX = "0x5f297B3A1e8154c4D58702F7a880b7631bBf5340";
6+
7+
const withdrawalParams: PartialContractEventParams = {
8+
target: MAILBOX,
9+
topic: "Process(uint32,bytes32,address)",
10+
abi: ["event Process(uint32 indexed origin, bytes32 indexed sender, address indexed recipient)"],
11+
logKeys: {
12+
blockNumber: "blockNumber",
13+
txHash: "transactionHash",
14+
},
15+
argKeys: {
16+
to: "recipient",
17+
},
18+
fixedEventData: {
19+
from: MAILBOX,
20+
},
21+
isDeposit: false,
22+
getTokenFromReceipt: {
23+
token: true,
24+
amount: true,
25+
},
26+
};
27+
28+
const depositParams: PartialContractEventParams = {
29+
target: MAILBOX,
30+
topic: "Dispatch(address,uint32,bytes32,bytes)",
31+
abi: ["event Dispatch(address indexed sender, uint32 indexed destination, bytes32 indexed recipient, bytes message)"],
32+
logKeys: {
33+
blockNumber: "blockNumber",
34+
txHash: "transactionHash",
35+
},
36+
argKeys: {
37+
from: "sender",
38+
},
39+
fixedEventData: {
40+
to: MAILBOX,
41+
},
42+
isDeposit: true,
43+
getTokenFromReceipt: {
44+
token: true,
45+
amount: true,
46+
},
47+
};
48+
49+
const constructParams = (chain: string) => {
50+
return async (fromBlock: number, toBlock: number) =>
51+
getTxDataFromEVMEventLogs("kaspabridge", chain as Chain, fromBlock, toBlock, [depositParams, withdrawalParams]);
52+
};
53+
54+
const adapter: BridgeAdapter = {
55+
bsc: constructParams("bsc"),
56+
};
57+
58+
export default adapter;

src/data/bridgeNetworkData.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2717,4 +2717,18 @@ export default [
27172717
chains: ["Ethereum", "Arbitrum", "Base", "ICP"],
27182718
destinationChain: "ICP"
27192719
},
2720-
] as BridgeNetwork[];
2720+
{
2721+
id: 105,
2722+
displayName: "Kaspa Bridge",
2723+
bridgeDbName: "kaspabridge",
2724+
slug: "kaspabridge",
2725+
iconLink: "icons:kaspabridge",
2726+
largeTxThreshold: 10000,
2727+
url: "https://www.kaspabridge.com/",
2728+
chains: [
2729+
"kasplex",
2730+
"bsc",
2731+
],
2732+
destinationChain: "kasplex",
2733+
},
2734+
] as BridgeNetwork[];

0 commit comments

Comments
 (0)