-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimpleWallet.sol
29 lines (22 loc) · 886 Bytes
/
SimpleWallet.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
//SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import "./Allowance.sol";
contract SimpleWallet is Allowance {
event MoneySent(address indexed _beneficiary, uint _amount);
event MoneyReceived(address indexed _from, uint _amount);
function renounceOwnership() public override view onlyOwner {
revert("can't renounceOwnership here"); //not possible with this smart contract
}
function withdrawMoney(address payable _to, uint _amount) public onlyOwnerOrAllowed(_amount) {
require(_amount <= address(this).balance, "There are not enough funds in the contract");
if(!isOwner())
{
reduceAllowance(msg.sender, _amount);
}
emit MoneySent(_to, _amount);
_to.transfer(_amount);
}
receive() external payable {
emit MoneyReceived(msg.sender, msg.value);
}
}