diff --git a/schema.graphql b/schema.graphql index a1cbae7..8e4c5ac 100644 --- a/schema.graphql +++ b/schema.graphql @@ -140,5 +140,5 @@ type Token { transactionHash: String! version: Int! tokenType: TokenType! - tokenOwner: String! + tokenOwner: Avatar! } diff --git a/src/common/handleTransfer.ts b/src/common/handleTransfer.ts index 652cf91..8fee156 100644 --- a/src/common/handleTransfer.ts +++ b/src/common/handleTransfer.ts @@ -35,8 +35,6 @@ export const handleTransfer = async ({ transferType: TransferType_t; version: number; }) => { - let isWrapped = transferType === "Erc20WrapperTransfer"; - for (let i = 0; i < tokens.length; i++) { const token = await context.Token.get(tokens[i]); if (!token) { @@ -51,7 +49,7 @@ export const handleTransfer = async ({ // TODO: fix tokenType: "RegisterHuman", // TODO: fix - tokenOwner: event.params.to, + tokenOwner_id: event.params.to, }); } @@ -74,24 +72,14 @@ export const handleTransfer = async ({ }; context.Transfer.set(transferEntity); - await updateAvatarBalance( - context, - values[i], - event.block.timestamp, - { - id: event.params.to, - token_id: tokens[i], - } - ); - await updateAvatarBalance( - context, - -values[i], - event.block.timestamp, - { - id: event.params.from, - token_id: tokens[i], - }, - ); + await updateAvatarBalance(context, values[i], event.block.timestamp, { + id: event.params.to, + token_id: tokens[i], + }); + await updateAvatarBalance(context, -values[i], event.block.timestamp, { + id: event.params.from, + token_id: tokens[i], + }); await incrementStats(context, "transfers"); } }; diff --git a/src/event_handlers/hubV2.ts b/src/event_handlers/hubV2.ts index 66841e3..01ad2a7 100644 --- a/src/event_handlers/hubV2.ts +++ b/src/event_handlers/hubV2.ts @@ -40,7 +40,7 @@ ERC20Lift.ERC20WrapperDeployed.handler(async ({ event, context }) => { event.params.circlesType === 0n ? "WrappedDemurrageToken" : "WrappedStaticToken", - tokenOwner: event.params.avatar, + tokenOwner_id: event.params.avatar, }); });