Smart Mining V1
Smart Mining V1: A flexible on-demand mining mode
Background
As one of the digital financial derivatives on SUN.io, mining provides crypto holders with stable, secure and reliable services for investment product subscription and redemption. Smart Mining V1, also known as flexible mining, is an important part of SUN.io's mining service. It distributes rewards according to the share of users' staked assets in the mining pool's total stake amount. And users can redeem their assets anytime.
Explanation
SUN.io's mining service distributes token rewards at an even inflation rate within a certain period of time, as shown in the graph below.
Changes in the total staked assets in the mining pool at the time point ti will lead to changes in rewards for individual users, who are rewarded according to the following formula:
denotes the expansion factor of token rewards, denotes the i-th change, denotes the total staked assets during the period from ti−1 to ti, and denotes users' staked assets during the period from to .
According to the above formula, changes in the mining pool’s total staked assets will affect the distribution of rewards for all users. In order to avoid high gas fees incurred from updating the reward distribution for every user, the above formula is altered to the following one:
When the total staked assets in the mining pool have changed while the users' staked assets have not during the period from starti to endi, only the following summation formula needs to be updated:
Contract code
Mining pools
2pool farm
Mainnet contract address:TFpg63byqDwniXnyxVYpSzBfWGBwZExM9J
USDD-USDT V2 farm
Mainnet contract address:TCkNadwxyik1D66qCGmavuneowDRXPgdkL
Contract interaction
We use TronWeb to interact with contracts. One can easily interact with online contracts after initializing TronWeb instances.
Get mining pool information
View addresses of fixed-term/on-demand mining pools
Function: reward_contract()
View rewards of on-demand mining pools
Function:earned(address)
Parameter: user's address
Transaction execution
Deposit
Function:deposit(uint256)
Parameter:Deposit amount
Withdrawal
Function:withdraw(uint256)
Parameter:Withdrawal amount
Last updated