Skip to content

Instantly share code, notes, and snippets.

@prestwich
Last active February 18, 2019 19:11
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 prestwich/2da5cc36ff2fee5100343ba514598dc1 to your computer and use it in GitHub Desktop.
Save prestwich/2da5cc36ff2fee5100343ba514598dc1 to your computer and use it in GitHub Desktop.
Nonfungibilizer.sol
// This is an alpha contract designed to be proxied
// It is NOT production ready
contract Nonfungiblizer {
bool initDone;
address owner;
address asset;
uint256 value;
constructor () {}
function init(address _asset, uint256 _value) {
require(!initDone);
require(_value > 0, '_value must be greater than 0');
require(
IERC20(_asset).transferFrom(msg.sender, address(this), _value),
'transferFrom failed'
);
asset = _asset;
value = _value;
initDone = true;
}
function withdraw(address _recipient) {
require(msg.sender == owner);
IERC20(_asset).transfer(_recipient, value);
selfdestruct();
}
function transfer(address _newOwner) {
require(msg.sender == owner);
owner = _newOwner;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment