Peripheral EOSIO smart contracts for interacting with Evolution Dex
#include <sx.evodex/evodex.hpp>
#include <sx.uniswap/uniswap.hpp>
// user input
const asset quantity = asset{10000, symbol{"EOS", 4}};
const uint64_t pair_id = "EOSUSDT"; // EOS/USDT pair
// get evodex info
const auto [ reserve_in, reserve_out ] = evodex::get_reserves( pair_id, quantity.symbol );
const uint8_t fee = evodex::get_fee();
// calculate out price
const asset out = uniswap::get_amount_out( quantity, reserves_in, reserves_out, fee );
// => "2.6500 USDT"Get reserves for a pair
{string} pair_id- pair id{symbol} sort- sort by symbol (reserve0 will be first item in pair)
{pair<asset, asset>}- pair of reserve assets
const uint64_t pair_id = "EOSUSDT";
const symbol sort = symbol{"EOS", 4};
const auto [reserve0, reserve1] = evodex::get_reserves( pair_id, sort );
// reserve0 => "4638.5353 EOS"
// reserve1 => "13614.8381 USDT"Get total fee
{uint8_t}- total fee (trade + protocol)
const uint8_t fee = evodex::get_fee();
// => 30