mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 12:11:09 +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:
@@ -125,7 +125,7 @@ use frame_support::{
|
||||
parameter_types, IsSubType,
|
||||
weights::DispatchInfo,
|
||||
};
|
||||
use frame_support::traits::{OnFreeBalanceZero, OnUnbalanced, Currency, Get, Time, Randomness};
|
||||
use frame_support::traits::{OnReapAccount, OnUnbalanced, Currency, Get, Time, Randomness};
|
||||
use frame_system::{self as system, ensure_signed, RawOrigin, ensure_root};
|
||||
use sp_core::storage::well_known_keys::CHILD_STORAGE_KEY_PREFIX;
|
||||
use pallet_contracts_primitives::{RentProjection, ContractAccessError};
|
||||
@@ -401,9 +401,6 @@ pub trait Trait: frame_system::Trait {
|
||||
/// to removal of a contract.
|
||||
type SurchargeReward: Get<BalanceOf<Self>>;
|
||||
|
||||
/// The fee required to make a transfer.
|
||||
type TransferFee: Get<BalanceOf<Self>>;
|
||||
|
||||
/// The fee required to create an account.
|
||||
type CreationFee: Get<BalanceOf<Self>>;
|
||||
|
||||
@@ -520,9 +517,6 @@ decl_module! {
|
||||
/// to removal of a contract.
|
||||
const SurchargeReward: BalanceOf<T> = T::SurchargeReward::get();
|
||||
|
||||
/// The fee required to make a transfer.
|
||||
const TransferFee: BalanceOf<T> = T::TransferFee::get();
|
||||
|
||||
/// The fee required to create an account.
|
||||
const CreationFee: BalanceOf<T> = T::CreationFee::get();
|
||||
|
||||
@@ -953,8 +947,8 @@ decl_storage! {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> OnFreeBalanceZero<T::AccountId> for Module<T> {
|
||||
fn on_free_balance_zero(who: &T::AccountId) {
|
||||
impl<T: Trait> OnReapAccount<T::AccountId> for Module<T> {
|
||||
fn on_reap_account(who: &T::AccountId) {
|
||||
if let Some(ContractInfo::Alive(info)) = <ContractInfoOf<T>>::take(who) {
|
||||
child::kill_storage(&info.trie_id, info.child_trie_unique_id());
|
||||
}
|
||||
@@ -973,7 +967,6 @@ pub struct Config<T: Trait> {
|
||||
pub max_value_size: u32,
|
||||
pub contract_account_instantiate_fee: BalanceOf<T>,
|
||||
pub account_create_fee: BalanceOf<T>,
|
||||
pub transfer_fee: BalanceOf<T>,
|
||||
}
|
||||
|
||||
impl<T: Trait> Config<T> {
|
||||
@@ -986,7 +979,6 @@ impl<T: Trait> Config<T> {
|
||||
max_value_size: T::MaxValueSize::get(),
|
||||
contract_account_instantiate_fee: T::ContractFee::get(),
|
||||
account_create_fee: T::CreationFee::get(),
|
||||
transfer_fee: T::TransferFee::get(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1031,6 +1023,9 @@ pub struct Schedule {
|
||||
/// Gas cost per one byte written to the sandbox memory.
|
||||
pub sandbox_data_write_cost: Gas,
|
||||
|
||||
/// Cost for a simple balance transfer.
|
||||
pub transfer_cost: Gas,
|
||||
|
||||
/// The maximum number of topics supported by an event.
|
||||
pub max_event_topics: u32,
|
||||
|
||||
@@ -1069,6 +1064,7 @@ impl Default for Schedule {
|
||||
instantiate_base_cost: 175,
|
||||
sandbox_data_read_cost: 1,
|
||||
sandbox_data_write_cost: 1,
|
||||
transfer_cost: 100,
|
||||
max_event_topics: 4,
|
||||
max_stack_height: 64 * 1024,
|
||||
max_memory_pages: 16,
|
||||
|
||||
Reference in New Issue
Block a user