CLI Trading
Command-Line Interface Usage for Ref Exchange
Deploy contract
export NEAR_ENV=default
near deploy $CONTRACT_ID --wasmFile=res/ref_exchange.wasm
near call $CONTRACT_ID new "{\"owner_id\": \"$USER_ID\", \"exchange_fee\": 4, \"referral_fee\": 1}" --accountId $CONTRACT_IDAdd a simple pool
near call $CONTRACT_ID add_simple_pool "{\"tokens\": [\"$TOKEN1\", \"$TOKEN2\"], \"fee\": 25}" --accountId $USER_ID --amount 0.1Query pools
near view $CONTRACT_ID get_pools '{"from_index": 0, "limit": 10}'Register account in the exchange
Query whitelisted tokens
Check that account is registered and storage available
Deposit funds
Query deposit balances in the exchange
Add liquidity to a pool
Get pool's information
Get pool's accumulated volume
Get number of liquidity shares in the pool
Remove liquidity from a pool
Output amount after swap
Swap
Withdraw funds
Check owner
Free up user's storage
Last updated
Was this helpful?