Here you will find the computations for staking and un-staking
Explanation:
The staking system will provide greater rewards for those that stake longer and continue to participate in THE Ecosystem. When pairing with one of the DAO NFTs you will incur additional bonuses in the staking platform.
uint256 multiplier =getMultiplier(user.startedAt, block.timestamp);-- first we calculate the time difference between staking deposit and current timeuint256 totalMultiplier =10000+ (multiplier * (pointsPerDay + user.boostPointsBP)) / ONE_DAY;-- we use 10000 denominator--10000+ means that staker should always start with 1x rewards-- we add time difference * (0.41 (pointsperday) + nftboost) and divide that with number of seconds in a dayuserWeightedAmount = (user.amount * totalMultiplier) /10000;-- final calculation of user weighted stake
Formula when adding tokens to an existing stake (explained)
uint256 userVotingPower =getVotingPower(_pid, sender);-- we get current voting power, formula is described in first exampleuint256 totalMultiplier = ((userVotingPower + _amount) *10000) /(user.amount + _amount);-- then we reverse calculate totalMultiplier userVotingPower from above + _amount which is new amount user is trying to deposit * DENOMINATOR divided by staked amount (non-weighted) +new amount. totalMultiplier in this case means what would multiplier be if user initially staked user.amount + _amountuint256 multiplier = (ONE_DAY * (totalMultiplier -10000)) / (pointsPerDay + user.boostPointsBP);-- in the formula above we calculate what would that be in the secondsuser.startedAt = block.timestamp - multiplier;-- and finally we subtract those seconds from current timestamp