mirror of https://github.com/logos-co/staking.git
chore(StakeManager.spec): add rule to ensure MP 1to1 ratio
This commit is contained in:
parent
7e2f675115
commit
1632e08f83
|
@ -37,6 +37,13 @@ function getAccountCurrentMultiplierPoints(address addr) returns uint256 {
|
|||
return currentMP;
|
||||
}
|
||||
|
||||
function getAccountLockUntil(address addr) returns uint256 {
|
||||
uint256 lockUntil;
|
||||
_, _, _, _, _, lockUntil, _ = accounts(addr);
|
||||
|
||||
return lockUntil;
|
||||
}
|
||||
|
||||
function isMigrationfunction(method f) returns bool {
|
||||
return
|
||||
f.selector == sig:migrateTo(bool).selector ||
|
||||
|
@ -144,6 +151,27 @@ rule reachability(method f)
|
|||
satisfy true;
|
||||
}
|
||||
|
||||
rule stakingMintsMultiplierPoints1To1Ratio {
|
||||
|
||||
env e;
|
||||
uint256 amount;
|
||||
uint256 lockupTime;
|
||||
uint256 multiplierPointsBefore;
|
||||
uint256 multiplierPointsAfter;
|
||||
|
||||
requireInvariant InitialMPIsNeverSmallerThanBalance(e.msg.sender);
|
||||
requireInvariant CurrentMPIsNeverSmallerThanInitialMP(e.msg.sender);
|
||||
|
||||
require getAccountLockUntil(e.msg.sender) <= e.block.timestamp;
|
||||
|
||||
multiplierPointsBefore = getAccountInitialMultiplierPoints(e.msg.sender);
|
||||
stake(e, amount, lockupTime);
|
||||
multiplierPointsAfter = getAccountInitialMultiplierPoints(e.msg.sender);
|
||||
|
||||
assert lockupTime == 0 => to_mathint(multiplierPointsAfter) == multiplierPointsBefore + amount;
|
||||
assert to_mathint(multiplierPointsAfter) >= multiplierPointsBefore + amount;
|
||||
}
|
||||
|
||||
rule stakingGreaterLockupTimeMeansGreaterMPs {
|
||||
|
||||
env e;
|
||||
|
|
Loading…
Reference in New Issue