Hi All I am currently embarking on trying to send funds from the treasury via XCM
I am fairly certain this isn't possible right now because the treasury origin does not have send rights. I am currently working on a pr to make this possible
What I am trying to do is a reserve asset transfer, but that requires a signed origin and hence I am not sure it can be done via governance
As an alternative, I am trying to split it in 2 parts
batch {
spend(ParachainSovereignAccount),
// Notify destination of funds sent
send(dest: para, xcm: [ReserveAssetDeposited, ..])
}
However, unless I am mistaken, ReserveAssetDeposited
must be executed and not sent.
If I use DepositAssets
instead the message gets sent but there are no assets in holding so AssetTransactor
does not deposit the asset. See here
Even a simple message below fails
let assets = MultiAssets::from(vec![MultiAsset {
id: Concrete(MultiLocation {
parents: 0,
interior: Here,
}),
fun: Fungible(transfer_amount),
}]);
let msg = VersionedXcm::from(Xcm(vec![
UnpaidExecution {
weight_limit: WeightLimit::Unlimited,
check_origin: None,
},
ReserveAssetDeposited(assets.clone().into()),
]));
I get the below error from the logs
Sep 06 09:38:38.920 DEBUG xcm::send_xcm: dest: MultiLocation { parents: 0, interior: X1(Parachain(2121)) }, message: Xcm([DescendOrigin(X1(Plurality { id: Treasury, part: Voice })), UnpaidExecution { weight_limit: Unlimited, check_origin: None }, ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000000000000) }]))])
Sep 06 09:38:38.922 DEBUG xcm::execute_xcm: origin: MultiLocation { parents: 1, interior: Here }, message: Xcm([DescendOrigin(X1(Plurality { id: Treasury, part: Voice })), UnpaidExecution { weight_limit: Unlimited, check_origin: None }, ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000000000000) }]))]), weight_limit: Weight { ref_time: 18446744073709551615, proof_size: 18446744073709551615 }
Sep 06 09:38:38.922 TRACE xcm::weight: FixedWeightBounds message: Xcm([DescendOrigin(X1(Plurality { id: Treasury, part: Voice })), UnpaidExecution { weight_limit: Unlimited, check_origin: None }, ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000000000000) }]))])
Sep 06 09:38:38.922 TRACE xcm::execute_xcm_in_credit: origin: MultiLocation { parents: 1, interior: Here }, message: Xcm([DescendOrigin(X1(Plurality { id: Treasury, part: Voice })), UnpaidExecution { weight_limit: Unlimited, check_origin: None }, ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000000000000) }]))]), weight_credit: Weight { ref_time: 0, proof_size: 0 }
Sep 06 09:38:38.922 WARN xcm::barrier: Unexpected ReserveAssetDeposited from the Relay Chain
Sep 06 09:38:38.922 TRACE xcm::barriers: TakeWeightCredit origin: MultiLocation { parents: 1, interior: Here }, instructions: [DescendOrigin(X1(Plurality { id: Treasury, part: Voice })), UnpaidExecution { weight_limit: Unlimited, check_origin: None }, ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000000000000) }]))], max_weight: Weight { ref_time: 3000000, proof_size: 3072 }, weight_credit: Weight { ref_time: 0, proof_size: 0 }
Sep 06 09:38:38.922 TRACE xcm::barriers: AllowKnownQueryResponses origin: MultiLocation { parents: 1, interior: Here }, instructions: [DescendOrigin(X1(Plurality { id: Treasury, part: Voice })), UnpaidExecution { weight_limit: Unlimited, check_origin: None }, ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000000000000) }]))], max_weight: Weight { ref_time: 3000000, proof_size: 3072 }, weight_credit: Weight { ref_time: 0, proof_size: 0 }
Sep 06 09:38:38.922 TRACE xcm::barriers: WithComputedOrigin origin: MultiLocation { parents: 1, interior: Here }, instructions: [DescendOrigin(X1(Plurality { id: Treasury, part: Voice })), UnpaidExecution { weight_limit: Unlimited, check_origin: None }, ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000000000000) }]))], max_weight: Weight { ref_time: 3000000, proof_size: 3072 }, weight_credit: Weight { ref_time: 0, proof_size: 0 }
Sep 06 09:38:38.922 TRACE xcm::barriers: AllowTopLevelPaidExecutionFrom origin: MultiLocation { parents: 1, interior: X1(Plurality { id: Treasury, part: Voice }) }, instructions: [UnpaidExecution { weight_limit: Unlimited, check_origin: None }, ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000000000000) }]))], max_weight: Weight { ref_time: 3000000, proof_size: 3072 }, weight_credit: Weight { ref_time: 0, proof_size: 0 }
Sep 06 09:38:38.922 TRACE xcm::barriers: AllowExplicitUnpaidExecutionFrom origin: MultiLocation { parents: 1, interior: X1(Plurality { id: Treasury, part: Voice }) }, instructions: [UnpaidExecution { weight_limit: Unlimited, check_origin: None }, ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000000000000) }]))], max_weight: Weight { ref_time: 3000000, proof_size: 3072 }, weight_credit: Weight { ref_time: 0, proof_size: 0 }
Sep 06 09:38:38.922 TRACE xcm::process: origin: Some(MultiLocation { parents: 1, interior: Here }), total_surplus/refunded: Weight { ref_time: 0, proof_size: 0 }/Weight { ref_time: 0, proof_size: 0 }, error_handler_weight: Weight { ref_time: 0, proof_size: 0 }
Sep 06 09:38:38.923 TRACE xcm::process_instruction: === DescendOrigin(X1(Plurality { id: Treasury, part: Voice }))
Sep 06 09:40:32.773 TRACE xcm::process_instruction: === UnpaidExecution { weight_limit: Unlimited, check_origin: None }
Sep 06 09:40:33.027 TRACE xcm::process_instruction: === ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000000000000) }]))
Sep 06 09:40:33.241 TRACE xcm::execute: !!! ERROR: UntrustedReserveLocation
Sep 06 09:40:33.241 TRACE xcm::execute_xcm_in_credit: result: Err(ExecutorError { index: 2, xcm_error: UntrustedReserveLocation, weight: Weight { ref_time: 0, proof_size: 0 } })
Sep 06 09:40:33.241 TRACE xcm::execute_xcm_in_credit: Execution errored at 2: UntrustedReserveLocation (original_origin: MultiLocation { parents: 1, interior: Here })
So tldr; can I send Sep 06 10:43:08.280 TRACE xcm::execute_xcm_in_credit: Execution errored at 2: UntrustedReserveLocation (original_origin: MultiLocation { parents: 1, interior: Here })
which I think is because again this is not coming from the chain but rather through a gov body
I do wonder if DescendOrigin
can help but unfortunately, I cannot find documentation around that