@@ -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 = 0
166+ indexer . indexingRewardCut = BigInt . fromI32 ( 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 = 0
172+ indexer . queryFeeCut = BigInt . fromI32 ( 1000000 )
173173 indexer . queryFeeEffectiveCut = BigDecimal . fromString ( '0' )
174174 indexer . delegatorParameterCooldown = 0
175175 indexer . lastDelegationParameterUpdate = 0
@@ -226,9 +226,9 @@ export function createOrLoadProvision(indexerAddress: Bytes, verifierAddress: By
226226 provision . maxVerifierCutPending = BigInt . fromI32 ( 0 )
227227 provision . thawingPeriod = BigInt . fromI32 ( 0 )
228228 provision . thawingPeriodPending = BigInt . fromI32 ( 0 )
229- provision . queryFeeCut = BigInt . fromI32 ( 0 )
230- provision . indexingFeeCut = BigInt . fromI32 ( 0 )
231- provision . indexingRewardsCut = BigInt . fromI32 ( 0 )
229+ provision . queryFeeCut = BigInt . fromI32 ( 1000000 )
230+ provision . indexingFeeCut = BigInt . fromI32 ( 1000000 )
231+ provision . indexingRewardsCut = BigInt . fromI32 ( 1000000 )
232232 provision . indexingRewardEffectiveCut = BigInt . fromI32 ( 0 ) . toBigDecimal ( )
233233 provision . queryFeeEffectiveCut = BigInt . fromI32 ( 0 ) . toBigDecimal ( )
234234 provision . overDelegationDilution = BigInt . fromI32 ( 0 ) . toBigDecimal ( )
@@ -954,25 +954,22 @@ export function calculateDelegatedStakeRatio(indexer: Indexer): BigDecimal {
954954}
955955
956956export function calculateIndexingRewardEffectiveCut ( indexer : Indexer ) : BigDecimal {
957- let delegatorCut =
958- BigInt . fromI32 ( 1000000 - indexer . indexingRewardCut ) . toBigDecimal ( ) /
959- BigDecimal . fromString ( '1000000' )
957+ let delegatorCut = indexer . indexingRewardCut . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
960958 return indexer . delegatedStakeRatio == BigDecimal . fromString ( '0' )
961959 ? BigDecimal . fromString ( '0' )
962960 : BigDecimal . fromString ( '1' ) - delegatorCut / indexer . delegatedStakeRatio
963961}
964962
965963export function calculateQueryFeeEffectiveCut ( indexer : Indexer ) : BigDecimal {
966- let delegatorCut =
967- BigInt . fromI32 ( 1000000 - indexer . queryFeeCut ) . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
964+ let delegatorCut = indexer . queryFeeCut . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
968965 return indexer . delegatedStakeRatio == BigDecimal . fromString ( '0' )
969966 ? BigDecimal . fromString ( '0' )
970967 : BigDecimal . fromString ( '1' ) - delegatorCut / indexer . delegatedStakeRatio
971968}
972969
973970export function calculateIndexerRewardOwnGenerationRatio ( indexer : Indexer ) : BigDecimal {
974971 let rewardCut =
975- BigInt . fromI32 ( indexer . indexingRewardCut ) . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
972+ BigInt . fromI32 ( 1000000 - indexer . indexingRewardCut ) . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
976973 return indexer . ownStakeRatio == BigDecimal . fromString ( '0' )
977974 ? BigDecimal . fromString ( '0' )
978975 : rewardCut / indexer . ownStakeRatio
@@ -1017,7 +1014,7 @@ export function calculateDelegatedStakeRatioForProvision(provision: Provision):
10171014
10181015export function calculateIndexingRewardEffectiveCutForProvision ( provision : Provision ) : BigDecimal {
10191016 let delegatorCut =
1020- provision . indexingRewardsCut . toBigDecimal ( ) /
1017+ BigInt . fromI32 ( 1000000 - provision . indexingRewardsCut ) . toBigDecimal ( ) /
10211018 BigDecimal . fromString ( '1000000' )
10221019 return provision . delegatedStakeRatio == BigDecimal . fromString ( '0' )
10231020 ? BigDecimal . fromString ( '0' )
@@ -1026,15 +1023,17 @@ export function calculateIndexingRewardEffectiveCutForProvision(provision: Provi
10261023
10271024export function calculateQueryFeeEffectiveCutForProvision ( provision : Provision ) : BigDecimal {
10281025 let delegatorCut =
1029- provision . queryFeeCut . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
1026+ BigInt . fromI32 ( 1000000 - provision . queryFeeCut ) . toBigDecimal ( ) /
1027+ BigDecimal . fromString ( '1000000' )
10301028 return provision . delegatedStakeRatio == BigDecimal . fromString ( '0' )
10311029 ? BigDecimal . fromString ( '0' )
10321030 : BigDecimal . fromString ( '1' ) - delegatorCut / provision . delegatedStakeRatio
10331031}
10341032
10351033export function calculateIndexerRewardOwnGenerationRatioForProvision ( provision : Provision ) : BigDecimal {
10361034 let delegatorCut =
1037- provision . indexingRewardsCut . toBigDecimal ( ) / BigDecimal . fromString ( '1000000' )
1035+ BigInt . fromI32 ( 1000000 - provision . indexingRewardsCut ) . toBigDecimal ( ) /
1036+ BigDecimal . fromString ( '1000000' )
10381037 return provision . ownStakeRatio == BigDecimal . fromString ( '0' )
10391038 ? BigDecimal . fromString ( '0' )
10401039 : ( BigDecimal . fromString ( '1' ) - delegatorCut ) / provision . ownStakeRatio
@@ -1212,7 +1211,7 @@ export function batchUpdateSubgraphSignalledTokens(deployment: SubgraphDeploymen
12121211 }
12131212}
12141213
1215- export function convertBigIntSubgraphIDToBase58 ( bigIntRepresentation : BigInt ) : String {
1214+ export function convertBigIntSubgraphIDToBase58 ( bigIntRepresentation : BigInt ) : string {
12161215 // Might need to unpad the BigInt since `fromUnsignedBytes` pads one byte with a zero.
12171216 // Although for the events where the uint256 is provided, we probably don't need to unpad.
12181217 let hexString = bigIntRepresentation . toHexString ( )
0 commit comments