-
Notifications
You must be signed in to change notification settings - Fork 603
Expand file tree
/
Copy pathMultiSigWallet.sol
More file actions
61 lines (49 loc) · 1.39 KB
/
MultiSigWallet.sol
File metadata and controls
61 lines (49 loc) · 1.39 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
pragma solidity ^0.4.0;
contract MultiSigWallet {
address private _owner;
mapping(address => uint8) private _owners;
modifier isOwner() {
require(msg.sender == _owner);
_;
}
modifier validOwner() {
require(msg.sender == _owner || _owners[msg.sender] == 1);
_;
}
event DepositFunds(address from, uint amount);
event WithdrawFunds(address to, uint amount);
event TransferFunds(address from, address to, uint amount);
constructor()
public {
_owner = msg.sender;
}
function addOwner(address owner)
isOwner
public {
_owners[owner] = 1;
}
function removeOwner(address owner)
isOwner
public {
_owners[owner] = 0;
}
function ()
public
payable {
emit DepositFunds(msg.sender, msg.value);
}
function withdraw(uint amount)
validOwner
public {
require(address(this).balance >= amount);
msg.sender.transfer(amount);
emit WithdrawFunds(msg.sender, amount);
}
function transferTo(address to, uint amount)
validOwner
public {
require(address(this).balance >= amount);
to.transfer(amount);
emit TransferFunds(msg.sender, to, amount);
}
}