From 83f61cbbf4c112f9dc006867720eb9da74c63448 Mon Sep 17 00:00:00 2001 From: Dino Date: Fri, 9 Dec 2022 14:54:34 -0300 Subject: [PATCH] fixed bug: when removing members their entity wasn't deleted, and prevented them from showing if they rejoined --- src/mappings/BaseERC20Guild/mapping.ts | 13 ++++++++++--- src/mappings/ERC20SnapshotRep/mapping.ts | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/mappings/BaseERC20Guild/mapping.ts b/src/mappings/BaseERC20Guild/mapping.ts index fdca91a..d4c0fa9 100644 --- a/src/mappings/BaseERC20Guild/mapping.ts +++ b/src/mappings/BaseERC20Guild/mapping.ts @@ -1,4 +1,10 @@ -import { ipfs, json, JSONValueKind, BigInt } from '@graphprotocol/graph-ts'; +import { + ipfs, + json, + JSONValueKind, + BigInt, + store, +} from '@graphprotocol/graph-ts'; import { Guild, Proposal, @@ -285,9 +291,10 @@ export function handleTokenWithdrawal(event: TokensWithdrawn): void { guild.members = guildMembersClone; guild.save(); + store.remove('Member', memberId); + } else { + member!.save(); } - - member!.unset(memberId); } function isIPFS(contentHash: string): boolean { diff --git a/src/mappings/ERC20SnapshotRep/mapping.ts b/src/mappings/ERC20SnapshotRep/mapping.ts index 8a46c21..24c25ae 100644 --- a/src/mappings/ERC20SnapshotRep/mapping.ts +++ b/src/mappings/ERC20SnapshotRep/mapping.ts @@ -1,4 +1,4 @@ -import { Address, BigInt, log } from '@graphprotocol/graph-ts'; +import { Address, BigInt, log, store } from '@graphprotocol/graph-ts'; import { Guild, Member, Token } from '../../types/schema'; import { ERC20SnapshotRep, @@ -55,7 +55,7 @@ export function handleTransfer(event: Transfer): void { guild.members = guildMembersClone; guild.save(); - member.unset(memberId); + store.remove('Member', memberId); } }