- Typechain plugin enabled (typescript type bindings for smart contracts)
- hardhat-deploy plugin enabled
- Testing environment configured and operational, with test coverage
- Prettier and eslint configured for project files and solidity smart contract
- Solhint configured for enforcing best practices
- Prepared Smart Contract Examples, Tests, Deployments and Tasks for Common ERC Standards (ERC20, ERC721, ERC1155)
Check the Hardhat documentation for more information.
https://hardhat.org/getting-started/
.
├── contracts
│ ├── ERC1155.sol
│ ├── ERC20.sol
│ └── ERC721.sol
├── deploy
│ ├── DeployERC1155.ts
│ ├── DeployERC20.ts
│ └── DeployERC721.ts
├── deployments
├── hardhat.config.ts
├── tasks
│ ├── erc1155
│ ├── erc20
│ ├── erc721
│ └── utils
└── test
├── BasicERC1155.ts
├── BasicERC20.ts
└── BasicERC721.ts
- Hardhat Network (localhost)
- Rootstock Mainnet
- Rootstock Testnet
We recommend installing hh autocomplete so you can use hh shorthand globally.
npm i -g hardhat-shorthandhttps://hardhat.org/guides/shorthand.html
hh compile- to compile smart contract and generate typechain ts bindingshh test- to run testshh deploy- to deploy to local network (see options for more)hh node- to run a localhost nodehh help- to see all available commandshh TABTAB- to use autocomplete
npm installnpm run compileTo set up your environment, follow these steps:
- Create a
.envfile and add your environment variables. You can use.env.exampleas a template.
Ensure you include the following variables:
PRIVATE_KEY: Your private key (e.g., found in account details on Metamask).RSK_MAINNET_RPC_URLRSK_TESTNET_RPC_URL
- Obtain RPC URLs for the testnet and mainnet:
- For public RPC URLs, visit the Rootstock Developer Portal.
- For hosted RPC URLs, you can find them at GetBlock.
These URLs will be used to configure your .env file for accessing the RSK network.
This is an example flow to deploy an ERC721 token to a public network and interact with it.
hh deploy --network rskTestnet --tags 721hh erc721-mint \
--contract <ContractAddress>\
--recipient <RecipientAddress>\
--network rskTestnetnpx hardhat verify --network rskTestnet DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1"
npm run testnpm run coveragenpm run format:check
npm run format:writenpm run lint:check
npm run lint:fixnpm run sol:format:check
npm run sol:format:writenpm run solhint