Skip to content

Commit

Permalink
Merge pull request #67 from maticnetwork/delegation
Browse files Browse the repository at this point in the history
new: activestake in delegation
  • Loading branch information
nitinmittal23 authored Jul 1, 2022
2 parents b868949 + ef92a1d commit 616bc11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions root/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ type DelegatorUnbond @entity {
unbondStartedTimeStamp: BigInt
unbondClaimedTxHash: Bytes
unbondClaimedTimeStamp: BigInt
activeStake: BigInt!
}

type MaticTransfer @entity {
Expand Down Expand Up @@ -267,4 +268,5 @@ type Delegation @entity {
# delegated amount in that transaction
amount: BigInt!
block: BigInt!
activeStake: BigInt!
}
2 changes: 2 additions & 0 deletions root/src/mappings/staking-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ export function handleShareMinted(event: ShareMinted): void {
delegation.timestamp = event.block.timestamp
delegation.transactionHash = event.transaction.hash
delegation.amount = event.params.amount
delegation.activeStake = delegator.delegatedAmount

delegation.save()
// -- Saving updation
Expand Down Expand Up @@ -383,6 +384,7 @@ export function handleShareBurnedWithId(event: ShareBurnedWithId): void {
delegatorUnbond.tokens = event.params.tokens
delegatorUnbond.unbondStartedTxHash = event.transaction.hash
delegatorUnbond.unbondStartedTimeStamp = event.block.timestamp
delegatorUnbond.activeStake = delegator.delegatedAmount

// save entity
delegatorUnbond.save()
Expand Down

0 comments on commit 616bc11

Please sign in to comment.