@@ -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
@@ -956,14 +956,14 @@ export function calculateDelegatedStakeRatio(indexer: Indexer): BigDecimal {
956956}
957957
958958export function calculateIndexingRewardEffectiveCut ( indexer : Indexer ) : BigDecimal {
959- let delegatorCut = indexer . indexingRewardCut . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
959+ let delegatorCut = BigInt . fromI32 ( indexer . indexingRewardCut ) . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
960960 return indexer . delegatedStakeRatio == BigDecimal . fromString ( '0' )
961961 ? BigDecimal . fromString ( '0' )
962962 : BigDecimal . fromString ( '1' ) - delegatorCut / indexer . delegatedStakeRatio
963963}
964964
965965export function calculateQueryFeeEffectiveCut ( indexer : Indexer ) : BigDecimal {
966- let delegatorCut = indexer . queryFeeCut . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
966+ let delegatorCut = BigInt . fromI32 ( indexer . queryFeeCut ) . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
967967 return indexer . delegatedStakeRatio == BigDecimal . fromString ( '0' )
968968 ? BigDecimal . fromString ( '0' )
969969 : BigDecimal . fromString ( '1' ) - delegatorCut / indexer . delegatedStakeRatio
@@ -1017,7 +1017,7 @@ export function calculateDelegatedStakeRatioForProvision(provision: Provision):
10171017
10181018export function calculateIndexingRewardEffectiveCutForProvision ( provision : Provision ) : BigDecimal {
10191019 let delegatorCut =
1020- BigInt . fromI32 ( 1000000 - provision . indexingRewardsCut ) . toBigDecimal ( ) /
1020+ BigInt . fromI32 ( 1000000 ) . minus ( provision . indexingRewardsCut ) . toBigDecimal ( ) /
10211021 BigDecimal . fromString ( '1000000' )
10221022 return provision . delegatedStakeRatio == BigDecimal . fromString ( '0' )
10231023 ? BigDecimal . fromString ( '0' )
@@ -1026,7 +1026,7 @@ export function calculateIndexingRewardEffectiveCutForProvision(provision: Provi
10261026
10271027export function calculateQueryFeeEffectiveCutForProvision ( provision : Provision ) : BigDecimal {
10281028 let delegatorCut =
1029- BigInt . fromI32 ( 1000000 - provision . queryFeeCut ) . toBigDecimal ( ) /
1029+ BigInt . fromI32 ( 1000000 ) . minus ( provision . queryFeeCut ) . toBigDecimal ( ) /
10301030 BigDecimal . fromString ( '1000000' )
10311031 return provision . delegatedStakeRatio == BigDecimal . fromString ( '0' )
10321032 ? BigDecimal . fromString ( '0' )
@@ -1035,7 +1035,7 @@ export function calculateQueryFeeEffectiveCutForProvision(provision: Provision):
10351035
10361036export function calculateIndexerRewardOwnGenerationRatioForProvision ( provision : Provision ) : BigDecimal {
10371037 let delegatorCut =
1038- BigInt . fromI32 ( 1000000 - provision . indexingRewardsCut ) . toBigDecimal ( ) /
1038+ BigInt . fromI32 ( 1000000 ) . minus ( provision . indexingRewardsCut ) . toBigDecimal ( ) /
10391039 BigDecimal . fromString ( '1000000' )
10401040 return provision . ownStakeRatio == BigDecimal . fromString ( '0' )
10411041 ? BigDecimal . fromString ( '0' )
0 commit comments