Skip to content

Latest commit

 

History

History
150 lines (126 loc) · 5.07 KB

transaction-memos.md

File metadata and controls

150 lines (126 loc) · 5.07 KB
description
Transaction Intent, Memos, Refunds and Asset Notation.

Transaction Memos

Overview

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.

Mechanism for Transaction Intent

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.

Transactions

The following transactions are permitted:

Type Payload MEMO Expected Outcome
STAKE

RUNE &| Token

Can be either, or just one side.

STAKE:ASSET Stakes into the specified pool.
WITHDRAW

0.00000001 BNB

A non-zero transaction.

WITHDRAW:ASSET:PERCENT

Percent is in basis points (0-10000, where 10000=100%)

Withdraws from a pool
SWAP

RUNE || Token

Either/Or

SWAP:ASSET:DESTADDR:LIM

Set a destination address to swap and send to someone. If DESTADDRis blank, then it sends back to self:

SWAP:ASSET::LIM

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 LIM is ommitted, then there is no price protection:

SWAP:ASSET:DESTADDR

If both are ommitted then the format is:

SWAP:ASSET

Swaps to token.
ADD Assets

RUNE &| Token

Can be either, or just one side.

ADD:ASSET Adds to the pool balances without being credited.

Refunds

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

MEMO Alternatives

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 %

Asset Notation

The following is the notation for Assets in THORChain's system:

Examples

Asset Notation
Bitcoin BTC.BTC
Ethereum ETH.ETH
USDT ETH.USDT-0xdac17f958d2ee523a2206206994597c13d831ec7
BNB BNB.BNB
RUNE (BEP2) BNB.RUNE-B1A
RUNE (NATIVE) THOR.RUNE