Created
February 18, 2022 17:13
-
-
Save Turupawn/895b06708e225922024d1c9213dcfeba to your computer and use it in GitHub Desktop.
holis.sol
This file contains hidden or 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
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.12; | |
contract Hello | |
{ | |
string public hello = "Hola mundo!"; | |
function setHello(string memory _hello) public | |
{ | |
hello = _hello; | |
} | |
function getHello() public view returns(string memory) | |
{ | |
return hello; | |
} | |
} |
This file contains hidden or 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
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.12; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
contract MyToken is ERC20 | |
{ | |
uint MAX_TOKEN = 1_000_000 ether; | |
constructor() ERC20("My Token", "TKN") | |
{ | |
} | |
function buy() public payable | |
{ | |
require(msg.value == 0.01 ether, "Must pay token value"); | |
require(totalSupply() + 100 < MAX_TOKEN, "Supply limit reached"); | |
_mint(msg.sender, 100 ether); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment