Skip to content

Commit

Permalink
feat(runtimes): Update the runtime to reflect latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lrazovic committed Jan 16, 2023
1 parent 7c36ad0 commit fc6b0eb
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nodes/standalone/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,6 @@ fn testnet_genesis(
})
.collect::<Vec<_>>(),
},
..Default::default()
}
}
2 changes: 2 additions & 0 deletions runtimes/standalone/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pallet-randomness-collective-flip = { git = "https://github.com/paritytech/subst
pallet-treasury = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.32" }
pallet-utility = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.32" }
pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.32" }
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.32" }

# Used for the node"s RPCs
frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.32" }
Expand Down Expand Up @@ -84,6 +85,7 @@ std = [
"frame-system/std",
"frame-try-runtime/std",
"pallet-aura/std",
"pallet-assets/std",
"pallet-balances/std",
"pallet-grandpa/std",
"pallet-sudo/std",
Expand Down
47 changes: 41 additions & 6 deletions runtimes/standalone/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,42 @@ impl pallet_sudo::Config for Runtime {
type RuntimeCall = RuntimeCall;
}

pub const fn deposit(items: u32, bytes: u32) -> Balance {
items as Balance * 15 * MICRO_PLMC + (bytes as Balance) * 6 * MICRO_PLMC
}

pub const fn free_deposit() -> Balance {
0 * MICRO_PLMC
}

parameter_types! {
pub const AssetDeposit: Balance = PLMC; // 1 UNIT deposit to create asset
pub const ApprovalDeposit: Balance = EXISTENTIAL_DEPOSIT;
pub const AssetAccountDeposit: Balance = deposit(1, 16);
pub const AssetsStringLimit: u32 = 50;
/// Key = 32 bytes, Value = 36 bytes (32+1+1+1+1)
// https://github.com/paritytech/substrate/blob/069917b/frame/assets/src/lib.rs#L257L271
pub const MetadataDepositBase: Balance = free_deposit();
pub const MetadataDepositPerByte: Balance = free_deposit();
}

impl pallet_assets::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type AssetId = u32;
type Currency = Balances;
type ForceOrigin = EnsureRoot<AccountId>;
type AssetDeposit = AssetDeposit;
type MetadataDepositBase = MetadataDepositBase;
type MetadataDepositPerByte = MetadataDepositPerByte;
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = AssetsStringLimit;
type Freezer = ();
type Extra = ();
type WeightInfo = ();
type AssetAccountDeposit = AssetAccountDeposit;
}

parameter_types! {
pub const EvaluationDuration: BlockNumber = 28;
pub const EnglishAuctionDuration: BlockNumber = 5;
Expand All @@ -307,9 +343,11 @@ impl pallet_funding::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type StringLimit = ConstU32<64>;
type Currency = Balances;
type ProjectIdentifier = u32;
type ProjectIdParameter = codec::Compact<u32>;
type BiddingCurrency = Balances;
type Assets = Assets;
type CurrencyBalance = <Self as pallet_balances::Config>::Balance;
type ProjectIdentifier = u32;
type EvaluationDuration = EvaluationDuration;
type PalletId = FundingPalletId;
type ActiveProjectsLimit = ConstU32<100>;
Expand All @@ -318,7 +356,7 @@ impl pallet_funding::Config for Runtime {
type CommunityRoundDuration = CommunityRoundDuration;
type Randomness = Random;
type HandleMembers = Credentials;
type MaximumBidsPerProject = ConstU32<128>;
type MaximumBidsPerProject = ConstU32<256>;
type WeightInfo = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
Expand Down Expand Up @@ -476,10 +514,6 @@ impl pallet_authorship::Config for Runtime {
type EventHandler = ();
}

pub const fn deposit(items: u32, bytes: u32) -> Balance {
items as Balance * 15 * MICRO_PLMC + (bytes as Balance) * 6 * MICRO_PLMC
}

parameter_types! {
// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
pub const DepositBase: Balance = deposit(1, 88);
Expand Down Expand Up @@ -521,6 +555,7 @@ construct_runtime!(
Sudo: pallet_sudo,
Utility: pallet_utility,
Multisig: pallet_multisig,
Assets: pallet_assets,

Aura: pallet_aura,
Grandpa: pallet_grandpa,
Expand Down
2 changes: 2 additions & 0 deletions runtimes/testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,9 @@ impl pallet_funding::Config for Runtime {
type StringLimit = ConstU32<64>;
type Currency = Balances;
type ProjectIdentifier = u32;
type ProjectIdParameter = codec::Compact<u32>;
type BiddingCurrency = Balances;
type Assets = Assets;
type CurrencyBalance = <Self as pallet_balances::Config>::Balance;
type EvaluationDuration = EvaluationDuration;
type PalletId = FundingPalletId;
Expand Down

0 comments on commit fc6b0eb

Please sign in to comment.