diff --git a/generated/schema.ts b/generated/schema.ts index 655a67c..fc3b166 100644 --- a/generated/schema.ts +++ b/generated/schema.ts @@ -9327,8 +9327,8 @@ export class PassportScore extends Entity { this.set("id", Value.fromString(value)); } - get account(): Bytes { - let value = this.get("account"); + get user(): Bytes { + let value = this.get("user"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { @@ -9336,8 +9336,21 @@ export class PassportScore extends Entity { } } - set account(value: Bytes) { - this.set("account", Value.fromBytes(value)); + set user(value: Bytes) { + this.set("user", Value.fromBytes(value)); + } + + get passport(): Bytes { + let value = this.get("passport"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBytes(); + } + } + + set passport(value: Bytes) { + this.set("passport", Value.fromBytes(value)); } get round(): string { diff --git a/src/Passport.ts b/src/Passport.ts index 141ab49..401e068 100644 --- a/src/Passport.ts +++ b/src/Passport.ts @@ -138,7 +138,7 @@ export function handleRegisteredAction(event: RegisteredActionEvent): void { appRoundSummary.save() // stats for scores + Account + Round - const accountRoundSustainability = fetchAccountRoundSustainability(event.params.user, app, round) + const accountRoundSustainability = fetchAccountRoundSustainability(event.params.passport, app, round) accountRoundSustainability.passportScore = accountRoundSustainability.passportScore.plus(event.params.actionScore) accountRoundSustainability.save() @@ -148,7 +148,8 @@ export function handleRegisteredAction(event: RegisteredActionEvent): void { stats.save() const passportScore = new PassportScore(events.id(event)) - passportScore.account = fetchAccount(event.params.user).id + passportScore.user = fetchAccount(event.params.user).id + passportScore.passport = fetchAccount(event.params.passport).id passportScore.round = round.id passportScore.app = app.id passportScore.score = event.params.actionScore diff --git a/subgraph.graphql b/subgraph.graphql index 84f91cb..a5fc9c5 100644 --- a/subgraph.graphql +++ b/subgraph.graphql @@ -219,7 +219,7 @@ type Account @entity { passportDelegatee: PassportDelegation @derivedFrom(field: "delegatee") passportEntities: [PassportEntityLink!]! @derivedFrom(field: "passport") - passportScores: [PassportScore!]! @derivedFrom(field: "account") + passportScores: [PassportScore!]! @derivedFrom(field: "passport") } """ @@ -984,7 +984,8 @@ type PassportBlacklist @entity { type PassportScore implements Event @entity(immutable: true) { id: ID! - account: Account! + user: Account! + passport: Account! round: Round! app: App! score: BigInt!