diff --git a/pallets/duniter-account/src/lib.rs b/pallets/duniter-account/src/lib.rs index 2191bfac740e1885b64f1c4e814dd00cca003bd6..670da58024be528bf8e823741d3465143008936b 100644 --- a/pallets/duniter-account/src/lib.rs +++ b/pallets/duniter-account/src/lib.rs @@ -96,7 +96,7 @@ pub mod pallet { pub type PendingNewAccounts<T: Config> = StorageMap<_, Blake2_128Concat, T::AccountId, (), OptionQuery>; - #[derive(Encode, Decode, Clone, TypeInfo)] + #[derive(Encode, Decode, Clone, TypeInfo, Debug, PartialEq)] pub struct QueuedRefund<AccountId, IdtyId, Balance> { /// account to refund pub account: AccountId, diff --git a/runtime/gdev/tests/integration_tests.rs b/runtime/gdev/tests/integration_tests.rs index 87df60fa9ad2a89b6ce86ecc0034e3260ca569ef..916cac4c735b9a346e14d844ecbe17a31e9df3a1 100644 --- a/runtime/gdev/tests/integration_tests.rs +++ b/runtime/gdev/tests/integration_tests.rs @@ -954,6 +954,7 @@ fn test_validate_new_idty_after_few_uds() { IdtyData { // first eligible UD will be at block 30 first_eligible_ud: pallet_universal_dividend::FirstEligibleUd::from(3), + quotas: (0, 0) } ); }); @@ -1014,6 +1015,7 @@ fn test_claim_memberhsip_after_few_uds() { IdtyData { // first eligible UD will be at block 30 first_eligible_ud: pallet_universal_dividend::FirstEligibleUd::from(3), + quotas: (0, 0) } ); }); diff --git a/runtime/gdev/tests/xt_tests.rs b/runtime/gdev/tests/xt_tests.rs index 1614e8622c0f668d731884d1b82c40d13ed07135..8da6deb0a4f8b6b48739241e44c78bf729f1c4d8 100644 --- a/runtime/gdev/tests/xt_tests.rs +++ b/runtime/gdev/tests/xt_tests.rs @@ -100,3 +100,36 @@ fn test_transfer_xt() { assert_eq!(Balances::free_balance(Treasury::account_id()), 200 + 3); }) } + +/// test that fees are added to the refund queue +#[test] +fn test_refund_queue() { + ExtBuilder::new(1, 3, 4) + .with_initial_balances(vec![ + (AccountKeyring::Alice.to_account_id(), 10_000), + (AccountKeyring::Eve.to_account_id(), 10_000), + ]) + .build() + .execute_with(|| { + let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death { + dest: AccountKeyring::Eve.to_account_id().into(), + value: 500, + }); + + // 1 cĞD of tip + let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Alice, 1u64); + assert_ok!(Executive::apply_extrinsic(xt)); + + // check treasury initial amount + assert_eq!( + pallet_duniter_account::RefundQueue::<Runtime>::get() + .first() + .expect("a refund should have been added to the queue"), + &pallet_duniter_account::pallet::QueuedRefund { + account: AccountKeyring::Alice.to_account_id(), + identity: 1u32, + amount: 2u64 + } + ); + }) +}