Skip to content

Commit

Permalink
Lock manager updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed Dec 18, 2024
1 parent 0beb7f9 commit 27824f2
Show file tree
Hide file tree
Showing 2 changed files with 238 additions and 80 deletions.
175 changes: 136 additions & 39 deletions test/LockManager.t.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.17;

import {AragonTest} from "./util/AragonTest.sol";
import {Test} from "forge-std/Test.sol";

contract LockManagerTest is AragonTest {
function test_WhenDeployingTheContract() external {
contract LockManagerTest is Test {
modifier givenDeployingTheContract() {
_;
}

function test_RevertWhen_ConstructorHasInvalidUnlockMode() external givenDeployingTheContract {
// It Should revert
vm.skip(true);
}

function test_WhenConstructorWithValidParams() external givenDeployingTheContract {
// It Registers the DAO address
// It Stores the given settings
// It Stores the given plugin and token addresses
vm.skip(true);
}

modifier whenCallingUpdateSettings() {
Expand Down Expand Up @@ -34,65 +46,147 @@ contract LockManagerTest is AragonTest {
vm.skip(true);
}

function test_WhenLockingTokens() external {
// It Should allow any token holder to lock
// It Should use the full allowance
modifier givenNoLockedTokens() {
_;
}

modifier givenNoTokenAllowanceNoLocked() {
_;
}

function test_RevertWhen_CallingLock1() external givenNoLockedTokens givenNoTokenAllowanceNoLocked {
// It Should revert
vm.skip(true);
}

function test_RevertWhen_CallingLockAndVote1() external givenNoLockedTokens givenNoTokenAllowanceNoLocked {
// It Should revert
vm.skip(true);
}

modifier whenLockingAndOrVoting() {
function test_RevertWhen_CallingVote1() external givenNoLockedTokens givenNoTokenAllowanceNoLocked {
// It Should revert
vm.skip(true);
}

modifier givenWithTokenAllowanceNoLocked() {
_;
}

function test_GivenInvalidPlugin() external whenLockingAndOrVoting {
// It Locking and voting should revert
// It Voting should revert
function test_WhenCallingLock2() external givenNoLockedTokens givenWithTokenAllowanceNoLocked {
// It Should allow any token holder to lock
// It Should approve with the full token balance
vm.skip(true);
}

modifier givenValidLockToVotePlugin() {
function test_WhenCallingLockAndVote2() external givenNoLockedTokens givenWithTokenAllowanceNoLocked {
// It Should allow any token holder to lock
// It Should approve with the full token balance
// It The allocated token balance should have the full new balance
vm.skip(true);
}

function test_RevertWhen_CallingVote2() external givenNoLockedTokens givenWithTokenAllowanceNoLocked {
// It Should revert
vm.skip(true);
}

modifier givenLockedTokens() {
_;
}

function test_RevertWhen_NoTokenBalance() external whenLockingAndOrVoting givenValidLockToVotePlugin {
modifier givenNoTokenAllowanceSomeLocked() {
_;
}

function test_RevertWhen_CallingLock3() external givenLockedTokens givenNoTokenAllowanceSomeLocked {
// It Should revert
vm.skip(true);
}

function test_RevertWhen_NoTokenAllowance() external whenLockingAndOrVoting givenValidLockToVotePlugin {
function test_RevertWhen_CallingLockAndVote3() external givenLockedTokens givenNoTokenAllowanceSomeLocked {
// It Should revert
vm.skip(true);
}

function test_WhenInvalidOrInactiveProposal() external whenLockingAndOrVoting givenValidLockToVotePlugin {
// It Locking and voting should revert
// It Voting should revert
function test_RevertWhen_CallingVoteSameBalance3() external givenLockedTokens givenNoTokenAllowanceSomeLocked {
// It Should revert
vm.skip(true);
}

function test_WhenCallingVoteMoreLockedBalance3() external givenLockedTokens givenNoTokenAllowanceSomeLocked {
// It Should approve with the full token balance
vm.skip(true);
}

modifier whenValidProposal() {
modifier givenWithTokenAllowanceSomeLocked() {
_;
}

function test_WhenAlreadyVoted() external whenLockingAndOrVoting givenValidLockToVotePlugin whenValidProposal {
// It Should update the voting balance and the proposal tally
// It Should increase the voting power by the full allowance
function test_WhenCallingLock4() external givenLockedTokens givenWithTokenAllowanceSomeLocked {
// It Should allow any token holder to lock
// It Should approve with the full token balance
// It Should increase the locked amount
vm.skip(true);
}

function test_WhenCallingLockAndVoteNoPriorVotes4() external givenLockedTokens givenWithTokenAllowanceSomeLocked {
// It Should allow any token holder to lock
// It Should approve with the full token balance
// It Should increase the locked amount
// It The allocated token balance should have the full new balance
vm.skip(true);
}

function test_WhenNotVotedYet() external whenLockingAndOrVoting givenValidLockToVotePlugin whenValidProposal {
// It Should allow any token holder to vote
// It Should use the full allowance to vote
function test_WhenCallingLockAndVoteWithPriorVotes4()
external
givenLockedTokens
givenWithTokenAllowanceSomeLocked
{
// It Should allow any token holder to lock
// It Should approve with the full token balance
// It Should increase the locked amount
// It The allocated token balance should have the full new balance
vm.skip(true);
}

function test_WhenCallingGetTokens() external whenLockingAndOrVoting givenValidLockToVotePlugin whenValidProposal {
// It Should return the token addresses where votes have been cast
function test_RevertWhen_CallingVoteSameBalance4() external givenLockedTokens givenWithTokenAllowanceSomeLocked {
// It Should revert
vm.skip(true);
}

function test_GivenCallingGetLocks() external whenLockingAndOrVoting givenValidLockToVotePlugin whenValidProposal {
// It Should return the active proposals with 1+ locks
function test_WhenCallingVoteMoreLockedBalance4() external givenLockedTokens givenWithTokenAllowanceSomeLocked {
// It Should approve with the full token balance
vm.skip(true);
}

modifier givenCallingLockOrLockToVote() {
_;
}

function test_GivenInvalidPlugin() external givenCallingLockOrLockToVote {
// It Locking and voting should revert
vm.skip(true);
}

function test_GivenInvalidToken() external givenCallingLockOrLockToVote {
// It Locking should revert
// It Locking and voting should revert
// It Voting should revert
vm.skip(true);
}

modifier givenProposalEndedIsCalled() {
_;
}

function test_RevertWhen_TheCallerIsNotThePlugin() external givenProposalEndedIsCalled {
// It Should revert
vm.skip(true);
}

function test_WhenTheCallerIsThePlugin() external givenProposalEndedIsCalled {
// It Removes the proposal ID from the list of known proposals
vm.skip(true);
}

Expand Down Expand Up @@ -201,19 +295,19 @@ contract LockManagerTest is AragonTest {
_;
}

modifier givenBeforeReleaseLockIsCalled() {
modifier givenBeforeProposalEndedIsCalled() {
_;
}

modifier givenProposalVoterCallsUnlockNoReleaseLock() {
modifier givenProposalVoterCallsUnlockNoProposalEnded() {
_;
}

function test_WhenExecutedProposal()
external
givenAProposalHasEnded
givenBeforeReleaseLockIsCalled
givenProposalVoterCallsUnlockNoReleaseLock
givenBeforeProposalEndedIsCalled
givenProposalVoterCallsUnlockNoProposalEnded
{
// It Should allow voters from that proposal to unlock right away
vm.skip(true);
Expand All @@ -222,8 +316,8 @@ contract LockManagerTest is AragonTest {
function test_WhenDefeatedProposal()
external
givenAProposalHasEnded
givenBeforeReleaseLockIsCalled
givenProposalVoterCallsUnlockNoReleaseLock
givenBeforeProposalEndedIsCalled
givenProposalVoterCallsUnlockNoProposalEnded
{
// It Should allow voters from that proposal to unlock right away
vm.skip(true);
Expand All @@ -232,26 +326,29 @@ contract LockManagerTest is AragonTest {
function test_RevertWhen_ActiveProposal()
external
givenAProposalHasEnded
givenBeforeReleaseLockIsCalled
givenProposalVoterCallsUnlockNoReleaseLock
givenBeforeProposalEndedIsCalled
givenProposalVoterCallsUnlockNoProposalEnded
{
// It Should revert
vm.skip(true);
}

modifier whenAfterReleaseLockIsCalled() {
modifier whenAfterProposalEndedIsCalled() {
_;
}

function test_WhenProposalVoterCallsUnlockReleased() external givenAProposalHasEnded whenAfterReleaseLockIsCalled {
function test_WhenProposalVoterCallsUnlockReleased()
external
givenAProposalHasEnded
whenAfterProposalEndedIsCalled
{
// It Should allow voters from that proposal to unlock right away
// It Should revert on voters who have any other unreleased proposal votes
vm.skip(true);
}

function test_GivenPermissions() external {
// It Should revert if releaseLock is called by an incompatible plugin
// It Should revert if updateSettings is called by an address without the permission
// It Should revert if proposalEnded is called by an incompatible plugin
vm.skip(true);
}
}
Loading

0 comments on commit 27824f2

Please sign in to comment.