diff --git a/src/GovernorModule.sol b/src/GovernorModule.sol index 40cb60f..dfe536f 100644 --- a/src/GovernorModule.sol +++ b/src/GovernorModule.sol @@ -11,6 +11,10 @@ contract GovernorModule { safeProxy = Safe(payable(address(_safeProxy))); } + /// @notice this is to call replaceOwner() on the safe + /// @dev done with execTransactionFromModule() + //todo: check if this function is still needed + // we might only need addOwnerWithThreshold(), removeOwner(), and setupOwners() function replaceOwner(address prevOwner, address oldOwner, address newOwner) internal { bytes memory swapOwner = abi.encodeWithSignature( "swapOwner(address,address,address)", @@ -26,6 +30,8 @@ contract GovernorModule { ); } + /// @notice this is to call addOwnerWithThreshold() on the safe + /// @dev done with execTransactionFromModule() function addOwnerWithThreshold(address newOwner, uint256 threshold) internal { bytes memory addOwner = abi.encodeWithSignature( "addOwnerWithThreshold(address,uint256)", @@ -40,6 +46,8 @@ contract GovernorModule { ); } + /// @notice this is to call removeOwner() on the safe + /// @dev done with execTransactionFromModule() function removeOwner( address prevOwner, address owner, @@ -58,4 +66,31 @@ contract GovernorModule { Enum.Operation.Call ); } + + /// @notice this is to remove one owner from the safe when a replacement election starts + /// @dev removeOwner() needs a prevOwner param as well which is the owner that points to the owner to be removed in the linked list + function removeSingleOwner(address owner) internal { + + /// @dev this is to get the previous owner param + for (int i = 0; i < safeProxy.getOwners().length; i++) { + //todo: get prevOwner + if (safeProxy.getOwner(prevOwner) == owner) { + break; + } + } + + //todo: removeOwner and adjust threshold accordingly + removeOwner(address(0), owner, 1); + } + + /// @notice this is to add one owner to the safe when a replacement election ends + /// @dev threshold is justed according to the number of owners + /// should always be majority + function addSingleOwner(address owner) internal { + addOwnerWithThreshold(owner, 1); + } + + function putInFullElection() internal { + + } } diff --git a/test/Echidna.t.sol b/test/Echidna.t.sol index c5afe20..3088cfa 100644 --- a/test/Echidna.t.sol +++ b/test/Echidna.t.sol @@ -2,6 +2,9 @@ pragma solidity ^0.8.19; //todo: fix with stakingV2 +// this is all commented out because the deployment process +// is different now because AutomatedVoting now uses StakingRewardsV2 + // import {AutomatedVoting} from "../src/AutomatedVoting.sol"; // import {StakingRewards} from "../lib/token/contracts/StakingRewards.sol"; // import {Kwenta} from "../lib/token/contracts/Kwenta.sol";