Skip to content

Commit

Permalink
feat: isVerified prop in Avatar entity
Browse files Browse the repository at this point in the history
  • Loading branch information
vibern0 committed Nov 4, 2024
1 parent f8b6cc8 commit cdfc081
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type Avatar {
mintEndPeriod: Int
lastDemurrageUpdate: Int
trustedByN: Int!
isVerified: Boolean!
profile: Profile
}

Expand Down
13 changes: 10 additions & 3 deletions src/event_handlers/hubV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ HubV2.RegisterHuman.handler(async ({ event, context }) => {
mintEndPeriod: undefined,
lastDemurrageUpdate: undefined,
trustedByN: 0,
isVerified: false,
profile_id: event.params.avatar,
};

Expand Down Expand Up @@ -127,6 +128,7 @@ HubV2.RegisterOrganization.handler(async ({ event, context }) => {
mintEndPeriod: undefined,
lastDemurrageUpdate: undefined,
trustedByN: 0,
isVerified: false,
profile_id: event.params.organization,
};

Expand Down Expand Up @@ -165,6 +167,7 @@ HubV2.RegisterGroup.handler(async ({ event, context }) => {
mintEndPeriod: undefined,
lastDemurrageUpdate: undefined,
trustedByN: 0,
isVerified: false,
profile_id: event.params.group,
};

Expand Down Expand Up @@ -238,6 +241,7 @@ NameRegistry.UpdateMetadataDigest.handler(async ({ event, context }) => {
mintEndPeriod: undefined,
lastDemurrageUpdate: undefined,
trustedByN: 0,
isVerified: false,
profile_id: event.params.avatar,
});
} else {
Expand Down Expand Up @@ -383,15 +387,18 @@ HubV2.Trust.handler(async ({ event, context }) => {
mintEndPeriod: undefined,
lastDemurrageUpdate: undefined,
trustedByN: 1,
isVerified: false,
profile_id: event.params.trustee,
});
} else {
const newTurdtedByN = isUntrust
? avatarTrustee.trustedByN - 1
: avatarTrustee.trustedByN + 1;
context.Avatar.set({
...avatarTrustee,
invitedBy: event.params.truster,
trustedByN: isUntrust
? avatarTrustee.trustedByN - 1
: avatarTrustee.trustedByN + 1,
trustedByN: newTurdtedByN,
isVerified: newTurdtedByN >= 3,
});
}

Expand Down

0 comments on commit cdfc081

Please sign in to comment.