Skip to content

Commit

Permalink
Merge pull request #36 from maticnetwork/new-delegator-unbond-events
Browse files Browse the repository at this point in the history
Save operation moved up before validator entity is taken up.
  • Loading branch information
reddyismav authored Apr 8, 2021
2 parents 502dcf5 + 10e0563 commit 3da2867
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions root/src/mappings/staking-nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ export function handleTransfer(event: Transfer): void {
let transactionHashes = entity.transactionHashes
transactionHashes.push(event.transaction.hash)
entity.transactionHashes = transactionHashes
let validatorId = 'validator:' + event.params.tokenId.toString()
let validator = Validator.load(validatorId)
validator.owner = event.params.to

// save entity
entity.save()
validator.save()

// Save new owner address to validator DB.
let validatorId = 'validator:' + event.params.tokenId.toString()
let validator = Validator.load(validatorId)
if (validator) {
validator.owner = event.params.to
validator.save()
}
}

0 comments on commit 3da2867

Please sign in to comment.