contracts_rococo_runtime/
contracts.rs

1// Copyright (C) Parity Technologies (UK) Ltd.
2// SPDX-License-Identifier: Apache-2.0
3
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// 	http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16use crate::{
17	Balance, Balances, RandomnessCollectiveFlip, Runtime, RuntimeCall, RuntimeEvent,
18	RuntimeHoldReason, Timestamp,
19};
20use frame_support::{
21	parameter_types,
22	traits::{ConstBool, ConstU32, Nothing},
23};
24use frame_system::EnsureSigned;
25use pallet_contracts::{
26	weights::SubstrateWeight, Config, DebugInfo, DefaultAddressGenerator, Frame, Schedule,
27};
28use sp_runtime::Perbill;
29
30use testnet_parachains_constants::rococo::currency::deposit;
31
32// Prints debug output of the `contracts` pallet to stdout if the node is
33// started with `-lruntime::contracts=debug`.
34pub const CONTRACTS_DEBUG_OUTPUT: DebugInfo = DebugInfo::UnsafeDebug;
35
36parameter_types! {
37	pub const DepositPerItem: Balance = deposit(1, 0);
38	pub const DepositPerByte: Balance = deposit(0, 1);
39	pub const DefaultDepositLimit: Balance = deposit(1024, 1024 * 1024);
40	pub MySchedule: Schedule<Runtime> = Default::default();
41	pub CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(30);
42}
43
44impl Config for Runtime {
45	type Time = Timestamp;
46	type Randomness = RandomnessCollectiveFlip;
47	type Currency = Balances;
48	type RuntimeEvent = RuntimeEvent;
49	type RuntimeCall = RuntimeCall;
50	/// The safest default is to allow no calls at all.
51	///
52	/// Runtimes should whitelist dispatchables that are allowed to be called from contracts
53	/// and make sure they are stable. Dispatchables exposed to contracts are not allowed to
54	/// change because that would break already deployed contracts. The `Call` structure itself
55	/// is not allowed to change the indices of existing pallets, too.
56	type CallFilter = Nothing;
57	type DepositPerItem = DepositPerItem;
58	type DepositPerByte = DepositPerByte;
59	type DefaultDepositLimit = DefaultDepositLimit;
60	type WeightPrice = pallet_transaction_payment::Pallet<Self>;
61	type WeightInfo = SubstrateWeight<Self>;
62	type ChainExtension = ();
63	type Schedule = MySchedule;
64	type CallStack = [Frame<Self>; 5];
65	type AddressGenerator = DefaultAddressGenerator;
66	type MaxCodeLen = ConstU32<{ 123 * 1024 }>;
67	type MaxStorageKeyLen = ConstU32<128>;
68	type MaxTransientStorageSize = ConstU32<{ 1 * 1024 * 1024 }>;
69	type UnsafeUnstableInterface = ConstBool<true>;
70	type UploadOrigin = EnsureSigned<Self::AccountId>;
71	type InstantiateOrigin = EnsureSigned<Self::AccountId>;
72	type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>;
73	type MaxDelegateDependencies = ConstU32<32>;
74	type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
75	#[cfg(not(feature = "runtime-benchmarks"))]
76	type Migrations = ();
77	#[cfg(feature = "runtime-benchmarks")]
78	type Migrations = pallet_contracts::migration::codegen::BenchMigrations;
79	type RuntimeHoldReason = RuntimeHoldReason;
80	type Debug = ();
81	type Environment = ();
82	type ApiVersion = ();
83	type Xcm = pallet_xcm::Pallet<Self>;
84}