nutbox-dao / nutbox-contract

Nutbox contract repository.
https://nutbox.io
9 stars 4 forks source link

Configuration options of StakingTemplate contract #2

Open tolak opened 3 years ago

tolak commented 3 years ago

Here we discuss the configuration options that user should specify when deploy their own staking economy on Nutbox. Just contains technical related option, which means we do not talk about things like log, registration information here.

Bascially people who deploy thier staking economy are only care 1) what distribution mechanism they should use; 2) what asset their community member should deposi; 3) which community token used to be minted.

The first question is handled by staking pool #1 , and to handle the last two questiones we giving the following specification:

struct Distribution {
    // if current block height > stopHeight, this distribution passed.
    bool hasPassed;
    // rewards per block of this distribution.
    uint256 amount;
    // when current block height > startHeight, distribution was enabled.
    uint256 startHeight;
    // when curent block height > stopHeight, distribution was disabled
    uint256 stopHeight;
}

Constract StakingTemplate {
    Pool[] openedPools,
    Distribution[] distributionEras,
    NutboxERC20 rewardToken;
}

openedPools

User can add multiple Pool defined in #1 to one single staking economy, and every pool have its own ratio that determines how many reward the pool can get when new block produced.

distributionEras

This field describe how the reward be minted. For example, staking deployer may have a dynamic distribution mechanisms:

height rewards
[10000, 11000] 20
[11000, 21000] 10
[21000, ...] 5

As the table shown, different block height range can mint different amount of rewards. So the distribution field we save the information used to handle the diffent distribution requirement.

rewardToken

The community token ready to be minted that deployer specify.

tolak commented 3 years ago

update