Skip to content

Instantly share code, notes, and snippets.

@shanev
Created October 6, 2018 05:13
Show Gist options
  • Save shanev/0e639b34783d84122bac9c3f3573b0d5 to your computer and use it in GitHub Desktop.
Save shanev/0e639b34783d84122bac9c3f3573b0d5 to your computer and use it in GitHub Desktop.
An ERC20 token that can only be transferred to the address which created it
pragma solidity ^0.4.24;
import "./ERC20.sol";
/**
* @title One-way Fungible Token
*/
contract ERC20Unidirectional is ERC20 {
address private _parent;
constructor(address parent) {
_parent = parent;
}
function transfer(address to, uint256 value) public returns (bool) {
require(to == _parent, "must transfer to parent");
_transfer(msg.sender, to, value);
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment