// `rex_balance` structure underlying the rex balance table. A rex balance table entry is defined by:
// - `version` defaulted to zero,
// - `owner` the owner of the rex fund,
// - `vote_stake` the amount of CORE_SYMBOL currently included in owner's vote,
// - `rex_balance` the amount of REX owned by owner,
// - `matured_rex` matured REX available for selling
struct [[eosio::table,eosio::contract("eosio.system")]] rex_balance {
uint8_t version = 0;
name owner;
asset vote_stake;
asset rex_balance;
int64_t matured_rex = 0;
std::vector<pair_time_point_sec_int64> rex_maturities; /// REX daily maturity buckets
uint64_t primary_key()const { return owner.value; }
};
typedef eosio::multi_index< "rexbal"_n, rex_balance > rex_balance_table;
Purpose
Force close matured REX positions to automatically be sold when REX is matured, balance is credited to user's balance
Feedback provided by
Code example
Preconditions
mvtosavings
wheneverbuyrex
is triggeredprocess_rex_maturities
must applysell_rex
ifmatured_rex
is a positive amount.add_to_rex_balance
sellrex
updaterex
mvtosavings
mvfrsavings
sell_rex
private method withoutrequire_auth( from );
authority checkprocess_rex_maturities
require_auth( owner );
fromupdaterex
actionprocess_rex_maturities
to another accountReferences
sellrex
process_rex_maturities
rexbal
add_to_rex_balance
fill_rex_order