Skip to content

Commit

Permalink
Scaffolding the LockManager functions
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed Dec 11, 2024
1 parent 1429c91 commit b3c1c4c
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 20 deletions.
54 changes: 51 additions & 3 deletions src/LockManager.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,58 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {IDAO} from "@aragon/osx/core/dao/IDAO.sol";
import {DaoAuthorizable} from "@aragon/osx/core/plugin/dao-authorizable/DaoAuthorizable.sol";
import {ILockManager} from "./interfaces/ILockManager.sol";
import {ILockToVote} from "./interfaces/ILockToVote.sol";
import {IVotesUpgradeable} from "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol";

contract LockManager is ILockManager {
struct PluginSettings {
uint64 proposlDuration;
contract LockManager is ILockManager, DaoAuthorizable {
enum LockMode {
STRICT,
FLEXIBLE
}
struct Settings {
LockMode lockMode;
}

Settings public settings;

error InvalidLockMode();

constructor(IDAO _dao, Settings memory _settings) DaoAuthorizable(_dao) {
if (
_settings.lockMode != LockMode.STRICT &&
_settings.lockMode != LockMode.FLEXIBLE
) {
revert InvalidLockMode();
}

settings.lockMode = _settings.lockMode;
}

/// @inheritdoc ILockManager
function lock() public {
//
}

/// @inheritdoc ILockManager
function lockAndVote(ILockToVote plugin, uint256 proposalId) public {
//
}

/// @inheritdoc ILockManager
function vote(ILockToVote plugin, uint256 proposalId) public {
//
}

/// @inheritdoc ILockManager
function unlock() public {
//
}

/// @inheritdoc ILockManager
function releaseLock(uint256 proposalId) public {
//
}
}
5 changes: 3 additions & 2 deletions src/LockToVotePlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ pragma solidity ^0.8.13;

import {ILockToVote} from "./interfaces/ILockToVote.sol";

contract LockToVotePlugin is ILockToVote {
contract LockToVotePlugin {
// is ILockToVote
struct PluginSettings {
uint64 proposlDuration;
uint64 proposalDuration;
}
}
4 changes: 4 additions & 0 deletions test/LockManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ pragma solidity 0.8.17;
import {AragonTest} from "./util/AragonTest.sol";

contract LockManagerTest is AragonTest {
function test_WhenDeployingTheContract() external {
// It Registers the DAO address
}

modifier whenCallingUpdateSettings() {
_;
}
Expand Down
3 changes: 3 additions & 0 deletions test/LockManager.t.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
LockManagerTest:
- when: Deploying the contract
then:
- it: Registers the DAO address
- when: calling updateSettings
and:
- when: updateSettings without the permission
Expand Down
17 changes: 9 additions & 8 deletions test/LockToVote.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ import {AragonTest} from "./util/AragonTest.sol";

contract LockToVoteTest is AragonTest {
function test_WhenDeployingTheContract() external {
// It should initialize normally
vm.skip(true);
}

function test_GivenADeployedContract() external {
// It should refuse to initialize again
// It should disable the initializers
vm.skip(true);
}

modifier givenANewInstance() {
modifier givenANewProxy() {
_;
}

function test_GivenCallingInitialize() external givenANewInstance {
function test_WhenCallingInitialize() external givenANewProxy {
// It should set the DAO address
// It should initialize normally
vm.skip(true);
}

function test_GivenADeployedContract() external {
// It should refuse to initialize again
vm.skip(true);
}

Expand Down
14 changes: 7 additions & 7 deletions test/LockToVote.t.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ LockToVoteTest:
# contract lifecycle
- when: deploying the contract
then:
- it: should initialize normally
- given: a deployed contract
- it: should disable the initializers
- given: A new proxy
then:
- it: should refuse to initialize again
- given: a new instance
and:
- given: calling initialize
- when: calling initialize
and:
- it: should set the DAO address

- it: should initialize normally
- given: a deployed contract
then:
- it: should refuse to initialize again
- when: calling updateSettings
and:
- when: updateSettings without the permission
Expand Down

0 comments on commit b3c1c4c

Please sign in to comment.