Skip to content

Commit 9e0500e

Browse files
committed
fix: load correct abis for chain requests
1 parent 9d0b619 commit 9e0500e

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

src/handlers/balanceSheetHandlers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ multiMapper("balanceSheet:NoteDeposit", async ({ event, context }) => {
5252
await snapshotter(
5353
context,
5454
event,
55-
"balanceSheetV3:NoteDeposit",
55+
"balanceSheetV3_1:NoteDeposit",
5656
[holdingEscrow],
5757
HoldingEscrowSnapshot
5858
);
@@ -99,7 +99,7 @@ multiMapper("balanceSheet:Withdraw", async ({ event, context }) => {
9999
await snapshotter(
100100
context,
101101
event,
102-
"balanceSheetV3:Withdraw",
102+
"balanceSheetV3_1:Withdraw",
103103
[holdingEscrow],
104104
HoldingEscrowSnapshot
105105
);

src/handlers/holdingsHandlers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ multiMapper("holdings:Increase", async ({ event, context }) => {
7070
await holding.increase(amount, increasedValue);
7171
await holding.save(event);
7272

73-
await snapshotter(context, event, "holdingsV3:Increase", [holding], HoldingSnapshot);
73+
await snapshotter(context, event, "holdingsV3_1:Increase", [holding], HoldingSnapshot);
7474
});
7575

7676
multiMapper("holdings:Decrease", async ({ event, context }) => {
@@ -122,7 +122,7 @@ multiMapper("holdings:Update", async ({ event, context }) => {
122122
await holding.update(isPositive, diffValue);
123123
await holding.save(event);
124124

125-
await snapshotter(context, event, "holdingsV3:Update", [holding], HoldingSnapshot);
125+
await snapshotter(context, event, "holdingsV3_1:Update", [holding], HoldingSnapshot);
126126
});
127127

128128
multiMapper("holdings:UpdateValuation", async ({ event, context }) => {
@@ -148,5 +148,5 @@ multiMapper("holdings:UpdateValuation", async ({ event, context }) => {
148148
await holding.setValuation(valuation);
149149
await holding.save(event);
150150

151-
await snapshotter(context, event, "holdingsV3:UpdateValuation", [holding], HoldingSnapshot);
151+
await snapshotter(context, event, "holdingsV3_1:UpdateValuation", [holding], HoldingSnapshot);
152152
});

src/handlers/merkleProofManagerHandlers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { multiMapper } from "../helpers/multiMapper";
22
import { logEvent, serviceError } from "../helpers/logger";
33
import { BlockchainService, MerkleProofManagerService, PolicyService } from "../services";
4-
import { Abis } from "../contracts";
4+
import { Abis, getVersionForContract, REGISTRY_VERSION_ORDER } from "../contracts";
55

66
multiMapper("merkleProofManagerFactory:DeployMerkleProofManager", async ({ event, context }) => {
77
logEvent(event, context, "merkleProofManagerFactory:DeployMerkleProofManager");
@@ -26,11 +26,13 @@ multiMapper("merkleProofManager:UpdatePolicy", async ({ event, context }) => {
2626
logEvent(event, context, "merkleProofManager:UpdatePolicy");
2727
const { strategist, newRoot } = event.args;
2828

29+
const indexerVersion = REGISTRY_VERSION_ORDER[0];
30+
2931
const centrifugeId = await BlockchainService.getCentrifugeId(context);
3032

3133
const poolId = await context.client.readContract({
3234
address: event.log.address,
33-
abi: Abis.v3.MerkleProofManager,
35+
abi: Abis[indexerVersion as keyof typeof Abis].MerkleProofManager,
3436
functionName: "poolId",
3537
});
3638

src/handlers/spokeHandlers.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
TokenInstancePositionService,
1212
} from "../services";
1313
import { ERC20Abi } from "../../abis/ERC20";
14-
import { Abis } from "../contracts";
14+
import { Abis, REGISTRY_VERSION_ORDER } from "../contracts";
1515
import { RegistryChains } from "../chains";
1616
import { snapshotter } from "../helpers/snapshotter";
1717
import { HoldingEscrowSnapshot } from "ponder:schema";
@@ -155,6 +155,7 @@ multiMapper("spoke:UpdateAssetPrice", async ({ event, context }) => {
155155
} = event.args;
156156

157157
const centrifugeId = await BlockchainService.getCentrifugeId(context);
158+
const indexerVersion = REGISTRY_VERSION_ORDER[0];
158159

159160
const chainId = context.chain.id;
160161
const poolEscrowFactoryAddress = RegistryChains.find((chain) => chain.network.chainId === chainId)
@@ -165,7 +166,7 @@ multiMapper("spoke:UpdateAssetPrice", async ({ event, context }) => {
165166
}
166167

167168
const escrowAddress = await context.client.readContract({
168-
abi: Abis.v3.PoolEscrowFactory,
169+
abi: Abis[indexerVersion as keyof typeof Abis].PoolEscrowFactory,
169170
address: poolEscrowFactoryAddress.address,
170171
functionName: "escrow",
171172
args: [poolId],
@@ -202,7 +203,7 @@ multiMapper("spoke:UpdateAssetPrice", async ({ event, context }) => {
202203
await snapshotter(
203204
context,
204205
event,
205-
"spokeV3:UpdateAssetPrice",
206+
"spokeV3_1:UpdateAssetPrice",
206207
[holdingEscrow],
207208
HoldingEscrowSnapshot
208209
);

0 commit comments

Comments
 (0)