referrerpolicy=no-referrer-when-downgrade

Trait Config

Source
pub trait Config: Config + Config<RuntimeEvent: From<Event<Self>>> {
Show 22 associated items type Time: Time; type Currency: Inspect<Self::AccountId> + Mutate<Self::AccountId> + MutateHold<Self::AccountId, Reason = Self::RuntimeHoldReason>; type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>; type RuntimeCall: Parameter + Dispatchable<RuntimeOrigin = Self::RuntimeOrigin, PostInfo = PostDispatchInfo> + GetDispatchInfo; type RuntimeHoldReason: From<HoldReason>; type WeightPrice: Convert<Weight, BalanceOf<Self>>; type WeightInfo: WeightInfo; type Precompiles: Precompiles<Self>; type FindAuthor: FindAuthor<Self::AccountId>; type DepositPerByte: Get<BalanceOf<Self>>; type DepositPerItem: Get<BalanceOf<Self>>; type CodeHashLockupDepositPercent: Get<Perbill>; type AddressMapper: AddressMapper<Self>; type UnsafeUnstableInterface: Get<bool>; type AllowEVMBytecode: Get<bool>; type UploadOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>; type InstantiateOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>; type RuntimeMemory: Get<u32>; type PVFMemory: Get<u32>; type ChainId: Get<u64>; type NativeToEthRatio: Get<u32>; type EthGasEncoder: GasEncoder<BalanceOf<Self>>;
}
Expand description

Configuration trait of this pallet.

The main purpose of this trait is to act as an interface between this pallet and the runtime in which it is embedded in. A type, function, or constant in this trait is essentially left to be configured by the runtime that includes this pallet.

Consequently, a runtime that wants to include this pallet must implement this trait.

Required Associated Types§

Source

type Time: Time

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

Source

type Currency: Inspect<Self::AccountId> + Mutate<Self::AccountId> + MutateHold<Self::AccountId, Reason = Self::RuntimeHoldReason>

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

Source

type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>

The overarching event type.

Source

type RuntimeCall: Parameter + Dispatchable<RuntimeOrigin = Self::RuntimeOrigin, PostInfo = PostDispatchInfo> + GetDispatchInfo

The overarching call type.

Source

type RuntimeHoldReason: From<HoldReason>

Overarching hold reason.

Source

type WeightPrice: Convert<Weight, BalanceOf<Self>>

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.

Source

type WeightInfo: WeightInfo

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

Source

type Precompiles: Precompiles<Self>

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

Pass in a tuple of types that implement precompiles::Precompile.

Source

type FindAuthor: FindAuthor<Self::AccountId>

Find the author of the current block.

Source

type DepositPerByte: Get<BalanceOf<Self>>

The amount of balance a caller has to pay for each byte of storage.

§Note

It is safe to change this value on a live chain as all refunds are pro rata.

Source

type DepositPerItem: Get<BalanceOf<Self>>

The amount of balance a caller has to pay for each storage item.

§Note

It is safe to change this value on a live chain as all refunds are pro rata.

Source

type CodeHashLockupDepositPercent: Get<Perbill>

The percentage of the storage deposit that should be held for using a code hash. Instantiating a contract, protects the code from being removed. In order to prevent abuse these actions are protected with a percentage of the code deposit.

Source

type AddressMapper: AddressMapper<Self>

Use either valid type is address::AccountId32Mapper or [address::H160Mapper].

Source

type UnsafeUnstableInterface: Get<bool>

Make contract callable functions marked as #[unstable] available.

Contracts that use #[unstable] functions won’t be able to be uploaded unless this is set to true. This is only meant for testnets and dev nodes in order to experiment with new features.

§Warning

Do not set to true on productions chains.

Source

type AllowEVMBytecode: Get<bool>

Allow EVM bytecode to be uploaded and instantiated.

Source

type UploadOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>

Origin allowed to upload code.

By default, it is safe to set this to EnsureSigned, allowing anyone to upload contract code.

Source

type InstantiateOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>

Origin allowed to instantiate code.

§Note

This is not enforced when a contract instantiates another contract. The Self::UploadOrigin should make sure that no code is deployed that does unwanted instantiations.

By default, it is safe to set this to EnsureSigned, allowing anyone to instantiate contract code.

Source

type RuntimeMemory: Get<u32>

The amount of memory in bytes that parachain nodes a lot to the runtime.

This is used in Pallet::integrity_test to make sure that the runtime has enough memory to support this pallet if set to the correct value.

Source

type PVFMemory: Get<u32>

The amount of memory in bytes that relay chain validators a lot to the PoV.

This is used in Pallet::integrity_test to make sure that the runtime has enough memory to support this pallet if set to the correct value.

This value is usually higher than Self::RuntimeMemory to account for the fact that validators have to hold all storage items in PvF memory.

Source

type ChainId: Get<u64>

The EIP-155 chain ID.

This is a unique identifier assigned to each blockchain network, preventing replay attacks.

Source

type NativeToEthRatio: Get<u32>

The ratio between the decimal representation of the native token and the ETH token.

Source

type EthGasEncoder: GasEncoder<BalanceOf<Self>>

Encode and decode Ethereum gas values. Only valid value is (). See GasEncoder.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§