Skip to content

Instantly share code, notes, and snippets.

@mgraczyk
Last active July 1, 2021 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgraczyk/089f2bca52d8020bdfdc7d54ce333f9d to your computer and use it in GitHub Desktop.
Save mgraczyk/089f2bca52d8020bdfdc7d54ce333f9d to your computer and use it in GitHub Desktop.
liquidum_pool_1
// DO NOT USE: Incomplete example code.
contract PlotNFT is Ownable {
address target;
uint256 targetMinBlock;
constructor(address _target) public {
target = _target;
targetMinBlock = 0;
}
// Called by pool or plot owner to withdraw farmed rewards.
function withdraw() public {
require(block.number > targetMinBlock, "Target change pending");
target.transfer(this.balance);
}
// Called by the owner to switch pools or to solo mine.
function changeTarget(address _newTarget) public onlyOwner {
require(block.number > targetMinBlock, "Target change already pending");
// Approximately 30 minute wait time.
targetMinBlock = block.number + 136;
target = _newTarget;
}
// Used by the pool to check where the rewards will go.
function getTarget(address) public view returns (address) {
return target;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment