Skip to content

Commit

Permalink
fix: v2 isMutual (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
vibern0 authored Dec 20, 2024
1 parent 51b7a94 commit 62f4dfb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/event_handlers/hubV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,7 @@ HubV2.Trust.handlerWithLoader({
return;
}

const timeDifference =
event.params.expiryTime - BigInt(event.block.timestamp);
const isUntrust = timeDifference < 3600n;
const isUntrust = event.params.expiryTime < 2_000_000_000n;

if (!avatarTrustee) {
context.Avatar.set({
Expand Down Expand Up @@ -528,7 +526,11 @@ HubV2.Trust.handlerWithLoader({
return;
}
const isMutual = oppositeTrustRelation !== undefined;
if (isMutual) {
if (
isMutual &&
!oppositeTrustRelation.isMutual &&
oppositeTrustRelation.expiryTime !== 0n
) {
context.TrustRelation.set({
...oppositeTrustRelation,
isMutual: true,
Expand All @@ -551,7 +553,7 @@ HubV2.Trust.handlerWithLoader({

context.TrustRelation.set(entity);

if (trustRelationV1) {
if (trustRelationV1 && !trustRelationV1.isMigrated) {
context.TrustRelation.set({
...trustRelationV1,
isMigrated: true,
Expand Down

0 comments on commit 62f4dfb

Please sign in to comment.