Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement "Set/Delete/Exec Schedules" ACTION #136

Closed
Tracked by #128 ...
DenisCarriere opened this issue May 4, 2024 · 1 comment
Closed
Tracked by #128 ...

Implement "Set/Delete/Exec Schedules" ACTION #136

DenisCarriere opened this issue May 4, 2024 · 1 comment

Comments

@DenisCarriere
Copy link
Contributor

DenisCarriere commented May 4, 2024

Purpose

Create setschedule, delschedule, execschedule, setpayfactor ACTION & schedules TABLE to allow for the scheduling of system annual inflation rate changes to be executed at a future time.

Feedback provided by

setschedule ACTION

/**
 * Set the schedule for pre-determined annual rate changes.
 *
 * @param start_time - the time to start the schedule.
 * @param annual_rate - the annual inflation rate of the core token supply.
 *     (eg. For 5% Annual inflation => annual_rate=500
 *          For 1.5% Annual inflation => annual_rate=150
 */
[[eosio::action]]
void setschedule( const time_point_sec start_time, int64_t annual_rate );

delschedule ACTION

/**
 * Delete the schedule for pre-determined annual rate changes.
 *
 * @param start_time - the time to start the schedule.
 */
[[eosio::action]]
void delschedule( const time_point_sec start_time );

execschedule ACTION

 /**
  * Executes the next schedule for pre-determined annual rate changes.
  *
  * Start time of the schedule must be in the past.
  *
  * Can be executed by any account.
  */
 void execschedule();

setpayfactor ACTION

/**
 * Change how inflated or vested tokens will be distributed based on the following structure.
 *
 * @param inflation_pay_factor - Inverse of the fraction of the inflation used to reward block producers.
 *     The remaining inflation will be sent to the `eosio.saving` account.
 *     (eg. For 20% of inflation going to block producer rewards   => inflation_pay_factor = 50000
 *          For 100% of inflation going to block producer rewards  => inflation_pay_factor = 10000).
 * @param votepay_factor - Inverse of the fraction of the block producer rewards to be distributed proportional to blocks produced.
 *     The remaining rewards will be distributed proportional to votes received.
 *     (eg. For 25% of block producer rewards going towards block pay => votepay_factor = 40000
 *          For 75% of block producer rewards going towards block pay => votepay_factor = 13333).
 */
[[eosio::action]]
void setpayfactor( int64_t inflation_pay_factor, int64_t votepay_factor );

schedules TABLE

/**
 * Defines the schedule for pre-determined annual rate changes.
 */
struct [[eosio::table]] schedules {
    time_point_sec start_time;
    int64_t annual_rate;

    uint64_t primary_key() const { return start_time.sec_since_epoch(); }
};

Preconditions

  • require_auth(get_self())
  • start_time must be in the future
  • start_time is used as the primary key, overrides existing row if it exists
  • annual_rate cannot be negative value (0 or higher)
  • claimrewards will trigger the inflation rate change if the start_time has passed
    • once triggered, the row will be deleted from the schedules table
  • execschedule can be executed by any account
    • Executes the next schedule for pre-determined annual rate changes.

References

Note: changes should be pushed to Antelope Reference contracts https://github.com/AntelopeIO/reference-contracts

DenisCarriere added a commit to AntelopeIO/reference-contracts that referenced this issue May 4, 2024
@DenisCarriere DenisCarriere changed the title Implement "Set/Delete Schedules" ACTION Implement "Set/Delete/Exec Schedules" ACTION May 4, 2024
@DenisCarriere
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants