Skip to content

Commit

Permalink
Update 02_bank.sol
Browse files Browse the repository at this point in the history
modifier onlyOwner
  • Loading branch information
xanpena committed Jan 15, 2022
1 parent d5b6216 commit 2a6ae1e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions 02_bank.sol
Expand Up @@ -5,6 +5,10 @@ contract Bank {

address owner;

modifier onlyOwner {
require(msg.sender == owner);
}

function Bank() payable public {
owner = msg.sender;
}
Expand All @@ -13,8 +17,7 @@ contract Bank {
require(msg.value == amount);
}

function withdrawBalance() public {
require(msg.sender == owner);
function withdrawBalance() public onlyOwner {
msg.sender.transfer(address(this).balance);
}
}

0 comments on commit 2a6ae1e

Please sign in to comment.