Skip to content
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

[evm-template] XCM config for foreign assets #219

Merged
merged 29 commits into from
Jun 18, 2024

Conversation

4meta5
Copy link
Contributor

@4meta5 4meta5 commented Jun 6, 2024

Closes #215

  • fork moonbeam and ORML, match deps to polkadot-v1.10.1
  • config evm-template pallet-asset-manager s.t. pallet_assets::CreateOrigin aligns with XCM config expectation
  • config evm-template xcm_executor::Trader to use pallet-assets for foreign assets
  • move evm asset configs from configs/mod.rs into configs/asset_config.rs
  • revert changes to generic-template in favor of follow up
  • make follow up issues for remaining TODOs

Follow ups:

@4meta5 4meta5 added the priority: 3 We will resolve this first before everything else. label Jun 6, 2024
@4meta5 4meta5 added this to the Deliverable 2 - EVM template milestone Jun 6, 2024
@4meta5 4meta5 self-assigned this Jun 6, 2024
Copy link

netlify bot commented Jun 6, 2024

Deploy Preview for docs-oz-polkadot canceled.

Name Link
🔨 Latest commit 9846aa8
🔍 Latest deploy log https://app.netlify.com/sites/docs-oz-polkadot/deploys/667194cefa4d120008022d2f

@4meta5
Copy link
Contributor Author

4meta5 commented Jun 11, 2024

