-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: invariants compile and have a few TS tests
- Loading branch information
1 parent
7e777ae
commit d27487f
Showing
7 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
pragma solidity ^0.8.0; | ||
|
||
import {BeforeAfter} from "../BeforeAfter.sol"; | ||
import {Governance} from "src/Governance.sol"; | ||
import {IGovernance} from "src/interfaces/IGovernance.sol"; | ||
import {IBribeInitiative} from "src/interfaces/IBribeInitiative.sol"; | ||
|
||
abstract contract TsProperties is BeforeAfter { | ||
// Properties that ensure that a user TS is somewhat sound | ||
|
||
function property_user_ts_is_always_greater_than_start() public { | ||
for(uint256 i; i < users.length; i++) { | ||
(uint88 user_allocatedLQTY, uint120 userTs) = governance.userStates(users[i]); | ||
if(user_allocatedLQTY > 0) { | ||
gte(userTs, magnifiedStartTS, "User ts must always be GTE than start"); | ||
} | ||
} | ||
} | ||
|
||
function property_global_ts_is_always_greater_than_start() public { | ||
( | ||
uint88 totalCountedLQTY, | ||
uint120 globalTs | ||
) = governance.globalState(); | ||
|
||
if(totalCountedLQTY > 0) { | ||
gte(globalTs, magnifiedStartTS, "Global ts must always be GTE than start"); | ||
} | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters