fixes
This commit is contained in:
parent
de36363438
commit
6a78790bd4
|
@ -15,11 +15,12 @@ import { getUser } from './utils/userUtils'
|
|||
import {
|
||||
getToken,
|
||||
getNftToken,
|
||||
getPredictContract,
|
||||
getErc20TemplateId
|
||||
getErc20TemplateId,
|
||||
getPredictContract
|
||||
} from './utils/tokenUtils'
|
||||
import { BigInt } from '@graphprotocol/graph-ts'
|
||||
import { addDatatoken } from './utils/globalUtils'
|
||||
|
||||
export function handleNftCreated(event: NFTCreated): void {
|
||||
// const nft = new Nft(event.params.newTokenAddress.toHexString())
|
||||
const nft = getNftToken(event.params.newTokenAddress)
|
||||
|
@ -37,7 +38,6 @@ export function handleNftCreated(event: NFTCreated): void {
|
|||
nft.eventIndex = event.logIndex.toI32()
|
||||
nft.transferable = event.params.transferable
|
||||
nft.template = event.params.templateAddress.toHexString()
|
||||
|
||||
nft.save()
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ export function handleNewToken(event: TokenCreated): void {
|
|||
token.templateId = getErc20TemplateId(event.params.templateAddress)
|
||||
token.save()
|
||||
addDatatoken()
|
||||
if (token.templateId == BigInt.fromString('3')) {
|
||||
if (token.templateId === BigInt.fromString('3')) {
|
||||
factoryERC20Template3.create(event.params.newTokenAddress)
|
||||
const predictContract = getPredictContract(event.params.newTokenAddress)
|
||||
predictContract.timestamp = event.block.timestamp.toI32()
|
||||
|
|
|
@ -114,6 +114,22 @@ export function getUSDValue(
|
|||
return BigDecimal.zero()
|
||||
}
|
||||
|
||||
export function getErc721TemplateId(address: Address): BigInt {
|
||||
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.toHexString())
|
||||
if (template) {
|
||||
return template.templateId
|
||||
}
|
||||
return BigInt.zero()
|
||||
}
|
||||
|
||||
export function createPredictContract(address: Address): PredictContract {
|
||||
const predictContract = new PredictContract(address.toHexString())
|
||||
const token = getToken(address, true)
|
||||
|
@ -137,19 +153,3 @@ export function getPredictContract(address: Address): PredictContract {
|
|||
}
|
||||
return newPredictContract
|
||||
}
|
||||
|
||||
export function getErc721TemplateId(address: Address): BigInt {
|
||||
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.toHexString())
|
||||
if (template) {
|
||||
return template.templateId
|
||||
}
|
||||
return BigInt.zero()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue