Skip to content

stableex/sx.sovdex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

SovDex

Peripheral EOSIO smart contracts for interacting with SovDex exchange

Dependencies

Quickstart

#include <sx.sovdex/sovdex.hpp>
#include <sx.uniswap/uniswap.hpp>

// user input
const asset quantity = asset{10000, symbol{"EOS", 4}};
const symbol_out = symbol{"SVX", 4}};

// get sovdex info
const auto [ reserve_in, reserve_out ] = sovdex::get_reserves( quantity.symbol, symbol_out );
const uint8_t fee = sovdex::get_fee();

// calculate out price
const asset out = uniswap::get_amount_out( quantity, reserves_in, reserves_out, fee );
// => "2.6500 USDT"

Table of Content

STATIC get_reserves

Get reserves for a pair

params

  • {symbol} symbol_in - symbol to convert from
  • {symbol} symbol_out - symbol to convert to

returns

  • {pair<asset, asset>} - pair of reserve assets

example

const symbol from = symbol{"EOS", 4};
const symbol to = symbol{"SVX", 4};

const auto [reserve0, reserve1] = sovdex::get_reserves( from, to );
// reserve0 => "4585193.1234 EOS"
// reserve1 => "12568203.3533 USDT"

STATIC get_fee

Get SovDex total fee

returns

  • {uint8_t} - total fee (trade + protocol)

example

const uint8_t fee = sovdex::get_fee();
// => 0

About

SovDex exchange interface

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages