Created
February 22, 2022 18:43
-
-
Save Turupawn/aa575ff38d26494487d6fd4ade0cd1b5 to your computer and use it in GitHub Desktop.
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"; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
contract MyToken is ERC20 | |
{ | |
constructor() ERC20("My Token", "TKN") | |
{ | |
_mint(msg.sender, 100 ether); | |
} | |
} | |
contract MyNFT is ERC721 { | |
uint256 token_count; | |
MyToken my_token = MyToken(0xb427D612822Fc9879B537Dd7e9e87475f28B6aB7); | |
constructor() ERC721("My NFT", "MNFT") {} | |
function mintNFT(address to) public | |
{ | |
my_token.transferFrom(msg.sender, address(this), 10 ether); | |
_mint(to, token_count); | |
token_count += 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment