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 (2020-03)
Local
$ git checkout v1.0.2
$ eosio-cpp --version
eosio-cpp version 1.7.0
$ eosio-cpp curve.sx.cpp -I include
$ shasum -a 256 curve.sx.wasm
9126cde6ddd504df91922aff921f42e5a5618b6d38df5184c865dc4112ac4880 curve.sx.wasm
EOS Mainnet
$ cleos -u https://api.eosn.io get code curve.sx
code hash: 9126cde6ddd504df91922aff921f42e5a5618b6d38df5184c865dc4112ac4880
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 [email protected]"
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