From 3c520a3ab1fe87da86e27af431773524d90d8778 Mon Sep 17 00:00:00 2001 From: jalbiero <51678384+jalbiero@users.noreply.github.com> Date: Fri, 2 Aug 2019 20:28:08 -0300 Subject: [PATCH 1/6] [KEW-1450] Minor fix --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8345888d..a75fc15d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog -## Pending (wax-1.5.2-X.Y.Z) +## Pending (wax-1.7.0-X.Y.Z) BREAKING CHANGES: From 467a2944ac3067b338fea939f27db0de2a883ded Mon Sep 17 00:00:00 2001 From: Ernesto Messina Date: Wed, 7 Aug 2019 00:31:58 -0300 Subject: [PATCH 2/6] [KEW-1468] Removed REX references. --- contracts/eosio.system/CMakeLists.txt | 1 - .../include/eosio.system/eosio.system.hpp | 499 ------------------ .../eosio.system/src/delegate_bandwidth.cpp | 3 - contracts/eosio.system/src/eosio.system.cpp | 6 +- contracts/eosio.system/src/producer_pay.cpp | 1 - contracts/eosio.system/src/voting.cpp | 5 - 6 files changed, 1 insertion(+), 514 deletions(-) diff --git a/contracts/eosio.system/CMakeLists.txt b/contracts/eosio.system/CMakeLists.txt index 3f909084..25753452 100755 --- a/contracts/eosio.system/CMakeLists.txt +++ b/contracts/eosio.system/CMakeLists.txt @@ -4,7 +4,6 @@ add_contract(eosio.system eosio.system ${CMAKE_CURRENT_SOURCE_DIR}/src/exchange_state.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/native.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/producer_pay.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/rex.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/voting.cpp ) diff --git a/contracts/eosio.system/include/eosio.system/eosio.system.hpp b/contracts/eosio.system/include/eosio.system/eosio.system.hpp index 209a9be6..ec5f2e69 100755 --- a/contracts/eosio.system/include/eosio.system/eosio.system.hpp +++ b/contracts/eosio.system/include/eosio.system/eosio.system.hpp @@ -400,168 +400,6 @@ namespace eosiosystem { typedef eosio::multi_index< "genesis"_n, genesis_tokens > genesis_balance_table; typedef eosio::multi_index< "genonce"_n, genesis_nonce > genesis_nonce_table; - /** - * `rex_pool` structure underlying the rex pool table. - * - * @details A rex pool table entry is defined by: - * - `version` defaulted to zero, - * - `total_lent` total amount of CORE_SYMBOL in open rex_loans - * - `total_unlent` total amount of CORE_SYMBOL available to be lent (connector), - * - `total_rent` fees received in exchange for lent (connector), - * - `total_lendable` total amount of CORE_SYMBOL that have been lent (total_unlent + total_lent), - * - `total_rex` total number of REX shares allocated to contributors to total_lendable, - * - `namebid_proceeds` the amount of CORE_SYMBOL to be transferred from namebids to REX pool, - * - `loan_num` increments with each new loan. - */ - struct [[eosio::table,eosio::contract("eosio.system")]] rex_pool { - uint8_t version = 0; - asset total_lent; - asset total_unlent; - asset total_rent; - asset total_lendable; - asset total_rex; - asset namebid_proceeds; - uint64_t loan_num = 0; - - uint64_t primary_key()const { return 0; } - }; - - /** - * Rex pool table - * - * @details The rex pool table is storing the only one instance of rex_pool which it stores - * the global state of the REX system. - */ - typedef eosio::multi_index< "rexpool"_n, rex_pool > rex_pool_table; - - /** - * `rex_fund` structure underlying the rex fund table. - * - * @details A rex fund table entry is defined by: - * - `version` defaulted to zero, - * - `owner` the owner of the rex fund, - * - `balance` the balance of the fund. - */ - struct [[eosio::table,eosio::contract("eosio.system")]] rex_fund { - uint8_t version = 0; - name owner; - asset balance; - - uint64_t primary_key()const { return owner.value; } - }; - - /** - * Rex fund table - * - * @details The rex fund table is storing all the `rex_fund`s instances. - */ - typedef eosio::multi_index< "rexfund"_n, rex_fund > rex_fund_table; - - /** - * `rex_balance` structure underlying the rex balance table. - * - * @details 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::deque> rex_maturities; /// REX daily maturity buckets - - uint64_t primary_key()const { return owner.value; } - }; - - /** - * Rex balance table - * - * @details The rex balance table is storing all the `rex_balance`s instances. - */ - typedef eosio::multi_index< "rexbal"_n, rex_balance > rex_balance_table; - - /** - * `rex_loan` structure underlying the `rex_cpu_loan_table` and `rex_net_loan_table`. - * - * @details A rex net/cpu loan table entry is defined by: - * - `version` defaulted to zero, - * - `from` account creating and paying for loan, - * - `receiver` account receiving rented resources, - * - `payment` SYS tokens paid for the loan, - * - `balance` is the amount of SYS tokens available to be used for loan auto-renewal, - * - `total_staked` total amount staked, - * - `loan_num` loan number/id, - * - `expiration` the expiration time when loan will be either closed or renewed - * If payment <= balance, the loan is renewed, and closed otherwise. - */ - struct [[eosio::table,eosio::contract("eosio.system")]] rex_loan { - uint8_t version = 0; - name from; - name receiver; - asset payment; - asset balance; - asset total_staked; - uint64_t loan_num; - eosio::time_point expiration; - - uint64_t primary_key()const { return loan_num; } - uint64_t by_expr()const { return expiration.elapsed.count(); } - uint64_t by_owner()const { return from.value; } - }; - - /** - * Rex cpu loan table - * - * @details The rex cpu loan table is storing all the `rex_loan`s instances for cpu, indexed by loan number, expiration and owner. - */ - typedef eosio::multi_index< "cpuloan"_n, rex_loan, - indexed_by<"byexpr"_n, const_mem_fun>, - indexed_by<"byowner"_n, const_mem_fun> - > rex_cpu_loan_table; - - /** - * Rex net loan table - * - * @details The rex net loan table is storing all the `rex_loan`s instances for net, indexed by loan number, expiration and owner. - */ - typedef eosio::multi_index< "netloan"_n, rex_loan, - indexed_by<"byexpr"_n, const_mem_fun>, - indexed_by<"byowner"_n, const_mem_fun> - > rex_net_loan_table; - - struct [[eosio::table,eosio::contract("eosio.system")]] rex_order { - uint8_t version = 0; - name owner; - asset rex_requested; - asset proceeds; - asset stake_change; - eosio::time_point order_time; - bool is_open = true; - - void close() { is_open = false; } - uint64_t primary_key()const { return owner.value; } - uint64_t by_time()const { return is_open ? order_time.elapsed.count() : std::numeric_limits::max(); } - }; - - /** - * Rex order table - * - * @details The rex order table is storing all the `rex_order`s instances, indexed by owner and time and owner. - */ - typedef eosio::multi_index< "rexqueue"_n, rex_order, - indexed_by<"bytime"_n, const_mem_fun>> rex_order_table; - - struct rex_order_outcome { - bool success; - asset proceeds; - asset stake_change; - }; - /** * The EOSIO system contract. * @@ -580,10 +418,6 @@ namespace eosiosystem { eosio_global_state2 _gstate2; eosio_global_state3 _gstate3; rammarket _rammarket; - rex_pool_table _rexpool; - rex_fund_table _rexfunds; - rex_balance_table _rexbalance; - rex_order_table _rexorders; public: static constexpr eosio::name active_permission{"active"_n}; @@ -597,11 +431,9 @@ namespace eosiosystem { static constexpr eosio::name saving_account{"eosio.saving"_n}; static constexpr eosio::name voters_account{"eosio.voters"_n}; static constexpr eosio::name genesis_account{"genesis.wax"_n}; - static constexpr eosio::name rex_account{"eosio.rex"_n}; static constexpr eosio::name null_account{"eosio.null"_n}; static constexpr symbol ramcore_symbol = symbol(symbol_code("RAMCORE"), 4); static constexpr symbol ram_symbol = symbol(symbol_code("RAM"), 0); - static constexpr symbol rex_symbol = symbol(symbol_code("REX"), 4); /** * System contract constructor. @@ -735,281 +567,6 @@ namespace eosiosystem { void delegatebw( const name& from, const name& receiver, const asset& stake_net_quantity, const asset& stake_cpu_quantity, bool transfer ); - /** - * Setrex action. - * - * @details Sets total_rent balance of REX pool to the passed value. - * @param balance - amount to set the REX pool balance. - */ - [[eosio::action]] - void setrex( const asset& balance ); - - /** - * Deposit to REX fund action. - * - * @details Deposits core tokens to user REX fund. - * All proceeds and expenses related to REX are added to or taken out of this fund. - * An inline transfer from 'owner' liquid balance is executed. - * All REX-related costs and proceeds are deducted from and added to 'owner' REX fund, - * with one exception being buying REX using staked tokens. - * Storage change is billed to 'owner'. - * - * @param owner - REX fund owner account, - * @param amount - amount of tokens to be deposited. - */ - [[eosio::action]] - void deposit( const name& owner, const asset& amount ); - - /** - * Withdraw from REX fund action. - * - * @details Withdraws core tokens from user REX fund. - * An inline token transfer to user balance is executed. - * - * @param owner - REX fund owner account, - * @param amount - amount of tokens to be withdrawn. - */ - [[eosio::action]] - void withdraw( const name& owner, const asset& amount ); - - /** - * Buyrex action. - * - * @details Buys REX in exchange for tokens taken out of user's REX fund by transfering - * core tokens from user REX fund and converts them to REX stake. By buying REX, user is - * lending tokens in order to be rented as CPU or NET resourses. - * Storage change is billed to 'from' account. - * - * @param from - owner account name, - * @param amount - amount of tokens taken out of 'from' REX fund. - * - * @pre A voting requirement must be satisfied before action can be executed. - * @pre User must vote for at least 21 producers or delegate vote to proxy before buying REX. - * - * @post User votes are updated following this action. - * @post Tokens used in purchase are added to user's voting power. - * @post Bought REX cannot be sold before 4 days counting from end of day of purchase. - */ - [[eosio::action]] - void buyrex( const name& from, const asset& amount ); - - /** - * Unstaketorex action. - * - * @details Use staked core tokens to buy REX. - * Storage change is billed to 'owner' account. - * - * @param owner - owner of staked tokens, - * @param receiver - account name that tokens have previously been staked to, - * @param from_net - amount of tokens to be unstaked from NET bandwidth and used for REX purchase, - * @param from_cpu - amount of tokens to be unstaked from CPU bandwidth and used for REX purchase. - * - * @pre A voting requirement must be satisfied before action can be executed. - * @pre User must vote for at least 21 producers or delegate vote to proxy before buying REX. - * - * @post User votes are updated following this action. - * @post Tokens used in purchase are added to user's voting power. - * @post Bought REX cannot be sold before 4 days counting from end of day of purchase. - */ - [[eosio::action]] - void unstaketorex( const name& owner, const name& receiver, const asset& from_net, const asset& from_cpu ); - - /** - * Sellrex action. - * - * @details Sells REX in exchange for core tokens by converting REX stake back into core tokens - * at current exchange rate. If order cannot be processed, it gets queued until there is enough - * in REX pool to fill order, and will be processed within 30 days at most. If successful, user - * votes are updated, that is, proceeds are deducted from user's voting power. In case sell order - * is queued, storage change is billed to 'from' account. - * - * @param from - owner account of REX, - * @param rex - amount of REX to be sold. - */ - [[eosio::action]] - void sellrex( const name& from, const asset& rex ); - - /** - * Cnclrexorder action. - * - * @details Cancels unfilled REX sell order by owner if one exists. - * - * @param owner - owner account name. - * - * @pre Order cannot be cancelled once it's been filled. - */ - [[eosio::action]] - void cnclrexorder( const name& owner ); - - /** - * Rentcpu action. - * - * @details Use payment to rent as many SYS tokens as possible as determined by market price and - * stake them for CPU for the benefit of receiver, after 30 days the rented core delegation of CPU - * will expire. At expiration, if balance is greater than or equal to `loan_payment`, `loan_payment` - * is taken out of loan balance and used to renew the loan. Otherwise, the loan is closed and user - * is refunded any remaining balance. - * Owner can fund or refund a loan at any time before its expiration. - * All loan expenses and refunds come out of or are added to owner's REX fund. - * - * @param from - account creating and paying for CPU loan, 'from' account can add tokens to loan - * balance using action `fundcpuloan` and withdraw from loan balance using `defcpuloan` - * @param receiver - account receiving rented CPU resources, - * @param loan_payment - tokens paid for the loan, it has to be greater than zero, - * amount of rented resources is calculated from `loan_payment`, - * @param loan_fund - additional tokens can be zero, and is added to loan balance. - * Loan balance represents a reserve that is used at expiration for automatic loan renewal. - */ - [[eosio::action]] - void rentcpu( const name& from, const name& receiver, const asset& loan_payment, const asset& loan_fund ); - - /** - * Rentnet action. - * - * @details Use payment to rent as many SYS tokens as possible as determined by market price and - * stake them for NET for the benefit of receiver, after 30 days the rented core delegation of NET - * will expire. At expiration, if balance is greater than or equal to `loan_payment`, `loan_payment` - * is taken out of loan balance and used to renew the loan. Otherwise, the loan is closed and user - * is refunded any remaining balance. - * Owner can fund or refund a loan at any time before its expiration. - * All loan expenses and refunds come out of or are added to owner's REX fund. - * - * @param from - account creating and paying for NET loan, 'from' account can add tokens to loan - * balance using action `fundnetloan` and withdraw from loan balance using `defnetloan`, - * @param receiver - account receiving rented NET resources, - * @param loan_payment - tokens paid for the loan, it has to be greater than zero, - * amount of rented resources is calculated from `loan_payment`, - * @param loan_fund - additional tokens can be zero, and is added to loan balance. - * Loan balance represents a reserve that is used at expiration for automatic loan renewal. - */ - [[eosio::action]] - void rentnet( const name& from, const name& receiver, const asset& loan_payment, const asset& loan_fund ); - - /** - * Fundcpuloan action. - * - * @details Transfers tokens from REX fund to the fund of a specific CPU loan in order to - * be used for loan renewal at expiry. - * - * @param from - loan creator account, - * @param loan_num - loan id, - * @param payment - tokens transfered from REX fund to loan fund. - */ - [[eosio::action]] - void fundcpuloan( const name& from, uint64_t loan_num, const asset& payment ); - - /** - * Fundnetloan action. - * - * @details Transfers tokens from REX fund to the fund of a specific NET loan in order to - * be used for loan renewal at expiry. - * - * @param from - loan creator account, - * @param loan_num - loan id, - * @param payment - tokens transfered from REX fund to loan fund. - */ - [[eosio::action]] - void fundnetloan( const name& from, uint64_t loan_num, const asset& payment ); - - /** - * Defcpuloan action. - * - * @details Withdraws tokens from the fund of a specific CPU loan and adds them to REX fund. - * - * @param from - loan creator account, - * @param loan_num - loan id, - * @param amount - tokens transfered from CPU loan fund to REX fund. - */ - [[eosio::action]] - void defcpuloan( const name& from, uint64_t loan_num, const asset& amount ); - - /** - * Defnetloan action. - * - * @details Withdraws tokens from the fund of a specific NET loan and adds them to REX fund. - * - * @param from - loan creator account, - * @param loan_num - loan id, - * @param amount - tokens transfered from NET loan fund to REX fund. - */ - [[eosio::action]] - void defnetloan( const name& from, uint64_t loan_num, const asset& amount ); - - /** - * Updaterex action. - * - * @details Updates REX owner vote weight to current value of held REX tokens. - * - * @param owner - REX owner account. - */ - [[eosio::action]] - void updaterex( const name& owner ); - - /** - * Rexexec action. - * - * @details Processes max CPU loans, max NET loans, and max queued sellrex orders. - * Action does not execute anything related to a specific user. - * - * @param user - any account can execute this action, - * @param max - number of each of CPU loans, NET loans, and sell orders to be processed. - */ - [[eosio::action]] - void rexexec( const name& user, uint16_t max ); - - /** - * Consolidate action. - * - * @details Consolidates REX maturity buckets into one bucket that can be sold after 4 days - * starting from the end of the day. - * - * @param owner - REX owner account name. - */ - [[eosio::action]] - void consolidate( const name& owner ); - - /** - * Mvtosavings action. - * - * @details Moves a specified amount of REX into savings bucket. REX savings bucket - * never matures. In order for it to be sold, it has to be moved explicitly - * out of that bucket. Then the moved amount will have the regular maturity - * period of 4 days starting from the end of the day. - * - * @param owner - REX owner account name. - * @param rex - amount of REX to be moved. - */ - [[eosio::action]] - void mvtosavings( const name& owner, const asset& rex ); - - /** - * Mvfrsavings action. - * - * @details Moves a specified amount of REX out of savings bucket. The moved amount - * will have the regular REX maturity period of 4 days. - * - * @param owner - REX owner account name. - * @param rex - amount of REX to be moved. - */ - [[eosio::action]] - void mvfrsavings( const name& owner, const asset& rex ); - - /** - * Closerex action. - * - * @details Deletes owner records from REX tables and frees used RAM. Owner must not have - * an outstanding REX balance. - * - * @param owner - user account name. - * - * @pre If owner has a non-zero REX balance, the action fails; otherwise, - * owner REX balance entry is deleted. - * @pre If owner has no outstanding loans and a zero REX fund balance, - * REX fund entry is deleted. - */ - [[eosio::action]] - void closerex( const name& owner ); - /** * Undelegate bandwitdh action. * @@ -1331,25 +888,6 @@ namespace eosiosystem { using setacctcpu_action = eosio::action_wrapper<"setacctcpu"_n, &system_contract::setacctcpu>; using activate_action = eosio::action_wrapper<"activate"_n, &system_contract::activate>; using delegatebw_action = eosio::action_wrapper<"delegatebw"_n, &system_contract::delegatebw>; - using deposit_action = eosio::action_wrapper<"deposit"_n, &system_contract::deposit>; - using withdraw_action = eosio::action_wrapper<"withdraw"_n, &system_contract::withdraw>; - using buyrex_action = eosio::action_wrapper<"buyrex"_n, &system_contract::buyrex>; - using unstaketorex_action = eosio::action_wrapper<"unstaketorex"_n, &system_contract::unstaketorex>; - using sellrex_action = eosio::action_wrapper<"sellrex"_n, &system_contract::sellrex>; - using cnclrexorder_action = eosio::action_wrapper<"cnclrexorder"_n, &system_contract::cnclrexorder>; - using rentcpu_action = eosio::action_wrapper<"rentcpu"_n, &system_contract::rentcpu>; - using rentnet_action = eosio::action_wrapper<"rentnet"_n, &system_contract::rentnet>; - using fundcpuloan_action = eosio::action_wrapper<"fundcpuloan"_n, &system_contract::fundcpuloan>; - using fundnetloan_action = eosio::action_wrapper<"fundnetloan"_n, &system_contract::fundnetloan>; - using defcpuloan_action = eosio::action_wrapper<"defcpuloan"_n, &system_contract::defcpuloan>; - using defnetloan_action = eosio::action_wrapper<"defnetloan"_n, &system_contract::defnetloan>; - using updaterex_action = eosio::action_wrapper<"updaterex"_n, &system_contract::updaterex>; - using rexexec_action = eosio::action_wrapper<"rexexec"_n, &system_contract::rexexec>; - using setrex_action = eosio::action_wrapper<"setrex"_n, &system_contract::setrex>; - using mvtosavings_action = eosio::action_wrapper<"mvtosavings"_n, &system_contract::mvtosavings>; - using mvfrsavings_action = eosio::action_wrapper<"mvfrsavings"_n, &system_contract::mvfrsavings>; - using consolidate_action = eosio::action_wrapper<"consolidate"_n, &system_contract::consolidate>; - using closerex_action = eosio::action_wrapper<"closerex"_n, &system_contract::closerex>; using awardgenesis_action = eosio::action_wrapper<"awardgenesis"_n, &system_contract::awardgenesis>; using delgenesis_action = eosio::action_wrapper<"delgenesis"_n, &system_contract::delgenesis>; using removerefund_action = eosio::action_wrapper<"removerefund"_n, &system_contract::removerefund>; @@ -1396,41 +934,6 @@ namespace eosiosystem { symbol core_symbol()const; void update_ram_supply(); - // defined in rex.cpp - void runrex( uint16_t max ); - void update_resource_limits( const name& from, const name& receiver, int64_t delta_net, int64_t delta_cpu ); - void check_voting_requirement( const name& owner, - const char* error_msg = "must vote for at least 21 producers or for a proxy before buying REX" )const; - rex_order_outcome fill_rex_order( const rex_balance_table::const_iterator& bitr, const asset& rex ); - asset update_rex_account( const name& owner, const asset& proceeds, const asset& unstake_quant, bool force_vote_update = false ); - void channel_to_rex( const name& from, const asset& amount ); - void channel_namebid_to_rex( const int64_t highest_bid ); - template - int64_t rent_rex( T& table, const name& from, const name& receiver, const asset& loan_payment, const asset& loan_fund ); - template - void fund_rex_loan( T& table, const name& from, uint64_t loan_num, const asset& payment ); - template - void defund_rex_loan( T& table, const name& from, uint64_t loan_num, const asset& amount ); - void transfer_from_fund( const name& owner, const asset& amount ); - void transfer_to_fund( const name& owner, const asset& amount ); - bool rex_loans_available()const; - bool rex_system_initialized()const { return _rexpool.begin() != _rexpool.end(); } - bool rex_available()const { return rex_system_initialized() && _rexpool.begin()->total_rex.amount > 0; } - static time_point_sec get_rex_maturity(); - asset add_to_rex_balance( const name& owner, const asset& payment, const asset& rex_received ); - asset add_to_rex_pool( const asset& payment ); - void process_rex_maturities( const rex_balance_table::const_iterator& bitr ); - void consolidate_rex_balance( const rex_balance_table::const_iterator& bitr, - const asset& rex_in_sell_order ); - int64_t read_rex_savings( const rex_balance_table::const_iterator& bitr ); - void put_rex_savings( const rex_balance_table::const_iterator& bitr, int64_t rex ); - void update_rex_stake( const name& voter ); - - void add_loan_to_rex_pool( const asset& payment, int64_t rented_tokens, bool new_loan ); - void remove_loan_from_rex_pool( const rex_loan& loan ); - template - int64_t update_renewed_loan( Index& idx, const Iterator& itr, int64_t rented_tokens ); - // defined in delegate_bandwidth.cpp void changebw( name from, const name& receiver, const asset& stake_net_quantity, const asset& stake_cpu_quantity, bool transfer ); @@ -1480,8 +983,6 @@ namespace eosiosystem { system_contract* this_contract; }; - - registration<&system_contract::update_rex_stake> vote_stake_updater{ this }; }; /** @}*/ // end of @defgroup eosiosystem eosio.system diff --git a/contracts/eosio.system/src/delegate_bandwidth.cpp b/contracts/eosio.system/src/delegate_bandwidth.cpp index 748fc063..a3f0eef4 100755 --- a/contracts/eosio.system/src/delegate_bandwidth.cpp +++ b/contracts/eosio.system/src/delegate_bandwidth.cpp @@ -67,7 +67,6 @@ namespace eosiosystem { if ( fee.amount > 0 ) { token::transfer_action transfer_act{ token_account, { {payer, active_permission} } }; transfer_act.send( payer, ramfee_account, fee, "ram fee" ); - channel_to_rex( ramfee_account, fee ); } int64_t bytes_out; @@ -157,7 +156,6 @@ namespace eosiosystem { if ( fee > 0 ) { token::transfer_action transfer_act{ token_account, { {account, active_permission} } }; transfer_act.send( account, ramfee_account, asset(fee, core_symbol()), "sell ram fee" ); - channel_to_rex( ramfee_account, asset(fee, core_symbol() )); } } @@ -343,7 +341,6 @@ namespace eosiosystem { } } - vote_stake_updater( from ); update_voting_power( from, stake_net_delta + stake_cpu_delta ); } diff --git a/contracts/eosio.system/src/eosio.system.cpp b/contracts/eosio.system/src/eosio.system.cpp index b8105db5..84bbd122 100755 --- a/contracts/eosio.system/src/eosio.system.cpp +++ b/contracts/eosio.system/src/eosio.system.cpp @@ -17,11 +17,7 @@ namespace eosiosystem { _global(get_self(), get_self().value), _global2(get_self(), get_self().value), _global3(get_self(), get_self().value), - _rammarket(get_self(), get_self().value), - _rexpool(get_self(), get_self().value), - _rexfunds(get_self(), get_self().value), - _rexbalance(get_self(), get_self().value), - _rexorders(get_self(), get_self().value) + _rammarket(get_self(), get_self().value) { //print( "construct system\n" ); _gstate = _global.exists() ? _global.get() : get_default_parameters(); diff --git a/contracts/eosio.system/src/producer_pay.cpp b/contracts/eosio.system/src/producer_pay.cpp index 1089947a..38c43f2e 100755 --- a/contracts/eosio.system/src/producer_pay.cpp +++ b/contracts/eosio.system/src/producer_pay.cpp @@ -56,7 +56,6 @@ namespace eosiosystem { (current_time_point() - _gstate.thresh_activated_stake_time) > microseconds(14 * useconds_per_day) ) { _gstate.last_name_close = timestamp; - channel_namebid_to_rex( highest->high_bid ); idx.modify( highest, same_payer, [&]( auto& b ){ b.high_bid = -b.high_bid; }); diff --git a/contracts/eosio.system/src/voting.cpp b/contracts/eosio.system/src/voting.cpp index 0c0cf3a8..40e1a477 100755 --- a/contracts/eosio.system/src/voting.cpp +++ b/contracts/eosio.system/src/voting.cpp @@ -163,12 +163,7 @@ namespace eosiosystem { void system_contract::voteproducer( const name& voter_name, const name& proxy, const std::vector& producers ) { require_auth( voter_name ); - vote_stake_updater( voter_name ); update_votes( voter_name, proxy, producers, true ); - auto rex_itr = _rexbalance.find( voter_name.value ); - if( rex_itr != _rexbalance.end() && rex_itr->rex_balance.amount > 0 ) { - check_voting_requirement( voter_name, "voter holding REX tokens must vote for at least 21 producers or for a proxy" ); - } } void system_contract::update_votes( const name& voter_name, const name& proxy, const std::vector& producers, bool voting ) { From 259e7fdf293c734b79dc846dbd78fe235c7ed7ac Mon Sep 17 00:00:00 2001 From: Ernesto Messina Date: Wed, 7 Aug 2019 00:45:07 -0300 Subject: [PATCH 3/6] [KEW-1468] Removed unnecessary rex.cpp and rex.results.cpp files. --- CHANGELOG.md | 1 + contracts/eosio.system/CMakeLists.txt | 10 - contracts/eosio.system/src/rex.cpp | 1082 -------------------- contracts/eosio.system/src/rex.results.cpp | 11 - 4 files changed, 1 insertion(+), 1103 deletions(-) delete mode 100644 contracts/eosio.system/src/rex.cpp delete mode 100644 contracts/eosio.system/src/rex.results.cpp diff --git a/CHANGELOG.md b/CHANGELOG.md index a75fc15d..31c1c24f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ BREAKING CHANGES: FEATURES: IMPROVEMENTS: +- [KEW-1468] Removed REX referencies. BUG FIXES: diff --git a/contracts/eosio.system/CMakeLists.txt b/contracts/eosio.system/CMakeLists.txt index 25753452..7ee1cdb8 100755 --- a/contracts/eosio.system/CMakeLists.txt +++ b/contracts/eosio.system/CMakeLists.txt @@ -16,16 +16,6 @@ set_target_properties(eosio.system PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") -add_contract(rex.results rex.results ${CMAKE_CURRENT_SOURCE_DIR}/src/rex.results.cpp) - -target_include_directories(rex.results - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/include) - -set_target_properties(rex.results - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.rex") - configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/eosio.system.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/eosio.system.contracts.md @ONLY ) target_compile_options( eosio.system PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian ) diff --git a/contracts/eosio.system/src/rex.cpp b/contracts/eosio.system/src/rex.cpp deleted file mode 100644 index 4a4596e2..00000000 --- a/contracts/eosio.system/src/rex.cpp +++ /dev/null @@ -1,1082 +0,0 @@ -#include -#include -#include - -namespace eosiosystem { - - using eosio::current_time_point; - using eosio::token; - - void system_contract::deposit( const name& owner, const asset& amount ) - { - require_auth( owner ); - - check( amount.symbol == core_symbol(), "must deposit core token" ); - check( 0 < amount.amount, "must deposit a positive amount" ); - // inline transfer from owner's token balance - { - token::transfer_action transfer_act{ token_account, { owner, active_permission } }; - transfer_act.send( owner, rex_account, amount, "deposit to REX fund" ); - } - transfer_to_fund( owner, amount ); - } - - void system_contract::withdraw( const name& owner, const asset& amount ) - { - require_auth( owner ); - - check( amount.symbol == core_symbol(), "must withdraw core token" ); - check( 0 < amount.amount, "must withdraw a positive amount" ); - update_rex_account( owner, asset( 0, core_symbol() ), asset( 0, core_symbol() ) ); - transfer_from_fund( owner, amount ); - // inline transfer to owner's token balance - { - token::transfer_action transfer_act{ token_account, { rex_account, active_permission } }; - transfer_act.send( rex_account, owner, amount, "withdraw from REX fund" ); - } - } - - void system_contract::buyrex( const name& from, const asset& amount ) - { - require_auth( from ); - - check( amount.symbol == core_symbol(), "asset must be core token" ); - check( 0 < amount.amount, "must use positive amount" ); - check_voting_requirement( from ); - transfer_from_fund( from, amount ); - const asset rex_received = add_to_rex_pool( amount ); - const asset delta_rex_stake = add_to_rex_balance( from, amount, rex_received ); - runrex(2); - update_rex_account( from, asset( 0, core_symbol() ), delta_rex_stake ); - // dummy action added so that amount of REX tokens purchased shows up in action trace - rex_results::buyresult_action buyrex_act( rex_account, std::vector{ } ); - buyrex_act.send( rex_received ); - } - - void system_contract::unstaketorex( const name& owner, const name& receiver, const asset& from_net, const asset& from_cpu ) - { - require_auth( owner ); - - check( from_net.symbol == core_symbol() && from_cpu.symbol == core_symbol(), "asset must be core token" ); - check( (0 <= from_net.amount) && (0 <= from_cpu.amount) && (0 < from_net.amount || 0 < from_cpu.amount), - "must unstake a positive amount to buy rex" ); - check_voting_requirement( owner ); - - { - del_bandwidth_table dbw_table( get_self(), owner.value ); - auto del_itr = dbw_table.require_find( receiver.value, "delegated bandwidth record does not exist" ); - check( from_net.amount <= del_itr->net_weight.amount, "amount exceeds tokens staked for net"); - check( from_cpu.amount <= del_itr->cpu_weight.amount, "amount exceeds tokens staked for cpu"); - dbw_table.modify( del_itr, same_payer, [&]( delegated_bandwidth& dbw ) { - dbw.net_weight.amount -= from_net.amount; - dbw.cpu_weight.amount -= from_cpu.amount; - }); - if ( del_itr->is_empty() ) { - dbw_table.erase( del_itr ); - } - } - - update_resource_limits( name(0), receiver, -from_net.amount, -from_cpu.amount ); - - const asset payment = from_net + from_cpu; - // inline transfer from stake_account to rex_account - { - token::transfer_action transfer_act{ token_account, { stake_account, active_permission } }; - transfer_act.send( stake_account, rex_account, payment, "buy REX with staked tokens" ); - } - const asset rex_received = add_to_rex_pool( payment ); - add_to_rex_balance( owner, payment, rex_received ); - runrex(2); - update_rex_account( owner, asset( 0, core_symbol() ), asset( 0, core_symbol() ), true ); - // dummy action added so that amount of REX tokens purchased shows up in action trace - rex_results::buyresult_action buyrex_act( rex_account, std::vector{ } ); - buyrex_act.send( rex_received ); - } - - void system_contract::sellrex( const name& from, const asset& rex ) - { - require_auth( from ); - - runrex(2); - - auto bitr = _rexbalance.require_find( from.value, "user must first buyrex" ); - check( rex.amount > 0 && rex.symbol == bitr->rex_balance.symbol, - "asset must be a positive amount of (REX, 4)" ); - process_rex_maturities( bitr ); - check( rex.amount <= bitr->matured_rex, "insufficient available rex" ); - - const auto current_order = fill_rex_order( bitr, rex ); - if ( current_order.success && current_order.proceeds.amount == 0 ) { - check( false, "proceeds are negligible" ); - } - asset pending_sell_order = update_rex_account( from, current_order.proceeds, current_order.stake_change ); - if ( !current_order.success ) { - if ( from == "b1"_n ) { - check( false, "b1 sellrex orders should not be queued" ); - } - /** - * REX order couldn't be filled and is added to queue. - * If account already has an open order, requested rex is added to existing order. - */ - auto oitr = _rexorders.find( from.value ); - if ( oitr == _rexorders.end() ) { - oitr = _rexorders.emplace( from, [&]( auto& order ) { - order.owner = from; - order.rex_requested = rex; - order.is_open = true; - order.proceeds = asset( 0, core_symbol() ); - order.stake_change = asset( 0, core_symbol() ); - order.order_time = current_time_point(); - }); - } else { - _rexorders.modify( oitr, same_payer, [&]( auto& order ) { - order.rex_requested.amount += rex.amount; - }); - } - pending_sell_order.amount = oitr->rex_requested.amount; - } - check( pending_sell_order.amount <= bitr->matured_rex, "insufficient funds for current and scheduled orders" ); - // dummy action added so that sell order proceeds show up in action trace - if ( current_order.success ) { - rex_results::sellresult_action sellrex_act( rex_account, std::vector{ } ); - sellrex_act.send( current_order.proceeds ); - } - } - - void system_contract::cnclrexorder( const name& owner ) - { - require_auth( owner ); - - auto itr = _rexorders.require_find( owner.value, "no sellrex order is scheduled" ); - check( itr->is_open, "sellrex order has been filled and cannot be canceled" ); - _rexorders.erase( itr ); - } - - void system_contract::rentcpu( const name& from, const name& receiver, const asset& loan_payment, const asset& loan_fund ) - { - require_auth( from ); - - rex_cpu_loan_table cpu_loans( get_self(), get_self().value ); - int64_t rented_tokens = rent_rex( cpu_loans, from, receiver, loan_payment, loan_fund ); - update_resource_limits( from, receiver, 0, rented_tokens ); - } - - void system_contract::rentnet( const name& from, const name& receiver, const asset& loan_payment, const asset& loan_fund ) - { - require_auth( from ); - - rex_net_loan_table net_loans( get_self(), get_self().value ); - int64_t rented_tokens = rent_rex( net_loans, from, receiver, loan_payment, loan_fund ); - update_resource_limits( from, receiver, rented_tokens, 0 ); - } - - void system_contract::fundcpuloan( const name& from, uint64_t loan_num, const asset& payment ) - { - require_auth( from ); - - rex_cpu_loan_table cpu_loans( get_self(), get_self().value ); - fund_rex_loan( cpu_loans, from, loan_num, payment ); - } - - void system_contract::fundnetloan( const name& from, uint64_t loan_num, const asset& payment ) - { - require_auth( from ); - - rex_net_loan_table net_loans( get_self(), get_self().value ); - fund_rex_loan( net_loans, from, loan_num, payment ); - } - - void system_contract::defcpuloan( const name& from, uint64_t loan_num, const asset& amount ) - { - require_auth( from ); - - rex_cpu_loan_table cpu_loans( get_self(), get_self().value ); - defund_rex_loan( cpu_loans, from, loan_num, amount ); - } - - void system_contract::defnetloan( const name& from, uint64_t loan_num, const asset& amount ) - { - require_auth( from ); - - rex_net_loan_table net_loans( get_self(), get_self().value ); - defund_rex_loan( net_loans, from, loan_num, amount ); - } - - void system_contract::updaterex( const name& owner ) - { - require_auth( owner ); - - runrex(2); - - auto itr = _rexbalance.require_find( owner.value, "account has no REX balance" ); - const asset init_stake = itr->vote_stake; - - auto rexp_itr = _rexpool.begin(); - const int64_t total_rex = rexp_itr->total_rex.amount; - const int64_t total_lendable = rexp_itr->total_lendable.amount; - const int64_t rex_balance = itr->rex_balance.amount; - - asset current_stake( 0, core_symbol() ); - if ( total_rex > 0 ) { - current_stake.amount = ( uint128_t(rex_balance) * total_lendable ) / total_rex; - } - _rexbalance.modify( itr, same_payer, [&]( auto& rb ) { - rb.vote_stake = current_stake; - }); - - update_rex_account( owner, asset( 0, core_symbol() ), current_stake - init_stake, true ); - process_rex_maturities( itr ); - } - - void system_contract::setrex( const asset& balance ) - { - require_auth( "eosio"_n ); - - check( balance.amount > 0, "balance must be set to have a positive amount" ); - check( balance.symbol == core_symbol(), "balance symbol must be core symbol" ); - check( rex_system_initialized(), "rex system is not initialized" ); - _rexpool.modify( _rexpool.begin(), same_payer, [&]( auto& pool ) { - pool.total_rent = balance; - }); - } - - void system_contract::rexexec( const name& user, uint16_t max ) - { - require_auth( user ); - - runrex( max ); - } - - void system_contract::consolidate( const name& owner ) - { - require_auth( owner ); - - runrex(2); - - auto bitr = _rexbalance.require_find( owner.value, "account has no REX balance" ); - asset rex_in_sell_order = update_rex_account( owner, asset( 0, core_symbol() ), asset( 0, core_symbol() ) ); - consolidate_rex_balance( bitr, rex_in_sell_order ); - } - - void system_contract::mvtosavings( const name& owner, const asset& rex ) - { - require_auth( owner ); - - runrex(2); - - auto bitr = _rexbalance.require_find( owner.value, "account has no REX balance" ); - check( rex.amount > 0 && rex.symbol == bitr->rex_balance.symbol, "asset must be a positive amount of (REX, 4)" ); - const asset rex_in_sell_order = update_rex_account( owner, asset( 0, core_symbol() ), asset( 0, core_symbol() ) ); - const int64_t rex_in_savings = read_rex_savings( bitr ); - check( rex.amount + rex_in_sell_order.amount + rex_in_savings <= bitr->rex_balance.amount, - "insufficient REX balance" ); - process_rex_maturities( bitr ); - _rexbalance.modify( bitr, same_payer, [&]( auto& rb ) { - int64_t moved_rex = 0; - while ( !rb.rex_maturities.empty() && moved_rex < rex.amount) { - const int64_t drex = std::min( rex.amount - moved_rex, rb.rex_maturities.back().second ); - rb.rex_maturities.back().second -= drex; - moved_rex += drex; - if ( rb.rex_maturities.back().second == 0 ) { - rb.rex_maturities.pop_back(); - } - } - if ( moved_rex < rex.amount ) { - const int64_t drex = rex.amount - moved_rex; - rb.matured_rex -= drex; - moved_rex += drex; - check( rex_in_sell_order.amount <= rb.matured_rex, "logic error in mvtosavings" ); - } - check( moved_rex == rex.amount, "programmer error in mvtosavings" ); - }); - put_rex_savings( bitr, rex_in_savings + rex.amount ); - } - - void system_contract::mvfrsavings( const name& owner, const asset& rex ) - { - require_auth( owner ); - - runrex(2); - - auto bitr = _rexbalance.require_find( owner.value, "account has no REX balance" ); - check( rex.amount > 0 && rex.symbol == bitr->rex_balance.symbol, "asset must be a positive amount of (REX, 4)" ); - const int64_t rex_in_savings = read_rex_savings( bitr ); - check( rex.amount <= rex_in_savings, "insufficient REX in savings" ); - process_rex_maturities( bitr ); - _rexbalance.modify( bitr, same_payer, [&]( auto& rb ) { - const time_point_sec maturity = get_rex_maturity(); - if ( !rb.rex_maturities.empty() && rb.rex_maturities.back().first == maturity ) { - rb.rex_maturities.back().second += rex.amount; - } else { - rb.rex_maturities.emplace_back( maturity, rex.amount ); - } - }); - put_rex_savings( bitr, rex_in_savings - rex.amount ); - update_rex_account( owner, asset( 0, core_symbol() ), asset( 0, core_symbol() ) ); - } - - void system_contract::closerex( const name& owner ) - { - require_auth( owner ); - - if ( rex_system_initialized() ) - runrex(2); - - update_rex_account( owner, asset( 0, core_symbol() ), asset( 0, core_symbol() ) ); - - /// check for any outstanding loans or rex fund - { - rex_cpu_loan_table cpu_loans( get_self(), get_self().value ); - auto cpu_idx = cpu_loans.get_index<"byowner"_n>(); - bool no_outstanding_cpu_loans = ( cpu_idx.find( owner.value ) == cpu_idx.end() ); - - rex_net_loan_table net_loans( get_self(), get_self().value ); - auto net_idx = net_loans.get_index<"byowner"_n>(); - bool no_outstanding_net_loans = ( net_idx.find( owner.value ) == net_idx.end() ); - - auto fund_itr = _rexfunds.find( owner.value ); - bool no_outstanding_rex_fund = ( fund_itr != _rexfunds.end() ) && ( fund_itr->balance.amount == 0 ); - - if ( no_outstanding_cpu_loans && no_outstanding_net_loans && no_outstanding_rex_fund ) { - _rexfunds.erase( fund_itr ); - } - } - - /// check for remaining rex balance - { - auto rex_itr = _rexbalance.find( owner.value ); - if ( rex_itr != _rexbalance.end() ) { - check( rex_itr->rex_balance.amount == 0, "account has remaining REX balance, must sell first"); - _rexbalance.erase( rex_itr ); - } - } - } - - /** - * @brief Updates account NET and CPU resource limits - * - * @param from - account charged for RAM if there is a need - * @param receiver - account whose resource limits are updated - * @param delta_net - change in NET bandwidth limit - * @param delta_cpu - change in CPU bandwidth limit - */ - void system_contract::update_resource_limits( const name& from, const name& receiver, int64_t delta_net, int64_t delta_cpu ) - { - if ( delta_cpu == 0 && delta_net == 0 ) { // nothing to update - return; - } - - user_resources_table totals_tbl( get_self(), receiver.value ); - auto tot_itr = totals_tbl.find( receiver.value ); - if ( tot_itr == totals_tbl.end() ) { - check( 0 <= delta_net && 0 <= delta_cpu, "logic error, should not occur"); - tot_itr = totals_tbl.emplace( from, [&]( auto& tot ) { - tot.owner = receiver; - tot.net_weight = asset( delta_net, core_symbol() ); - tot.cpu_weight = asset( delta_cpu, core_symbol() ); - }); - } else { - totals_tbl.modify( tot_itr, same_payer, [&]( auto& tot ) { - tot.net_weight.amount += delta_net; - tot.cpu_weight.amount += delta_cpu; - }); - } - check( 0 <= tot_itr->net_weight.amount, "insufficient staked total net bandwidth" ); - check( 0 <= tot_itr->cpu_weight.amount, "insufficient staked total cpu bandwidth" ); - - { - bool net_managed = false; - bool cpu_managed = false; - - auto voter_itr = _voters.find( receiver.value ); - if( voter_itr != _voters.end() ) { - net_managed = has_field( voter_itr->flags1, voter_info::flags1_fields::net_managed ); - cpu_managed = has_field( voter_itr->flags1, voter_info::flags1_fields::cpu_managed ); - } - - if( !(net_managed && cpu_managed) ) { - int64_t ram_bytes = 0, net = 0, cpu = 0; - get_resource_limits( receiver, ram_bytes, net, cpu ); - - set_resource_limits( receiver, - ram_bytes, - net_managed ? net : tot_itr->net_weight.amount, - cpu_managed ? cpu : tot_itr->cpu_weight.amount ); - } - } - - if ( tot_itr->is_empty() ) { - totals_tbl.erase( tot_itr ); - } - } - - /** - * @brief Checks if account satisfies voting requirement (voting for a proxy or 21 producers) - * for buying REX - * - * @param owner - account buying or already holding REX tokens - * @err_msg - error message - */ - void system_contract::check_voting_requirement( const name& owner, const char* error_msg )const - { - auto vitr = _voters.find( owner.value ); - check( vitr != _voters.end() && ( vitr->proxy || 21 <= vitr->producers.size() ), error_msg ); - } - - /** - * @brief Checks if CPU and Network loans are available - * - * Loans are available if 1) REX pool lendable balance is nonempty, and 2) there are no - * unfilled sellrex orders. - */ - bool system_contract::rex_loans_available()const - { - if ( !rex_available() ) { - return false; - } else { - if ( _rexorders.begin() == _rexorders.end() ) { - return true; // no outstanding sellrex orders - } else { - auto idx = _rexorders.get_index<"bytime"_n>(); - return !idx.begin()->is_open; // no outstanding unfilled sellrex orders - } - } - } - - /** - * @brief Updates rex_pool balances upon creating a new loan or renewing an existing one - * - * @param payment - loan fee paid - * @param rented_tokens - amount of tokens to be staked to loan receiver - * @param new_loan - flag indicating whether the loan is new or being renewed - */ - void system_contract::add_loan_to_rex_pool( const asset& payment, int64_t rented_tokens, bool new_loan ) - { - _rexpool.modify( _rexpool.begin(), same_payer, [&]( auto& rt ) { - // add payment to total_rent - rt.total_rent.amount += payment.amount; - // move rented_tokens from total_unlent to total_lent - rt.total_unlent.amount -= rented_tokens; - rt.total_lent.amount += rented_tokens; - // add payment to total_unlent - rt.total_unlent.amount += payment.amount; - rt.total_lendable.amount = rt.total_unlent.amount + rt.total_lent.amount; - // increment loan_num if a new loan is being created - if ( new_loan ) { - rt.loan_num++; - } - }); - } - - /** - * @brief Updates rex_pool balances upon closing an expired loan - * - * @param loan - loan to be closed - */ - void system_contract::remove_loan_from_rex_pool( const rex_loan& loan ) - { - const auto& pool = _rexpool.begin(); - const int64_t delta_total_rent = exchange_state::get_bancor_output( pool->total_unlent.amount, - pool->total_rent.amount, - loan.total_staked.amount ); - _rexpool.modify( pool, same_payer, [&]( auto& rt ) { - // deduct calculated delta_total_rent from total_rent - rt.total_rent.amount -= delta_total_rent; - // move rented tokens from total_lent to total_unlent - rt.total_unlent.amount += loan.total_staked.amount; - rt.total_lent.amount -= loan.total_staked.amount; - rt.total_lendable.amount = rt.total_unlent.amount + rt.total_lent.amount; - }); - } - - /** - * @brief Updates the fields of an existing loan that is being renewed - */ - template - int64_t system_contract::update_renewed_loan( Index& idx, const Iterator& itr, int64_t rented_tokens ) - { - int64_t delta_stake = rented_tokens - itr->total_staked.amount; - idx.modify ( itr, same_payer, [&]( auto& loan ) { - loan.total_staked.amount = rented_tokens; - loan.expiration += eosio::days(30); - loan.balance.amount -= loan.payment.amount; - }); - return delta_stake; - } - - /** - * @brief Performs maintenance operations on expired NET and CPU loans and sellrex orders - * - * @param max - maximum number of each of the three categories to be processed - */ - void system_contract::runrex( uint16_t max ) - { - check( rex_system_initialized(), "rex system not initialized yet" ); - - const auto& pool = _rexpool.begin(); - - auto process_expired_loan = [&]( auto& idx, const auto& itr ) -> std::pair { - /// update rex_pool in order to delete existing loan - remove_loan_from_rex_pool( *itr ); - bool delete_loan = false; - int64_t delta_stake = 0; - /// calculate rented tokens at current price - int64_t rented_tokens = exchange_state::get_bancor_output( pool->total_rent.amount, - pool->total_unlent.amount, - itr->payment.amount ); - /// conditions for loan renewal - bool renew_loan = itr->payment <= itr->balance /// loan has sufficient balance - && itr->payment.amount < rented_tokens /// loan has favorable return - && rex_loans_available(); /// no pending sell orders - if ( renew_loan ) { - /// update rex_pool in order to account for renewed loan - add_loan_to_rex_pool( itr->payment, rented_tokens, false ); - /// update renewed loan fields - delta_stake = update_renewed_loan( idx, itr, rented_tokens ); - } else { - delete_loan = true; - delta_stake = -( itr->total_staked.amount ); - /// refund "from" account if the closed loan balance is positive - if ( itr->balance.amount > 0 ) { - transfer_to_fund( itr->from, itr->balance ); - } - } - - return { delete_loan, delta_stake }; - }; - - /// transfer from eosio.names to eosio.rex - if ( pool->namebid_proceeds.amount > 0 ) { - channel_to_rex( names_account, pool->namebid_proceeds ); - _rexpool.modify( pool, same_payer, [&]( auto& rt ) { - rt.namebid_proceeds.amount = 0; - }); - } - - /// process cpu loans - { - rex_cpu_loan_table cpu_loans( get_self(), get_self().value ); - auto cpu_idx = cpu_loans.get_index<"byexpr"_n>(); - for ( uint16_t i = 0; i < max; ++i ) { - auto itr = cpu_idx.begin(); - if ( itr == cpu_idx.end() || itr->expiration > current_time_point() ) break; - - auto result = process_expired_loan( cpu_idx, itr ); - if ( result.second != 0 ) - update_resource_limits( itr->from, itr->receiver, 0, result.second ); - - if ( result.first ) - cpu_idx.erase( itr ); - } - } - - /// process net loans - { - rex_net_loan_table net_loans( get_self(), get_self().value ); - auto net_idx = net_loans.get_index<"byexpr"_n>(); - for ( uint16_t i = 0; i < max; ++i ) { - auto itr = net_idx.begin(); - if ( itr == net_idx.end() || itr->expiration > current_time_point() ) break; - - auto result = process_expired_loan( net_idx, itr ); - if ( result.second != 0 ) - update_resource_limits( itr->from, itr->receiver, result.second, 0 ); - - if ( result.first ) - net_idx.erase( itr ); - } - } - - /// process sellrex orders - if ( _rexorders.begin() != _rexorders.end() ) { - auto idx = _rexorders.get_index<"bytime"_n>(); - auto oitr = idx.begin(); - for ( uint16_t i = 0; i < max; ++i ) { - if ( oitr == idx.end() || !oitr->is_open ) break; - auto next = oitr; - ++next; - auto bitr = _rexbalance.find( oitr->owner.value ); - if ( bitr != _rexbalance.end() ) { // should always be true - auto result = fill_rex_order( bitr, oitr->rex_requested ); - if ( result.success ) { - const name order_owner = oitr->owner; - idx.modify( oitr, same_payer, [&]( auto& order ) { - order.proceeds.amount = result.proceeds.amount; - order.stake_change.amount = result.stake_change.amount; - order.close(); - }); - /// send dummy action to show owner and proceeds of filled sellrex order - rex_results::orderresult_action order_act( rex_account, std::vector{ } ); - order_act.send( order_owner, result.proceeds ); - } - } - oitr = next; - } - } - - } - - template - int64_t system_contract::rent_rex( T& table, const name& from, const name& receiver, const asset& payment, const asset& fund ) - { - runrex(2); - - check( rex_loans_available(), "rex loans are currently not available" ); - check( payment.symbol == core_symbol() && fund.symbol == core_symbol(), "must use core token" ); - check( 0 < payment.amount && 0 <= fund.amount, "must use positive asset amount" ); - - transfer_from_fund( from, payment + fund ); - - const auto& pool = _rexpool.begin(); /// already checked that _rexpool.begin() != _rexpool.end() in rex_loans_available() - - int64_t rented_tokens = exchange_state::get_bancor_output( pool->total_rent.amount, - pool->total_unlent.amount, - payment.amount ); - check( payment.amount < rented_tokens, "loan price does not favor renting" ); - add_loan_to_rex_pool( payment, rented_tokens, true ); - - table.emplace( from, [&]( auto& c ) { - c.from = from; - c.receiver = receiver; - c.payment = payment; - c.balance = fund; - c.total_staked = asset( rented_tokens, core_symbol() ); - c.expiration = current_time_point() + eosio::days(30); - c.loan_num = pool->loan_num; - }); - - rex_results::rentresult_action rentresult_act{ rex_account, std::vector{ } }; - rentresult_act.send( asset{ rented_tokens, core_symbol() } ); - return rented_tokens; - } - - /** - * @brief Processes a sellrex order and returns object containing the results - * - * Processes an incoming or already scheduled sellrex order. If REX pool has enough core - * tokens not frozen in loans, order is filled. In this case, REX pool totals, user rex_balance - * and user vote_stake are updated. However, this function does not update user voting power. The - * function returns success flag, order proceeds, and vote stake delta. These are used later in a - * different function to complete order processing, i.e. transfer proceeds to user REX fund and - * update user vote weight. - * - * @param bitr - iterator pointing to rex_balance database record - * @param rex - amount of rex to be sold - * - * @return rex_order_outcome - a struct containing success flag, order proceeds, and resultant - * vote stake change - */ - rex_order_outcome system_contract::fill_rex_order( const rex_balance_table::const_iterator& bitr, const asset& rex ) - { - auto rexitr = _rexpool.begin(); - const int64_t S0 = rexitr->total_lendable.amount; - const int64_t R0 = rexitr->total_rex.amount; - const int64_t p = (uint128_t(rex.amount) * S0) / R0; - const int64_t R1 = R0 - rex.amount; - const int64_t S1 = S0 - p; - asset proceeds( p, core_symbol() ); - asset stake_change( 0, core_symbol() ); - bool success = false; - - const int64_t unlent_lower_bound = ( uint128_t(2) * rexitr->total_lent.amount ) / 10; - const int64_t available_unlent = rexitr->total_unlent.amount - unlent_lower_bound; // available_unlent <= 0 is possible - if ( proceeds.amount <= available_unlent ) { - const int64_t init_vote_stake_amount = bitr->vote_stake.amount; - const int64_t current_stake_value = ( uint128_t(bitr->rex_balance.amount) * S0 ) / R0; - _rexpool.modify( rexitr, same_payer, [&]( auto& rt ) { - rt.total_rex.amount = R1; - rt.total_lendable.amount = S1; - rt.total_unlent.amount = rt.total_lendable.amount - rt.total_lent.amount; - }); - _rexbalance.modify( bitr, same_payer, [&]( auto& rb ) { - rb.vote_stake.amount = current_stake_value - proceeds.amount; - rb.rex_balance.amount -= rex.amount; - rb.matured_rex -= rex.amount; - }); - stake_change.amount = bitr->vote_stake.amount - init_vote_stake_amount; - success = true; - } else { - proceeds.amount = 0; - } - - return { success, proceeds, stake_change }; - } - - template - void system_contract::fund_rex_loan( T& table, const name& from, uint64_t loan_num, const asset& payment ) - { - check( payment.symbol == core_symbol(), "must use core token" ); - transfer_from_fund( from, payment ); - auto itr = table.require_find( loan_num, "loan not found" ); - check( itr->from == from, "user must be loan creator" ); - check( itr->expiration > current_time_point(), "loan has already expired" ); - table.modify( itr, same_payer, [&]( auto& loan ) { - loan.balance.amount += payment.amount; - }); - } - - template - void system_contract::defund_rex_loan( T& table, const name& from, uint64_t loan_num, const asset& amount ) - { - check( amount.symbol == core_symbol(), "must use core token" ); - auto itr = table.require_find( loan_num, "loan not found" ); - check( itr->from == from, "user must be loan creator" ); - check( itr->expiration > current_time_point(), "loan has already expired" ); - check( itr->balance >= amount, "insufficent loan balance" ); - table.modify( itr, same_payer, [&]( auto& loan ) { - loan.balance.amount -= amount.amount; - }); - transfer_to_fund( from, amount ); - } - - /** - * @brief Transfers tokens from owner REX fund - * - * @pre - owner REX fund has sufficient balance - * - * @param owner - owner account name - * @param amount - tokens to be transfered out of REX fund - */ - void system_contract::transfer_from_fund( const name& owner, const asset& amount ) - { - check( 0 < amount.amount && amount.symbol == core_symbol(), "must transfer positive amount from REX fund" ); - auto itr = _rexfunds.require_find( owner.value, "must deposit to REX fund first" ); - check( amount <= itr->balance, "insufficient funds" ); - _rexfunds.modify( itr, same_payer, [&]( auto& fund ) { - fund.balance.amount -= amount.amount; - }); - } - - /** - * @brief Transfers tokens to owner REX fund - * - * @param owner - owner account name - * @param amount - tokens to be transfered to REX fund - */ - void system_contract::transfer_to_fund( const name& owner, const asset& amount ) - { - check( 0 < amount.amount && amount.symbol == core_symbol(), "must transfer positive amount to REX fund" ); - auto itr = _rexfunds.find( owner.value ); - if ( itr == _rexfunds.end() ) { - _rexfunds.emplace( owner, [&]( auto& fund ) { - fund.owner = owner; - fund.balance = amount; - }); - } else { - _rexfunds.modify( itr, same_payer, [&]( auto& fund ) { - fund.balance.amount += amount.amount; - }); - } - } - - /** - * @brief Processes owner filled sellrex order and updates vote weight - * - * Checks if user has a scheduled sellrex order that has been filled, completes its processing, - * and deletes it. Processing entails transfering proceeds to user REX fund and updating user - * vote weight. Additional proceeds and stake change can be passed as arguments. This function - * is called only by actions pushed by owner. - * - * @param owner - owner account name - * @param proceeds - additional proceeds to be transfered to owner REX fund - * @param delta_stake - additional stake to be added to owner vote weight - * @param force_vote_update - if true, vote weight is updated even if vote stake didn't change - * - * @return asset - REX amount of owner unfilled sell order if one exists - */ - asset system_contract::update_rex_account( const name& owner, const asset& proceeds, const asset& delta_stake, bool force_vote_update ) - { - asset to_fund( proceeds ); - asset to_stake( delta_stake ); - asset rex_in_sell_order( 0, rex_symbol ); - auto itr = _rexorders.find( owner.value ); - if ( itr != _rexorders.end() ) { - if ( itr->is_open ) { - rex_in_sell_order.amount = itr->rex_requested.amount; - } else { - to_fund.amount += itr->proceeds.amount; - to_stake.amount += itr->stake_change.amount; - _rexorders.erase( itr ); - } - } - - if ( to_fund.amount > 0 ) - transfer_to_fund( owner, to_fund ); - if ( force_vote_update || to_stake.amount != 0 ) - update_voting_power( owner, to_stake ); - - return rex_in_sell_order; - } - - /** - * @brief Channels system fees to REX pool - * - * @param from - account from which asset is transfered to REX pool - * @param amount - amount of tokens to be transfered - */ - void system_contract::channel_to_rex( const name& from, const asset& amount ) - { -#if CHANNEL_RAM_AND_NAMEBID_FEES_TO_REX - if ( rex_available() ) { - _rexpool.modify( _rexpool.begin(), same_payer, [&]( auto& rp ) { - rp.total_unlent.amount += amount.amount; - rp.total_lendable.amount += amount.amount; - }); - // inline transfer to rex_account - token::transfer_action transfer_act{ token_account, { from, active_permission } }; - transfer_act.send( from, rex_account, amount, - std::string("transfer from ") + from.to_string() + " to eosio.rex" ); - } -#endif - } - - /** - * @brief Updates namebid proceeds to be transfered to REX pool - * - * @param highest_bid - highest bidding amount of closed namebid - */ - void system_contract::channel_namebid_to_rex( const int64_t highest_bid ) - { -#if CHANNEL_RAM_AND_NAMEBID_FEES_TO_REX - if ( rex_available() ) { - _rexpool.modify( _rexpool.begin(), same_payer, [&]( auto& rp ) { - rp.namebid_proceeds.amount += highest_bid; - }); - } -#endif - } - - /** - * @brief Calculates maturity time of purchased REX tokens which is 4 days from end - * of the day UTC - * - * @return time_point_sec - */ - time_point_sec system_contract::get_rex_maturity() - { - const uint32_t num_of_maturity_buckets = 5; - static const uint32_t now = current_time_point().sec_since_epoch(); - static const uint32_t r = now % seconds_per_day; - static const time_point_sec rms{ now - r + num_of_maturity_buckets * seconds_per_day }; - return rms; - } - - /** - * @brief Updates REX owner maturity buckets - * - * @param bitr - iterator pointing to rex_balance object - */ - void system_contract::process_rex_maturities( const rex_balance_table::const_iterator& bitr ) - { - const time_point_sec now = current_time_point(); - _rexbalance.modify( bitr, same_payer, [&]( auto& rb ) { - while ( !rb.rex_maturities.empty() && rb.rex_maturities.front().first <= now ) { - rb.matured_rex += rb.rex_maturities.front().second; - rb.rex_maturities.pop_front(); - } - }); - } - - /** - * @brief Consolidates REX maturity buckets into one - * - * @param bitr - iterator pointing to rex_balance object - * @param rex_in_sell_order - REX tokens in owner unfilled sell order, if one exists - */ - void system_contract::consolidate_rex_balance( const rex_balance_table::const_iterator& bitr, - const asset& rex_in_sell_order ) - { - const int64_t rex_in_savings = read_rex_savings( bitr ); - _rexbalance.modify( bitr, same_payer, [&]( auto& rb ) { - int64_t total = rb.matured_rex - rex_in_sell_order.amount; - rb.matured_rex = rex_in_sell_order.amount; - while ( !rb.rex_maturities.empty() ) { - total += rb.rex_maturities.front().second; - rb.rex_maturities.pop_front(); - } - if ( total > 0 ) { - rb.rex_maturities.emplace_back( get_rex_maturity(), total ); - } - }); - put_rex_savings( bitr, rex_in_savings ); - } - - /** - * @brief Updates REX pool balances upon REX purchase - * - * @param payment - amount of core tokens paid - * - * @return asset - calculated amount of REX tokens purchased - */ - asset system_contract::add_to_rex_pool( const asset& payment ) - { - /** - * If CORE_SYMBOL is (EOS,4), maximum supply is 10^10 tokens (10 billion tokens), i.e., maximum amount - * of indivisible units is 10^14. rex_ratio = 10^4 sets the upper bound on (REX,4) indivisible units to - * 10^18 and that is within the maximum allowable amount field of asset type which is set to 2^62 - * (approximately 4.6 * 10^18). For a different CORE_SYMBOL, and in order for maximum (REX,4) amount not - * to exceed that limit, maximum amount of indivisible units cannot be set to a value larger than 4 * 10^14. - * If precision of CORE_SYMBOL is 4, that corresponds to a maximum supply of 40 billion tokens. - */ - const int64_t rex_ratio = 10000; - const asset init_total_rent( 20'000'0000, core_symbol() ); /// base balance prevents renting profitably until at least a minimum number of core_symbol() is made available - asset rex_received( 0, rex_symbol ); - auto itr = _rexpool.begin(); - if ( !rex_system_initialized() ) { - /// initialize REX pool - _rexpool.emplace( get_self(), [&]( auto& rp ) { - rex_received.amount = payment.amount * rex_ratio; - rp.total_lendable = payment; - rp.total_lent = asset( 0, core_symbol() ); - rp.total_unlent = rp.total_lendable - rp.total_lent; - rp.total_rent = init_total_rent; - rp.total_rex = rex_received; - rp.namebid_proceeds = asset( 0, core_symbol() ); - }); - } else if ( !rex_available() ) { /// should be a rare corner case, REX pool is initialized but empty - _rexpool.modify( itr, same_payer, [&]( auto& rp ) { - rex_received.amount = payment.amount * rex_ratio; - rp.total_lendable.amount = payment.amount; - rp.total_lent.amount = 0; - rp.total_unlent.amount = rp.total_lendable.amount - rp.total_lent.amount; - rp.total_rent.amount = init_total_rent.amount; - rp.total_rex.amount = rex_received.amount; - }); - } else { - /// total_lendable > 0 if total_rex > 0 except in a rare case and due to rounding errors - check( itr->total_lendable.amount > 0, "lendable REX pool is empty" ); - const int64_t S0 = itr->total_lendable.amount; - const int64_t S1 = S0 + payment.amount; - const int64_t R0 = itr->total_rex.amount; - const int64_t R1 = (uint128_t(S1) * R0) / S0; - rex_received.amount = R1 - R0; - _rexpool.modify( itr, same_payer, [&]( auto& rp ) { - rp.total_lendable.amount = S1; - rp.total_rex.amount = R1; - rp.total_unlent.amount = rp.total_lendable.amount - rp.total_lent.amount; - check( rp.total_unlent.amount >= 0, "programmer error, this should never go negative" ); - }); - } - - return rex_received; - } - - /** - * @brief Updates owner REX balance upon buying REX tokens - * - * @param owner - account name of REX owner - * @param payment - amount core tokens paid to buy REX - * @param rex_received - amount of purchased REX tokens - * - * @return asset - change in owner REX vote stake - */ - asset system_contract::add_to_rex_balance( const name& owner, const asset& payment, const asset& rex_received ) - { - asset init_rex_stake( 0, core_symbol() ); - asset current_rex_stake( 0, core_symbol() ); - auto bitr = _rexbalance.find( owner.value ); - if ( bitr == _rexbalance.end() ) { - bitr = _rexbalance.emplace( owner, [&]( auto& rb ) { - rb.owner = owner; - rb.vote_stake = payment; - rb.rex_balance = rex_received; - }); - current_rex_stake.amount = payment.amount; - } else { - init_rex_stake.amount = bitr->vote_stake.amount; - _rexbalance.modify( bitr, same_payer, [&]( auto& rb ) { - rb.rex_balance.amount += rex_received.amount; - rb.vote_stake.amount = ( uint128_t(rb.rex_balance.amount) * _rexpool.begin()->total_lendable.amount ) - / _rexpool.begin()->total_rex.amount; - }); - current_rex_stake.amount = bitr->vote_stake.amount; - } - - const int64_t rex_in_savings = read_rex_savings( bitr ); - process_rex_maturities( bitr ); - _rexbalance.modify( bitr, same_payer, [&]( auto& rb ) { - const time_point_sec maturity = get_rex_maturity(); - if ( !rb.rex_maturities.empty() && rb.rex_maturities.back().first == maturity ) { - rb.rex_maturities.back().second += rex_received.amount; - } else { - rb.rex_maturities.emplace_back( maturity, rex_received.amount ); - } - }); - put_rex_savings( bitr, rex_in_savings ); - return current_rex_stake - init_rex_stake; - } - - /** - * @brief Reads amount of REX in savings bucket and removes the bucket from maturities - * - * Reads and (temporarily) removes REX savings bucket from REX maturities in order to - * allow uniform processing of remaining buckets as savings is a special case. This - * function is used in conjunction with put_rex_savings. - * - * @param bitr - iterator pointing to rex_balance object - * - * @return int64_t - amount of REX in savings bucket - */ - int64_t system_contract::read_rex_savings( const rex_balance_table::const_iterator& bitr ) - { - int64_t rex_in_savings = 0; - static const time_point_sec end_of_days = time_point_sec::maximum(); - if ( !bitr->rex_maturities.empty() && bitr->rex_maturities.back().first == end_of_days ) { - _rexbalance.modify( bitr, same_payer, [&]( auto& rb ) { - rex_in_savings = rb.rex_maturities.back().second; - rb.rex_maturities.pop_back(); - }); - } - return rex_in_savings; - } - - /** - * @brief Adds a specified REX amount to savings bucket - * - * @param bitr - iterator pointing to rex_balance object - * @param rex - amount of REX to be added - */ - void system_contract::put_rex_savings( const rex_balance_table::const_iterator& bitr, int64_t rex ) - { - if ( rex == 0 ) return; - static const time_point_sec end_of_days = time_point_sec::maximum(); - _rexbalance.modify( bitr, same_payer, [&]( auto& rb ) { - if ( !rb.rex_maturities.empty() && rb.rex_maturities.back().first == end_of_days ) { - rb.rex_maturities.back().second += rex; - } else { - rb.rex_maturities.emplace_back( end_of_days, rex ); - } - }); - } - - /** - * @brief Updates voter REX vote stake to the current value of REX tokens held - * - * @param voter - account name of voter - */ - void system_contract::update_rex_stake( const name& voter ) - { - int64_t delta_stake = 0; - auto bitr = _rexbalance.find( voter.value ); - if ( bitr != _rexbalance.end() && rex_available() ) { - asset init_vote_stake = bitr->vote_stake; - asset current_vote_stake( 0, core_symbol() ); - current_vote_stake.amount = ( uint128_t(bitr->rex_balance.amount) * _rexpool.begin()->total_lendable.amount ) - / _rexpool.begin()->total_rex.amount; - _rexbalance.modify( bitr, same_payer, [&]( auto& rb ) { - rb.vote_stake.amount = current_vote_stake.amount; - }); - delta_stake = current_vote_stake.amount - init_vote_stake.amount; - } - - if ( delta_stake != 0 ) { - auto vitr = _voters.find( voter.value ); - if ( vitr != _voters.end() ) { - _voters.modify( vitr, same_payer, [&]( auto& vinfo ) { - vinfo.staked += delta_stake; - }); - } - } - } - -}; /// namespace eosiosystem diff --git a/contracts/eosio.system/src/rex.results.cpp b/contracts/eosio.system/src/rex.results.cpp deleted file mode 100644 index 1aabca02..00000000 --- a/contracts/eosio.system/src/rex.results.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -void rex_results::buyresult( const asset& rex_received ) { } - -void rex_results::sellresult( const asset& proceeds ) { } - -void rex_results::orderresult( const name& owner, const asset& proceeds ) { } - -void rex_results::rentresult( const asset& rented_tokens ) { } - -extern "C" void apply( uint64_t, uint64_t, uint64_t ) { } From 5682ecb854baf1e53b9c32a05bbd75a230c145ed Mon Sep 17 00:00:00 2001 From: Ernesto Messina Date: Wed, 7 Aug 2019 14:34:15 -0300 Subject: [PATCH 4/6] [KEW-1468] Removed unnecessary rex.results.hpp file. --- .../include/eosio.system/rex.results.hpp | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 contracts/eosio.system/include/eosio.system/rex.results.hpp diff --git a/contracts/eosio.system/include/eosio.system/rex.results.hpp b/contracts/eosio.system/include/eosio.system/rex.results.hpp deleted file mode 100644 index b5a1949c..00000000 --- a/contracts/eosio.system/include/eosio.system/rex.results.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include - -using eosio::action_wrapper; -using eosio::asset; -using eosio::name; - -class [[eosio::contract("rex.results")]] rex_results : eosio::contract { - public: - - using eosio::contract::contract; - - [[eosio::action]] - void buyresult( const asset& rex_received ); - - [[eosio::action]] - void sellresult( const asset& proceeds ); - - [[eosio::action]] - void orderresult( const name& owner, const asset& proceeds ); - - [[eosio::action]] - void rentresult( const asset& rented_tokens ); - - using buyresult_action = action_wrapper<"buyresult"_n, &rex_results::buyresult>; - using sellresult_action = action_wrapper<"sellresult"_n, &rex_results::sellresult>; - using orderresult_action = action_wrapper<"orderresult"_n, &rex_results::orderresult>; - using rentresult_action = action_wrapper<"rentresult"_n, &rex_results::rentresult>; -}; From 387f28b0aec9d06153d1dfbdfa5f59dd2a972447 Mon Sep 17 00:00:00 2001 From: Aaron Caswell Date: Thu, 8 Aug 2019 09:18:29 -0700 Subject: [PATCH 5/6] [KEW-1463] Clean up recommendations --- CHANGELOG.md | 1 + .../eosio.system/include/eosio.system/eosio.system.hpp | 8 -------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31c1c24f..e797cfdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ FEATURES: IMPROVEMENTS: - [KEW-1468] Removed REX referencies. +- [KEW-1463] Clean up recommendations BUG FIXES: diff --git a/contracts/eosio.system/include/eosio.system/eosio.system.hpp b/contracts/eosio.system/include/eosio.system/eosio.system.hpp index ec5f2e69..26a2904c 100755 --- a/contracts/eosio.system/include/eosio.system/eosio.system.hpp +++ b/contracts/eosio.system/include/eosio.system/eosio.system.hpp @@ -15,14 +15,6 @@ #include -#ifdef CHANNEL_RAM_AND_NAMEBID_FEES_TO_REX -#undef CHANNEL_RAM_AND_NAMEBID_FEES_TO_REX -#endif -// CHANNEL_RAM_AND_NAMEBID_FEES_TO_REX macro determines whether ramfee and namebid proceeds are -// channeled to REX pool. In order to stop these proceeds from being channeled, the macro must -// be set to 0. -#define CHANNEL_RAM_AND_NAMEBID_FEES_TO_REX 1 - namespace eosiosystem { using eosio::asset; From f210c4d5a751078fcf5bb8b8abbd620377899a74 Mon Sep 17 00:00:00 2001 From: jalbiero <51678384+jalbiero@users.noreply.github.com> Date: Mon, 12 Aug 2019 14:36:50 -0300 Subject: [PATCH 6/6] [KEW-1463] Update history --- CHANGELOG.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e797cfdd..fbc8531f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,21 @@ # Changelog - ## Pending (wax-1.7.0-X.Y.Z) BREAKING CHANGES: FEATURES: +IMPROVEMENTS: + +BUG FIXES: + +## Pending (wax-1.7.0-1.1.0) + +BREAKING CHANGES: + +FEATURES: + IMPROVEMENTS: - [KEW-1468] Removed REX referencies. - [KEW-1463] Clean up recommendations