...
node -vEğer bilgisayarınızda Node.js yüklü değilse bu bu adresten size uygun versiyonu yükleyebilirsiniz veya Hardhat'in önerdiği kurulum ve güncelleme yöntemlerini inceleyebilirsiniz.
npm init --yes npm install --save-dev hardhat npx hardhat npm install --save-dev @nomiclabs/hardhat-ethers ethers @nomiclabs/hardhat-waffle ethereum-waffle chai
//require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-waffle");
const PRIVATE_KEY = "PRIVATE_KEY";
module.exports = {
solidity: "0.8.2",
networks: {
mainnet: {
url: `https://api.avax.network/ext/bc/C/rpc`,
accounts: [`${PRIVATE_KEY}`]
},
fuji: {
url: `https://api.avax-test.network/ext/bc/C/rpc`,
accounts: [`${PRIVATE_KEY}`]
}
}
}; boilerplate/
├── hardhat.config.js
├── package.json
├── package-lock.json
├── node_modules
├──── contracts/
├──── test/
└──── scripts/
npx hardhat compile npm install @openzeppelin/contracts npx hardhat test npx hardhat run <deploy-scrpit-path>
npx hardhat run <deploy-scrpit-path> --network <network-name>
npx hardhat run scripts/deploy.js --network fuji await expect(token.transfer(walletTo.address, 1007)).to.be.reverted;
expect('0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B').to.be.properAddress;
expect(token).to.not.be.undefined;
expect(token.balanceOf("0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B")).to.be.equal(0);
expect(token.balanceOf("0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B")).to.be.greaterThan(0); await ethers.getContractFactory("Token");
await ethers.getSigners();
ethers.utils.parseEther("100");
ethers.utils.parseUnits("100", 18);
ethers.utils.formatEther("1000000000000000000");
ethers.utils.formatUnits("100", 2);
ethers.constants.MaxUint256;
const provider = ethers.provider;
block_number = await provider.getBlockNumber();
await provider.getBlock(block_number)
block_timestamp = block.timestamp;Not: Ethers Playground