-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSharedWallet.sol
More file actions
33 lines (24 loc) · 987 Bytes
/
SharedWallet.sol
File metadata and controls
33 lines (24 loc) · 987 Bytes
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
//SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import "./Allowance.sol";
contract SharedWallet is Allowance {
event MoneySent(address indexed _beneficiary, uint _amount);
event MoneyReceived(address indexed _from, uint _amount);
function withdrawMoney(address payable _to, uint _amount) public ownerOrAllowed(_amount) {
require(_amount <= address(this).balance, "Contract doesn't own enough money");
if(!isOwner()) {
reduceAllowance(msg.sender, _amount);
}
emit MoneySent(_to, _amount);
_to.transfer(_amount);
}
function renounceOwnership() public override onlyOwner {
revert("can't renounceOwnership here"); //not possible with this smart contract
}
function getMoney() external payable {
emit MoneyReceived(msg.sender,msg.value);
}
receive() external payable {
emit MoneyReceived(msg.sender, msg.value);
}
}