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
6
namespace
sysiosystem
{
7
8
using
sysio::asset
;
9
using
sysio::symbol
;
10
17
struct
[[sysio::table,
sysio
::contract("sysio.system")]]
exchange_state
{
18
asset
supply
;
19
20
struct
connector
{
21
asset
balance
;
22
double
weight = .5;
23
24
SYSLIB_SERIALIZE(
connector
, (balance)(weight) )
25
};
26
27
connector
base
;
28
connector
quote
;
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::chain::symbol
Definition
symbol.hpp:57
sysio
Definition
abi_serializer.cpp:8
sysiosystem
Definition
block_info.hpp:10
sysiosystem::rammarket
sysio::multi_index< "rammarket"_n, exchange_state > rammarket
Definition
exchange_state.hpp:47
int64_t
signed __int64 int64_t
Definition
stdint.h:135
uint64_t
unsigned __int64 uint64_t
Definition
stdint.h:136
sysio::chain::asset
Definition
asset.hpp:18
sysiosystem::exchange_state::connector
Definition
exchange_state.hpp:20
sysiosystem::exchange_state::connector::balance
asset balance
Definition
exchange_state.hpp:21
sysiosystem::exchange_state
Definition
exchange_state.hpp:17
sysiosystem::exchange_state::supply
asset supply
Definition
exchange_state.hpp:18
sysiosystem::exchange_state::quote
connector quote
Definition
exchange_state.hpp:28
sysiosystem::exchange_state::base
connector base
Definition
exchange_state.hpp:27
sysiosystem::exchange_state::primary_key
uint64_t primary_key() const
Definition
exchange_state.hpp:30
wire-system-contracts
contracts
sysio.system
include
sysio.system
exchange_state.hpp
Generated by
1.12.0