For the generic-template, stumped on following errors so moved it from this PR's scope (to follow up #222 ) to ensure we meet the EVM template deliverable.

     Compiling parachain-template-runtime v1.0.0 (/Users/4meta5/oz/polkadot-runtime-template/generic-template/runtime)
  error[E0277]: the trait bound `sp_runtime::AccountId32: core::default::Default` is not satisfied
     --> /Users/4meta5/oz/polkadot-runtime-template/generic-template/runtime/src/configs/xcm_config.rs:175:28
      |
  175 |     type AssetTransactor = AssetTransactors;
      |                            ^^^^^^^^^^^^^^^^ the trait `core::default::Default` is not implemented for `sp_runtime::AccountId32`, which is required by `(FungibleAdapter<pallet_balances::Pallet<Runtime>, IsConcrete<BalancesPalletLocation>, (ParentIsPreset<sp_runtime::AccountId32>, SiblingParachainConvertsVia<polkadot_parachain_primitives::primitives::Sibling, sp_runtime::AccountId32>, AccountId32Aliases<RelayNetwork, sp_runtime::AccountId32>), sp_runtime::AccountId32, ()>, FungiblesAdapter<pallet_assets::Pallet<Runtime>, ConvertedConcreteId<u128, u128, AsAssetType<u128, AssetType, pallet_asset_manager::Pallet<Runtime>>, JustTry>, (ParentIsPreset<sp_runtime::AccountId32>, SiblingParachainConvertsVia<polkadot_parachain_primitives::primitives::Sibling, sp_runtime::AccountId32>, AccountId32Aliases<RelayNetwork, sp_runtime::AccountId32>), sp_runtime::AccountId32, NoChecking, ()>): TransactAsset`
      |
      = help: the following other types implement trait `TransactAsset`:
                ()
                (TupleElement0,)
                (TupleElement0, TupleElement1)
                (TupleElement0, TupleElement1, TupleElement2)
                (TupleElement0, TupleElement1, TupleElement2, TupleElement3)
                (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4)
                (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5)
                (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6)
              and 23 others
      = note: required for `()` to implement `sp_core::Get<sp_runtime::AccountId32>`
      = note: required for `FungiblesAdapter<Pallet<Runtime>, ConvertedConcreteId<u128, u128, ..., ...>, ..., ..., ..., ...>` to implement `TransactAsset`
      = note: the full type name has been written to '/Users/4meta5/oz/polkadot-runtime-template/generic-template/target/release/wbuild/parachain-template-runtime/target/wasm32-unknown-unknown/release/deps/parachain_template_runtime-35cd061f42ac92dc.long-type-10252185917316068372.txt'
      = note: 1 redundant requirement hidden
      = note: required for `(FungibleAdapter<Pallet<Runtime>, IsConcrete<BalancesPalletLocation>, (..., ..., ...), ..., ...>, ...)` to implement `TransactAsset`
      = note: the full type name has been written to '/Users/4meta5/oz/polkadot-runtime-template/generic-template/target/release/wbuild/parachain-template-runtime/target/wasm32-unknown-unknown/release/deps/parachain_template_runtime-35cd061f42ac92dc.long-type-15556171770185959633.txt'
  note: required by a bound in `staging_xcm_executor::Config::AssetTransactor`
     --> /Users/4meta5/.cargo/git/checkouts/polkadot-sdk-cff69157b985ed76/7049c3c/polkadot/xcm/xcm-executor/src/config.rs:39:24
      |
  39  |     type AssetTransactor: TransactAsset;
      |                           ^^^^^^^^^^^^^ required by this bound in `Config::AssetTransactor`

  error[E0277]: the trait bound `sp_runtime::AccountId32: core::default::Default` is not satisfied
     --> /Users/4meta5/oz/polkadot-runtime-template/generic-template/runtime/src/configs/xcm_config.rs:179:23
      |
  179 |       type FeeManager = XcmFeeManagerFromComponents<
      |  _______________________^
  180 | |         IsChildSystemParachain<primitives::Id>,
  181 | |         XcmFeeToAccount<Self::AssetTransactor, AccountId, XcmFeesAccount>,
  182 | |     >;
      | |_____^ the trait `core::default::Default` is not implemented for `sp_runtime::AccountId32`, which is required by `XcmFeeManagerFromComponents<IsChildSystemParachain<ParaId>, XcmFeeToAccount<(FungibleAdapter<pallet_balances::Pallet<Runtime>, IsConcrete<BalancesPalletLocation>, (ParentIsPreset<sp_runtime::AccountId32>, SiblingParachainConvertsVia<polkadot_parachain_primitives::primitives::Sibling, sp_runtime::AccountId32>, AccountId32Aliases<RelayNetwork, sp_runtime::AccountId32>), sp_runtime::AccountId32, ()>, FungiblesAdapter<pallet_assets::Pallet<Runtime>, ConvertedConcreteId<u128, u128, AsAssetType<u128, AssetType, pallet_asset_manager::Pallet<Runtime>>, JustTry>, (ParentIsPreset<sp_runtime::AccountId32>, SiblingParachainConvertsVia<polkadot_parachain_primitives::primitives::Sibling, sp_runtime::AccountId32>, AccountId32Aliases<RelayNetwork, sp_runtime::AccountId32>), sp_runtime::AccountId32, NoChecking, ()>), sp_runtime::AccountId32, XcmFeesAccount>>: FeeManager`
      |
      = help: the trait `FeeManager` is implemented for `XcmFeeManagerFromComponents<WaivedLocations, FeeHandler>`
      = note: required for `()` to implement `sp_core::Get<sp_runtime::AccountId32>`
      = note: required for `FungiblesAdapter<Pallet<Runtime>, ConvertedConcreteId<u128, u128, ..., ...>, ..., ..., ..., ...>` to implement `TransactAsset`
      = note: the full type name has been written to '/Users/4meta5/oz/polkadot-runtime-template/generic-template/target/release/wbuild/parachain-template-runtime/target/wasm32-unknown-unknown/release/deps/parachain_template_runtime-35cd061f42ac92dc.long-type-10252185917316068372.txt'
      = note: 1 redundant requirement hidden
      = note: required for `(FungibleAdapter<Pallet<Runtime>, IsConcrete<BalancesPalletLocation>, (..., ..., ...), ..., ...>, ...)` to implement `TransactAsset`
      = note: the full type name has been written to '/Users/4meta5/oz/polkadot-runtime-template/generic-template/target/release/wbuild/parachain-template-runtime/target/wasm32-unknown-unknown/release/deps/parachain_template_runtime-35cd061f42ac92dc.long-type-15556171770185959633.txt'
      = note: required for `XcmFeeToAccount<(FungibleAdapter<Pallet<Runtime>, IsConcrete<...>, ..., ..., ...>, ...), ..., ...>` to implement `HandleFee`
      = note: the full type name has been written to '/Users/4meta5/oz/polkadot-runtime-template/generic-template/target/release/wbuild/parachain-template-runtime/target/wasm32-unknown-unknown/release/deps/parachain_template_runtime-35cd061f42ac92dc.long-type-316572754337197889.txt'
      = note: required for `XcmFeeManagerFromComponents<IsChildSystemParachain<ParaId>, XcmFeeToAccount<(..., ...), ..., ...>>` to implement `FeeManager`
      = note: the full type name has been written to '/Users/4meta5/oz/polkadot-runtime-template/generic-template/target/release/wbuild/parachain-template-runtime/target/wasm32-unknown-unknown/release/deps/parachain_template_runtime-35cd061f42ac92dc.long-type-6213363938863090770.txt'
  note: required by a bound in `staging_xcm_executor::Config::FeeManager`
     --> /Users/4meta5/.cargo/git/checkouts/polkadot-sdk-cff69157b985ed76/7049c3c/polkadot/xcm/xcm-executor/src/config.rs:95:19
      |
  95  |     type FeeManager: FeeManager;
      |                      ^^^^^^^^^^ required by this bound in `Config::FeeManager`

  For more information about this error, try `rustc --explain E0277`.
  error: could not compile `parachain-template-runtime` (lib) due to 2 previous errors

@4meta5 4meta5 marked this pull request as ready for review June 11, 2024 20:46
@4meta5 4meta5 changed the title XCM config for foreign assets [evm-template] XCM config for foreign assets Jun 12, 2024
@4meta5 4meta5 requested review from ozgunozerk and KitHat June 13, 2024 12:53
Copy link
Member

@KitHat KitHat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Collaborator

@ozgunozerk ozgunozerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have a single request on my comments (moving the type to types.rs file). My other comments are not blockers by any means. LGTM overall.

I'm approving in advance to make things faster ⚡

@4meta5 4meta5 merged commit b0c0a81 into main Jun 18, 2024
5 checks passed
@4meta5 4meta5 deleted the amar-enable-xcm-foreign-assets branch June 18, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: 3 We will resolve this first before everything else.
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[evm-template] XCM for foreign assets
3 participants