Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcos20 committed Jul 29, 2023
1 parent 3b4e6c8 commit a31ac25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/mappings/erc721Factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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()
}
Expand Down
4 changes: 2 additions & 2 deletions src/mappings/utils/tokenUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ 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
}
return BigInt.zero()
}

export function getErc20TemplateId(address: Address): BigInt {
const template = Erc20Template.load(address)
const template = Erc20Template.load(address.toHexString())
if (template) {
return template.templateId
}
Expand Down

0 comments on commit a31ac25

Please sign in to comment.