How to Deploy
This section will cover how to deploy contracts to the AirDAO network using Hardhat or Foundry project setup.
This tutorial cover both cloning existing project and initializing from scratch.
From Scratch
Hardhat
For hardhat example we use default hardhat template contract.
Install dependencies and initiate project:
Follow the initialization process and wait for installation process.
Hardhat creates default contract, and we will use it for that example.
Configuration for AIRDAO network:
Open ./hardhat.config.js
(or ./hardhat.config.ts
) and modify the following parameters
Modify
networks
:
Modify the compiler settings, the
evmVersion
should beistanbul
/petersburg
:
(Optional for verifying contracts) Modify the
hardhat-verify
parameters (etherscan
andsourcify
):
Deployment process:
Follow the ignition deployment process and the address will be printed to console.
Contract verification:
via explorer
search for deployed address
drag&drop file from
artifacts/build-info
to explorer verification page in “Contract“ section.
with cmd
Foundry
For the foundry example we will use hello_foundry
template.
Initiate project:
Configuration for AIRDAO network:
Modify the foundry.toml
file with configuration
Use --verifier sourcify --verifier-url https://sourcify.ambrosus.io/ --verify
when deploying to verify your contracts.
Deployment process:
Once you will be ready with deployment script, run it with --legacy
flag and additional values for verification, network and keys (example for script/Counter.s.sol:CounterScript
)
Contract verification:
via explorer
search for deployed address
drag&drop file from
out/build-info
to explorer verification page in “Contract“ section.
with cmd
Forking
If you want to fork existing project just fork and edit the configuration.
To deploy this project in AirDAO we didn’t modify any solidity file! All that needed to be done was to write scripts for deployment (since they were not in the repository), and specify our networks in the configuration file (see above)
Foundry
Update the foundry.toml
config with EVM version and RPCs like here.
Create deployment script like that:
Run the script via CLI:
Hardhat
For completeness purposes, we tried to use hardhat framework with this project.
Update the hardhat.config.[j,t]s
config with EVM version and RPCs like here.
Copy project contracts and dependencies to hardhat empty project.
Create hardhat ignition script to deploy contracts:
Then run npx hardhat ignition deploy ./ignition/modules/PolyLend.js --network testnet
Verified contracts
Last updated