Skip to content

Commit 9647f18

Browse files
committed
feat: update round total distribution state for DG
1 parent 3a3b221 commit 9647f18

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

packages/processors/src/processors/strategy/directGrantsLite/handlers/allocated.handler.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ export class DGLiteAllocatedHandler implements IEventHandler<"Strategy", "Alloca
104104
},
105105
},
106106
},
107+
{
108+
type: "IncrementRoundTotalDistributed",
109+
args: {
110+
chainId: this.chainId,
111+
roundId: round.id,
112+
amount: amountInRoundMatchToken,
113+
},
114+
},
107115
];
108116
}
109117
}

packages/processors/test/strategy/directGrantsLite/handlers/allocated.handler.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ describe("DGLiteAllocatedHandler", () => {
105105
},
106106
},
107107
});
108+
109+
expect(result[1]).toEqual({
110+
type: "IncrementRoundTotalDistributed",
111+
args: {
112+
chainId,
113+
roundId: "round1",
114+
amount: BigInt(amount),
115+
},
116+
});
108117
});
109118

110119
it("doesn't fetch token price if amount is 0", async () => {
@@ -159,6 +168,15 @@ describe("DGLiteAllocatedHandler", () => {
159168
expect(changeset.args.applicationPayout.amount).toBe(0n);
160169
expect(changeset.args.applicationPayout.amountInUsd).toBe("0");
161170
expect(changeset.args.applicationPayout.amountInRoundMatchToken).toBe(0n);
171+
172+
expect(result[1]).toEqual({
173+
type: "IncrementRoundTotalDistributed",
174+
args: {
175+
chainId,
176+
roundId: "round1",
177+
amount: BigInt(0),
178+
},
179+
});
162180
});
163181

164182
it("throws RoundNotFound if round is not found", async () => {
@@ -369,5 +387,13 @@ describe("DGLiteAllocatedHandler", () => {
369387
args: { applicationPayout: { amountInRoundMatchToken: bigint } };
370388
};
371389
expect(changeset.args.applicationPayout.amountInRoundMatchToken).toBe(parseEther("0.005"));
390+
expect(result[1]).toEqual({
391+
type: "IncrementRoundTotalDistributed",
392+
args: {
393+
chainId,
394+
roundId: "round1",
395+
amount: parseEther("0.005"),
396+
},
397+
});
372398
});
373399
});

0 commit comments

Comments
 (0)