Skip to content

Commit a0c71f6

Browse files
authored
Fix closing time only executed (#644)
1 parent a4ce760 commit a0c71f6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/domain/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,12 @@ export function handleNativeTokenTransfer(event: Transfer): void {
287287

288288
export function handleExecuteProposal(event: ExecuteProposal): void {
289289
if (isProposalValid(event.params._proposalId.toHex())) {
290-
updateProposalExecution(event.params._proposalId, event.params._totalReputation, event.block.timestamp);
290+
updateProposalExecution(
291+
event.params._proposalId,
292+
event.params._totalReputation,
293+
event.block.timestamp,
294+
event.params._decision,
295+
);
291296
}
292297
}
293298

src/domain/proposal.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,12 +429,14 @@ export function updateProposalExecution(
429429
proposalId: Bytes,
430430
totalReputation: BigInt,
431431
timestamp: BigInt,
432+
decision: BigInt,
432433
): void {
433434
let proposal = getProposal(proposalId.toHex());
434435
proposal.executedAt = timestamp;
436+
proposal.winningOutcome = parseOutcome(decision);
435437
// Setting the closingAt field to a far away point in the future so it will be easy to
436438
// sort all proposal(open and executed) in ascending order by the closingAt field
437-
if (proposal.genericSchemeMultiCall !== null && equalStrings(proposal.winningOutcome, 'Pass')) {
439+
if (proposal.genericSchemeMultiCall !== null && decision.equals(BigInt.fromI32(1))) {
438440
proposal.closingAt = timestamp.minus(BigInt.fromI32(CLOSING_AT_TIME_DECREASE_GSMC));
439441
} else {
440442
proposal.closingAt = (BigInt.fromI32(CLOSING_AT_TIME_INCREASE).minus(timestamp)).times(BigInt.fromI32(100));

0 commit comments

Comments
 (0)