fix vdodo

This commit is contained in:
owen05
2021-02-13 13:31:48 +08:00
parent 1360f60d60
commit 7df484fccc
6 changed files with 31 additions and 7 deletions

View File

@@ -273,7 +273,11 @@ contract vDODOToken is InitializableOwnable {
// ============ Helper Functions ============
function getLatestAlpha() public view returns (uint256 newAlpha, uint256 curDistribution) {
curDistribution = _DODO_PER_BLOCK_ * (block.number - _LAST_REWARD_BLOCK_);
if (_LAST_REWARD_BLOCK_ == 0) {
curDistribution = 0;
} else {
curDistribution = _DODO_PER_BLOCK_ * (block.number - _LAST_REWARD_BLOCK_);
}
if (_TOTAL_STAKING_POWER_ > 0) {
newAlpha = uint256(alpha).add(DecimalMath.divFloor(curDistribution, _TOTAL_STAKING_POWER_));
} else {