AntelopeIO / reference-contracts

Other
10 stars 14 forks source link

Tokenomics - REX Upgrade #80

Closed DenisCarriere closed 4 months ago

DenisCarriere commented 5 months ago

Change Description

REX upgrades related to buying, selling & unstaking REX.

Deployment Changes

API Changes

 /**
  * Facilitates the modification of REX maturity buckets
  *
  * @param num_of_maturity_buckets - used to calculate maturity time of purchase REX tokens from end of the day UTC.
  * @param sell_matured_rex - if true, matured REX is sold immediately.
  *                           https://github.com/eosnetworkfoundation/eos-system-contracts/issues/134
  * @param buy_rex_to_savings - if true, buying REX is moved immediately to REX savings.
  *                             https://github.com/eosnetworkfoundation/eos-system-contracts/issues/135
  */
 [[eosio::action]]
 void setrexmature(const std::optional<uint32_t> num_of_maturity_buckets, const std::optional<bool> sell_matured_rex, const std::optional<bool> buy_rex_to_savings );
struct rex_maturity {
  uint32_t num_of_maturity_buckets = 5;
  bool sell_matured_rex = false;
  bool buy_rex_to_savings = false;
};

Documentation Additions

REX Legacy

  1. Buy REX => matures in 4 days (earning yield)
  2. Can sell REX anytime while holding to matured (liquid) REX

    REX maturing state happens on buying REX

REX 2.0

  1. Buy REX => moves all newly purchased REX to savings
  2. To start unstaking, user must call mvfrsaving to start the 21 day unstaking period
  3. Once 21 day unstaking period is over, funds are force sold to their user balance (on their next REX action)

    REX maturing after moving from savings REX cannot be held in matured (liquid) form

REX 2 0