contracts_parachain_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},
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 AddressGenerator = pallet_revive::DefaultAddressGenerator;
53 type MaxCodeLen = ConstU32<{ 123 * 1024 }>;
54 type RuntimeMemory = ConstU32<{ 128 * 1024 * 1024 }>;
55 type PVFMemory = ConstU32<{ 512 * 1024 * 1024 }>;
56 type UnsafeUnstableInterface = ConstBool<true>;
57 type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
58 type RuntimeHoldReason = RuntimeHoldReason;
59 type Debug = ();
60 type Migrations = ();
61 #[cfg(feature = "parachain")]
62 type Xcm = pallet_xcm::Pallet<Self>;
63 #[cfg(not(feature = "parachain"))]
64 type Xcm = ();
65 type UploadOrigin = EnsureSigned<Self::AccountId>;
66 type InstantiateOrigin = EnsureSigned<Self::AccountId>;
67}