Skip to content

Commit cd0fe1f

Browse files
authored
feat(uniswap): add defi-kingdoms chain (#32)
1 parent 5c046ae commit cd0fe1f

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

services/decoder/protocols/uniswap-v2/uniswap-v2.configs.ts

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ const configs: Configs = [
77
protocol_name: "uniswap-v2",
88
chain_name: "eth-mainnet",
99
},
10+
{
11+
address: "0xcf329b34049033de26e4449aebcb41f1992724d3",
12+
is_factory: true,
13+
protocol_name: "uniswap-v2",
14+
chain_name: "defi-kingdoms-mainnet",
15+
},
1016
];
1117

1218
export default configs;

services/decoder/protocols/uniswap-v2/uniswap-v2.decoders.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111

1212
GoldRushDecoder.on(
1313
"uniswap-v2:Swap",
14-
["eth-mainnet"],
14+
["eth-mainnet", "defi-kingdoms-mainnet"],
1515
PairABI as Abi,
1616
async (log_event, tx, chain_name, covalent_client): Promise<EventType> => {
1717
const {

services/decoder/protocols/uniswap-v2/uniswap-v2.test.ts

+20
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,26 @@ describe("uniswap-v2", () => {
2323
expect(event.details?.length).toEqual(2);
2424
});
2525

26+
test("defi-kingdoms-mainnet:Swap", async () => {
27+
const res = await request(app)
28+
.post("/api/v1/tx/decode")
29+
.set({
30+
"x-covalent-api-key": process.env.TEST_COVALENT_API_KEY,
31+
})
32+
.send({
33+
chain_name: "defi-kingdoms-mainnet",
34+
tx_hash:
35+
"0x9327e7e7ba43fdb276e6b098e5ef7eb114640f14ce528f0419716d950ee9f947",
36+
});
37+
const { events } = res.body as { events: EventType[] };
38+
const event = events.find(({ name }) => name === "Swap");
39+
if (!event) {
40+
throw Error("Event not found");
41+
}
42+
expect(event.tokens?.length).toEqual(2);
43+
expect(event.details?.length).toEqual(2);
44+
});
45+
2646
test("eth-mainnet:Mint", async () => {
2747
const res = await request(app)
2848
.post("/api/v1/tx/decode")

0 commit comments

Comments
 (0)