ink_node_runtime/
revive_config.rs1use crate::{
2 Balance, Balances, BalancesCall, Perbill, Runtime, RuntimeCall, RuntimeEvent,
3 RuntimeHoldReason, Timestamp,
4};
5use frame_support::{
6 parameter_types,
7 traits::{ConstBool, ConstU32, ConstU64},
8};
9use frame_system::EnsureSigned;
10
11pub enum AllowBalancesCall {}
12
13impl frame_support::traits::Contains<RuntimeCall> for AllowBalancesCall {
14 fn contains(call: &RuntimeCall) -> bool {
15 matches!(call, RuntimeCall::Balances(BalancesCall::transfer_allow_death { .. }))
16 }
17}
18
19const UNIT: Balance = 1_000_000_000_000;
21const MILLIUNIT: Balance = 1_000_000_000;
22
23const fn deposit(items: u32, bytes: u32) -> Balance {
24 (items as Balance * UNIT + (bytes as Balance) * (5 * MILLIUNIT / 100)) / 10
25}
26
27parameter_types! {
28 pub const DepositPerItem: Balance = deposit(1, 0);
29 pub const DepositPerByte: Balance = deposit(0, 1);
30 pub const DefaultDepositLimit: Balance = deposit(1024, 1024 * 1024);
31 pub const CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(0);
32 pub const MaxDelegateDependencies: u32 = 32;
33}
34
35impl pallet_revive::Config for Runtime {
36 type Time = Timestamp;
37 type Currency = Balances;
38 type RuntimeEvent = RuntimeEvent;
39 type RuntimeCall = RuntimeCall;
40 type CallFilter = AllowBalancesCall;
47 type DepositPerItem = DepositPerItem;
48 type DepositPerByte = DepositPerByte;
49 type WeightPrice = pallet_transaction_payment::Pallet<Self>;
50 type WeightInfo = pallet_revive::weights::SubstrateWeight<Self>;
51 type ChainExtension = ();
52 type AddressMapper = pallet_revive::AccountId32Mapper<Self>;
53 type RuntimeMemory = ConstU32<{ 128 * 1024 * 1024 }>;
54 type PVFMemory = ConstU32<{ 512 * 1024 * 1024 }>;
55 type UnsafeUnstableInterface = ConstBool<true>;
56 type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
57 type RuntimeHoldReason = RuntimeHoldReason;
58 #[cfg(feature = "parachain")]
59 type Xcm = pallet_xcm::Pallet<Self>;
60 #[cfg(not(feature = "parachain"))]
61 type Xcm = ();
62 type UploadOrigin = EnsureSigned<Self::AccountId>;
63 type InstantiateOrigin = EnsureSigned<Self::AccountId>;
64 type ChainId = ConstU64<420_420_420>;
65 type NativeToEthRatio = ConstU32<1_000_000>; type EthGasEncoder = ();
67 type FindAuthor = <Runtime as pallet_authorship::Config>::FindAuthor;
68}