Commit 42d4f5e5 authored by Maurelian's avatar Maurelian

refactor(ctb): Move pre-removal check to outer function

parent a725a3c2
...@@ -63,15 +63,18 @@ contract LivenessModule is ISemver { ...@@ -63,15 +63,18 @@ contract LivenessModule is ISemver {
require(_previousOwners.length == _ownersToRemove.length, "LivenessModule: arrays must be the same length"); require(_previousOwners.length == _ownersToRemove.length, "LivenessModule: arrays must be the same length");
// We will remove at least one owner, so we'll initialize the newOwners count to the current number of owners // We will remove at least one owner, so we'll initialize the newOwners count to the current number of owners
// minus one. uint256 ownersCount = SAFE.getOwners().length;
uint256 newOwnersCount = SAFE.getOwners().length;
for (uint256 i = 0; i < _previousOwners.length; i++) { for (uint256 i = 0; i < _previousOwners.length; i++) {
newOwnersCount--; ownersCount--;
require(
ownersCount < MIN_OWNERS || _canRemove(_ownersToRemove[i]),
"LivenessModule: the safe still has sufficient owners, or the owner to remove has signed recently"
);
_removeOwner({ _removeOwner({
_prevOwner: _previousOwners[i], _prevOwner: _previousOwners[i],
_ownerToRemove: _ownersToRemove[i], _ownerToRemove: _ownersToRemove[i],
_newOwnersCount: newOwnersCount, _newOwnersCount: ownersCount,
_newThreshold: get75PercentThreshold(newOwnersCount) _newThreshold: get75PercentThreshold(ownersCount)
}); });
} }
_verifyFinalState(); _verifyFinalState();
...@@ -88,10 +91,6 @@ contract LivenessModule is ISemver { ...@@ -88,10 +91,6 @@ contract LivenessModule is ISemver {
) )
internal internal
{ {
require(
_newOwnersCount < MIN_OWNERS || _canRemove(_ownerToRemove),
"LivenessModule: the safe still has sufficient owners, or the owner to remove has signed recently"
);
if (_newOwnersCount > 0) { if (_newOwnersCount > 0) {
// Remove the owner and update the threshold // Remove the owner and update the threshold
_removeOwnerSafeCall({ _prevOwner: _prevOwner, _owner: _ownerToRemove, _threshold: _newThreshold }); _removeOwnerSafeCall({ _prevOwner: _prevOwner, _owner: _ownerToRemove, _threshold: _newThreshold });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment