3#include <sysio/asset.hpp>
4#include <sysio/sysio.hpp>
25 class [[sysio::contract(
"sysio.token")]]
token :
public contract {
27 using contract::contract;
41 void create(
const name& issuer,
42 const asset& maximum_supply);
51 void issue(
const name& to,
const asset& quantity,
const string& memo );
61 void retire(
const asset& quantity,
const string& memo );
73 void transfer(
const name& from,
75 const asset& quantity,
106 stats statstable( token_contract_account, sym_code.raw() );
107 const auto& st = statstable.get( sym_code.raw(),
"invalid supply symbol code" );
113 accounts accountstable( token_contract_account, owner.value );
114 const auto& ac = accountstable.get( sym_code.raw(),
"no balance with specified symbol" );
122 using open_action = sysio::action_wrapper<
"open"_n, &token::open>;
125 struct [[sysio::table]] account {
128 uint64_t primary_key()
const {
return balance.symbol.code().raw(); }
131 struct [[sysio::table]] currency_stats {
136 uint64_t primary_key()
const {
return supply.symbol.code().raw(); }
139 typedef sysio::multi_index<
"accounts"_n, account > accounts;
140 typedef sysio::multi_index<
"stat"_n, currency_stats > stats;
142 void sub_balance(
const name& owner,
const asset&
value );
143 void add_balance(
const name& owner,
const asset&
value,
const name& ram_payer );
sysio::action_wrapper<"issue"_n, &token::issue > issue_action
static asset get_balance(const name &token_contract_account, const name &owner, const symbol_code &sym_code)
sysio::action_wrapper<"create"_n, &token::create > create_action
sysio::action_wrapper<"transfer"_n, &token::transfer > transfer_action
sysio::action_wrapper<"open"_n, &token::open > open_action
static asset get_supply(const name &token_contract_account, const symbol_code &sym_code)
sysio::action_wrapper<"close"_n, &token::close > close_action
sysio::action_wrapper<"retire"_n, &token::retire > retire_action
void close(T *e, websocketpp::connection_hdl hdl)
unsigned __int64 uint64_t
Immutable except for fc::from_variant.