mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 19:51:05 +00:00
Refactor the balances module (#4649)
* Initially scoping out of the problem * Remove need for exiry in balance locks. * Remove expiry from locks. * Remove supefluous balance test * Amalgamate pieces of balance module * Split out vesting * Fix tests * Fixes for vesting. * Docs. * Weight docs. * Refactor things in terms of set_balances. * Switch out ED to be free + reserved. * Remove on_free_balance_zero and some docs. * Build fixes * Update frame/vesting/src/lib.rs Co-Authored-By: Xiliang Chen <xlchen1291@gmail.com> * Update frame/vesting/src/lib.rs Co-Authored-By: Xiliang Chen <xlchen1291@gmail.com> * Migration * Remove superfluous code. * Test fixes * Fix some tests * Fix repatriate reserve * Fixes * Add test for migration * Final cleanups * Fix * Indentation. * Undo unneeded referencing * Bump runtime version * Fixes Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
This commit is contained in:
@@ -81,20 +81,17 @@ impl frame_system::Trait for Test {
|
||||
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: u64 = 1;
|
||||
pub const TransferFee: u64 = 0;
|
||||
pub const CreationFee: u64 = 0;
|
||||
}
|
||||
|
||||
impl pallet_balances::Trait for Test {
|
||||
type Balance = u128;
|
||||
type OnFreeBalanceZero = ();
|
||||
type OnReapAccount = (System, Recovery);
|
||||
type OnNewAccount = ();
|
||||
type Event = TestEvent;
|
||||
type TransferPayment = ();
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type TransferFee = TransferFee;
|
||||
type CreationFee = CreationFee;
|
||||
}
|
||||
|
||||
@@ -126,7 +123,6 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 100), (2, 100), (3, 100), (4, 100), (5, 100)],
|
||||
vesting: vec![],
|
||||
}.assimilate_storage(&mut t).unwrap();
|
||||
t.into()
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ fn basic_setup_works() {
|
||||
assert_eq!(Recovery::active_recovery(&1, &2), None);
|
||||
assert_eq!(Recovery::recovery_config(&1), None);
|
||||
// Everyone should have starting balance of 100
|
||||
assert_eq!(Balances::free_balance(&1), 100);
|
||||
assert_eq!(Balances::free_balance(1), 100);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ fn initiate_recovery_handles_basic_errors() {
|
||||
assert_ok!(Recovery::initiate_recovery(Origin::signed(1), 5));
|
||||
assert_noop!(Recovery::initiate_recovery(Origin::signed(1), 5), Error::<Test>::AlreadyStarted);
|
||||
// No double deposit
|
||||
assert_eq!(Balances::reserved_balance(&1), 10);
|
||||
assert_eq!(Balances::reserved_balance(1), 10);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ fn initiate_recovery_works() {
|
||||
// Recovery can be initiated
|
||||
assert_ok!(Recovery::initiate_recovery(Origin::signed(1), 5));
|
||||
// Deposit is reserved
|
||||
assert_eq!(Balances::reserved_balance(&1), 10);
|
||||
assert_eq!(Balances::reserved_balance(1), 10);
|
||||
// Recovery status object is created correctly
|
||||
let recovery_status = ActiveRecovery {
|
||||
created: 1,
|
||||
|
||||
Reference in New Issue
Block a user