From a31ac25971fed990dff2ec9c852a9b41cc91a6bb Mon Sep 17 00:00:00 2001 From: alexcos20 Date: Sat, 29 Jul 2023 18:09:03 +0300 Subject: [PATCH] fixes --- src/mappings/erc721Factory.ts | 8 ++++++-- src/mappings/utils/tokenUtils.ts | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mappings/erc721Factory.ts b/src/mappings/erc721Factory.ts index fbc6089f..d754d218 100644 --- a/src/mappings/erc721Factory.ts +++ b/src/mappings/erc721Factory.ts @@ -65,7 +65,9 @@ export function handleNewToken(event: TokenCreated): void { export function handleNew721Template(event: Template721Added): void { const dbId = getErc721TemplateId(event.params._templateAddress) if (dbId === BigInt.zero()) { - const template = new Erc721Template(event.params._templateAddress) + const template = new Erc721Template( + event.params._templateAddress.toHexString() + ) template.templateId = event.params.nftTemplateCount template.save() } @@ -74,7 +76,9 @@ export function handleNew721Template(event: Template721Added): void { export function handleNew20Template(event: Template20Added): void { const dbId = getErc20TemplateId(event.params._templateAddress) if (dbId === BigInt.zero()) { - const template = new Erc20Template(event.params._templateAddress) + const template = new Erc20Template( + event.params._templateAddress.toHexString() + ) template.templateId = event.params.nftTemplateCount template.save() } diff --git a/src/mappings/utils/tokenUtils.ts b/src/mappings/utils/tokenUtils.ts index f37fc384..df612895 100644 --- a/src/mappings/utils/tokenUtils.ts +++ b/src/mappings/utils/tokenUtils.ts @@ -111,7 +111,7 @@ export function getUSDValue( } export function getErc721TemplateId(address: Address): BigInt { - const template = Erc721Template.load(address) + const template = Erc721Template.load(address.toHexString()) if (template) { return template.templateId } @@ -119,7 +119,7 @@ export function getErc721TemplateId(address: Address): BigInt { } export function getErc20TemplateId(address: Address): BigInt { - const template = Erc20Template.load(address) + const template = Erc20Template.load(address.toHexString()) if (template) { return template.templateId }