Last active
March 24, 2020 14:56
-
-
Save tienshaoku/5b3accdf5af1f876327cc9694d42b511 to your computer and use it in GitHub Desktop.
The filename ends with .py for Python syntax highlighting
This file contains 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
import ERC20 as ERC20 | |
owner: public(address) | |
tokenAddress: public(address) | |
erc20: ERC20 | |
@public | |
def __init__(_tokenAddress: address): | |
self.owner = msg.sender | |
self.tokenAddress = _tokenAddress | |
self.erc20 = ERC20(self.tokenAddress) | |
@payable | |
@public | |
def buyToken(): | |
assert msg.value == 10 ** 16 | |
assert_modifiable(self.erc20.transfer(msg.sender, 500)) | |
@public | |
def endSale(): | |
assert msg.sender == self.owner | |
selfdestruct(self.owner) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment