@@ -300,6 +300,8 @@ fn init_pool_id(pool_id_number: u32, pool_currency_id: CurrencyId) -> Result<Poo
300
300
match pool_id_number {
301
301
0 => Ok ( PoolId :: Loans ( pool_currency_id) ) ,
302
302
1 => Ok ( PoolId :: Dex ( pool_currency_id) ) ,
303
+ 2 => Ok ( PoolId :: Earning ( pool_currency_id) ) ,
304
+ 3 => Ok ( PoolId :: NomineesElection ) ,
303
305
// Shouldn't happen as solidity compiler should not allow nonexistent enum value
304
306
_ => Err ( PrecompileFailure :: Revert {
305
307
exit_status : ExitRevert :: Reverted ,
@@ -336,10 +338,14 @@ mod tests {
336
338
337
339
assert_ok ! ( Incentives :: update_incentive_rewards(
338
340
RuntimeOrigin :: signed( ALICE ) ,
339
- vec![ ( PoolId :: Loans ( DOT ) , vec![ ( DOT , 100 ) ] ) ]
341
+ vec![
342
+ ( PoolId :: Loans ( DOT ) , vec![ ( DOT , 100 ) ] ) ,
343
+ ( PoolId :: Earning ( ACA ) , vec![ ( ACA , 101 ) ] ) ,
344
+ ( PoolId :: NomineesElection , vec![ ( ACA , 102 ) ] ) ,
345
+ ]
340
346
) ) ;
341
347
342
- // getIncetiveRewardAmount (PoolId,address,address) => 0x7469000d
348
+ // getIncentiveRewardAmount (PoolId,address,address) => 0x7469000d
343
349
// pool
344
350
// pool_currency_id
345
351
// reward_currency_id
@@ -359,6 +365,48 @@ mod tests {
359
365
IncentivesPrecompile :: execute ( & mut MockPrecompileHandle :: new ( & input, None , & context, false ) ) . unwrap ( ) ;
360
366
assert_eq ! ( res. exit_status, ExitSucceed :: Returned ) ;
361
367
assert_eq ! ( res. output, expected_output. to_vec( ) ) ;
368
+
369
+ // getIncentiveRewardAmount(PoolId,address,address) => 0x7469000d
370
+ // pool
371
+ // pool_currency_id
372
+ // reward_currency_id
373
+ let input = hex ! { "
374
+ 7469000d
375
+ 00000000000000000000000000000000 00000000000000000000000000000002
376
+ 000000000000000000000000 0000000000000000000100000000000000000000
377
+ 000000000000000000000000 0000000000000000000100000000000000000000
378
+ " } ;
379
+
380
+ // value of 101
381
+ let expected_output = hex ! { "
382
+ 00000000000000000000000000000000 00000000000000000000000000000065
383
+ " } ;
384
+
385
+ let res =
386
+ IncentivesPrecompile :: execute ( & mut MockPrecompileHandle :: new ( & input, None , & context, false ) ) . unwrap ( ) ;
387
+ assert_eq ! ( res. exit_status, ExitSucceed :: Returned ) ;
388
+ assert_eq ! ( res. output, expected_output. to_vec( ) ) ;
389
+
390
+ // getIncentiveRewardAmount(PoolId,address,address) => 0x7469000d
391
+ // pool
392
+ // pool_currency_id
393
+ // reward_currency_id
394
+ let input = hex ! { "
395
+ 7469000d
396
+ 00000000000000000000000000000000 00000000000000000000000000000003
397
+ 000000000000000000000000 0000000000000000000100000000000000000003
398
+ 000000000000000000000000 0000000000000000000100000000000000000000
399
+ " } ;
400
+
401
+ // value of 102
402
+ let expected_output = hex ! { "
403
+ 00000000000000000000000000000000 00000000000000000000000000000066
404
+ " } ;
405
+
406
+ let res =
407
+ IncentivesPrecompile :: execute ( & mut MockPrecompileHandle :: new ( & input, None , & context, false ) ) . unwrap ( ) ;
408
+ assert_eq ! ( res. exit_status, ExitSucceed :: Returned ) ;
409
+ assert_eq ! ( res. output, expected_output. to_vec( ) ) ;
362
410
} ) ;
363
411
}
364
412
0 commit comments