Skip to content

Commit

Permalink
feat: supporting the simplified DK structure
Browse files Browse the repository at this point in the history
  • Loading branch information
jaybuidl committed Dec 7, 2023
1 parent 838e7bf commit 4a007e3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
3 changes: 0 additions & 3 deletions subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,7 @@ type Draw @entity(immutable: true) {
type DisputeKit @entity {
id: ID!
address: Bytes
parent: DisputeKit
children: [DisputeKit!]! @derivedFrom(field: "parent")
needsFreezing: Boolean!
depthLevel: BigInt!
rounds: [Round!]! @derivedFrom(field: "disputeKit")
courts: [Court!]! @derivedFrom(field: "supportedDisputeKits")
}
Expand Down
11 changes: 2 additions & 9 deletions subgraph/src/entities/DisputeKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,14 @@ import { ZERO, ONE } from "../utils";

export function createDisputeKitFromEvent(event: DisputeKitCreated): void {
const disputeKit = new DisputeKit(event.params._disputeKitID.toString());
disputeKit.parent = event.params._parent.toString();
disputeKit.address = event.params._disputeKitAddress;
disputeKit.needsFreezing = false;
const parent = DisputeKit.load(event.params._parent.toString());
disputeKit.depthLevel = parent ? parent.depthLevel.plus(ONE) : ZERO;
disputeKit.save();
}

export function filterSupportedDisputeKits(
supportedDisputeKits: string[],
disputeKitID: string
): string[] {
export function filterSupportedDisputeKits(supportedDisputeKits: string[], disputeKitID: string): string[] {
let result: string[] = [];
for (let i = 0; i < supportedDisputeKits.length; i++)
if (supportedDisputeKits[i] !== disputeKitID)
result = result.concat([supportedDisputeKits[i]]);
if (supportedDisputeKits[i] !== disputeKitID) result = result.concat([supportedDisputeKits[i]]);
return result;
}
2 changes: 1 addition & 1 deletion subgraph/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dataSources:
handler: handleCourtCreated
- event: CourtModified(indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4])
handler: handleCourtModified
- event: DisputeKitCreated(indexed uint256,indexed address,indexed uint256)
- event: DisputeKitCreated(indexed uint256,indexed address)
handler: handleDisputeKitCreated
- event: DisputeKitEnabled(indexed uint96,indexed uint256,indexed bool)
handler: handleDisputeKitEnabled
Expand Down

0 comments on commit 4a007e3

Please sign in to comment.