A BoilerPlate Template Project To start building on Base With Solidity, Hardhat, and Typescript. All you have to do is create a new repository from the template and start coding your smart contracts.
- 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
- Github actions workflows prepared for CI/CD
- 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/
Ethereum
- Ethereum Mainnet
- Ethereum Sepolia Testnet
Base
- Base Mainnet
- Base Sepolia Testnet
Polygon
- Polygon Mainnet
- Polygon Mumbai Testnet
Local development
- Hardhat Network (localhost)
Feel free to add more networks in hardhat.config.ts
file.
npm install
Copy .env.example
to .env
and edit it.
Make sure you include either MNEMONIC
or PRIVATE_KEY
in your .env
file.
Add your contract in the folder /contracts
(see the demo example), and your tests in /test
.
Then compile your Solidity contract to verify you have no error.
npm run compile
To deploy on Base Sepolia Testnet
npx hardhat run scripts/deploy.ts --network base-sepolia
To deploy on Base Mainnet
npx hardhat run scripts/deploy.ts --network base-mainnet
To Verify your contract on Base Sepolia Testnet
npx hardhat verify --network base-sepolia <contract address>
To Verify your contract on Base Mainnet
npx hardhat verify --network base-mainnet <contract address>
This framework comes with few utility scripts to help you to test your solution.
The scripts/airdrop.ts
allows you to enter a list of recipients and the amount of token for each of them.
To airdrop on Base Sepolia
npx hardhat run scripts/airdrop.ts --network base-sepolia
To airdrop on Base Sepolia
npx hardhat run scripts/airdrop.ts --network base-mainnet
We have tailored a ChatGPT only for Base: "Build on Base Assistant".
This GPT is made to know Base tokens and contract addresses, as well to help you in all steps of your development.
.
├── contracts
│ └── DemoERC20Token.sol
├── deployments
├── hardhat.config.ts
├── scripts
│ ├── airdrop.ts
│ └── deploy.ts
├── tasks
│ └── utils
│ ├── account.ts
│ ├── balance.ts
│ ├── block-numbers.ts
│ └── send-eth.ts
└── test
└── DemoERC20Token.ts
npm run test
npm run coverage
npm run format:check
npm run format:write
npm run lint:check
npm run lint:fix
npm run sol:format:check
npm run sol:format:write
npm run solhint
All credit for this framework goes to:
- Protokol for their original project solidity-typescript-hardhat-template we forked.
- Base team for the Tutorial "Deploying a smart contract using Hardhat"