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

Add support for pallet-xcm precompile #35

Merged
merged 23 commits into from Apr 24, 2024
Merged

Conversation

Agusrodri
Copy link
Collaborator

@Agusrodri Agusrodri commented Apr 2, 2024

What does it do?

This PR adds a precompile that allows to access the new transfer_assets() extrinsic of pallet-xcm, and leverage its use cases, like for instance, sending two assets with different reserves in the same message.

Precompile functions

  • transferAssetsLocation: sends XCM assets using transfer_assets extrinsic of pallet-xcm. In this function we have to specify assets the same way the original extrinsic does (using Location format).

  • transferAssetsToPara20: sends XCM assets to a 20 byte-like parachain via transfer_assets extrinsic of pallet-xcm. In this case, assets can be indicated through an address format.

  • transferAssetsToPara32: same as transferAssetsToPara20, with the difference that sends the assets to a 32 byte-like parachain. The parameters have the same format as in transferAssetsToPara20.

  • transferAssetsToRelay: sends XCM assets to the relay chain through transfer_assets extrinsic of pallet-xcm. This function also allows the possibility of sending assets in an address format.

@Agusrodri Agusrodri marked this pull request as ready for review April 2, 2024 16:30
.collect::<Vec<Asset>>()
.into();

let weight_limit = match weight.ref_time() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is very interesting :)

@Agusrodri Agusrodri marked this pull request as draft April 7, 2024 04:11
@Agusrodri Agusrodri marked this pull request as ready for review April 22, 2024 20:59
Copy link
Collaborator

@girazoki girazoki left a comment

Choose a reason for hiding this comment

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

looks good Agus

@Agusrodri Agusrodri merged commit 66edb0e into main Apr 24, 2024
10 checks passed
@Agusrodri Agusrodri deleted the agustin-pallet-xcm-precompile branch April 24, 2024 14:13
Agusrodri added a commit that referenced this pull request May 14, 2024
* add pallet-xcm precompile

* update interface docs

* update comment for Unlimited weight

* add comment in record_cost

* mock cleanup

* remove custom address from solidity interface

* start converter implementation (PoC)

* use size_of in AssetIdInfo

* fmt

* refactor converter

* fmt

* add Erc20PalletMatcher and adapt mock

* remove unused import

* minor fixes

* add new functions

* refactor ForeignAssetMatcher

* rust fmt

* add more tests and handle db reads costs

* fix tests

* use proper origin in mock

* update solidity interface docs

* remove TODO comment
Agusrodri added a commit that referenced this pull request May 16, 2024
* add pallet-xcm precompile

* update interface docs

* update comment for Unlimited weight

* add comment in record_cost

* mock cleanup

* remove custom address from solidity interface

* start converter implementation (PoC)

* use size_of in AssetIdInfo

* fmt

* refactor converter

* fmt

* add Erc20PalletMatcher and adapt mock

* remove unused import

* minor fixes

* add new functions

* refactor ForeignAssetMatcher

* rust fmt

* add more tests and handle db reads costs

* fix tests

* use proper origin in mock

* update solidity interface docs

* remove TODO comment
Agusrodri added a commit that referenced this pull request May 16, 2024
* add pallet-xcm precompile

* update interface docs

* update comment for Unlimited weight

* add comment in record_cost

* mock cleanup

* remove custom address from solidity interface

* start converter implementation (PoC)

* use size_of in AssetIdInfo

* fmt

* refactor converter

* fmt

* add Erc20PalletMatcher and adapt mock

* remove unused import

* minor fixes

* add new functions

* refactor ForeignAssetMatcher

* rust fmt

* add more tests and handle db reads costs

* fix tests

* use proper origin in mock

* update solidity interface docs

* remove TODO comment
Agusrodri added a commit that referenced this pull request May 16, 2024
* add pallet-xcm precompile

* update interface docs

* update comment for Unlimited weight

* add comment in record_cost

* mock cleanup

* remove custom address from solidity interface

* start converter implementation (PoC)

* use size_of in AssetIdInfo

* fmt

* refactor converter

* fmt

* add Erc20PalletMatcher and adapt mock

* remove unused import

* minor fixes

* add new functions

* refactor ForeignAssetMatcher

* rust fmt

* add more tests and handle db reads costs

* fix tests

* use proper origin in mock

* update solidity interface docs

* remove TODO comment
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 this pull request may close these issues.

None yet

6 participants