@@ -44,24 +44,42 @@ given('astar')('Number of slots adjusted based on price', async ({ networks: { a
4444 450000 , // 45%
4545 ] ,
4646 // Perbill percentages
47- // percentages below are calulated based on total issuance at the time when dApp staking v3 was launched (8.4B)
47+ // percentages below are calculated based on total issuance at the time when dApp staking v3 was launched (8.4B)
4848 tierThresholds : [
4949 {
5050 DynamicPercentage : {
5151 percentage : 35_700_000 , // 3.57%
5252 minimumRequiredPercentage : 23_800_000 , // 2.38%
53+ // new parameter on version 10
54+ ...( palletVersion >= 10
55+ ? {
56+ maximumPossiblePercentage : 35_700_000 , // 3.57%
57+ }
58+ : { } ) ,
5359 } ,
5460 } ,
5561 {
5662 DynamicPercentage : {
5763 percentage : 8_900_000 , // 0.89%
5864 minimumRequiredPercentage : 6_000_000 , // 0.6%
65+ // new parameter on version 10
66+ ...( palletVersion >= 10
67+ ? {
68+ maximumPossiblePercentage : 8_900_000 , // 0.89%
69+ }
70+ : { } ) ,
5971 } ,
6072 } ,
6173 {
6274 DynamicPercentage : {
6375 percentage : 2_380_000 , // 0.238%
6476 minimumRequiredPercentage : 1_790_000 , // 0.179%
77+ // new parameter on version 10
78+ ...( palletVersion >= 10
79+ ? {
80+ maximumPossiblePercentage : 2_380_000 , // 0.238%
81+ }
82+ : { } ) ,
6583 } ,
6684 } ,
6785 {
@@ -70,8 +88,7 @@ given('astar')('Number of slots adjusted based on price', async ({ networks: { a
7088 } ,
7189 } ,
7290 ] ,
73- // new parameter on version 9
74- ...( palletVersion >= 9 ? { slotNumberArgs : [ 1000 , 50 ] } : { } ) ,
91+ slotNumberArgs : [ 1000 , 50 ] ,
7592 } ,
7693 } ,
7794 priceAggregator : {
@@ -154,13 +171,13 @@ given('astar')('Number of slots adjusted based on price', async ({ networks: { a
154171 }
155172 ` )
156173
157- // set price to $0.05
174+ // set price to $0.01
158175 await astar . dev . setStorage ( {
159176 priceAggregator : {
160177 valuesCircularBuffer : {
161178 head : 1 ,
162179 buffer : [
163- 50_000_000_000_000_000n , // $0.05
180+ 10_000_000_000_000_000n , // $0.01
164181 ] ,
165182 } ,
166183 } ,
@@ -171,27 +188,52 @@ given('astar')('Number of slots adjusted based on price', async ({ networks: { a
171188 config = await astar . api . query . dappStaking . tierConfig < TiersConfigurationV8 > ( )
172189 numberOfSlots = calculateNumberOfSlots ( config . slotsPerTier )
173190
174- expect ( numberOfSlots ) . toEqual ( 100 )
175- expect ( config . toHuman ( ) ) . toMatchInlineSnapshot ( `
176- {
177- "rewardPortion": [
178- "25.00%",
179- "47.00%",
180- "25.00%",
181- "3.00%",
182- ],
183- "slotsPerTier": [
184- "5",
185- "20",
186- "30",
187- "45",
188- ],
189- "tierThresholds": [
190- "299,880,001,946,038,151,514,954,140",
191- "74,760,000,485,146,766,063,952,153",
192- "19,992,000,129,735,876,767,663,609",
193- "1,680,000,010,902,174,518,291,060",
194- ],
195- }
196- ` )
191+ expect ( numberOfSlots ) . toEqual ( 60 )
192+ if ( palletVersion >= 10 ) {
193+ expect ( config . toHuman ( ) ) . toMatchInlineSnapshot ( `
194+ {
195+ "rewardPortion": [
196+ "25.00%",
197+ "47.00%",
198+ "25.00%",
199+ "3.00%",
200+ ],
201+ "slotsPerTier": [
202+ "3",
203+ "12",
204+ "18",
205+ "27",
206+ ],
207+ "tierThresholds": [
208+ "299,880,001,946,038,151,514,954,140",
209+ "74,760,000,485,146,766,063,952,153",
210+ "19,992,000,129,735,876,767,663,609",
211+ "1,680,000,010,902,174,518,291,060",
212+ ],
213+ }
214+ ` )
215+ } else {
216+ expect ( config . toHuman ( ) ) . toMatchInlineSnapshot ( `
217+ {
218+ "rewardPortion": [
219+ "25.00%",
220+ "47.00%",
221+ "25.00%",
222+ "3.00%",
223+ ],
224+ "slotsPerTier": [
225+ "3",
226+ "12",
227+ "18",
228+ "27",
229+ ],
230+ "tierThresholds": [
231+ "499,800,003,243,396,919,291,550,233",
232+ "124,600,000,808,577,943,464,840,255",
233+ "33,320,000,216,226,461,286,103,348",
234+ "1,680,000,010,902,174,518,291,060",
235+ ],
236+ }
237+ ` )
238+ }
197239} )
0 commit comments