Skip to content

Commit b534cec

Browse files
committed
feat: add factory address based decoding
1 parent 08928ee commit b534cec

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

services/decoder/decoder.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,14 @@ export class GoldRushDecoder {
166166
for (const log of logs) {
167167
const {
168168
raw_log_topics: [topic0_hash],
169-
sender_address: contract_address,
169+
sender_address,
170+
sender_factory_address,
170171
} = log;
171172
const decoding_index =
172-
this.decoders[chain_name]?.[contract_address]?.[topic0_hash];
173+
this.decoders[chain_name]?.[sender_address]?.[topic0_hash] ??
174+
this.decoders[chain_name]?.[sender_factory_address]?.[
175+
topic0_hash
176+
];
173177
const fallback_index = this.fallbacks[topic0_hash];
174178
let logEvent: EventType | null = null;
175179
if (decoding_index !== undefined) {

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

+4-16
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,16 @@ import { type Configs } from "../../decoder.types";
22

33
const configs: Configs = [
44
{
5-
protocol_name: "uniswap-v2",
6-
address: "0xaf31fd9c3b0350424bf96e551d2d1264d8466205",
7-
is_factory: false,
8-
chain_name: "eth-mainnet",
9-
},
10-
{
11-
address: "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc",
12-
is_factory: false,
13-
protocol_name: "uniswap-v2",
14-
chain_name: "eth-mainnet",
15-
},
16-
{
17-
address: "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852",
18-
is_factory: false,
5+
address: "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f",
6+
is_factory: true,
197
protocol_name: "uniswap-v2",
208
chain_name: "eth-mainnet",
219
},
2210
{
23-
address: "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f",
11+
address: "0xcf329b34049033de26e4449aebcb41f1992724d3",
2412
is_factory: true,
2513
protocol_name: "uniswap-v2",
26-
chain_name: "eth-mainnet",
14+
chain_name: "defi-kingdoms-mainnet",
2715
},
2816
];
2917

0 commit comments

Comments
 (0)