Transaction Memos
Understanding Transaction Memo In Detail
Overview
Transactions to MAYAChain pass user intent with the MEMO
field on their respective chains. MAYAChain inspects the transaction object and the MEMO
in order to process the transaction, so care must be taken to ensure the MEMO
and the transaction are both valid. If not, MAYAChain will automatically refund the assets. All memos are listed here.
MAYAChain uses specific Asset Notation for all assets. Assets and functions can be abbreviated and Affiliate Addresses and asset amounts can be shortened to reduce memo length.
Guides have been created for Swap and Savers to enable quoting and the automatic construction of memos for simplicity.
Memo Size Limits
MAYAChain has a memo size limit of 250 bytes, any inbound tx sent with a larger memo will be ignored. Additionally, memos on UTXO chains are further constrained by the OP_RETURN
size limit, which is 80 bytes.
Format
All memos follow the format: FUNCTION:PARAM1:PARAM2:PARAM3:PARAM4
The function is invoked by a string, which in turn calls a particular handler in the state machine. The state machine parses the memo looking for the parameters which it simply decodes from human-readable strings.
In addition, some parameters are optional. Simply leave them blank, but retain the :
separator:
FUNCTION:PARAM1:::PARAM4
Permitted Functions
The following functions can be put into a memo:
Swap
Perform a swap.
SWAP:ASSET:DESTADDR:LIM/INTERVAL/QUANTITY:AFFILIATE:FEE
Parameter | Notes | Conditions |
---|---|---|
Payload | Send the asset to swap. | Must be an active pool on MAYAChain. |
| The swap handler. | Also, |
| The asset identifier. |
|
| The destination address to send to. | Can use MAYAName. |
| The trade limit ie, set 100000000 to get a minimum of 1 full asset, else a refund. | Optional, 1e8 or Scientific Notation. |
|
|
|
|
|
|
| The affiliate address. RUNE is sent to Affiliate. | Optional. Must be MAYAName or MAYA Address. |
| The affiliate fee. Limited from 0 to 1000 Basis Points. | Optional. Limited from 0 to 1000 Basis Points. |
Syntactic Examples:
SWAP:ASSET:DESTADDR
simple swapSWAP:ASSET:DESTADDR:LIM
swap with trade limitSWAP:ASSET:DESTADDR:LIM/
swap with limit,1/1do not stream swapSWAP:ASSET:DESTADDR:LIM/
swap with limit,3/0optimise swap amount, every 3 blocksSWAP:ASSET:DESTADDR:
LIM/1/0:AFFILIATE:FEE
swap with limit,optimisedand affiliate fee
Actual Examples:
SWAP:ETH.ETH:0xe6a30f4f3bad978910e2cbb4d97581f5b5a0ade0
- swap to Ether, send output to the specified address.SWAP:ETH.ETH:0xe6a30f4f3bad978910e2cbb4d97581f5b5a0ade0:10000000,
same as above except the Ether output should be more than 0.1 Ether else refund.SWAP:ETH.ETH:0xe6a30f4f3bad978910e2cbb4d97581f5b5a0ade0:10000000
/1/1,
same as above except explicitly stated,do not stream the swap.SWAP:ETH.ETH:0xe6a30f4f3bad978910e2cbb4d97581f5b5a0ade0:10000000
/3/0,
same as above except told toallow streaming swap, mini swap every 3 blocks and MAYAChain to work out the number of swaps required to achieve optimal price efficiency.SWAP:ETH.ETH:0xe6a30f4f3bad978910e2cbb4d97581f5b5a0ade0:10000000
/3/0:t:10
- same as above except will send 10 basis points from the input and send it tot
(THORSwap's MAYAName).
The above memo can be further reduced to:
=:ETH.ETH:0xe6a30f4f3bad978910e2cbb4d97581f5b5a0ade0:1e6/3/0:t:10
Other examples:
=:r:thor1el4ufmhll3yw7zxzszvfakrk66j7fx0tvcslym:19779138111
- swap to at least 197.79 RUNE=:BNB/BUSD-BD1:thor15s4apx9ap7lazpsct42nmvf0t6am4r3w0r64f2:628197586176 -
Swap to at least 6281.9 Synthetic BUSD.=:BNB.BNB:bnb108n64knfm38f0mm23nkreqqmpc7rpcw89sqqw5:544e6/2/6
- swap to at least 5.4 BNB, using streaming swaps, six swaps, every two blocks.
Deposit Savers
ADD:POOL::AFFILIATE:FEE
Depositing savers can work without a memo; however, memos are recommended to be explicit about the transaction intent.
Parameter | Notes | Conditions |
---|---|---|
Payload | The asset to add liquidity with. | Must be supported by THORChain. |
| The Deposit handler. | Also |
| The pool to add liquidity to. | Gas and stablecoin pools only. |
| Must be empty | Optional, Required if adding affiliate and fee |
| The affiliate address. RUNE is sent to Affiliate. | Optional. Must be THORName or THOR Address. |
| The affiliate fee. Limited from 0 to 1000 Basis Points. | Optional. Limited from 0 to 1000 Basis Points. |
Examples
+:BTC/BTC
add to the BTC Savings Vaulta:ETH/ETH
add to the ETH Savings Vault+:BTC/BTC::t:10
Deposit with a 10 basis points affiliate
Withdraw Savers
WITHDRAW:POOL
Parameter | Notes | Extra |
---|---|---|
Payload | Send the dust threshold of the asset to cause the transaction to be picked up by THORChain. | Caution Dust Limits: BTC,BCH,LTC chains 10k sats; DOGE 1m Sats; ETH 0 wei; THOR 0 RUNE. |
| The withdraw handler. | Also |
| The pool to withdraw liquidity from. | Gas and stablecoin pools only. |
| Basis points (0-10000, where 10000=100%). | Optional. Limited from 0 to 1000 Basis Points. |
Examples
-:BTC/BTC:10000
Withdraw 100% from BTC Saversw:ETH/ETH:5000
Withdraw 50% from ETH Savers
Add Liquidity
There are rules for adding liquidity, see the rules here.
ADD:POOL:PAIREDADDR:AFFILIATE:FEE
Parameter | Notes | Conditions |
---|---|---|
Payload | The asset to add liquidity with. | Must be supported by THORChain. |
| The Add Liquidity handler. | also |
| The pool to add liquidity to. | Can be shortened. |
| The other address to link with. If on external chain, link to THOR address. If on THORChain, link to external address. If a paired address is found, the LP is matched and added. If none is found, the liquidity is put into pending. | Optional. If not specified, a single-sided add-liquidity action is created. |
| The affiliate address. The affiliate is added in to the pool as an LP. | Optional. Must be THORName or THOR Address. |
| The affiliate fee. Fee is allocated to the affiliate. | Optional. Limited from 0 to 1000 Basis Points. |
Examples:
ADD:POOL
single-sided add liquidity. If this is a position's first add, liquidity can only be withdrawn to the same address.+:POOL:PAIREDADDR
add on both sides.+:POOL:PAIREDADDR:AFFILIATE:FEE
add with affiliate+:BTC.BTC:
Withdraw Liquidity
Withdraw liquidity from a pool. A withdrawal can be either dual-sided (withdrawn based on pool's price) or entirely single-sided (converted to one side and sent out).
WD:POOL:BASISPOINTS:ASSET
Parameter | Notes | Extra |
---|---|---|
Payload | Send the dust threshold of the asset to cause the transaction to be picked up by THORChain. | Caution Dust Limits: BTC,BCH,LTC chains 10k sats; DOGE 1m Sats; ETH 0 wei; THOR 0 RUNE. |
| The withdraw handler. | Also |
| The pool to withdraw liquidity from. | Can be shortened. |
| Basis points (0-10000, where 10000=100%). | |
| Single-sided withdraw to one side. | Optional. Can be shortened. Must be either RUNE or the ASSET. |
Examples:
WITHDRAW:POOL:10000
dual-sided 100% withdraw liquidity. If a single-address position, this withdraws single-sidedly instead.-:POOL:1000
dual-sided 10% withdraw liquidity.wd:POOL:5000:ASSET
withdraw 50% liquidity as the asset specified while the rest stays in the pool, eg:wd:BTC.BTC:5000:BTC.BTC
DONATE & RESERVE
Donate to a pool or the RESERVE.
DONATE:POOL
Parameter | Notes | Extra |
---|---|---|
Payload | The asset to donate to a THORChain pool. | Must be supported by THORChain. Can be RUNE or ASSET. |
| The donate handler. | Also |
| The pool to withdraw liquidity from. | Can be shortened. |
Example: DONATE:ETH.ETH
- Donate to the ETH pool.
RESERVE
Parameter | Notes | Extra |
---|---|---|
Payload | THOR.RUNE. | The RUNE to credit to the RESERVE. |
| The reserve handler. |
BOND, UNBOND & LEAVE
Perform node maintenance features. Also see Pooled Nodes.
BOND:NODEADDR:PROVIDER:FEE
Parameter | Notes | Extra |
---|---|---|
Payload | The asset to bond to a Node. | Must be RUNE. |
| The bond handler. | Anytime. |
| The node to bond with. | |
| Whitelist in a provider. | Optional, add a provider |
| Specify an Operator Fee in Basis Points. | Optional, default will be the mimir value (2000 Basis Points). Can be changed anytime. |
UNBOND:NODEADDR:AMOUNT
Parameter | Notes | Extra |
---|---|---|
Payload | None required. | Use |
| The unbond handler. | |
| The node to unbond from. | Must be in standby only. |
| The amount to unbond. | In 1e8 format. If setting more than actual bond, then capped at bond. |
| Unwhitelist a provider. | Optional, remove a provider |
LEAVE:NODEADDR
Parameter | Notes | Extra |
---|---|---|
Payload | None required. | Use |
| The leave handler. | |
| The node to force to leave. | If in Active, request a churn out to Standby for 1 churn cycle. If in Standby, forces a permanent leave. |
Examples:
BOND:thor19m4kqulyqvya339jfja84h6qp8tkjgxuxa4n4aUNBOND:thor1x2whgc2nt665y0kc44uywhynazvp0l8tp0vtu6:750000000000LEAVE:thor1hlhdm0ngr2j4lt8tt8wuvqxz6aus58j57nxnps
MIRGRATE
Internal memo type used to mark migration transactions between a retiring vault and a new Asgard vault during churn. Special MAYAChain triggered outbound tx without a related inbound tx.
:MIGRATE
Parameter | Notes | Extra |
---|---|---|
Payload | Assets migrating | |
| The migrate Handler | |
| MAYAChain Blockheight to migrate | Must be a valid blockheight |
Example (LINK): MIGRATE:3494355
NOOP
Dev-centric functions to fix MAYAChain state. Caution: may cause loss of funds if not done exactly right at the right time.
NOOP
Parameter | Notes | Extra |
---|---|---|
Payload | The asset to credit to a vault. | Must be ASSET or RUNE. |
| The noop handler. | Adds to the vault balance, but does not add to the pool. |
| Do not credit the vault. | Optional. Just fix the insolvency issue. |
Refunds
The following are the conditions for refunds:
Condition | Notes |
---|---|
Invalid | If the |
Invalid Assets | 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.
Other Internal Memos
donate
- add funds to a pool (example:DONATE:ETH.ETH
)consolidate
- consolidate UTXO transactionsragnarok
- only used to delist pools.
Last updated