본문 바로가기

Hardhat

(3)
[Hardhat] .deploy VS .deployed contract 배포할 때 어떤 코드는 .deploy 까지만 하고 어떤 코드는 .deploy 이후에 .deployed 까지 해줘서 뭐가 다른걸까 궁금했다. 내 테스트코드의 일부다. GachaCard = await ethers.getContractFactory("GachaCard"); gachaCard = await GachaCard.deploy( FIRST_MINT_PRICE, MINT_PRICE, FIRST_MINT_AMOUNT ); await gachaCard.deployed(); .deploy()는 이 컨트랙트 배포를 트리거하고 .deployed()는 컨트랙트가 이미 블록체인에서 사용 가능한지 확인하고 배포가 아직 진행 중이면 배포 트랜잭션이 채굴될 때까지 기다린다. .deployed()는 컨트랙트..
[Hardhat] 명함 NFT 만들 때 보았던 링크들 모음 https://dev.to/jacobedawson/import-test-a-popular-nft-smart-contract-with-hardhat-ethers-12i5 Import & Test a Popular NFT Smart Contract with Hardhat & Ethers Today we're going to learn how to use the very cool smart-contract development framework Hardhat to... dev.to https://ethereum.org/en/developers/tutorials/how-to-mint-an-nft/ Home | ethereum.org Ethereum is a global, decentralized platform..
[Hardhat, javascript] test code에서 beforeEach 프로젝트폴더/test/MYNFT.js 테스트코드에서 beforeEach는 어떻게 쓰이는가. const { expect } = require("chai"); describe("MyTinaCard", function () { let sharedValue = 0; beforeEach(function () { sharedValue++; }); it("Test Case 1", function () { expect(sharedValue).to.equal(1); }); it("Test Case 2", function () { expect(sharedValue).to.equal(2); }); }); 여기서 npx hardhat test 을 하면 MyTinaCard ✔ Test Case 1 (64ms) ✔ Test Ca..