Created
May 23, 2018 08:53
-
-
Save hvrauhal/d0fc67cd5ccb697a9be05ea842ff99bc 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.4.24-nightly.2018.5.16+commit.7f965c86.js&optimize=false&gist=
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.23; | |
contract BreakpointSample { | |
address public owner; | |
uint256 public blockNumberToUnlock; | |
constructor (address _owner, uint256 blocksToUnlock) public { | |
if (_owner == address(0)) { | |
owner = msg.sender; | |
} else { | |
owner = _owner; | |
} | |
require(blocksToUnlock > 0); | |
owner = msg.sender; | |
blockNumberToUnlock = block.number + blocksToUnlock; | |
} | |
function changeOwner(address newOwner) external { | |
require(msg.sender == owner); | |
owner = newOwner; | |
} | |
function sendBack() external { | |
require(block.number > blockNumberToUnlock); | |
owner.transfer(address(this).balance); | |
} | |
function () payable public { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment