Skip to content

Commit

Permalink
Update KTON owner (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier authored Dec 20, 2022
1 parent 7fd05bc commit c9fdfa1
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 14 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.

2 changes: 1 addition & 1 deletion node/src/chain_spec/crab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ fn testnet_genesis(
},
transaction_payment: Default::default(),
assets: AssetsConfig {
assets: vec![(AssetIds::CKton as _, array_bytes::hex_n_into_unchecked(ALITH), true, 1)],
assets: vec![(AssetIds::CKton as _, ROOT, true, 1)],
metadata: vec![(
AssetIds::CKton as _,
b"Crab Commitment Token".to_vec(),
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain_spec/darwinia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ fn testnet_genesis(
},
transaction_payment: Default::default(),
assets: AssetsConfig {
assets: vec![(AssetIds::Kton as _, array_bytes::hex_n_into_unchecked(ALITH), true, 1)],
assets: vec![(AssetIds::Kton as _, ROOT, true, 1)],
metadata: vec![(
AssetIds::Kton as _,
b"Darwinia Commitment Token".to_vec(),
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain_spec/pangolin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ pub fn genesis_config() -> ChainSpec {
assets: AssetsConfig {
assets: vec![(
AssetIds::PKton as _,
array_bytes::hex_n_into_unchecked(ALITH),
ROOT,
true,
1,
)],
Expand Down
4 changes: 2 additions & 2 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ pub fn run() -> Result<()> {
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle)
.map_err(|err| format!("Relay chain argument error: {}", err))?;

return if chain_spec.is_crab() {
if chain_spec.is_crab() {
service::start_parachain_node::<CrabRuntimeApi, CrabRuntimeExecutor>(
config,
polkadot_config,
Expand Down Expand Up @@ -630,7 +630,7 @@ pub fn run() -> Result<()> {
.await
.map(|r| r.0)
.map_err(Into::into)
};
}
})
},
}
Expand Down
2 changes: 1 addition & 1 deletion pallet/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ pub mod pallet {
/// Stakers' exposure.
#[pallet::storage]
#[pallet::unbounded]
#[pallet::getter(fn exposure)]
#[pallet::getter(fn exposure_of)]
pub type Exposures<T: Config> =
StorageMap<_, Twox64Concat, T::AccountId, Exposure<T::AccountId>>;

Expand Down
16 changes: 11 additions & 5 deletions runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ dc-primitives = { default-features = false, path = "../../core/primitives" }
# darwinia-messages-substrate
bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" }

# moonbeam
account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" }

# polkadot
xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" }
xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" }

# substrate
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

[features]
default = ["std"]
Expand All @@ -39,6 +42,9 @@ std = [
# darwinia
"dc-primitives/std",

# moonbeam
"account/std",

# polkadot
"xcm/std",
"xcm-executor/std",
Expand Down
6 changes: 6 additions & 0 deletions runtime/common/src/gov_origin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

// darwinia
use dc_primitives::AccountId;
// moonbeam
use account::AccountId20;
// substrate
use frame_support::traits::EitherOfDiverse;
use frame_system::EnsureRoot;
Expand All @@ -39,3 +41,7 @@ pub type RootOrAtLeastThreeFifth<Collective> =

pub type RootOrAll<Collective> =
EitherOfDiverse<Root, EnsureProportionAtLeast<AccountId, Collective, 1, 1>>;

/// An [`AccountId20`] generated from b"root".
pub const ROOT: AccountId20 =
AccountId20([0x72, 0x6f, 0x6f, 0x74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
2 changes: 1 addition & 1 deletion runtime/crab/src/pallets/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl darwinia_deposit::Minting for CKtonMinting {
type AccountId = AccountId;

fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult {
Assets::mint(RuntimeOrigin::root(), AssetIds::CKton as AssetId, *beneficiary, amount)
Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::CKton as AssetId, *beneficiary, amount)
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/darwinia/src/pallets/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl darwinia_deposit::Minting for KtonMinting {
type AccountId = AccountId;

fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult {
Assets::mint(RuntimeOrigin::root(), AssetIds::Kton as AssetId, *beneficiary, amount)
Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::Kton as AssetId, *beneficiary, amount)
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/pangolin/src/pallets/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl darwinia_deposit::Minting for PKtonMinting {
type AccountId = AccountId;

fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult {
Assets::mint(RuntimeOrigin::root(), AssetIds::PKton as AssetId, *beneficiary, amount)
Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::PKton as AssetId, *beneficiary, amount)
}
}

Expand Down

0 comments on commit c9fdfa1

Please sign in to comment.