Skip to content

Commit f74024b

Browse files
committed
fix: address feedback from Delegation Pool pr
1 parent 8e5377e commit f74024b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

schema.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ type Provision @entity {
948948
delegatedTokens: BigInt!
949949
"Total shares of the delegator pool"
950950
delegatorShares: BigInt!
951-
"Exchange rate of of tokens received for each share"
951+
"Exchange rate of tokens received for each share"
952952
delegationExchangeRate: BigDecimal!
953953
"Ratio between the amount of the indexers own stake over the total usable stake (capped by the delegationRatio)."
954954
ownStakeRatio: BigDecimal!

src/mappings/horizonStaking.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ export function handleTokensToDelegationPoolAdded(event: TokensToDelegationPoolA
270270
let indexer = Indexer.load(event.params.serviceProvider.toHexString())!
271271
let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp)
272272
provision.delegatedTokens = provision.delegatedTokens.plus(event.params.tokens)
273+
if (provision.delegatorShares != BigInt.fromI32(0)) {
274+
provision = updateDelegationExchangeRateForProvision(provision as Provision)
275+
}
273276
provision.save()
274277

275278
indexer.delegatedTokens = indexer.delegatedTokens.plus(event.params.tokens) // this only serves as a general tracker, but the real deal is per provision

0 commit comments

Comments
 (0)