File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ export const DISPUTEKIT_ID = "1";
2929export function handleDisputeCreation ( event : DisputeCreation ) : void {
3030 const disputeID = event . params . _coreDisputeID . toString ( ) ;
3131 createClassicDisputeFromEvent ( event ) ;
32- createClassicRound ( disputeID , ZERO ) ;
32+ const numberOfChoices = event . params . _numberOfChoices ;
33+ createClassicRound ( disputeID , numberOfChoices , ZERO ) ;
3334}
3435
3536export function handleEvidenceEvent ( event : EvidenceEvent ) : void {
@@ -88,7 +89,8 @@ export function handleChoiceFunded(event: ChoiceFunded): void {
8889 ) ;
8990 if ( ! localDispute ) return ;
9091 const newRoundIndex = localDispute . currentLocalRoundIndex . plus ( ONE ) ;
91- createClassicRound ( coreDisputeID , newRoundIndex ) ;
92+ const numberOfChoices = localDispute . numberOfChoices ;
93+ createClassicRound ( coreDisputeID , numberOfChoices , newRoundIndex ) ;
9294 }
9395
9496 localRound . save ( ) ;
Original file line number Diff line number Diff line change 11import { BigInt } from "@graphprotocol/graph-ts" ;
22import { Contribution } from "../../generated/DisputeKitClassic/DisputeKitClassic" ;
33import { ClassicRound } from "../../generated/schema" ;
4- import { ZERO } from "../utils" ;
4+ import { ONE , ZERO } from "../utils" ;
55
66export function createClassicRound (
77 disputeID : string ,
8+ numberOfChoices : BigInt ,
89 roundIndex : BigInt
910) : void {
11+ const choicesLength = numberOfChoices . plus ( ONE ) ;
1012 const localDisputeID = `1-${ disputeID } ` ;
1113 const id = `${ localDisputeID } -${ roundIndex . toString ( ) } ` ;
1214 const classicRound = new ClassicRound ( id ) ;
1315 classicRound . localDispute = localDisputeID ;
1416 classicRound . votes = [ ] ;
1517 classicRound . winningChoice = ZERO ;
16- classicRound . counts = [ ] ;
18+ classicRound . counts = new Array < BigInt > ( choicesLength . toI32 ( ) ) . fill ( ZERO ) ;
1719 classicRound . tied = true ;
1820 classicRound . totalVoted = ZERO ;
1921 classicRound . totalCommited = ZERO ;
20- classicRound . paidFees = [ ] ;
22+ classicRound . paidFees = new Array < BigInt > ( choicesLength . toI32 ( ) ) . fill ( ZERO ) ;
2123 classicRound . feeRewards = ZERO ;
2224 classicRound . fundedChoices = [ ] ;
2325 classicRound . save ( ) ;
You can’t perform that action at this time.
0 commit comments