changed a year ago
Published Linked with GitHub

How to claim assets on Polkadot/Kusama

When an XCM that is holding funds fails, where do those assets go? Do they disappear? Thankfully not, they get trapped in the same chain where the execution failed.

In order to claim them, all that's needed is to locally execute an XCM with the ClaimAsset instruction.

The AssetsTrapped event

When assets get trapped because of XCM execution failing, the AssetsTrapped event is emitted:

assets-trapped-pjs

This event contains the following information:

  • origin: The origin location, whose assets were trapped.
  • assets: The versioned assets that were trapped. The XCM version used is specified here.
  • hash: The hash of the trapped assets, not relevant for claiming them.

Claiming the assets

From version 1.2.0 onwards of the Polkadot and Kusama runtimes (including system parachains), there's a new claim_assets extrinsic that allows for easily claiming assets trapped in that chain.

In Polkadot JS Apps, choose the chain where your assets were trapped.
Choose the xcm pallet, it's usually called XcmPallet in relay chains and PolkadotXcm in system parachains.
Under that, pick the claimAssets extrinsic.

There are two fields you need to fill:

  • assets
  • beneficiary

The first one is the assets exactly as shown in the AssetsTrapped event we mentioned earlier.
You should use the XCM version that was shown in the AssetsTrapped event.
You should also add the exact amount of the assets that were trapped.

The second one is the beneficiary, you can just choose your own account or another account you prefer that is local to that chain (no remote transfer will be done).
This is always of the form (parents: 0, interior: X1(AccountId32 { <insert-your-account-id-here> })).

Make sure NOT to input the location (parents: 0, interior: Here) as that will move your recently claimed assets to the local chain origin.
Meaning the chain's governance will have control of your funds, not you.

Here is a screenshot of how the extrinsic call might look like in Polkadot JS Apps (without the assets):

Screenshot 2024-04-25 at 14.39.14

The assets you have to put in might be something like this:

Screenshot 2024-04-25 at 16.30.51

Those assets, when executed in the Polkadot Asset Hub, identify 1 DOT.
Remember, DOT has 10 decimals, so 1 -> 10_000_000_000.
However, no need to worry about this, the AssetsTrapped event has the correct number.

After that, you should see a new event, AssetsClaimed, showing you you have claimed your assets, and you should have them in the beneficiary account you specified.

This event has the same fields as AssetsTrapped.

Select a repo