@@ -300,6 +300,8 @@ fn init_pool_id(pool_id_number: u32, pool_currency_id: CurrencyId) -> Result<Poo
300300 match pool_id_number {
301301 0 => Ok ( PoolId :: Loans ( pool_currency_id) ) ,
302302 1 => Ok ( PoolId :: Dex ( pool_currency_id) ) ,
303+ 2 => Ok ( PoolId :: Earning ( pool_currency_id) ) ,
304+ 3 => Ok ( PoolId :: NomineesElection ) ,
303305 // Shouldn't happen as solidity compiler should not allow nonexistent enum value
304306 _ => Err ( PrecompileFailure :: Revert {
305307 exit_status : ExitRevert :: Reverted ,
@@ -336,10 +338,14 @@ mod tests {
336338
337339 assert_ok ! ( Incentives :: update_incentive_rewards(
338340 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+ ]
340346 ) ) ;
341347
342- // getIncetiveRewardAmount (PoolId,address,address) => 0x7469000d
348+ // getIncentiveRewardAmount (PoolId,address,address) => 0x7469000d
343349 // pool
344350 // pool_currency_id
345351 // reward_currency_id
@@ -359,6 +365,48 @@ mod tests {
359365 IncentivesPrecompile :: execute ( & mut MockPrecompileHandle :: new ( & input, None , & context, false ) ) . unwrap ( ) ;
360366 assert_eq ! ( res. exit_status, ExitSucceed :: Returned ) ;
361367 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( ) ) ;
362410 } ) ;
363411 }
364412
0 commit comments