Closed 3esmit closed 6 months ago
I changed to time be relative together with the initialization of accounts based on lockUntil.
Unlocked accounts basically are accounts that lockUntil the exact same time they deposit, so the _time for locking is the block.timestamp of the transaction that initialized the staking.
Therefore, if an account have a lockUntil == 0, this means this account is not initializated, because timestamp 0 is an invalid timestamp value, therefore this value was used to determine initialization of an account.
Previously the refactor, the _time was absolute, this means that the parameter was exact timestamp of lockUntil. and therefore the parameter could be considered _lockUntil. Or it could be zero, that would use _lockUntil as block.timestamp.
After the refactor, the amount of seconds to increase, relative from:
I favour the use of relative time, because:
There's a chance that changes done here are related to https://github.com/logos-co/staking/issues/80
@3esmit do you think we can get your _time
related changes in?
If you confirm it's this commit introducing the necessary changes (https://github.com/logos-co/staking/pull/69/commits/c12d1ee9b17d806300d683fd623f98e965a44d71), we can cherry-pick it.
_time parameters can be used differently, depending on how current account state is.
After refactor _time become relative.
account.lockUntil = block.timestamp + _time
.account.lockUntil += _time
For both, _mintIntialMP would use _time.
Previously before refactor (https://github.com/logos-co/staking/pull/63) _time was absolute, therefore
account.lockUntil = _time
, and checks were done to ensure this parameters was within boundries of block.timestamp, and _mintIntialMP would usedeltaTime = _time - block.timestamp