-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleWallet.sol
More file actions
27 lines (20 loc) · 827 Bytes
/
SimpleWallet.sol
File metadata and controls
27 lines (20 loc) · 827 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
pragma solidity ^0.6.0;
import "./Allowance.sol";
contract SimpleWallet 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, "There are not enough funds stored in the smart contract");
if(!isOwner()) {
reduceAllowance(msg.sender, _amount);
}
emit MoneySent(_to, _amount);
_to.transfer(_amount);
}
function depositMoney() external payable {
emit MoneyReceived(msg.sender,msg.value);
}
function renounceOwnership() override public onlyOwner {
revert("Can't renounce ownership here");
}
}