Reward Smart Contract

As described in Basic Rewards, each season is divided into three parts: raising (3 days), lock-up (84 days), and settlement (3 days).

API

There are several APIs in reward contract which are further divided into two classes admin and investor according to the authority.

Here we list all APIs below.

Admin API

Admin
API Description
newRaise() Inaugurate a new raising period.
newLock() Inaugurate a new lock-up period.
newSettlement() Inaugurate a new settlement period.
distributeInterest(address investor) Distribute interest for a user.
setRaisePeriod(uint256 _raisePeriod) Set the length for raising period. The default value is 3 days.
setLockPeriod(uint256 _lockPeriod) Set the length for lock-up period. The default value is 84 days.
setSettlementPeriod(uint256 _settlementPeriod) Set the length for settlement period. The default value is 3 days.
setEnodeThreshold(uint256 _enodeThreshold) Set the threshold to become an economy node. The default value is 20,000 tokens.
setNextRaiseTime(uint256 _NextRaiseTime) Set the the time to inaugurate the next period. Normally, it is automatically calculated.
setNextLockTime(uint256 _NextLockTime)
setNextSettlementTime(uint256 _NextSettlementTime)
refund(address investor, uint 256 amount) Refund the deposit in this contract to a node, and disable the contract. Both functions are invoked only when this smart contract is going to terminate.
disable()

Investor API

Investor
API Description
deposit() It is invoked when deposit in economy pool. The value of the transaction is the amount of deposit.
withdraw(uint amount) It is invoked when withdraw deposit.
claimInterest() Investor claim interest in settlement period.

Read-only API

The reward contract all provides read-only API to seek information about the node.

Read-only
API Description
mapping(address => uint 256) public investments Query for the invest of an address in the pool.
mapping(address => mapping( address => bool )) returned Return a boolean result that whether an address has been distributed interest in a certain round.
uint256 public totalInvestment Query for current total investment of the pool.
uint256 public totalInterest Query for distributed interest of the current season.
bool public inRaise Return if it is in raising period.
bool public inLock Return if it is in lock-up period.
bool public inSettlement Return if it is in settlement period.
uint256 public bonusPool Query for the total bonus in the pool.
uint256 public round Query for the sequence number of the current season.
uint256 public nextRaiseTime Query for the beginning of the next raising period.
uint256 public nextLockTime Query for the beginning of the next lock-up period.
uint256 public nextSettlementTime Query for the beginning of the next settlement period.
function getEnodes() public view returns(address[]) Retrieve the address of all economy nodes.

Availability of API

Some APIs can ony be called in a certain period. The table below lists all available APIs for each period.

Period API
Raising deposit()
withdraw(uint amount)
Receive transfer.
Read-only API
Lock-up Read-only API
Settlement claimInterest
distributeInterest(address investor)
Read-only API