diff --git a/src/mapping-wiseToken.ts b/src/mapping-wiseToken.ts index 5f98e88..2438cbe 100644 --- a/src/mapping-wiseToken.ts +++ b/src/mapping-wiseToken.ts @@ -15,17 +15,22 @@ import { } from "../generated/schema" export function handleGiveStatus (call: GiveStatusCall): void { - let referrer = createUser(call.inputs._referrer.toHex()) + let referrerID = call.inputs._referrer.toHex() + let referrer = User.load(referrerID) + if (referrer == null) { + referrer = createUser(referrerID) + } if (referrer.cmStatus === false) { referrer.cmStatus = true referrer.cmStatusInLaunch = true - referrer.save() let global = getOrCreateGlobal() global.cmStatusCount = global.cmStatusCount.plus(ONE) global.cmStatusInLaunchCount = global.cmStatusInLaunchCount.plus(ONE) global.save() } + + referrer.save() } export function handleStakeStart (event: StakeStart): void {