Created
July 10, 2018 15:02
-
-
Save ashtewari/38d6dba1434bec730a89d756f78d80ec to your computer and use it in GitHub Desktop.
This file contains 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
pragma solidity ^0.4.24; | |
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/lifecycle/Destructible.sol"; | |
contract SimpleBank is Destructible { | |
mapping (address => uint) private balances; | |
address public owner; | |
event LogDepositMade(address accountAddress, uint amount); | |
constructor() public { | |
owner = msg.sender; | |
} | |
function deposit() public payable returns (uint) { | |
require((balances[msg.sender] + msg.value) >= balances[msg.sender]); | |
balances[msg.sender] += msg.value; | |
emit LogDepositMade(msg.sender, msg.value); | |
return balances[msg.sender]; | |
} | |
function balance() constant public returns (uint) { | |
return balances[msg.sender]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment