Smart Mining V2: A high-yield fixed-term mining mode
Background
As one of the digital financial derivatives on SUN.io, mining provides crypto holders with stable, secure, and reliable services for subscription and redemption of investment products. Smart Mining V2, also known as fixed-term mining, is an important part of SUN.io's mining service. It converts a user's staked assets to virtual assets of a certain amount according to the amount of assets staked and the staking duration. The total virtual stake is defined as the total amount of virtual assets converted from all users' staked assets. Users are rewarded based on their virtual assets' proportion in the total virtual stake, and they are only allowed to redeem their assets during a specified period of time.
Explanation
Reward Distribution
Suppose the stake amount of a token is "amount". The token's lock-up duration Durationlockā meets the following condition: Durationminā<=Durationlockā<=Durationmaxāć where Durationmaxā is 1080 days, Durationminā is 30 days, and the maximum acceleration rateweightmaxā is 1400% (magnifying by e12 times). The veToken is calculated in the following wayļ¼
Here,balanceveTokenārefers to the amount of a user's virtual assets. According to the reward distribution formula (2) of Smart Mining V1, the user's rewards are calculated in the following way:
Here, rtā denotes the expansion factor of the reward token, tiā denotes the i-th change, Tiā denotes the total virtual stake at the time tiā1āto tiā, and balanceveTokenā denotes the amount of the user's virtual assets at the time tiā1āto tiā.
Contract code
function calculateBoostedBalance(uint256 amount, uint256 lockDuration) public view returns (uint256) {
if (lockDuration == 0) {
return amount;
}
uint256 boostWeight = lockDuration.mul(BOOST_WEIGHT).div(DURATION_FACTOR);
return amount.add(amount.mul(boostWeight).div(PRECISION_FACTOR));
}
Redemption Time of Fixed-Term Mining
Durationlockā denotes the length of a lock-up period, Durationmaintenanceā denotes the length of a cooling-off period for re-staking, tstakeā denotes the time when the assets are staked, and tnowā denotes the current time. Assets can be redeemed when the following conditions are both met:
rewards denotes the total amount of rewards, rewardsprevā denotes the amount of settled rewards, tlastActionā denotes the time of the last settlement, and Durationrewardā denotes the lock-up duration during which the rewards are not settled yet. Durationoverdueā denotes the duration of time that is after the last lock-up period and shorter than a lock-up period. The user's rewards are calculated in the following way: