Skip to content

Instantly share code, notes, and snippets.

@sagar-barapatre
Created April 4, 2022 11:07
Show Gist options
  • Save sagar-barapatre/cf9e094be4ac5346e83b77a358c5ed7e to your computer and use it in GitHub Desktop.
Save sagar-barapatre/cf9e094be4ac5346e83b77a358c5ed7e to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.12+commit.27d51765.js&optimize=false&runs=200&gist=
pragma solidity ^0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/access/Ownable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/math/SafeMath.sol";
import "./Allowance.sol";
contract SharedWallet is Ownable, 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
}
receive() external payable {
emit MoneyReceived(msg.sender, msg.value);
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment