This project demonstrates a basic use case (Lock), using Synthetix Router Proxy architecture. It comes with sample contracts representing modules, storages and interfaces. Also a Hardhat test for the whole system contracts, a Foundry test for an individual module, and a script that deploys the system.
Using:
- Hardhat Toolbox
- Any NPM dependencies (like OpenZeppelin contracts)
- Any Foundry libs (like solmate contracts)
- Hardhat Cannon
- Use Foundry:
forge install
forge test
- Use Hardhat:
npm install
npx hardhat test --network hardhat
REPORT_GAS=true npx hardhat test --network hardhat
- Use both:
npm test
- Use cannon
npx @usecannon/cli build
npx hardhat cannon:build
npx hardhat cannon:deploy --network hardhat
Whenever you install new libraries using Foundry, make sure to update your remappings.txt
file by running forge remappings > remappings.txt
. This is required because we use hardhat-preprocessor
and the remappings.txt
file to allow Hardhat to resolve libraries you install with Foundry.