This directory contains the smart contracts and related tooling for Omni. It is structured to facilitate development, testing, and deployment of the contracts.
bindings/
: Go bindings for contracts, including utility scripts for generation.src/
: Solidity source files, organized by functionality (deploy, examples, interfaces, libraries, protocol).script/
: Scripts for deploying contracts on various networks and utility tasks.test/
: Test cases for the smart contracts, using Foundry.Makefile
: Utility to automate common tasks such as building contracts, generating bindings, and running tests.foundry.toml
,package.json
,pnpm-lock.yaml
,tsconfig.json
: Configuration files for Foundry, Node.js, and TypeScript.
To set up your environment for development:
- Install Foundry for smart contract compilation and testing. Follow the instructions at Foundry's GitHub repository.
- Install Node.js and pnpm to handle script execution and package management:
- Node.js: https://nodejs.org/
- pnpm: Run
npm install -g pnpm
after installing Node.js.
- Ensure you have
abigen
installed for generating Go bindings. It should be version 1.13.14-stable. Install with:go install github.com/ethereum/go-ethereum/cmd/[email protected]
To compile the smart contracts, run:
make build
This command compiles the Solidity contracts and also prints version information of the tools used.
Execute the test suite with:
pnpm run test
Or, for AVS tests locally with a running anvil
node:
make avs-fork-test-local
Note: checks require setting an INFURA_KEY
and ETHERSCAN_GOERLI_KEY
, however these may be set to dummy values for local testing.
Or, for AVS tests with on a goerli fork:
make avs-fork-test-goerli
Generate Go bindings for the contracts with:
make bindings
This command requires abigen
and will generate bindings, including examples.
Deploy contracts to networks such as Goerli with scripts included in the script/
directory. Use the following commands for deployment and verification:
- Deploy to Goerli:
make deploy-goerli-avs
- Verify contracts on Goerli Etherscan:
make verify-goerli-avs