bugfix: balances::transfer for new_account issue#722 (#731)

* bugfix: balances::transfer for new_account

issue:#722
would_create flag should depend on dest, not origin.
change 
```rust
let would_create = from_balance.is_zero();
```
to 
```rust
    let to_balance = Self::free_balance(&dest); 
    let would_create = to_balance.is_zero(); 
```
in the other hand, provide `fn new_test_ext2()` and let `transfer_fee=10`, `creation_fee=50` for test case

* Update lib.rs

* Update tests.rs

* Make `impl_outer_origin!` support generic `Origin`s (#732)

* Make `impl_outer_origin!` support generic `Origin`s

* Support empty outer origin

* Contracts: fix transfer function. (#733)

* Remove dependency on the parity repo (#734)

* Fix test

* Anothe fix
This commit is contained in:
金XX(Aton)
2018-09-13 21:54:56 +08:00
committed by Gav Wood
parent a7f8f0f1bd
commit ca8f0d6625
4 changed files with 112 additions and 3 deletions
+23
View File
@@ -73,5 +73,28 @@ pub fn new_test_ext(ext_deposit: u64, monied: bool) -> runtime_io::TestExternali
t.into()
}
pub fn new_test_ext2(ext_deposit: u64, monied: bool) -> runtime_io::TestExternalities<Blake2Hasher> {
let mut t = system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
let balance_factor = if ext_deposit > 0 {
256
} else {
1
};
t.extend(GenesisConfig::<Runtime>{
balances: if monied {
vec![(1, 10 * balance_factor), (2, 20 * balance_factor), (3, 30 * balance_factor), (4, 40 * balance_factor)]
} else {
vec![(10, balance_factor), (20, balance_factor)]
},
transaction_base_fee: 0,
transaction_byte_fee: 0,
existential_deposit: ext_deposit,
transfer_fee: 10, // transfer_fee not zero
creation_fee: 50, // creation_fee not zero
reclaim_rebate: 0,
}.build_storage().unwrap());
t.into()
}
pub type System = system::Module<Runtime>;
pub type Balances = Module<Runtime>;