This commit is contained in:
alexcos20 2023-07-29 18:09:03 +03:00
parent 3b4e6c8fca
commit a31ac25971
2 changed files with 8 additions and 4 deletions

View File

@ -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()
}

View File

@ -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
}