diff --git a/control/preimage/src/commands.rs b/control/preimage/src/commands.rs index f6495ed3b7..2e8c81613d 100644 --- a/control/preimage/src/commands.rs +++ b/control/preimage/src/commands.rs @@ -337,6 +337,7 @@ pub fn force_set_metadata(params: &UpdateAssetArgs) -> AssetHubRuntimeCall { } pub fn register_ether(params: &RegisterEtherArgs) -> (AssetHubRuntimeCall, AssetHubRuntimeCall) { + use subxt::utils::AccountId32; let chain_id = crate::bridge_hub_runtime::CHAIN_ID; #[cfg(feature = "paseo")] use asset_hub_paseo_types::*; @@ -346,7 +347,15 @@ pub fn register_ether(params: &RegisterEtherArgs) -> (AssetHubRuntimeCall, Asset use asset_hub_westend_types::*; let asset_id = get_ether_id(chain_id); + let owner = GlobalConsensusEthereumConvertsFor::<[u8; 32]>::from_chain_id(&chain_id); + let force_register = + AssetHubRuntimeCall::ForeignAssets(pallet_assets::pallet::Call2::force_create { + id: asset_id.clone(), + min_balance: params.ether_min_balance, + is_sufficient: true, + owner: MultiAddress::::Id(owner.into()), + }); let metadata = AssetHubRuntimeCall::ForeignAssets(pallet_assets::pallet::Call2::force_set_metadata { id: asset_id, @@ -356,5 +365,5 @@ pub fn register_ether(params: &RegisterEtherArgs) -> (AssetHubRuntimeCall, Asset is_frozen: false, }); - return (metadata.clone(), metadata); + return (force_register, metadata); } diff --git a/control/preimage/src/main.rs b/control/preimage/src/main.rs index 51cc9eb466..8c5e72e861 100644 --- a/control/preimage/src/main.rs +++ b/control/preimage/src/main.rs @@ -223,14 +223,8 @@ pub struct TreasuryProposal2024Args { #[derive(Debug, Args)] pub struct RegisterEtherArgs { /// The minimum balance of the Ether asset that users are allowed to hold - #[arg(long, value_name = "WEI", value_parser = parse_units_wei, default_value_t = 1u128)] + #[arg(long, value_name = "WEI", default_value_t = 1u128)] ether_min_balance: u128, - /// Make Ether asset sufficient - #[arg(long, default_value_t = true)] - ether_sufficient: bool, - /// The Ether asset owner. This should be the Gateway Proxy Address sovereign account - #[arg(long, value_name = "ADDRESS", value_parser=parse_hex_bytes32)] - ether_owner: FixedBytes<32>, /// The Ether asset display name #[arg(long, value_name = "ASSET_DISPLAY_NAME", default_value_t = String::from("Ether"))] ether_name: String, @@ -281,11 +275,6 @@ fn parse_units_polkadot(v: &str) -> Result { Ok(amount) } -fn parse_units_wei(v: &str) -> Result { - let amount = parse_units(v, "wei").map_err(|e| format!("{e}"))?; - Ok(amount.into()) -} - fn parse_units_gwei(v: &str) -> Result { let amount = parse_units(v, "gwei").map_err(|e| format!("{e}"))?; Ok(amount.into())