우선 메타마스크에서 테스트 네트워크를 만들어 준다.
Remix IDE에서 MintToken.sol 파일을 생성한다.
정식으로 배우기 전이라 내용이 확실치 않음.
pragma solidity ^0.8.18;
▶ ERC20Burnable을 사용하기 위해 삽입
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
contract MintToken is ERC20Burnable {
constructor(uint256 _initialSupply, string memory _name, string memory _symbol) ERC20(_name, _symbol) {
_mint(msg.sender, _initialSupply);
} ▶construtor는 deploy에 넣을 값들
}
{
"name": "이름",
"description": "설명",
"image": "피나타에 업로드한 이미지 파일의 주소",
"attributes": [
{
"trait_type": "Animal", ▶특징 설명
"value": "Cat"
},
{
"trait_type": "Color",
"value": "Gray"
}
]
}
pragma solidity ^0.8.18;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract MintNft is ERC721Enumerable {
mapping(uint => string) public metadataUri;
uint public totalNft;
constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {}
function mintNft(string memory _metadataUri) public {
uint tokenId = totalSupply() + 1;
_mint(msg.sender, tokenId);
metadataUri[tokenId] = _metadataUri;
}
function tokenURI(uint _tokenId) public override view returns(string memory) {
return metadataUri[_tokenId];
}
}