Skip to content

Latest commit

 

History

History
61 lines (40 loc) · 1.75 KB

File metadata and controls

61 lines (40 loc) · 1.75 KB

Bera-HardhatExample

This repo should serve as an example of the config and manual gas-override required for hardhat-based contract deployments on Berachain Bepolia. The repo also should help you verify contracts via hardhat (Routescan api and configs have been provided in the repo).

Sum-up on the changes made/required for contract deployments on Bepolia.

  1. The default Hardhat deployContract is having issue. But crafting the deploy transaction manually with gasLimit and gasPrice specified works.
  2. Removing the gas: “auto” setting in hardhat config file.
  3. Building the transaction manually and setting a forced gas limit override (this may be more expensive gas-wise, but not significantly).

Post fork - please do the following

  1. npm init --y
  2. npm install --save-dev hardhat
  3. npm install --save-dev dotenv
  4. create .env - and add WALLET_KEY=0x
  5. npx hardhat run scripts/deploy.ts --network berachain-bepolia

To deploy on the live testnet

npx hardhat run scripts/deploy.ts --network berachain-bepolia

To Verify Contracts

Installation

npm install --save-dev @nomicfoundation/hardhat-verify

Verify

npx hardhat verify --network berachain-bepolia <0x...>

Make sure to replace the whole " <0xaddress> ". A correct example would be:-

✅ npx hardhat verify --network berachain-bepolia 0x3229075dd6F75bD879F7af07d384A0856c30a806
❌ npx hardhat verify --network berachain-bepolia <0x3229075dd6F75bD879F7af07d384A0856c30a806> (This is incorrect)


To deploy on a local fork

Spin up a local fork:

npx hardhat node --fork https://bepolia.rpc.berachain.com/

Run the deploy script in a new terminal:

npx hardhat run scripts/deploy.ts --network berachain-local