Created
February 13, 2021 06:12
-
-
Save AceVikings/05156195481b5cf11c324c40f1525c8e 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.26+commit.4563c3fc.js&optimize=false&runs=200&gist=
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
| pragma solidity ^0.4.8; | |
| contract dms | |
| { | |
| event is_Alive(uint blocknum); | |
| address public owner; | |
| address public recipient; | |
| uint public lastblock; | |
| constructor () public { | |
| owner = msg.sender; | |
| recipient = "replace with recipient address"; | |
| lastblock = block.number; | |
| emit is_Alive(lastblock); | |
| } | |
| modifier isOwner(){ | |
| require(msg.sender==owner,'sender is not owner'); | |
| lastblock = block.number; | |
| emit is_Alive(lastblock); | |
| _; | |
| } | |
| function release() public{ | |
| require(block.number > lastblock + 10,"owner was recently active") ; | |
| selfdestruct(recipient); | |
| } | |
| function releaseToOwner() public isOwner{ | |
| require(block.number <= lastblock + 10,"kinda dark but owner is dead bruh"); | |
| selfdestruct(owner); | |
| } | |
| function is_alive() public isOwner returns(bool) { | |
| return true; | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment