Trait pallet_contracts::pallet::Config[][src]

pub trait Config: Config {
Show associated items type Time: Time; type Randomness: Randomness<Self::Hash, Self::BlockNumber>; type Currency: Currency<Self::AccountId>; type Event: From<Event<Self>> + IsType<<Self as Config>::Event>; type Call: Dispatchable<Origin = Self::Origin, PostInfo = PostDispatchInfo> + GetDispatchInfo + Decode + IsType<<Self as Config>::Call>; type CallFilter: Contains<<Self as Config>::Call>; type RentPayment: OnUnbalanced<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::NegativeImbalance>; type WeightPrice: Convert<Weight, <<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>; type WeightInfo: WeightInfo; type ChainExtension: ChainExtension<Self>; type Schedule: Get<Schedule<Self>>; type SignedClaimHandicap: Get<Self::BlockNumber>; type TombstoneDeposit: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>; type DepositPerContract: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>; type DepositPerStorageByte: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>; type DepositPerStorageItem: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>; type RentFraction: Get<Perbill>; type SurchargeReward: Get<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::Balance>; type CallStack: Array<Item = Frame<Self>>; type DeletionQueueDepth: Get<u32>; type DeletionWeightLimit: Get<Weight>;
}
Expand description

Configuration trait of this pallet.

Implement this type for a runtime in order to customize this pallet.

Associated Types

The time implementation used to supply timestamps to conntracts through seal_now.

The generator used to supply randomness to contracts through seal_random.

The currency in which fees are paid and contract balances are held.

The overarching event type.

The overarching call type.

Filter that is applied to calls dispatched by contracts.

Use this filter to control which dispatchables are callable by contracts. This is applied in addition to frame_system::Config::BaseCallFilter. It is recommended to treat this as a whitelist.

Subsistence Threshold

The runtime must make sure that any allowed dispatchable makes sure that the total_balance of the contract stays above Pallet::subsistence_threshold(). Otherwise contracts can clutter the storage with their tombstones without deposting the correct amount of balance.

Stability

The runtime must make sure that all dispatchables that are callable by contracts remain stable. In addition Self::Call itself must remain stable. This means that no existing variants are allowed to switch their positions.

Note

Note that dispatchables that are called via contracts do not spawn their own wasm instance for each call (as opposed to when called via a transaction). Therefore please make sure to be restrictive about which dispatchables are allowed in order to not introduce a new DoS vector like memory allocation patterns that can be exploited to drive the runtime into a panic.

Handler for rent payments.

Used to answer contracts’ queries regarding the current weight price. This is not used to calculate the actual fee and is only for informational purposes.

Describes the weights of the dispatchables of this module and is also used to construct a default cost schedule.

Type that allows the runtime authors to add new host functions for a contract to call.

Cost schedule and limits.

Number of block delay an extrinsic claim surcharge has.

When claim surcharge is called by an extrinsic the rent is checked for current_block - delay

The minimum amount required to generate a tombstone.

The balance every contract needs to deposit to stay alive indefinitely.

This is different from the Self::TombstoneDeposit because this only needs to be deposited while the contract is alive. Costs for additional storage are added to this base cost.

This is a simple way to ensure that contracts with empty storage eventually get deleted by making them pay rent. This creates an incentive to remove them early in order to save rent.

The balance a contract needs to deposit per storage byte to stay alive indefinitely.

Let’s suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1 BU/byte/day, then a contract with 1,000,000 BU that uses 1,000 bytes of storage would pay no rent. But if the balance reduced to 500,000 BU and the storage stayed the same at 1,000, then it would pay 500 BU/day.

The balance a contract needs to deposit per storage item to stay alive indefinitely.

It works the same as Self::DepositPerStorageByte but for storage items.

The fraction of the deposit that should be used as rent per block.

When a contract hasn’t enough balance deposited to stay alive indefinitely it needs to pay per block for the storage it consumes that is not covered by the deposit. This determines how high this rent payment is per block as a fraction of the deposit.

Reward that is received by the party whose touch has led to removal of a contract.

The type of the call stack determines the maximum nesting depth of contract calls.

The allowed depth is CallStack::size() + 1. Therefore a size of 0 means that a contract cannot use call or instantiate. In other words only the origin called “root contract” is allowed to execute then.

The maximum number of tries that can be queued for deletion.

The maximum amount of weight that can be consumed per block for lazy trie removal.

Implementors