-
Notifications
You must be signed in to change notification settings - Fork 18
/
MultiSignatureWalletHelpers.sol
38 lines (31 loc) · 1.23 KB
/
MultiSignatureWalletHelpers.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
pragma solidity ^0.5.1;
contract MultiSignatureWalletHelpers {
function changeRequiredSignatures(uint256 requiredSignatures) external {
assembly {
sstore(1, requiredSignatures) // change number of required signatures
}
}
function addSignatory(uint256 requiredSignatures, address signatory, uint256 weight) external {
assembly {
switch iszero(gt(signatory, 1)) // ensure signatory is not reserved slots
case 1 { revert(0, 0) }
sstore(1, requiredSignatures)
sstore(signatory, weight)
}
}
function changeSignatoryWeight(address signatory, uint256 weight) external {
assembly {
switch iszero(gt(signatory, 1)) // ensure signatory is not reserved slots
case 1 { revert(0, 0) }
sstore(signatory, weight)
}
}
function removeSignatory(uint256 requiredSignatures, address signatory) external {
assembly {
switch iszero(gt(signatory, 1)) // ensure signatory is not reserved slots
case 1 { revert(0, 0) }
sstore(1, requiredSignatures) // change required signatures
sstore(signatory, 0) // set signatory weight to zero
}
}
}