mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
create new user when processing new datatoken
This commit is contained in:
parent
7184969ece
commit
d834f6bdfa
@ -115,7 +115,7 @@ type Datatoken @entity {
|
|||||||
cap: BigDecimal!
|
cap: BigDecimal!
|
||||||
supply: BigDecimal!
|
supply: BigDecimal!
|
||||||
minter: User!
|
minter: User!
|
||||||
publisher: User!
|
publisher: String!
|
||||||
|
|
||||||
holderCount: BigInt! # Number of addresses holding a balance of datatoken
|
holderCount: BigInt! # Number of addresses holding a balance of datatoken
|
||||||
orderCount: BigInt! # Number of orders executed for this dataset
|
orderCount: BigInt! # Number of orders executed for this dataset
|
||||||
|
@ -3,6 +3,7 @@ import { TokenRegistered } from '../types/DTFactory/DTFactory'
|
|||||||
import { DatatokenFactory, Datatoken } from '../types/schema'
|
import { DatatokenFactory, Datatoken } from '../types/schema'
|
||||||
import { Datatoken as DatatokenContract } from '../types/templates'
|
import { Datatoken as DatatokenContract } from '../types/templates'
|
||||||
import {
|
import {
|
||||||
|
createUserEntity,
|
||||||
tokenToDecimal,
|
tokenToDecimal,
|
||||||
ZERO_BD,
|
ZERO_BD,
|
||||||
} from './helpers'
|
} from './helpers'
|
||||||
@ -29,6 +30,8 @@ export function handleNewToken(event: TokenRegistered): void {
|
|||||||
datatoken.address = event.params.tokenAddress.toHexString()
|
datatoken.address = event.params.tokenAddress.toHexString()
|
||||||
datatoken.cap = tokenToDecimal(event.params.tokenCap.toBigDecimal(), 18)
|
datatoken.cap = tokenToDecimal(event.params.tokenCap.toBigDecimal(), 18)
|
||||||
datatoken.supply = ZERO_BD
|
datatoken.supply = ZERO_BD
|
||||||
|
|
||||||
|
createUserEntity(event.params.registeredBy.toHex())
|
||||||
datatoken.minter = event.params.registeredBy.toHex()
|
datatoken.minter = event.params.registeredBy.toHex()
|
||||||
datatoken.publisher = event.params.registeredBy.toHex()
|
datatoken.publisher = event.params.registeredBy.toHex()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user