Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

MultiAsset Treasury Spend Over XCM. Companion PR for Substrate #13607 #7058

Closed
wants to merge 82 commits into from

Conversation

tonyalaribe
Copy link
Contributor

@tonyalaribe tonyalaribe commented Apr 11, 2023

Companion PR for paritytech/substrate#13607

Background

This PR is a step towards multi-asset treasury spends. Instead of the treasury spends operating only on local assets on the relay chain, we rename the old spend extrinsic to spend_local() and introduce a new spend() extrinsic which is configured to spend over XCM.

Implemnetation

This is implementend based on the PayOverXcm implementation of the Pay trait. This PayOverXcm instance is in turn configured and pointed towards statemine/t respectively.

In practice, the treasury would have an account on statemin/t which would hold assets of different asset classes. These assets would be sourced by any means including teleports from the relay chain and via asset conversions by governance. (The means of conversions is outside the scope of this PR)

This PR allows the treasury spend to control the assets stored on statemine/t. So you can specify an asset class when performing a treasury spend, and that asset class and amount would be transfered to the beneficiary of the spend call.

Depends strongly on: #6900

}

impl pallet_treasury::Config for Runtime {
type PalletId = TreasuryPalletId;
type AssetKind = xcm::latest::AssetId;
Copy link
Contributor

Choose a reason for hiding this comment

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

with the setup there is no way to spend some DOTs on Statemint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this is an xcm assetId, it can point to any asset at any xcm multilocation

@tonyalaribe tonyalaribe force-pushed the aa/multi-asset-treasury-over-xcm-2 branch from 018260d to f4c5bd7 Compare April 20, 2023 19:57
@tonyalaribe
Copy link
Contributor Author

bot rebase

@paritytech-processbot
Copy link

Rebased

@tonyalaribe tonyalaribe marked this pull request as ready for review April 21, 2023 12:03
@tonyalaribe
Copy link
Contributor Author

bot rebase

@paritytech-processbot
Copy link

Rebased

@@ -217,6 +217,8 @@ impl<Network: Get<Option<NetworkId>>, AccountId: From<[u8; 32]> + Into<[u8; 32]>
{
fn convert(location: MultiLocation) -> Result<AccountId, MultiLocation> {
let id = match location {
// support account IDs from the relay chain
MultiLocation { parents: 1, interior: X1(AccountId32 { id, network: None }) } => id,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noteworthy change, since this allows interpreting an account on the parent chain into an accountId

@tonyalaribe tonyalaribe changed the title Companion PR for Substrate #13607 MultiAsset Treasury Spend Over XCM. Companion PR for Substrate #13607 May 8, 2023
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable
Logs: https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/2921163

Base automatically changed from cisco-xcm-query-handler to master May 31, 2023 10:09
@muharem
Copy link
Contributor

muharem commented Jun 26, 2023

closing in favour of #7427

@muharem muharem closed this Jun 26, 2023
@Polkadot-Forum
Copy link

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/opengov-on-polkadot-reflecting-on-the-payment-issues-from-kusama/3118/17

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B1-note_worthy Changes should be noted in the release notes C3-medium PR touches the given topic and has a medium impact on builders. D9-needsaudit 👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited. F3-breaks_API This PR changes public API; next release should be major.
Projects
Development

Successfully merging this pull request may close these issues.

6 participants