mirror of
https://github.com/logos-co/staking.git
synced 2025-01-24 17:39:15 +00:00
Initial MP mint repaired
- Now, MPs are minted on the newly staked amount only (previously was entire stake). - The bonus MPs are calculated correctly such that there is a 1x bonus per year of lock. - Still TBD: MPs are not minted for existing stake if current lock extended (or newly introduced), there is no check for max boost MP ceiling
This commit is contained in:
parent
24e59ff4a8
commit
fe5cd4b517
@ -24,9 +24,10 @@ contract StakeManager is Ownable {
|
||||
}
|
||||
|
||||
uint256 public constant EPOCH_SIZE = 1 weeks;
|
||||
uint256 public constant YEAR = 365 days;
|
||||
uint256 public constant MP_APY = 1;
|
||||
uint256 public constant STAKE_APY = 1;
|
||||
uint256 public constant MAX_BOOST = 1;
|
||||
uint256 public constant MAX_BOOST = 4;
|
||||
uint256 public constant MAX_MP = 1;
|
||||
|
||||
mapping (address => Account) accounts;
|
||||
@ -62,7 +63,7 @@ contract StakeManager is Ownable {
|
||||
processAccount(account, currentEpoch);
|
||||
account.balance += _amount;
|
||||
account.rewardAddress = StakeVault(msg.sender).owner();
|
||||
mintIntialMultiplier(account, _time);
|
||||
mintIntialMultiplier(account, _time, _amount);
|
||||
stakeSupply += _amount;
|
||||
}
|
||||
|
||||
@ -199,11 +200,11 @@ contract StakeManager is Ownable {
|
||||
multiplierSupply += increasedMultiplier;
|
||||
}
|
||||
|
||||
function mintIntialMultiplier(Account storage account, uint256 lockTime) private {
|
||||
function mintIntialMultiplier(Account storage account, uint256 lockTime, uint256 amount) private {
|
||||
//if balance still locked, multipliers must be minted from difference of time.
|
||||
uint256 dT = account.lockUntil > block.timestamp ? block.timestamp + lockTime - account.lockUntil : lockTime;
|
||||
account.lockUntil = block.timestamp + lockTime;
|
||||
uint256 increasedMultiplier = account.balance * (dT+1); //dT+1 could be replaced by requiring that dT is > 0, as it wouldnt matter 1 second locked.
|
||||
uint256 increasedMultiplier = amount * ((dT/YEAR)+1);
|
||||
account.lastMint = block.timestamp;
|
||||
account.multiplier += increasedMultiplier;
|
||||
multiplierSupply += increasedMultiplier;
|
||||
|
Loading…
x
Reference in New Issue
Block a user