Skip to content

Instantly share code, notes, and snippets.

@AceVikings
Created February 13, 2021 06:12
Show Gist options
  • Save AceVikings/05156195481b5cf11c324c40f1525c8e to your computer and use it in GitHub Desktop.
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=
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