ocean-subgraph/src/mappings/utils/userUtils.ts

15 lines
336 B
TypeScript
Raw Normal View History

import { BigInt } from '@graphprotocol/graph-ts'
2021-11-10 13:47:44 +01:00
import { User } from '../../@types/schema'
export function getUser(address: string): User {
let user = User.load(address)
if (user === null) {
user = new User(address)
user.totalOrders = BigInt.zero()
user.totalSales = BigInt.zero()
2021-11-10 13:47:44 +01:00
user.save()
}
return user
}