Created
April 29, 2022 21:12
-
-
Save jcbombardelli/5e9b800b729c073e4a8861695fad4303 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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