@@ -16,6 +16,51 @@ abstract contract ECDSAMultisigWalletInternal is IECDSAMultisigWalletInternal {
1616 using EnumerableSet for EnumerableSet.AddressSet;
1717 using ECDSAMultisigWalletStorage for ECDSAMultisigWalletStorage.Layout;
1818
19+ function _isInvalidNonce (address account , uint256 nonce )
20+ internal
21+ view
22+ returns (bool )
23+ {
24+ return ECDSAMultisigWalletStorage.layout ().nonces[account][nonce];
25+ }
26+
27+ function _setInvalidNonce (address account , uint256 nonce ) internal {
28+ ECDSAMultisigWalletStorage.layout ().nonces[account][nonce] = true ;
29+ }
30+
31+ function _setQuorum (uint256 quorum ) internal {
32+ ECDSAMultisigWalletStorage.Layout storage l = ECDSAMultisigWalletStorage
33+ .layout ();
34+
35+ if (quorum > l.signers.length ())
36+ revert ECDSAMultisigWallet__InsufficientSigners ();
37+ l.quorum = quorum;
38+ }
39+
40+ function _isSigner (address account ) internal view returns (bool ) {
41+ return ECDSAMultisigWalletStorage.layout ().signers.contains (account);
42+ }
43+
44+ function _addSigner (address account ) internal {
45+ ECDSAMultisigWalletStorage.Layout storage l = ECDSAMultisigWalletStorage
46+ .layout ();
47+
48+ if (l.signers.length () >= 256 )
49+ revert ECDSAMultisigWallet__SignerLimitReached ();
50+ if (! l.signers.add (account))
51+ revert ECDSAMultisigWallet__AddSignerFailed ();
52+ }
53+
54+ function _removeSigner (address account ) internal {
55+ ECDSAMultisigWalletStorage.Layout storage l = ECDSAMultisigWalletStorage
56+ .layout ();
57+
58+ if (l.quorum > l.signers.length () - 1 )
59+ revert ECDSAMultisigWallet__InsufficientSigners ();
60+ if (! l.signers.remove (account))
61+ revert ECDSAMultisigWallet__RemoveSignerFailed ();
62+ }
63+
1964 /**
2065 * @notice verify signatures and execute "call" or "delegatecall" with given parameters
2166 * @dev message parameters must be included in signature
@@ -103,10 +148,10 @@ abstract contract ECDSAMultisigWalletInternal is IECDSAMultisigWalletInternal {
103148
104149 if (index >= 256 )
105150 revert ECDSAMultisigWallet__RecoveredSignerNotAuthorized ();
106- if (l. isInvalidNonce (signer, signature.nonce))
151+ if (_isInvalidNonce (signer, signature.nonce))
107152 revert ECDSAMultisigWallet__InvalidNonce ();
108153
109- l. setInvalidNonce (signer, signature.nonce);
154+ _setInvalidNonce (signer, signature.nonce);
110155
111156 uint256 shift = 1 << index;
112157
0 commit comments