create new user when processing new datatoken

This commit is contained in:
ssallam 2020-12-02 11:26:50 +01:00
parent 7184969ece
commit d834f6bdfa
2 changed files with 4 additions and 1 deletions

View File

@ -115,7 +115,7 @@ type Datatoken @entity {
cap: BigDecimal!
supply: BigDecimal!
minter: User!
publisher: User!
publisher: String!
holderCount: BigInt! # Number of addresses holding a balance of datatoken
orderCount: BigInt! # Number of orders executed for this dataset

View File

@ -3,6 +3,7 @@ import { TokenRegistered } from '../types/DTFactory/DTFactory'
import { DatatokenFactory, Datatoken } from '../types/schema'
import { Datatoken as DatatokenContract } from '../types/templates'
import {
createUserEntity,
tokenToDecimal,
ZERO_BD,
} from './helpers'
@ -29,6 +30,8 @@ export function handleNewToken(event: TokenRegistered): void {
datatoken.address = event.params.tokenAddress.toHexString()
datatoken.cap = tokenToDecimal(event.params.tokenCap.toBigDecimal(), 18)
datatoken.supply = ZERO_BD
createUserEntity(event.params.registeredBy.toHex())
datatoken.minter = event.params.registeredBy.toHex()
datatoken.publisher = event.params.registeredBy.toHex()