Quickstart Guide
Introduction
MAYAChain allows users to deposit Layer1 assets into its network to earn asset-denominated yield without CACAO asset exposure, or being aware of MAYAChainโs network.
There is no permission, authentication or prior steps, so developers can get started and allow their users to earn asset-denominated yield simply by sending layer1 transactions to MAYAChain vaults.
Under the hood, MAYAChain deposits the userโs Layer1 asset into a liquidity pool which earns yield. This yield is tracked and paid to the userโs deposit value. Users can withdraw their Layer1 asset, including the yield earnt. There is no slashing, penalties, timelocks, or account minimum/maximums. The only fees paid are the Layer1 fees to make a deposit and withdraw transaction (as necessitated), and a slip-based fee on entry and exit to stop price manipulation attacks. Both of these are transparent and within the userโs control.
Quote for a Savers Quote
Savers Quote endpoints have been created to simplify the implementation process.
Add 1 BTC to Savers
Request: Add 1 BTC to Savers
https://mayanode.mayachain.info/mayachain/quote/saver/deposit?asset=BTC.BTC&amount=100000000
Response
If you send 1 BTC to bc1quuf5sr444km2zlgrg654mjdfgkuzayfs7nqrfmwith the memo +:BTC/BTC, you can expect 0.99932 BTC will and will incur 13 basis points (0.13%) of slippage.
The Inbound_Address
changes regularly, do not cache!
Inbound transactions should not be delayed for any reason else there is risk funds will be sent to an unreachable address. Use standard transactions, check the inbound address
before sending and use the recommended gas rate
to ensure transactions are confirmed in the next block to the latest Inbound_Address
.
For security reasons, your inbound transaction will be delayed by 1 BTC Block.
Full quote saving endpoint specification can be found here: https://mayanode.mayachain.info/mayachain/doc.
See an example implementation (LINK).
User withdrawing all of their BTC Saver's position
Request: Withdraw 100% of BTC Savers for bc1qy9rjlz5w3tqn7m3reh3y48n8del4y8z42sswx5
https://thornode.ninerealms.com/thorchain/quote/saver/withdraw?asset=BTC.BTC&address=bc1qy9rjlz5w3tqn7m3reh3y48n8del4y8z42sswx5&withdraw_bps=10000
Response
Deposit and withdraw interfaces will return inbound_address
and memo
fields that can be used to construct the transaction. Do not cache theinbound_address
field!
Basic Mechanics
Users can add assets to a vault by sending assets directly to the chainโs vault address
found on the /mayachain/inbound_addresses
endpoint. Quote endpoints will also return this.
1. Find the L1 vault address.
https://mayanode.mayachain.info/mayachain/inbound_addresses
Example:
2. Determine if there is capacity available to mint new synths
There is a cap on how many synths can be minted as a function of liquidity depth. To do this, find synth_mint_paused = false
on the /pool
endpoint
3. Send memoless savers transactions.
Both Saver Deposit and Withdraw transactions can be done without memos (optional memos can be included if a wallet wishes, see Transaction Memos
, since there is a marginal transaction cost savings to including memos).
To deposit, users should send any amount of asset they wish (avoiding dust amounts). The network will read the deposit and user address, then add them into the Saver Vault automatically.
To withdraw, the user should send a specific dust amount of asset (avoiding the dust threshold), from an amount 0 units above the dust threshold, to an amount 10,000 units above the threshold. 10000 units is read as โwithdraw 10000 basis pointsโ, which is 100%.
The dust threshold is the point at which the network will ignore the amount sent to stop dust attacks (widely seen on UTXO chains).
Specific rules for each chain and action are as follows:
Each chain has a defined
dust_threshold
in base unitsFor asset amounts in the range:
[ dust_threshold + 1 : dust_threshold + 10,000]
, the network will withdrawdust_threshold - 10,000
basis points from the userโs Savers positionFor asset amounts greater than
dust_threshold + 10,000
, the network will add to the userโs Savers position
The dust_threshold
for each chain are defined as:
BTC: 10,000 sats
DASH: ???
ETH,ARB: 0 wei
KUJI: 0 ukuji
THOR: ???
Transactions with asset amounts equal to or below the dust_threshold
for the chain will be ignored to prevent dust attacks. Ensure you are converting the โhuman readableโ amount (1 BTC) to the correct gas units (100,000,000 sats)
Examples:
User wants to deposit 100,000 sats (0.001 BTC): Wallet signs an inbound tx to MAYAChainโs BTC
/inbound_addresses
vault address from the user with 100,000 sats. This will be added to the userโs Savers position.User wants to withdraw 50% of their BTC Savers position: Wallet signs an inbound with 15,000 sats
50% = 5,000 basis points + 10,000[BTC dust_threshold
to MAYAChainโs BTC vaultUser wants to withdraw 10% of their ETH Savers position: Wallet signs an inbound with 1,000 wei
(10% = 1,000 basis points + 0 [ETH dust_threshold])
to MAYAChainโs ETH vaultUser wants to deposit 10,000 sats to their DASH Savers position: Not possible transactions below the
dust_threshold
for each chain are ignored to prevent dust attacks.User wants to deposit 20,000 sats to their BTC Savers position: Not possible with memoless, the userโs deposit will be interpreted as a
withdraw:100%
. Instead the user should use a memo.
(translates to: โwithdraw 10,000 basis points, or 100% of addressโ savings
Historical Data & Performance
An important consideration for UIs when implementing this feature is how to display:
an addressโ present performance (targeted at retaining current savers)
past performance of savings vaults (targeted at attracting potential savers)
Present Performance
A user is likely to want to know the following things:
What is the redeemable value of my share in the Savings Vault?
What is the absolute amount and % yield I have earned to date on my stake?
The latter can be derived from the former.
yield_percent = (1 - (depositValue / redeemableValue)) * 100
Past Performance
The easy way to determine lifetime performance of the savers vault is to look back 7 days, find the saver value, then compare it with the current saver value.
Example code: TBA
https://mayanode.mayachain.info/mayachain/pool/BTC.BTC/savers will show all BTC Savers
Support
Developers experiencing issues with these APIs can go to the Maya Protocol Discord Server for assistance. Interface developers should subscribe to the #interface-alerts channel for information pertinent to the endpoints and functionality discussed here.
Last updated