Skip to content

Commit

Permalink
chore: comment on FLs
Browse files Browse the repository at this point in the history
  • Loading branch information
GalloDaSballo committed Oct 17, 2024
1 parent d5273b2 commit cf99ff2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/VotingPower.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,18 @@ contract VotingPowerTest is Test {
assertEq(avgTs_reset_2, avgTs2_diff, "Same as diff means it does reset");
}


// Check if Flashloan can be used to cause issues?
// A flashloan would cause issues in the measure in which it breaks any specific property
// Or expectation

// Remove votes
// Removing votes would force you to exclusively remove
// You can always remove at any time afacit
// Removing just updates that + the weights
// The weights are the avg time * the number


function _getAverageTS(address initiative) internal returns (uint256) {
(
,
Expand Down
16 changes: 16 additions & 0 deletions test/recon/properties/GovernanceProperties.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.0;
import {BeforeAfter} from "../BeforeAfter.sol";
import {Governance} from "src/Governance.sol";
import {IGovernance} from "src/interfaces/IGovernance.sol";
import {MockStakingV1} from "test/mocks/MockStakingV1.sol";

abstract contract GovernanceProperties is BeforeAfter {

Expand Down Expand Up @@ -45,6 +46,21 @@ abstract contract GovernanceProperties is BeforeAfter {
}
}


function property_stake_and_votes_cannot_be_abused() public {
// User stakes
// User allocated

// allocated is always <= stakes
for(uint256 i; i < users.length; i++) {
// Only sum up user votes
uint256 stake = MockStakingV1(stakingV1).stakes(users[i]);
(uint88 user_allocatedLQTY, ) = governance.userStates(users[i]);
lte(user_allocatedLQTY, stake, "User can never allocated more than stake");
}

}

// View vs non view must have same results
function property_viewTotalVotesAndStateEquivalency() public {
for(uint8 i; i < deployedInitiatives.length; i++) {
Expand Down

0 comments on commit cf99ff2

Please sign in to comment.