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. Long assets can be shortened using Asset abbreviations (below) as well as THORNames to reduce the size of destination/affiliate addresses.
Limited to 80 bytes.
Smart Contract Input
Each transaction has an optional memo, limited to 128 bytes.
Each transaction can have attached
The following transactions are permitted:
Adds into the specified pool symmetrically. The asset that reaches THORChain first is put into "pending".
Adds into the specified pool assymetrically.
Percent is in basis points (0-10000, where 10000=100%)
Withdraws from a pool
Withdraw to the corresponding asset (RUNE or ASSET).
Withdraws assymetrically from a pool
Set a destination address to swap and send to someone.
Set trade protection. If the value isn't achieved then it is refunded. ie, set 100000000 to be guaranteed a minimum of 1 full asset.
Swaps to asset.
Can be either.
Adds to the pool balances without being credited.
Asset to add to bond.
Bond or Unbond to the THORNode
Force a THORNode to be kicked out, never to return. The bond will be retuned.
Add to the reserve
Asset to add to THORChain
These are special memos to bump state. Novault means the asset is not credited to the vault, it just fixes insolvency issues.
Affiliate fees can be taken for either Swaps or Add Liquidity. If it is a swap, it is converted to RUNE and sent to the address. If it is Add Liquidity, the affiliate is added as a LP in the pool alongside their user.
The fee is set in basispoints from 0 to 1000 (10%).
The address for the affiliate MUST be a THORChain address.
The following are the conditions for refunds:
If the asset for the transaction is incorrect (adding 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. The user will pay the correct outbound fee for that chain.
Alternative MEMO types are available to clients:
The following is the notation for Assets in THORChain's system:
Assets can be abbreviated using fuzzy logic. The following will all be matched appropriately. If there are conflicts then the deepest pool is matched. (To prevent attacks).