Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
42d4f5e5
Unverified
Commit
42d4f5e5
authored
Oct 25, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(ctb): Move pre-removal check to outer function
parent
a725a3c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
LivenessModule.sol
packages/contracts-bedrock/src/Safe/LivenessModule.sol
+8
-9
No files found.
packages/contracts-bedrock/src/Safe/LivenessModule.sol
View file @
42d4f5e5
...
@@ -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:
newO
wnersCount,
_newOwnersCount:
o
wnersCount,
_newThreshold: get75PercentThreshold(
newO
wnersCount)
_newThreshold: get75PercentThreshold(
o
wnersCount)
});
});
}
}
_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 });
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment