Skip to content

Instantly share code, notes, and snippets.

@Turupawn
Created February 18, 2022 17:13
Show Gist options
  • Save Turupawn/895b06708e225922024d1c9213dcfeba to your computer and use it in GitHub Desktop.
Save Turupawn/895b06708e225922024d1c9213dcfeba to your computer and use it in GitHub Desktop.
holis.sol
// 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;
}
}
// 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