SX Curve is an amplified AMM (automated market maker) swap liquidity pool designed efficiently for stable currencies and/or highly correlated assets.
- SlowMist Audit (2021-07)
- KnownSec (2021-05)
- Sentnl Audit (2021-03)
Local
$ git checkout v1.0.3
$ eosio-cpp --version
eosio-cpp version 1.7.0
$ eosio-cpp curve.sx.cpp -I include
$ shasum -a 256 curve.sx.wasm
a9aa7e60901cfc3ffe481099daa7f13f0b9cdba19c64ffd18aa5789932336f8c curve.sx.wasm
EOS Mainnet
$ cleos -u https://eos.greymass.com get code curve.sx
code hash: a9aa7e60901cfc3ffe481099daa7f13f0b9cdba19c64ffd18aa5789932336f8c
memo schema:
swap,<min_return>,<pair_ids>
$ cleos transfer myaccount curve.sx "10.0000 USDT" "swap,0,SXA" --contract tethertether
# => receive "10.0000 USN@danchortoken"
memo schema:
deposit,<pair_id>
$ cleos transfer myaccount curve.sx "10.0000 USDT" "deposit,SXA" --contract tethertether
$ cleos transfer myaccount curve.sx "10.0000 USN" "deposit,SXA" --contract danchortoken
$ cleos push action curve.sx deposit '["myaccount", "SXA", 200000]' -p myaccount
# => receive "20.0000 SXA@lptoken.sx"
memo schema:
N/A
$ cleos transfer myaccount curve.sx "20.0000 SXA" "" --contract lptoken.sx
# => receive "10.0000 USDT@tethertether" + "10.0000 USN@danchortoken"
$ cleos transfer myaccount curve.sx "10.0000 USDT" "deposit,SXA" --contract tethertether
$ cleos push action curve.sx cancel '["myaccount", "SXA"]' -p myaccount
# => receive "10.0000 USDT@tethertether"
#include "curve.sx.hpp"
// User Inputs
const asset in = asset{10'0000, {"USDT", 4}};
const symbol_code pair_id = symbol_code{"SXA"};
// Calculated Output
const asset out = sx::curve::get_amount_out( in, pair_id );
//=> "10.0000 USN"
Requirements:
- Bats - Bash Automated Testing System
- EOSIO -
nodeos
is the core service daemon &cleos
command line tool - Blanc - Toolchain for WebAssembly-based Blockchain Contracts
$ ./scripts/build.sh
$ ./scripts/restart.sh
$ ./test.sh