Skip to content
Merged
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ The registers are named:
- *Holding*
- *Surplus Weight*
- *Refunded Weight*
- *Transact Status*
- *Topic*

### **3.1** Programme

Expand Down Expand Up @@ -159,6 +161,19 @@ Of type `u64`, initialized to `0`.

Expresses the portion of Surplus Weight which has been refunded. Not used on XCM platforms which do not require payment for execution.

### **3.10** Transact Status

Of type `MaybeErrorCode`, initialized to `MaybeErrorCode::Success`.

Expresses the status when checking the versions between the origin, destination chain, and the requested pallet located on the destination chain.

### **3.11** Topic

Of type `Option<[u8; 32]>`, initialized to `None`.

Expresses an arbitrary topic of an XCM. This value can be set to anything, and is used as part of `XcmContext`.


## **4** Basic XCVM Operation

The XCVM operates as a fetch-dispatch loop common in state machines. The steps of the loop are:
Expand Down Expand Up @@ -218,6 +233,18 @@ The instructions, in order, are:
- `Trap`
- `SubscribeVersion`
- `UnsubscribeVersion`
- `BurnAsset`
- `ExpectAsset`
- `ExpectError`
- `ExpectOrigin`
- `QueryPallet`
- `ExpectPallet`
- `ReportTransactStatus`
- `ClearTransactStatus`
- `LockAsset`
- `UnlockAsset`
- `NoteUnlockable`
- `RequestUnlock`

### Notes on terminology

Expand Down Expand Up @@ -668,6 +695,107 @@ Errors:

- `ExpectationFalse`: If the value of the Error Register is not equal to the parameter.

### `QueryPallet`

Queries the existence of a particular pallet type.

Operands:

Kind: *Instruction*

Errors:

### `ExpectPallet`

Ensure that a particular pallet with a particular version exists.

Operands:

Kind: *Instruction*

Errors:

### `ReportTransactStatus(QueryResponseInfo)`

Send a `QueryResponse` message containing the value of the Transact Status Register to some destination.

Operands:

- `query_response_info`: The information needed for constructing and sending the `QueryResponse` message.

Kind: *Instruction*

Errors: *Fallible*.

### `ClearTransactStatus(QueryResponseInfo)`

Set the Transact Status Register to its default, cleared, value.

Operands: None

Kind: *Instruction*

Errors: *Infallible*.

### `LockAsset(MultiAsset, MultiLocation)`

Lock the locally held asset and prevent further transfer or withdrawal.

This restriction may be removed by the `UnlockAsset` instruction being called with an
Origin of `unlocker` and a `target` equal to the current `Origin`.

If the locking is successful, then a `NoteUnlockable` instruction is sent to `unlocker`.


Operands:

- `asset`: The asset(s) which should be locked.
- `unlocker`: The value which the Origin must be for a corresponding `UnlockAsset` instruction to work.

Kind: *Instruction*

Errors: *Fallible*.

### `UnlockAsset(MultiAsset, MultiLocation)`

Remove the lock over `asset` on this chain and (if nothing else is preventing it) allow the asset to be transferred.

Operands:

- `asset`: The asset to be unlocked.
- `owner`: The owner of the asset on the local chain.

Kind: *Instruction*

Errors:

### `NoteUnlockable(MultiAsset, MultiLocation)`

Asset (`asset`) has been locked on the `origin` system and may not be transferred. It may only be unlocked with the receipt of the `UnlockAsset` instruction from this chain.

Operands:

- `asset`: The asset(s) which are now unlockable from this origin.
- `owner`: The owner of the asset on the chain in which it was locked. This may be a location specific to the origin network.

Kind: *Instruction*

Errors: *Fallible*.

### `RequestUnlock(MultiAsset, MultiLocation)`

Send an `UnlockAsset` instruction to the `locker` for the given `asset`. This may fail if the local system is making use of the fact that the asset is locked or, of course, if there is no record that the asset actually is locked.

Operands:

- `asset`: The asset(s) to be unlocked.
- `locker`: The location from which a previous `NoteUnlockable` was sent and to which an `UnlockAsset` should be sent.

Kind: *Instruction*

Errors: *Fallible*.


## **6** Universal Asset Identifiers

*Note on versioning:* This describes the `MultiAsset` (and associates) as used in XCM version of this document, and its version is strictly implied by the XCM it is used within. If it is necessary to form a `MultiAsset` value that is used _outside_ of an XCM (where its version cannot be inferred) then the version-aware `VersionedMultiAsset` should be used instead, exactly analogous to how `Xcm` relates to `VersionedXcm`.
Expand Down