Deploy NFTs
NFT 배포
이 튜토리얼에서는 NFT(Non-Fungible Token)를 생성하고 공개 테스트넷에 배포할 것입니다.
우리는 새로운 프로젝트를 만드는 것으로 시작합니다.
$ mkdir mynft && cd mynft
$ npm init -y
$ npm i --save-dev @openzeppelin/contracts
$ npm i truffle
명령어
truffle init
이것을 사용하여 프로젝트를 구성할 것입니다.$ npx truffle init
Starting init...
================
> Copying project files to
Init successful, sweet!
우리는 Preset
ERC721PresetMinterPauserAutoId
를 사용할 것입니다. 이것은 발행, 일시 중지, 소각기능이 포함되어있는 ERC721입니다. Preset
계약은 이미 컴파일되었으므로 아티팩트만 build/contracts 디렉터리에 복사하면 됩니다.$ mkdir -p build/contracts/
$ cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/
migrations
폴더안에 편집기를 사용 하여 다음 내용으로 파일 2_deploy.js
를 생성합니다.// migrations/2_deploy.js
// SPDX-License-Identifier: MIT
const ERC721PresetMinterPauserAutoId = artifacts.require("ERC721PresetMinterPauserAutoId");
module.exports = function(deployer) {
deployer.deploy(ERC721PresetMinterPauserAutoId, "My NFT","NFT", "http://my-json-server.typicode.com/huangsuyu/nft/tokens");
};