description |
---|
Transaction Intent, Memos, Refunds and Asset Notation. |
THORChain processes all transactions made to the vault address that it monitors. The address is discovered by clients by querying THORChain (via Midgard).
Transactions to THORChain pass user-intent with the MEMO
field on their respective chains. The THORChain inspects the transaction object, as well as the MEMO
in order to process the transaction, so care must be taken to ensure the MEMO
and the transaction is valid. If not, THORChain will automatically refund.
Each chain will have a unique way of adding state to a transaction:
Chain | Mechanism | Notes |
---|---|---|
Bitcoin | OP_RETURN | Limited to 80 bytes, long memos need to use two OP_RETURN outputs. |
Ethereum | Smart Contract Input | The user can pass in the memo in the deposit(asset, value, memo) function, where memo is bytes32. This is emitted as an event. |
Binance Chain | MEMO | Each transaction has an optional memo, limited to 128 bytes. |
Monero | Extra Data | Each transaction can have attached extra data field, that has no limits. |
The following transactions are permitted:
Type | Payload | MEMO | Expected Outcome |
---|---|---|---|
STAKE |
Can be either, or just one side. |
STAKE:ASSET
|
Stakes into the specified pool. |
WITHDRAW |
A non-zero transaction. |
Percent is in basis points (0-10000, where 10000=100%) |
Withdraws from a pool |
SWAP |
Either/Or |
Set a destination address to swap and send to someone. If
Set price protection. If the value isn't achieved then it is refunded. ie, set 10000000 to be garuanteed a minimum of 1 full asset. If If both are ommitted then the format is: |
Swaps to token. |
ADD Assets |
Can be either, or just one side. |
ADD:ASSET
|
Adds to the pool balances without being credited. |
The following are the conditions for refunds:
Condition | Notes |
---|---|
Invalid MEMO |
If the MEMO is incorrect the user will be refunded. |
Invalid Assets | If the asset for the transaction is incorrect (staking an asset into a wrong pool) the user will be refunded. |
Invalid Transaction Type | If the user is performing a multi-send vs a send for a particular transaction, they are refunded. |
Exceeding Price Limit | If the final value achieved in a trade differs to expected, they are refunded. |
Refunds cost fees to prevent Denial of Service attacks:
Asset | Amount |
---|---|
RUNE | 1 RUNE |
Non-RUNE Asset | 1 RUNE equivalent |
Alternative MEMO types are available to clients:
Transaction | Long-form MEMO | Short-form MEMO | Symbol MEMO |
---|---|---|---|
STAKE | STAKE |
st |
+ |
WITHDRAW | WITHDRAW |
wd |
- |
SWAP | SWAP |
s |
= |
ADD | ADD |
a |
% |
The following is the notation for Assets in THORChain's system:
Asset | Notation |
---|---|
Bitcoin | BTC.BTC |
Ethereum | ETH.ETH |
USDT | ETH.USDT-0xdac17f958d2ee523a2206206994597c13d831ec7 |
BNB | BNB.BNB |
RUNE (BEP2) | BNB.RUNE-B1A |
RUNE (NATIVE) | THOR.RUNE |