Skip to content
This repository was archived by the owner on Feb 8, 2025. It is now read-only.

Commit 23bf1b4

Browse files
committed
fix(api): simulating events for unhandled function
1 parent 3165f9e commit 23bf1b4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

api/src/feat/simulations/simulations.worker.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ import {
1212
asUUID,
1313
decodeTransfer,
1414
encodeOperations,
15+
tryOrIgnore,
1516
} from 'lib';
1617
import { DatabaseService } from '~/core/database';
1718
import e, { $infer } from '~/edgeql-js';
1819
import { and } from '~/core/database';
1920
import { RUNNING_JOB_STATUSES, TypedJob, createQueue } from '~/core/bull/bull.util';
2021
import { Worker } from '~/core/bull/Worker';
21-
import { ERC20, SYNCSWAP } from 'lib/dapps';
22+
import { ERC20 } from 'lib/dapps';
2223
import { NetworksService } from '~/core/networks';
2324
import { TX_SHAPE, transactionAsTx } from '~/feat/transactions/transactions.util';
2425
import { Shape } from '~/core/database';
@@ -153,7 +154,7 @@ export class SimulationsWorker extends Worker<SimulationsQueue> {
153154
const selector = data && size(data) >= 4 && slice(data, 0, 4);
154155
if (!selector) continue;
155156

156-
const f = decodeFunctionData({ abi: EVENTS_ABI, data });
157+
const f = tryOrIgnore(() => decodeFunctionData({ abi: EVENTS_ABI, data }));
157158
match(f)
158159
.with({ functionName: 'transfer' }, (f) => {
159160
logs.push({
@@ -242,6 +243,7 @@ export class SimulationsWorker extends Worker<SimulationsQueue> {
242243
// }),
243244
// });
244245
// })
246+
.with(undefined, () => {})
245247
.exhaustive();
246248

247249
// TODO: swap

0 commit comments

Comments
 (0)