AlcorDocs

Contract actions

Order book DEX contract: transfer memos for orders and market creation, and cancel actions.

You trade by transferring tokens to the DEX contract with a memo. The contract account differs per chain (see Smart Contracts). The examples below use WAX (alcordexmain).

A memo that has no @ or no space is treated as a plain transfer.

Limit order

Transfer the amount you sell (the bid) and put the amount you want to receive (the ask) in the memo. The contract finds the market by the token pair and derives the price from bid and ask.

<amount> <SYMBOL>@<token_contract>
1000.0000 TLM@alien.worlds
  • The ask must use the token's exact precision and contract.
  • The part of the order that matches is filled at once. The rest stays in the order book.
  • Each market has minimum amounts, min_buy (base token) and min_sell (quote token), in the markets table.
  • An account can hold up to 300 open orders by default.
  • Orders cannot be edited. Cancel and place a new one.

Market order

Set the ask amount to zero. The order fills against the best opposite orders, and the unfilled remainder is refunded.

0.0000 TLM@alien.worlds

To fail the transaction unless you receive at least a minimum amount (after fees), put that amount in the memo and add |min:

950.0000 TLM@alien.worlds|min

Cancel order

Call cancelbuy or cancelsell on the DEX contract, signed by the order owner. The remaining bid is returned to the owner.

ParameterTypeDescription
executornameOrder owner
market_iduint64Market ID
order_iduint64Order ID in buyorder or sellorder
cleos -u https://wax.greymass.com push action alcordexmain cancelsell '["bob", 26, 1284277]' -p bob

Fees

Each market has a fee in hundredths of a percent (20 = 0.2%). On every match, both sides receive their amount minus the fee.

Open a new market

Transfer the market creation fee in the chain's system token (from eosio.token) with this memo:

new_market|<base>|<quote>

<base> and <quote> are zero amounts with full precision, symbol and contract:

new_market|0.00000000 WAX@eosio.token|0.0000 TLM@alien.worlds

The transaction fails if the market already exists or both tokens are the same. The fee goes to the Alcor fee account. See Market creation for the fee on each chain.

On this page