This project provides basic template for deploying and verifying contracts on Conflux eSpace testnet
using hardhat or foundry.
The hardhat project is a basic template for deploying and verifying contracts on Conflux eSpace testnet
. It comes with a sample contract, a test for that contract, and a script that deploys that contract.
Create .env
file in the root directory from .env.example
and update the PRIVATE_KEY
with your dev private key. Make sure it has some eSpace testnet CFX.
Note: You can get some testnet CFX from eSpace faucet
Install dependencies
yarn
After installing the dependencies(npm install
or yarn
), try running some of the following tasks:
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts
npx hardhat run scripts/deploy.ts --network espaceTestnet
npx hardhat verify --network espaceTestnet <contract address> <space separated constructor parameters>
For example, if you get following message for deploying Lock
contract:
Lock with 0.001ETH and unlock timestamp 1735008251 deployed to 0x8771b69CFE2c774Ea93eD65DE042CD20bcbf1319
You can verify the contract by running (as 1735008251 is the constructor parameter):
npx hardhat verify --network espaceTestnet 0x8771b69CFE2c774Ea93eD65DE042CD20bcbf1319 1735008251
Remember to init all submodules
git submodule update --init --recursive
curl -L https://foundry.paradigm.xyz | bash
foundryup
forge build
forge test
forge script scripts/Deploy.s.sol --rpc-url conflux_testnet --broadcast -g 200
The -g 200
is the gas multiplier, which is used to estimate the gas cost. It is set to 200, whereas 200%, because Conflux eSpace has a different opcode gas cost setting compared to Ethereum, this setting would make sure the deployment is successful.
Currently there is an API break with foundry command line verification, please check verification for the latest progress.