-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CU-1tf7kpr - Picasso v0 runtime - part 1 #478
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8b8bd9c
fix(dali): use `Assets` instead of `Tokens
hussein-aitlahcen 869946d
feat(picasso-v0): add currency-factory to runtime
hussein-aitlahcen a5cb4e5
feat(picasso-v0): add governance-registry to runtime
hussein-aitlahcen bcacb6f
feat(picasso-v0): add assets to runtime
hussein-aitlahcen 5b08c26
feat(picasso-v0): add crowdloan-rewards to runtime
hussein-aitlahcen f4c93d4
feat(picasso-v0): add vesting to runtime
hussein-aitlahcen c07c0da
feat(picasso-v0): add bonded-finance to runtime
hussein-aitlahcen f336612
chore(Cargo.lock)
hussein-aitlahcen File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { | |
spec_version: 2000, | ||
impl_version: 1, | ||
apis: RUNTIME_API_VERSIONS, | ||
transaction_version: 1, | ||
transaction_version: 2, | ||
}; | ||
|
||
/// The version information used to identify this runtime when compiled natively. | ||
|
@@ -385,6 +385,7 @@ where | |
system::CheckNonce::<Runtime>::from(nonce), | ||
system::CheckWeight::<Runtime>::new(), | ||
transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip), | ||
crowdloan_rewards::PrevalidateAssociation::<Runtime>::new(), | ||
); | ||
let raw_payload = SignedPayload::new(call, extra) | ||
.map_err(|_e| { | ||
|
@@ -673,6 +674,90 @@ impl democracy::Config for Runtime { | |
type WeightInfo = weights::democracy::WeightInfo<Runtime>; | ||
} | ||
|
||
parameter_types! { | ||
pub const DynamicCurrencyIdInitial: CurrencyId = CurrencyId::LOCAL_LP_TOKEN_START; | ||
} | ||
|
||
impl currency_factory::Config for Runtime { | ||
type Event = Event; | ||
type DynamicCurrencyId = CurrencyId; | ||
type DynamicCurrencyIdInitial = DynamicCurrencyIdInitial; | ||
} | ||
|
||
impl governance_registry::Config for Runtime { | ||
type Event = Event; | ||
type AssetId = CurrencyId; | ||
type WeightInfo = (); | ||
} | ||
|
||
parameter_types! { | ||
pub NativeAssetId: CurrencyId = CurrencyId::PICA; | ||
} | ||
|
||
impl assets::Config for Runtime { | ||
type NativeAssetId = NativeAssetId; | ||
type GenerateCurrencyId = Factory; | ||
type AssetId = CurrencyId; | ||
type Balance = Balance; | ||
type NativeCurrency = Balances; | ||
type MultiCurrency = Tokens; | ||
type WeightInfo = (); | ||
type AdminOrigin = EnsureRootOrHalfCouncil; | ||
type GovernanceRegistry = GovernanceRegistry; | ||
} | ||
|
||
parameter_types! { | ||
pub const InitialPayment: Perbill = Perbill::from_percent(25); | ||
pub const VestingStep: BlockNumber = 7 * DAYS; | ||
pub const Prefix: &'static [u8] = b"picasso-"; | ||
} | ||
|
||
impl crowdloan_rewards::Config for Runtime { | ||
type Event = Event; | ||
type Balance = Balance; | ||
type Currency = Assets; | ||
type AdminOrigin = EnsureRootOrHalfCouncil; | ||
type Convert = sp_runtime::traits::ConvertInto; | ||
type RelayChainAccountId = [u8; 32]; | ||
type InitialPayment = InitialPayment; | ||
type VestingStep = VestingStep; | ||
type Prefix = Prefix; | ||
type WeightInfo = weights::crowdloan_rewards::WeightInfo<Runtime>; | ||
} | ||
|
||
parameter_types! { | ||
pub const MaxVestingSchedule: u32 = 128; | ||
pub MinVestedTransfer: u64 = CurrencyId::PICA.milli::<u64>(); | ||
} | ||
|
||
impl vesting::Config for Runtime { | ||
type Currency = Assets; | ||
type Event = Event; | ||
type MaxVestingSchedules = MaxVestingSchedule; | ||
type MinVestedTransfer = MinVestedTransfer; | ||
type VestedTransferOrigin = system::EnsureSigned<AccountId>; | ||
type WeightInfo = (); | ||
} | ||
|
||
parameter_types! { | ||
pub const BondedFinanceId: PalletId = PalletId(*b"bondedfi"); | ||
pub MinReward: Balance = 10 * CurrencyId::PICA.unit::<Balance>(); | ||
pub Stake: Balance = 10 * CurrencyId::PICA.unit::<Balance>(); | ||
} | ||
|
||
impl bonded_finance::Config for Runtime { | ||
type AdminOrigin = EnsureRoot<AccountId>; | ||
type BondOfferId = u64; | ||
type Convert = sp_runtime::traits::ConvertInto; | ||
type Currency = Assets; | ||
type Event = Event; | ||
type MinReward = MinReward; | ||
type NativeCurrency = Balances; | ||
type PalletId = BondedFinanceId; | ||
type Stake = Stake; | ||
type Vesting = Vesting; | ||
} | ||
|
||
/// The calls we permit to be executed by extrinsics | ||
pub struct BaseCallFilter; | ||
|
||
|
@@ -728,6 +813,12 @@ construct_runtime!( | |
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 43, | ||
|
||
Tokens: orml_tokens::{Pallet, Call, Storage, Event<T>} = 52, | ||
Factory: currency_factory::{Pallet, Storage, Event<T>} = 53, | ||
GovernanceRegistry: governance_registry::{Pallet, Call, Storage, Event<T>} = 54, | ||
Assets: assets::{Pallet, Call, Storage} = 55, | ||
CrowdloanRewards: crowdloan_rewards::{Pallet, Call, Storage, Event<T>} = 56, | ||
Vesting: vesting::{Call, Event<T>, Pallet, Storage} = 57, | ||
Comment on lines
+816
to
+820
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hussein-aitlahcen this pr doesn't add these pallets to the benchmark section |
||
BondedFinance: bonded_finance::{Call, Event<T>, Pallet, Storage} = 58, | ||
} | ||
); | ||
|
||
|
@@ -745,6 +836,7 @@ pub type SignedExtra = ( | |
system::CheckNonce<Runtime>, | ||
system::CheckWeight<Runtime>, | ||
transaction_payment::ChargeTransactionPayment<Runtime>, | ||
crowdloan_rewards::PrevalidateAssociation<Runtime>, | ||
hussein-aitlahcen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
); | ||
|
||
/// Unchecked extrinsic type as expected by this runtime. | ||
|
@@ -885,6 +977,7 @@ impl_runtime_apis! { | |
list_benchmark!(list, extra, utility, Utility); | ||
list_benchmark!(list, extra, identity, Identity); | ||
list_benchmark!(list, extra, multisig, Multisig); | ||
list_benchmark!(list, extra, crowdloan_rewards, CrowdloanRewards); | ||
|
||
let storage_info = AllPalletsWithSystem::storage_info(); | ||
|
||
|
@@ -932,6 +1025,7 @@ impl_runtime_apis! { | |
add_benchmark!(params, batches, utility, Utility); | ||
add_benchmark!(params, batches, identity, Identity); | ||
add_benchmark!(params, batches, multisig, Multisig); | ||
add_benchmark!(params, batches, crowdloan_rewards, CrowdloanRewards); | ||
|
||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } | ||
Ok(batches) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
|
||
//! Autogenerated weights for `crowdloan_rewards` | ||
//! | ||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev | ||
//! DATE: 2021-12-17, STEPS: `10`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` | ||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("picasso-dev"), DB CACHE: 128 | ||
|
||
// Executed Command: | ||
// ./target/release/composable | ||
// benchmark | ||
// --chain=picasso-dev | ||
// --execution=wasm | ||
// --wasm-execution=compiled | ||
// --pallet=crowdloan-rewards | ||
// --extrinsic=* | ||
// --steps=10 | ||
// --repeat=5 | ||
// --raw | ||
// --output=runtime/picasso/src/weights/crowdloan_rewards.rs | ||
|
||
#![cfg_attr(rustfmt, rustfmt_skip)] | ||
#![allow(unused_parens)] | ||
#![allow(unused_imports)] | ||
|
||
use support::{traits::Get, weights::Weight}; | ||
use sp_std::marker::PhantomData; | ||
|
||
/// Weight functions for `crowdloan_rewards`. | ||
pub struct WeightInfo<T>(PhantomData<T>); | ||
impl<T: frame_system::Config> crowdloan_rewards::weights::WeightInfo for WeightInfo<T> { | ||
// Storage: CrowdloanRewards VestingBlockStart (r:1 w:0) | ||
// Storage: CrowdloanRewards Rewards (r:1001 w:1000) | ||
// Storage: CrowdloanRewards TotalContributors (r:0 w:1) | ||
// Storage: CrowdloanRewards TotalRewards (r:0 w:1) | ||
fn populate(x: u32, ) -> Weight { | ||
(0 as Weight) | ||
// Standard Error: 109_000 | ||
.saturating_add((6_792_000 as Weight).saturating_mul(x as Weight)) | ||
.saturating_add(T::DbWeight::get().reads(2 as Weight)) | ||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(x as Weight))) | ||
.saturating_add(T::DbWeight::get().writes(2 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(x as Weight))) | ||
} | ||
// Storage: CrowdloanRewards VestingBlockStart (r:1 w:1) | ||
fn initialize(x: u32, ) -> Weight { | ||
(33_355_000 as Weight) | ||
// Standard Error: 0 | ||
.saturating_add((1_000 as Weight).saturating_mul(x as Weight)) | ||
.saturating_add(T::DbWeight::get().reads(1 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(1 as Weight)) | ||
} | ||
// Storage: CrowdloanRewards VestingBlockStart (r:1 w:0) | ||
// Storage: CrowdloanRewards Rewards (r:1 w:1) | ||
// Storage: System Account (r:1 w:1) | ||
// Storage: CrowdloanRewards ClaimedRewards (r:1 w:1) | ||
// Storage: CrowdloanRewards Associations (r:0 w:1) | ||
fn associate(x: u32, ) -> Weight { | ||
(169_323_000 as Weight) | ||
// Standard Error: 1_000 | ||
.saturating_add((8_000 as Weight).saturating_mul(x as Weight)) | ||
.saturating_add(T::DbWeight::get().reads(4 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(4 as Weight)) | ||
} | ||
// Storage: CrowdloanRewards Associations (r:1 w:0) | ||
// Storage: CrowdloanRewards VestingBlockStart (r:1 w:0) | ||
// Storage: CrowdloanRewards Rewards (r:1 w:1) | ||
// Storage: System Account (r:1 w:1) | ||
// Storage: CrowdloanRewards ClaimedRewards (r:1 w:1) | ||
fn claim(x: u32, ) -> Weight { | ||
(94_034_000 as Weight) | ||
// Standard Error: 1_000 | ||
.saturating_add((31_000 as Weight).saturating_mul(x as Weight)) | ||
.saturating_add(T::DbWeight::get().reads(5 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(3 as Weight)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing std features as well as runtime-benchmark features