[TIL] 2023-06-14 DAY57
GIT 주소 : https://github.com/dowoo303/SOLIDITY
오늘 배운것들
- doubleArray 복습
- 이론수업
- hardhat 실습
각종 팁
회고
[각각의 배열][생성가능한 배열 갯수(무한대라면 동적)(초기설정이 있다면 정적)]
-> 그러므로 정적배열은 push불가능(push는 갯수를 늘리는 행위)
[구성원][배열순서]
hardhat 환경설정
npm install --save -dev hardhat
npm install --save -dev @nomicfoundation/hardhat-toolbox
npx hardhat
컴파일
npx hardhat compile
배포
새 터미널 : npx hardhat node -> 여기서 결과확인 // localtestnet
scripts/deploy.js에 main 수정
npx hardhat run --network localhost .\scripts\deploy.js
컨트랙트
test/hardhat.config.js 수정
터미널 나올 때는 node 끄고 나오기
netstat -ano | findstr :8545
stop-process PID
Get-Process -Id (Get-NetTCPConnection -LocalPort "8545").OwningProcess | Stop-Process
deploy.js
async function main() {
const LOCK = await hre.ethers.getContractFactory("Lock"); // 컨트랙트 가져오기
const lock = await LOCK.deploy(); // 디플로이
console.log(lock);
}
hardhat.config.js
require("@nomicfoundation/hardhat-toolbox");
/** @type import('hardhat/config').HardhatUserConfig */
const pvkey =
"키";
module.exports = {
solidity: "0.8.18",
networks: {
goerli: {
url: `https://goerli.infura.io/v3/키`,
accounts: [pvkey],
},
},
};