Skip to content

Instantly share code, notes, and snippets.

@jcbombardelli
Created April 29, 2022 21:12
Show Gist options
  • Save jcbombardelli/5e9b800b729c073e4a8861695fad4303 to your computer and use it in GitHub Desktop.
Save jcbombardelli/5e9b800b729c073e4a8861695fad4303 to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Bank {
//Properties
address private owner;
mapping(address => uint256) public addressToBalance;
//modifiers
modifier isOwner() {
require(msg.sender == owner, "Sender is not owner");
_;
}
//events
event OwnerChanged(address indexed oldOwner, address indexed newOwner);
event BalanceIncreased(address indexed target, uint256 value);
//constructor
constructor(){
owner = msg.sender;
}
//functions
function addBalance(address to, uint value) public isOwner {
addressToBalance[address(to)] = value;
emit BalanceIncreased(to, value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment