This document contains design information relating to both FIP-6 and FIP-21
https://github.com/fioprotocol/fips/blob/master/fip-0006.md
https://github.com/fioprotocol/fips/blob/master/fip-0021.md
this effort is tracked by the following story
Design:
FIP-6:
for FIP-6 There are several important factors
Establish tables to be used to record and account the new locked token model (these are called general locked tokens in this design).
integrate the new tables into the locked token accounting for voting and transferring of tokens. This task is relatively easy as we can use the same pattern of development as the genesis grants, and we can add logic for general locks in the places where the genesis locks are integrated, but we can do this in a way that will NOT impact the genesis locks. (IE: we will make new methods to handle the general locks, and leave the genesis locks untouched).
provide new actions for creating these new locks, this will require 2 new actions, one in the token contract, and one in the system contract (trnsloctoks, and addgenlocked)
integrate the new locking logic into the token contract and the system contract
make can transfer, and computegenerallockedtokens similar to the genesis token accounting, implement the logic specific for the general locks.
integrate the calls to these new methods throughout the token contract and system contract as necessary to ensure voting and transfer update the accounting as expected.
FIP-21:
There are 2 important aspects of the staking incentives being proposed:
Establish and integrate a set of set business rules for when to provide incentives, compute the amount of incentive to provide when incentives are applicable.
We will modify the trnsloctok (transfer locked tokens) action in the following ways:
it will look for one locking period being present and a duration matching the set of durations specified for the incentive program. The changes will be programmed using a block of constants which will aid in modifications going forward.
Before minting any new tokens,The amount to be added to the grant will be computed according to the table in FIP-21, this will be called Ra. the contents of the total_staking_incentives_granted will be checked, if the total_staking_incentives_granted is less than 20,000,000 then incentives will be added to the grant. if the total_staking_incentives_granted is >= 20,000,000 then NO incentives will be added to the grant. if incentives are being offered for this grant, The amount of incentives remaining will be calculate ad Ri = 20,000,000 - total_staking_incentives_granted . If Ri is less than the amount Ra, the incentive amount to be given will be reset for this grant to become Ri.
Conditional minting logic will be added in order to provide the necessary additional tokens to the locked token grant account. Tokens will be minted to the fio.treasury account and then transferred to the token grant account. The total amount of the grant will be increased by the amount of the incentive. Then the locked tokens table entry will be added to the table
Track the total amount of incentives provided by the program, and stop providing incentives once the 20,000,000 FIO threshold is reached.
A new global state table (global4) will be created containing the total_staking_incentives_granted. This table will be updated with any incentive amounts used by adding the computed incentive amount (as stated above) to the previous value of the table, until the 20,000,000 threshold is reached.
Summarize changes to fio and fio.contracts
System contract.
fio.system.hpp –
add the global4 table which will hold int32 total_staking_incentives_granted initialized to 0.
fio.system.cpp --
add new action to update staking incentives granted (updstkincgrn), special note, auth check that its the fio.token contract calling it.
Token Contract
fio.token.cpp --
modify trnsloctoks to implement the incentives logic, incentive computations, minting and transfer of new tokens, update of total staking incentives granted.
for minting, call issue of fio to the grant holder account for the specified amount of incentive.
call updstkincgrn to update incentive rewards accounting in global state.
New contract actions
trnsloctoks
addgenlocked
updstkincgrn
Note changes to structs and ABIs
new global4 table in system.
new actions trnsloctoks in token contract.
addgenlocked
, updstkincgrn in system contract
Detail any table updates or migrations
no table migrations are necessary.
Summary of risks, impacts and logistics analysis
performance testing of the trnsloctoks should be performed on dev box to ensure this new logic has time to run, if it succeeds on a dev box it should then be fine on other deployments.
functional testing will test this perf concern in all environments (dev local, dev net, test net)
SDK Requirements
Note functional updates needed for SDKs
Functional Test plan
List all of the pertinent tests, required setup, and expected results.
Performance Testing plan
List all of the pertinent tests, required setup, and expected results.
Fork Testing plan
List all of the pertinent tests, required setup, and expected results.List all pertinent tests pertaining to testing with different versions of the core code.
List all pertinent tests pertaining to pre-contracts update and post contracts update
Rollout/Release plan
make a comprehensive list of all necessary changes
include (new actions, removed actions, MSIGs for all required operations, and step by step instructions.
Rollout/Release verification plan
include step by set instructions for how to verify that the changes are on chain after rollout.
Bonus points if you make an automated script performing the verifications.
0 Comments