@@ -163,13 +163,13 @@ export function createOrLoadIndexer(indexerAddress: Bytes, timestamp: BigInt ):
163163 indexer . delegatedStakeRatio = BigDecimal . fromString ( '0' )
164164 indexer . delegatorShares = BigInt . fromI32 ( 0 )
165165 indexer . delegationExchangeRate = BigDecimal . fromString ( '1' )
166- indexer . indexingRewardCut = BigInt . fromI32 ( 1000000 )
166+ indexer . indexingRewardCut = 1000000
167167 indexer . indexingRewardEffectiveCut = BigDecimal . fromString ( '0' )
168168 indexer . overDelegationDilution = BigDecimal . fromString ( '0' )
169169 indexer . delegatorIndexingRewards = BigInt . fromI32 ( 0 )
170170 indexer . indexerIndexingRewards = BigInt . fromI32 ( 0 )
171171 indexer . delegatorQueryFees = BigInt . fromI32 ( 0 )
172- indexer . queryFeeCut = BigInt . fromI32 ( 1000000 )
172+ indexer . queryFeeCut = 1000000
173173 indexer . queryFeeEffectiveCut = BigDecimal . fromString ( '0' )
174174 indexer . delegatorParameterCooldown = 0
175175 indexer . lastDelegationParameterUpdate = 0
@@ -954,14 +954,14 @@ export function calculateDelegatedStakeRatio(indexer: Indexer): BigDecimal {
954954}
955955
956956export function calculateIndexingRewardEffectiveCut ( indexer : Indexer ) : BigDecimal {
957- let delegatorCut = indexer . indexingRewardCut . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
957+ let delegatorCut = BigInt . fromI32 ( indexer . indexingRewardCut ) . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
958958 return indexer . delegatedStakeRatio == BigDecimal . fromString ( '0' )
959959 ? BigDecimal . fromString ( '0' )
960960 : BigDecimal . fromString ( '1' ) - delegatorCut / indexer . delegatedStakeRatio
961961}
962962
963963export function calculateQueryFeeEffectiveCut ( indexer : Indexer ) : BigDecimal {
964- let delegatorCut = indexer . queryFeeCut . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
964+ let delegatorCut = BigInt . fromI32 ( indexer . queryFeeCut ) . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
965965 return indexer . delegatedStakeRatio == BigDecimal . fromString ( '0' )
966966 ? BigDecimal . fromString ( '0' )
967967 : BigDecimal . fromString ( '1' ) - delegatorCut / indexer . delegatedStakeRatio
@@ -1014,7 +1014,7 @@ export function calculateDelegatedStakeRatioForProvision(provision: Provision):
10141014
10151015export function calculateIndexingRewardEffectiveCutForProvision ( provision : Provision ) : BigDecimal {
10161016 let delegatorCut =
1017- BigInt . fromI32 ( 1000000 - provision . indexingRewardsCut ) . toBigDecimal ( ) /
1017+ BigInt . fromI32 ( 1000000 ) . minus ( provision . indexingRewardsCut ) . toBigDecimal ( ) /
10181018 BigDecimal . fromString ( '1000000' )
10191019 return provision . delegatedStakeRatio == BigDecimal . fromString ( '0' )
10201020 ? BigDecimal . fromString ( '0' )
@@ -1023,7 +1023,7 @@ export function calculateIndexingRewardEffectiveCutForProvision(provision: Provi
10231023
10241024export function calculateQueryFeeEffectiveCutForProvision ( provision : Provision ) : BigDecimal {
10251025 let delegatorCut =
1026- BigInt . fromI32 ( 1000000 - provision . queryFeeCut ) . toBigDecimal ( ) /
1026+ BigInt . fromI32 ( 1000000 ) . minus ( provision . queryFeeCut ) . toBigDecimal ( ) /
10271027 BigDecimal . fromString ( '1000000' )
10281028 return provision . delegatedStakeRatio == BigDecimal . fromString ( '0' )
10291029 ? BigDecimal . fromString ( '0' )
@@ -1032,7 +1032,7 @@ export function calculateQueryFeeEffectiveCutForProvision(provision: Provision):
10321032
10331033export function calculateIndexerRewardOwnGenerationRatioForProvision ( provision : Provision ) : BigDecimal {
10341034 let delegatorCut =
1035- BigInt . fromI32 ( 1000000 - provision . indexingRewardsCut ) . toBigDecimal ( ) /
1035+ BigInt . fromI32 ( 1000000 ) . minus ( provision . indexingRewardsCut ) . toBigDecimal ( ) /
10361036 BigDecimal . fromString ( '1000000' )
10371037 return provision . ownStakeRatio == BigDecimal . fromString ( '0' )
10381038 ? BigDecimal . fromString ( '0' )
0 commit comments