Skip to content

BRIDGE: add asset pallet #2340

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

Open
5 tasks
p5150j opened this issue Apr 18, 2025 · 0 comments · Fixed by #2354
Open
5 tasks

BRIDGE: add asset pallet #2340

p5150j opened this issue Apr 18, 2025 · 0 comments · Fixed by #2354
Assignees
Milestone

Comments

@p5150j
Copy link
Collaborator

p5150j commented Apr 18, 2025

Description
In order to teleport Frequency tokens to AssetHub, we need a way to pay the execution fee on AssetHub otherwise it will reject the request and treat the tokens as trapped assets.

Since AssetHub does not accept Frequency as payment for execution fees, we must also include DOT in the message to cover those fees.

To support this, Frequency must be able to handle DOT as an asset — both to receive DOT from AssetHub and to send DOT back out.

Acceptance Criteria

  • Add the ability to send and receive DOT on Frequency
  • Store DOT as a Multilocation on Frequency
  • Decide who should be allowed to create assets on Frequency
  • Generate Weights
  • Feature Flag Bridging

Implementation suggestions

  • User Pallet Assets
  • Config
pallet-assets = { workspace = true, default-features = false }
assets-common = { workspace = true, default-features = false }
parameter_types! {
	pub const AssetDeposit: Balance = 0;
	pub const AssetAccountDeposit: Balance = 0;
	pub const ApprovalDeposit: Balance = 0;
	pub const AssetsStringLimit: u32 = 50;
	pub const MetadataDepositBase: Balance = 0;
	pub const MetadataDepositPerByte: Balance = 0;
}

parameter_types! {
	// we just reuse the same deposits
	pub const ForeignAssetsAssetDeposit: Balance = AssetDeposit::get();
	pub const ForeignAssetsAssetAccountDeposit: Balance = AssetAccountDeposit::get();
	pub const ForeignAssetsApprovalDeposit: Balance = ApprovalDeposit::get();
	pub const ForeignAssetsAssetsStringLimit: u32 = AssetsStringLimit::get();
	pub const ForeignAssetsMetadataDepositBase: Balance = MetadataDepositBase::get();
	pub const ForeignAssetsMetadataDepositPerByte: Balance = MetadataDepositPerByte::get();
}
use xcm_config::{RelayLocation, XcmOriginToTransactDispatchOrigin, ForeignAssetsAssetId};
impl pallet_assets::Config  for Runtime {
	type RuntimeEvent = RuntimeEvent;
	type Balance = Balance;
////
	type AssetId = ForeignAssetsAssetId;
	type AssetIdParameter = ForeignAssetsAssetId;
	type Currency = Balances;
	// This is to allow any other remote location to create foreign assets. Used in tests, not
	// recommended on real chains.
	type **CreateOrigin** =
		**ForeignCreators**<Everything, LocationToAccountId, AccountId, xcm::latest::Location>;
	type ForceOrigin = EnsureRoot<AccountId>;
	type AssetDeposit = ForeignAssetsAssetDeposit;
	type MetadataDepositBase = ForeignAssetsMetadataDepositBase;
	type MetadataDepositPerByte = ForeignAssetsMetadataDepositPerByte;
	type ApprovalDeposit = ForeignAssetsApprovalDeposit;
	type StringLimit = ForeignAssetsAssetsStringLimit;
	type Freezer = ();
	type Extra = ();
	type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
	type CallbackHandle = ();
	type AssetAccountDeposit = ForeignAssetsAssetAccountDeposit;
	type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
	#[cfg(feature = "runtime-benchmarks")]
	type BenchmarkHelper = xcm_config::XcmBenchmarkHelper;
	type Holder = ();
}
@p5150j p5150j added this to the Bridge milestone Apr 18, 2025
@p5150j p5150j changed the title add asset pallet BRIDGE: add asset pallet Apr 18, 2025
@mattheworris mattheworris linked a pull request Apr 22, 2025 that will close this issue
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants