Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
exchange_state.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <sysio/asset.hpp>
4#include <sysio/multi_index.hpp>
5
6namespace sysiosystem {
7
8 using sysio::asset;
9 using sysio::symbol;
10
17 struct [[sysio::table, sysio::contract("sysio.system")]] exchange_state {
19
20 struct connector {
22 double weight = .5;
23
24 SYSLIB_SERIALIZE( connector, (balance)(weight) )
25 };
26
29
30 uint64_t primary_key()const { return supply.symbol.raw(); }
31
32 asset convert_to_exchange( connector& reserve, const asset& payment );
33 asset convert_from_exchange( connector& reserve, const asset& tokens );
34 asset convert( const asset& from, const symbol& to );
35 asset direct_convert( const asset& from, const symbol& to );
36
37 static int64_t get_bancor_output( int64_t inp_reserve,
38 int64_t out_reserve,
39 int64_t inp );
40 static int64_t get_bancor_input( int64_t out_reserve,
41 int64_t inp_reserve,
42 int64_t out );
43
44 SYSLIB_SERIALIZE( exchange_state, (supply)(base)(quote) )
45 };
46
47 typedef sysio::multi_index< "rammarket"_n, exchange_state > rammarket;
48}
sysio::multi_index< "rammarket"_n, exchange_state > rammarket
signed __int64 int64_t
Definition stdint.h:135
unsigned __int64 uint64_t
Definition stdint.h:136