mirror of
https://github.com/logos-co/staking.git
synced 2025-01-13 04:04:26 +00:00
chore(contracts): Normalize function signatures
This commit is contained in:
parent
6af73d3883
commit
ff94f5e46c
@ -172,10 +172,10 @@ abstract contract EpochMath is MultiplierPointMath {
|
|||||||
pure
|
pure
|
||||||
returns (uint256 mpRate, uint256 mpFractional, uint256 epochTarget1, uint256 mpRemainder)
|
returns (uint256 mpRate, uint256 mpFractional, uint256 epochTarget1, uint256 mpRemainder)
|
||||||
{
|
{
|
||||||
mpRate = _accruedMP(_balance, ACCURE_RATE);
|
mpRate = _accrueMP(_balance, ACCURE_RATE);
|
||||||
mpFractional = mpRate - _accruedMP(_balance, _deltaTime);
|
mpFractional = mpRate - _accrueMP(_balance, _deltaTime);
|
||||||
|
|
||||||
uint256 mpTarget = _accruedMaxMP(_balance) + mpFractional;
|
uint256 mpTarget = _maxAccrueMP(_balance) + mpFractional;
|
||||||
uint256 deltaEpochTarget1 = mpTarget / mpRate;
|
uint256 deltaEpochTarget1 = mpTarget / mpRate;
|
||||||
|
|
||||||
epochTarget1 = _accountEpoch + deltaEpochTarget1;
|
epochTarget1 = _accountEpoch + deltaEpochTarget1;
|
||||||
|
@ -31,9 +31,9 @@ abstract contract MultiplierPointMath is IStakeConstants {
|
|||||||
* @param _balance Represents the current account balance
|
* @param _balance Represents the current account balance
|
||||||
* @param _deltaTime The time difference or the duration over which the multiplier points are accrued, expressed in
|
* @param _deltaTime The time difference or the duration over which the multiplier points are accrued, expressed in
|
||||||
* seconds
|
* seconds
|
||||||
* @return _accruedMP points accrued for given `_amount` and `_seconds`
|
* @return _accruedMP points accrued for given `_balance` and `_seconds`
|
||||||
*/
|
*/
|
||||||
function _accruedMP(uint256 _balance, uint256 _deltaTime) internal pure returns (uint256 _accruedMP) {
|
function _accrueMP(uint256 _balance, uint256 _deltaTime) internal pure returns (uint256 _accruedMP) {
|
||||||
return Math.mulDiv(_balance, _deltaTime * MP_APY, YEAR * 100);
|
return Math.mulDiv(_balance, _deltaTime * MP_APY, YEAR * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,21 +42,21 @@ abstract contract MultiplierPointMath is IStakeConstants {
|
|||||||
* t_lock.
|
* t_lock.
|
||||||
* It is equivalent to the accrued multiplier points function but specifically applied in the context of a locked
|
* It is equivalent to the accrued multiplier points function but specifically applied in the context of a locked
|
||||||
* balance.
|
* balance.
|
||||||
* @param _amount quantity of tokens
|
* @param _balance quantity of tokens
|
||||||
* @param _lockedSeconds time in seconds locked
|
* @param _lockedSeconds time in seconds locked
|
||||||
* @return _bonusMP bonus multiplier points for given `_amount` and `_lockedSeconds`
|
* @return _bonusMP bonus multiplier points for given `_balance` and `_lockedSeconds`
|
||||||
*/
|
*/
|
||||||
function _bonusMP(uint256 _amount, uint256 _lockedSeconds) internal pure returns (uint256 _bonusMP) {
|
function _bonusMP(uint256 _balance, uint256 _lockedSeconds) internal pure returns (uint256 _bonusMP) {
|
||||||
return _accruedMP(_amount, _lockedSeconds);
|
return _accrueMP(_balance, _lockedSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Calculates the initial multiplier points (MPs) based on the balance change Δa. The result is equal to
|
* @notice Calculates the initial multiplier points (MPs) based on the balance change Δa. The result is equal to
|
||||||
* the amount of balance added.
|
* the amount of balance added.
|
||||||
* @param _amount Represents the change in balance.
|
* @param _balance Represents the change in balance.
|
||||||
*/
|
*/
|
||||||
function _initialMP(uint256 _amount) internal pure returns (uint256 _initialMP) {
|
function _initialMP(uint256 _balance) internal pure returns (uint256 _initialMP) {
|
||||||
return _amount;
|
return _balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,17 +64,17 @@ abstract contract MultiplierPointMath is IStakeConstants {
|
|||||||
* removed from the total balance a_bal `_balance`.
|
* removed from the total balance a_bal `_balance`.
|
||||||
* The reduction is proportional to the ratio of the removed balance to the total balance, applied to the current
|
* The reduction is proportional to the ratio of the removed balance to the total balance, applied to the current
|
||||||
* multiplier points $mp$.
|
* multiplier points $mp$.
|
||||||
* @param _mp Represents the current multiplier points
|
|
||||||
* @param _balance The total account balance before the removal of Δa `_reducedBalance`
|
* @param _balance The total account balance before the removal of Δa `_reducedBalance`
|
||||||
|
* @param _mp Represents the current multiplier points
|
||||||
* @param _reducedAmount reduced balance
|
* @param _reducedAmount reduced balance
|
||||||
* @return _reducedMP Multiplier points to reduce from `_mp`
|
* @return _reducedMP Multiplier points to reduce from `_mp`
|
||||||
*/
|
*/
|
||||||
function _reducedMP(
|
function _reduceMP(
|
||||||
uint256 _mp,
|
|
||||||
uint256 _balance,
|
uint256 _balance,
|
||||||
|
uint256 _mp,
|
||||||
uint256 _reducedAmount
|
uint256 _reducedAmount
|
||||||
)
|
)
|
||||||
public
|
internal
|
||||||
pure
|
pure
|
||||||
returns (uint256 _reducedMP)
|
returns (uint256 _reducedMP)
|
||||||
{
|
{
|
||||||
@ -82,11 +82,11 @@ abstract contract MultiplierPointMath is IStakeConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Calculates maximum stake a given `_amount` can be generated with `MAX_MULTIPLIER`
|
* @notice Calculates maximum stake a given `_balance` can be generated with `MAX_MULTIPLIER`
|
||||||
* @param _balance quantity of tokens
|
* @param _balance quantity of tokens
|
||||||
* @return _maxMPAccrued maximum quantity of muliplier points that can be generated for given `_amount`
|
* @return _maxMPAccrued maximum quantity of muliplier points that can be generated for given `_balance`
|
||||||
*/
|
*/
|
||||||
function _accruedMaxMP(uint256 _balance) internal pure returns (uint256 _maxMPAccrued) {
|
function _maxAccrueMP(uint256 _balance) internal pure returns (uint256 _maxMPAccrued) {
|
||||||
return Math.mulDiv(_balance, MP_MPY, 100);
|
return Math.mulDiv(_balance, MP_MPY, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ abstract contract MultiplierPointMath is IStakeConstants {
|
|||||||
* @param _lockTime The time duration for which the balance is locked
|
* @param _lockTime The time duration for which the balance is locked
|
||||||
* @return _maxMP Maximum Multiplier Points that can be generated for given `_balance` and `_lockTime`
|
* @return _maxMP Maximum Multiplier Points that can be generated for given `_balance` and `_lockTime`
|
||||||
*/
|
*/
|
||||||
function _totalMaxMP(uint256 _balance, uint256 _lockTime) internal pure returns (uint256 _maxMP) {
|
function _maxTotalMP(uint256 _balance, uint256 _lockTime) internal pure returns (uint256 _maxMP) {
|
||||||
return _balance + Math.mulDiv(_balance * MP_APY, (MAX_MULTIPLIER * YEAR) + _lockTime, YEAR * 100);
|
return _balance + Math.mulDiv(_balance * MP_APY, (MAX_MULTIPLIER * YEAR) + _lockTime, YEAR * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,29 +107,21 @@ abstract contract MultiplierPointMath is IStakeConstants {
|
|||||||
* @param _balance quantity of tokens
|
* @param _balance quantity of tokens
|
||||||
* @return _maxMPAbsolute Absolute Maximum Multiplier Points
|
* @return _maxMPAbsolute Absolute Maximum Multiplier Points
|
||||||
*/
|
*/
|
||||||
function _absoluteMaxMP(uint256 _balance) internal pure returns (uint256 _maxMPAbsolute) {
|
function _maxAbsoluteMP(uint256 _balance) internal pure returns (uint256 _maxMPAbsolute) {
|
||||||
return Math.mulDiv(_balance, MP_MPY_ABSOLUTE, 100);
|
return Math.mulDiv(_balance, MP_MPY_ABSOLUTE, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Caution: This value is estimated and can be incorrect due precision loss.
|
* @dev Caution: This value is estimated and can be incorrect due precision loss.
|
||||||
* @notice Calculates the remaining lock time available for a given `_mpMax` and `_balance`
|
* @notice Calculates the remaining lock time available for a given `_mpMax` and `_balance`
|
||||||
* @param _mpMax Maximum multiplier points calculated from the current balance.
|
|
||||||
* @param _balance Current balance used to calculate the maximum multiplier points.
|
* @param _balance Current balance used to calculate the maximum multiplier points.
|
||||||
|
* @param _mpMax Maximum multiplier points calculated from the current balance.
|
||||||
|
* @return _lockTime Amount of lock time allowed to be increased
|
||||||
*/
|
*/
|
||||||
function _lockTimeAvailable(uint256 _mpMax, uint256 _balance) public pure returns (uint256 _lockTime) {
|
function _lockTimeAvailable(uint256 _balance, uint256 _mpMax) internal pure returns (uint256 _lockTime) {
|
||||||
return Math.mulDiv((_balance * MP_MPY_ABSOLUTE) - _mpMax, YEAR, _balance * 100);
|
return Math.mulDiv((_balance * MP_MPY_ABSOLUTE) - _mpMax, YEAR, _balance * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @notice Calculates the lock time for a given bonus multiplier points and current balance.
|
|
||||||
* @param _bonusMP bonus multiplier points intended to be generated
|
|
||||||
* @param _balance current balance
|
|
||||||
*/
|
|
||||||
function _lockTime(uint256 _bonusMP, uint256 _balance) internal pure returns (uint256 _lockTime) {
|
|
||||||
return Math.mulDiv(_bonusMP * 100, YEAR, _balance * MP_APY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Calculates the time required to accrue a specific multiplier point value.
|
* @notice Calculates the time required to accrue a specific multiplier point value.
|
||||||
* @param _balance The current balance.
|
* @param _balance The current balance.
|
||||||
@ -147,7 +139,7 @@ abstract contract MultiplierPointMath is IStakeConstants {
|
|||||||
* @return _bonusMP The calculated bonus multiplier points.
|
* @return _bonusMP The calculated bonus multiplier points.
|
||||||
*/
|
*/
|
||||||
function _retrieveBonusMP(uint256 _balance, uint256 _maxMP) internal pure returns (uint256 _bonusMP) {
|
function _retrieveBonusMP(uint256 _balance, uint256 _maxMP) internal pure returns (uint256 _bonusMP) {
|
||||||
return _maxMP - (_balance + _accruedMaxMP(_balance));
|
return _maxMP - (_balance + _maxAccrueMP(_balance));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -166,6 +158,6 @@ abstract contract MultiplierPointMath is IStakeConstants {
|
|||||||
pure
|
pure
|
||||||
returns (uint256 _accruedMP)
|
returns (uint256 _accruedMP)
|
||||||
{
|
{
|
||||||
return _totalMP + _accruedMaxMP(_balance) - _maxMP;
|
return _totalMP + _maxAccrueMP(_balance) - _maxMP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ contract StakeManager is StakeMath, EpochMath, TrustedCodehashAccess, IStakeMana
|
|||||||
revert StakeManager__InvalidLockTime();
|
revert StakeManager__InvalidLockTime();
|
||||||
}
|
}
|
||||||
//mints bonus multiplier points for seconds increased
|
//mints bonus multiplier points for seconds increased
|
||||||
uint256 bonusMP = _accruedMP(account.balance, _secondsIncrease);
|
uint256 bonusMP = _accrueMP(account.balance, _secondsIncrease);
|
||||||
|
|
||||||
//update account storage
|
//update account storage
|
||||||
account.lockUntil = lockUntil;
|
account.lockUntil = lockUntil;
|
||||||
@ -339,7 +339,7 @@ contract StakeManager is StakeMath, EpochMath, TrustedCodehashAccess, IStakeMana
|
|||||||
* @param epoch Epoch to increment total supply
|
* @param epoch Epoch to increment total supply
|
||||||
*/
|
*/
|
||||||
function _mintMP(Account storage account, uint256 processTime, Epoch storage epoch) private {
|
function _mintMP(Account storage account, uint256 processTime, Epoch storage epoch) private {
|
||||||
uint256 accruedMP = _accruedMP(account.balance, processTime - account.lastMint);
|
uint256 accruedMP = _accrueMP(account.balance, processTime - account.lastMint);
|
||||||
if (accruedMP + account.totalMP > account.maxMP) {
|
if (accruedMP + account.totalMP > account.maxMP) {
|
||||||
accruedMP = account.maxMP - account.totalMP; //how much left to reach cap
|
accruedMP = account.maxMP - account.totalMP; //how much left to reach cap
|
||||||
}
|
}
|
||||||
@ -369,7 +369,7 @@ contract StakeManager is StakeMath, EpochMath, TrustedCodehashAccess, IStakeMana
|
|||||||
* @return mp multiplier points to mint
|
* @return mp multiplier points to mint
|
||||||
*/
|
*/
|
||||||
function calculateMP(uint256 _balance, uint256 _deltaTime) public pure returns (uint256 mp) {
|
function calculateMP(uint256 _balance, uint256 _deltaTime) public pure returns (uint256 mp) {
|
||||||
return _accruedMP(_balance, _deltaTime);
|
return _accrueMP(_balance, _deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +61,7 @@ abstract contract StakeMath is MultiplierPointMath {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_deltaMpTotal = _initialMP(_increasedAmount) + deltaMpBonus;
|
_deltaMpTotal = _initialMP(_increasedAmount) + deltaMpBonus;
|
||||||
_newMaxMP = _currentMaxMP + _deltaMpTotal + _accruedMP(_increasedAmount, MAX_MULTIPLIER * YEAR);
|
_newMaxMP = _currentMaxMP + _deltaMpTotal + _accrueMP(_increasedAmount, MAX_MULTIPLIER * YEAR);
|
||||||
|
|
||||||
require(_newMaxMP <= MP_MPY_ABSOLUTE * (_balance + _increasedAmount), "StakeMath: max multiplier exceeded");
|
require(_newMaxMP <= MP_MPY_ABSOLUTE * (_balance + _increasedAmount), "StakeMath: max multiplier exceeded");
|
||||||
}
|
}
|
||||||
@ -136,8 +136,8 @@ abstract contract StakeMath is MultiplierPointMath {
|
|||||||
if (newBalance < MIN_BALANCE) {
|
if (newBalance < MIN_BALANCE) {
|
||||||
revert StakeManager__StakeIsTooLow();
|
revert StakeManager__StakeIsTooLow();
|
||||||
}
|
}
|
||||||
_deltaMpTotal = _reducedMP(_currentTotalMP, _balance, _reducedAmount);
|
_deltaMpTotal = _reduceMP(_balance, _currentTotalMP, _reducedAmount);
|
||||||
_deltaMpMax = _reducedMP(_currentMaxMP, _balance, _reducedAmount);
|
_deltaMpMax = _reduceMP(_balance, _currentMaxMP, _reducedAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,7 +165,7 @@ abstract contract StakeMath is MultiplierPointMath {
|
|||||||
revert StakeManager__AccrueTimeNotReached();
|
revert StakeManager__AccrueTimeNotReached();
|
||||||
}
|
}
|
||||||
if (_currentTotalMP < _currentMaxMP) {
|
if (_currentTotalMP < _currentMaxMP) {
|
||||||
_deltaMpTotal = Math.min(_accruedMP(_balance, dt), _currentMaxMP - _currentTotalMP);
|
_deltaMpTotal = Math.min(_accrueMP(_balance, dt), _currentMaxMP - _currentTotalMP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ interface IStakeManager is IStakeConstants, ITrustedCodehashAccess {
|
|||||||
|
|
||||||
function totalStaked() external view returns (uint256);
|
function totalStaked() external view returns (uint256);
|
||||||
function totalMP() external view returns (uint256);
|
function totalMP() external view returns (uint256);
|
||||||
//function totalMaxMP() external view returns (uint256);
|
//function maxTotalMP() external view returns (uint256);
|
||||||
function getStakedBalance(address _vault) external view returns (uint256 _balance);
|
function getStakedBalance(address _vault) external view returns (uint256 _balance);
|
||||||
|
|
||||||
struct Account {
|
struct Account {
|
||||||
|
@ -185,7 +185,7 @@ contract DynamicTest is StakeMath, Test {
|
|||||||
require(action.args.length == 1, "Incorrect number of arguments");
|
require(action.args.length == 1, "Incorrect number of arguments");
|
||||||
output.stakeAmount = input.stakeAmount;
|
output.stakeAmount = input.stakeAmount;
|
||||||
output.predictedBonusMP = input.predictedBonusMP;
|
output.predictedBonusMP = input.predictedBonusMP;
|
||||||
output.increasedAccruedMP = _accruedMP(input.stakeAmount, action.args[0]);
|
output.increasedAccruedMP = _accrueMP(input.stakeAmount, action.args[0]);
|
||||||
output.predictedAccruedMP = input.predictedAccruedMP + output.increasedAccruedMP;
|
output.predictedAccruedMP = input.predictedAccruedMP + output.increasedAccruedMP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -340,8 +340,8 @@ contract DynamicTest is StakeMath, Test {
|
|||||||
}
|
}
|
||||||
assertEq(streamer.totalStaked(), globalParams[stage].stakeAmount, "wrong total staked");
|
assertEq(streamer.totalStaked(), globalParams[stage].stakeAmount, "wrong total staked");
|
||||||
assertEq(streamer.totalMP(), globalParams[stage].predictedBonusMP, "wrong total MP");
|
assertEq(streamer.totalMP(), globalParams[stage].predictedBonusMP, "wrong total MP");
|
||||||
assertEq(streamer.totalMaxMP(), globalParams[stage].stakeAmount * MAX_MULTIPLIER +
|
assertEq(streamer.maxTotalMP(), globalParams[stage].stakeAmount * MAX_MULTIPLIER +
|
||||||
globalParams[stage].predictedBonusMP, "wrong totalMaxMP MP");
|
globalParams[stage].predictedBonusMP, "wrong maxTotalMP MP");
|
||||||
}
|
}
|
||||||
|
|
||||||
stage++; // second stage = progress in time
|
stage++; // second stage = progress in time
|
||||||
@ -362,8 +362,8 @@ contract DynamicTest is StakeMath, Test {
|
|||||||
}
|
}
|
||||||
assertEq(streamer.totalStaked(), globalParams[stage].stakeAmount, "wrong total staked");
|
assertEq(streamer.totalStaked(), globalParams[stage].stakeAmount, "wrong total staked");
|
||||||
assertEq(streamer.totalMP(), globalParams[stage].predictedBonusMP, "wrong total MP");
|
assertEq(streamer.totalMP(), globalParams[stage].predictedBonusMP, "wrong total MP");
|
||||||
assertEq(streamer.totalMaxMP(), globalParams[stage].stakeAmount * MAX_MULTIPLIER +
|
assertEq(streamer.maxTotalMP(), globalParams[stage].stakeAmount * MAX_MULTIPLIER +
|
||||||
globalParams[stage].predictedBonusMP, "wrong totalMaxMP MP");
|
globalParams[stage].predictedBonusMP, "wrong maxTotalMP MP");
|
||||||
}
|
}
|
||||||
|
|
||||||
stage++; // third stage = reduce stake
|
stage++; // third stage = reduce stake
|
||||||
@ -384,8 +384,8 @@ contract DynamicTest is StakeMath, Test {
|
|||||||
}
|
}
|
||||||
assertEq(streamer.totalStaked(), globalParams[stage].stakeAmount, "wrong total staked");
|
assertEq(streamer.totalStaked(), globalParams[stage].stakeAmount, "wrong total staked");
|
||||||
assertEq(streamer.totalMP(), globalParams[stage].predictedBonusMP, "wrong total MP");
|
assertEq(streamer.totalMP(), globalParams[stage].predictedBonusMP, "wrong total MP");
|
||||||
assertEq(streamer.totalMaxMP(), globalParams[stage].stakeAmount * MAX_MULTIPLIER +
|
assertEq(streamer.maxTotalMP(), globalParams[stage].stakeAmount * MAX_MULTIPLIER +
|
||||||
globalParams[stage].predictedBonusMP, "wrong totalMaxMP MP");
|
globalParams[stage].predictedBonusMP, "wrong maxTotalMP MP");
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ contract StakeTest is StakeManagerTest {
|
|||||||
assertEq(balance, stakeAmount, "balance of user vault should be equal to stake amount after stake");
|
assertEq(balance, stakeAmount, "balance of user vault should be equal to stake amount after stake");
|
||||||
assertEq(
|
assertEq(
|
||||||
maxMP,
|
maxMP,
|
||||||
_totalMaxMP(stakeAmount, 0),
|
_maxTotalMP(stakeAmount, 0),
|
||||||
"maxMP of user vault should be equal to stake amount after stake if no lock"
|
"maxMP of user vault should be equal to stake amount after stake if no lock"
|
||||||
);
|
);
|
||||||
assertEq(
|
assertEq(
|
||||||
@ -146,7 +146,7 @@ contract StakeTest is StakeManagerTest {
|
|||||||
|
|
||||||
vm.prank(testUser);
|
vm.prank(testUser);
|
||||||
userVault.lock(lockTime);
|
userVault.lock(lockTime);
|
||||||
uint256 estimatedMaxMP = maxMP + _accruedMP(stakeAmount, lockTime);
|
uint256 estimatedMaxMP = maxMP + _accrueMP(stakeAmount, lockTime);
|
||||||
uint256 estimatedTotalMP = _initialMP(stakeAmount) + _bonusMP(stakeAmount, lockTime);
|
uint256 estimatedTotalMP = _initialMP(stakeAmount) + _bonusMP(stakeAmount, lockTime);
|
||||||
(, balance, maxMP, totalMP,,,,) = stakeManager.accounts(address(userVault));
|
(, balance, maxMP, totalMP,,,,) = stakeManager.accounts(address(userVault));
|
||||||
assertEq(balance, stakeAmount, "balance of user vault should be equal to stake amount after lock");
|
assertEq(balance, stakeAmount, "balance of user vault should be equal to stake amount after lock");
|
||||||
@ -790,11 +790,11 @@ contract UserFlowsTest is StakeManagerTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
uint256 epochTarget1;
|
uint256 epochTarget1;
|
||||||
uint256 mpRate = _accruedMP(_stakeAmount, ACCURE_RATE);
|
uint256 mpRate = _accrueMP(_stakeAmount, ACCURE_RATE);
|
||||||
uint256 mpFractional = mpRate - _accruedMP(_stakeAmount, ACCURE_RATE - _stakeWarpTime);
|
uint256 mpFractional = mpRate - _accrueMP(_stakeAmount, ACCURE_RATE - _stakeWarpTime);
|
||||||
uint256 mpRemainder;
|
uint256 mpRemainder;
|
||||||
{
|
{
|
||||||
uint256 mpTarget = _accruedMaxMP(_stakeAmount) + mpFractional;
|
uint256 mpTarget = _maxAccrueMP(_stakeAmount) + mpFractional;
|
||||||
uint256 deltaEpochTarget1 = (mpTarget / mpRate);
|
uint256 deltaEpochTarget1 = (mpTarget / mpRate);
|
||||||
epochTarget1 = _startEpoch + deltaEpochTarget1;
|
epochTarget1 = _startEpoch + deltaEpochTarget1;
|
||||||
if (mpTarget % mpRate > 0) {
|
if (mpTarget % mpRate > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user