Comment on page
The architecture of the contracts & functions
This is the contract with which the user can stake, unstake, claim rewards, see their reward balance and their staked amount. The Staking Manager is initialized by providing the values of a minimum staking period, minimum staking amount, max token allotment for rewards, reward fee percentage and the duration of the staking program, along with the addresses from the RebaseEngine, Staking Database, Network Demand and Distribution Pool.
A Staking Pool is created by the Staking Manager contract and nothing can access the Staking Pool assets other than Staking Manager itself. Before each stake, unstake and claim requests, the rebase method of the RebaseEngine is called, to update the pool variables including accumulatedPoolWeight and the user's reward based on currentAccumulatedPoolWeight and the user stake amount. The Rebase Engine and Network Demand are upgradable and can be replaced by future versions.
Integrated with DIA oracle price feeds to get the real time price of DAFI.
It will be integrated with Band Protocol's aggregator for the TVL feeds when they have completed the aggregator deployment. This will aggregate the entire amount of DAFI Super Staked across Binance Smart Chain, Ethereum and Polygon. Right now TVL is nullified, with Price left as the sole factor.
It uses TVLFeeds and PriceFeeds to calculate the network demand factor based on current price/baseline price and current TVL/baseline TVL. Only whitelisted accounts can update the variables. Both the TVL and Price feeds are upgradable.
This is a simple token pool to hold different pools of same token, we are using two pools i.e Staking Pool and the Reward Distribution Pool. Whenever a user stakes, the staked amount goes to Staking Pool and when user unstakes they get the staked amount back from the Staking Pool and the rewards from the Distribution Pool.
This is the database of the staking program. It holds the data variables of the staking program and the functions to view and update these data variables. Only whitelisted accounts can update the variables.
This contract rebases the pool variables as well as user stakes variables, based on formulae, before stake, unstake, and claimRewards functionalities of the StakingManager.