Staking Rewards - Addon Feature
Common info
Staking is a service for calculating rewards for blocked funds and displaying related information on the userApp and adminPanel.
The administrator turns on the "staking_enabled" switch to start calculating user rewards in the adminPanel and also configures the following settings:
staking_period
optional
in the form of cron syntax
DESCRIPTION The time and date fields are: field allowed values ----- -------------- minute 0-59 hour 0-23 day of month 0-31 month 0-12 (or names, see below) day of week 0-7 (0 or 7 is Sun, or use names) A field may be an asterisk (*), which always stands for ``first-last''. Step values can be used in conjunction with ranges. Fol- lowing a range with ``/<number>'' specifies skips of the number's value through the range. For example, if you want to say ``every two hours'', just use ``*/2''. EXAMPLE CRON FILE # run five minutes after midnight, every day 5 0 * * * # run at 2:15pm on the first of every month -- output mailed to paul 15 14 1 * * # run at 10 pm 0 22 * * * # run every hour * */1 * * *
if it is not defined for a currency, then the service uses the STAKING_PERIOD environment variable
staking_apr
compulsory
annual percent reward
min_staking_amount
minimal amount for first stake
Four “operations” that change the user balance:
“staking” type - user initiates blocking of funds
This operation creates ledgerRecords:
Dt 201 (user, currency) - amount to lock
Ct 206 (user, currency) - amount to lock
“staking_cancel” type - user initiated cancellation of funds blocking
When user initiates this process there is no change balance.
On the end of a calculation interval it creates ledgerRecords:
Dt 205 (user, currency) - balance of 205
Ct 201 (user, currency) - balance of 205
Dt 206 (user, currency) - balance of 206
Ct 201 (user, currency) - balance of 206
This kind of operation is a child on “staking” operation - its ledger records administrator can see in “staking” operation
“staking_rewards” type - calculation of rewards to the user credit balance of account 205 at the beginning of a new calculation interval
This operation creates ledgerRecords:
“staking_transfer” type - unblocking funds from accounts 206 and 205
This operation creates ledgerRecords:
This kind of operation is a child on “staking” operation - its ledger records administrator can see in “staking” operation
User interaction with staking data
Receive currency staking locked and active balance, next rewards time and amount:
Receive rewards history:
Default value page = 1, limit = 25. If currencyId is not defined - result will be for all currencies
Result array is ordered by staking_calc
DESC
Initiate stake:
Cancel stake: