Ethereum Deployment
Relevant source files
The following files were used as context for generating this wiki page:
The Ethereum deployment of Canon Guard involves deploying a suite of security-focused smart contracts onto the Ethereum mainnet. Canon Guard serves as a multisig enhancement layer, utilizing fully on-chain Actions contracts and dynamic timelocks to minimize reliance on external services and simplify transaction verification.
The deployment process is managed via Foundry scripts, specifically targeting the DeployCanonGuard script. This process ensures that core components like the SafeEntrypoint, ActionHub, and various Action Builders are correctly instantiated and configured to work with existing Safe smart accounts.
Sources: README.md:3, CLAUDE.md:7-10
Deployment Infrastructure and Configuration
Deployment is facilitated by the Foundry development framework. The configuration is defined in foundry.toml, which specifies the compiler version, optimization settings, and network endpoints.
Environment Setup
Before deployment, the environment must be configured with specific variables, including RPC URLs and deployer account names. Key configuration steps include:
- Sourcing environment variables from a
.envfile. - Importing the deployer's private key into Foundry's encrypted keystore using
cast wallet import.
Sources: README.md:78-88, foundry.toml:35-37
Network Parameters
The deployment targets Ethereum using the following parameters defined in the project's configuration files:
| Parameter | Value/Source | Description |
|---|---|---|
| Solidity Version | 0.8.30 | Version used for contract compilation |
| EVM Version | Prague | Target EVM version for deployment |
| Optimizer Runs | 10,000 | Level of bytecode optimization |
| RPC Alias | ethereum | Reference to ${ETHEREUM_RPC} in environment |
| Verification | Etherscan | Automated verification using ${ETHERSCAN_API_KEY} |
| Sources: foundry.toml:19-22, foundry.toml:36, foundry.toml:40 |
Deployment Workflow
The deployment workflow uses the forge script command encapsulated within a yarn script. This workflow handles compilation, execution of the deployment logic, broadcasting of transactions, and contract verification on Etherscan.
The diagram shows the sequential steps required to move from local environment setup to a fully verified on-chain deployment.
Sources: README.md:78-95, package.json:18
Core Components Deployed
The deployment script is responsible for instantiating several critical components of the Canon Guard architecture:
- SafeEntrypoint: The primary interface for executing time-delayed transactions on a Safe.
- CanonGuardFactory: Used for deterministic deployment of system components.
- Action Builders: Specific contracts like
SimpleActionsandCappedTokenTransfersthat define transaction logic. - Guards and Hooks: Security modules such as
OnlyEntrypointGuardandEmergencyModeHook.
Sources: CLAUDE.md:12-19, package.json:18
Deployment Commands and Execution
The deployment is executed via specific NPM scripts that pass arguments to the Foundry CLI.
Command Reference
| Action | Command |
|---|---|
| Deploy Canon Guard | yarn deploy:ethereum:canon-guard |
| Deploy Entrypoint (Alternative) | yarn deploy:ethereum:entrypoint |
| Deploy Safer-Safe (Alternative) | yarn deploy:ethereum:safer-safe |
| Sources: package.json:18, CLAUDE.md:43-44 |
Detailed Script Execution
The primary deployment command executes the following underlying Forge command:
forge script DeployCanonGuard --rpc-url ethereum --account $ETHEREUM_DEPLOYER_NAME --broadcast --verify --chain ethereum -vvvvv
This command ensures the DeployCanonGuard script is run against the Ethereum RPC endpoint, using a named account from the Foundry keystore, and automatically verifies the resulting bytecode.
Sources: package.json:18
Post-Deployment Artifacts
Upon successful execution, deployment artifacts and transaction logs are stored locally:
- Broadcasts: Transaction details are saved in the
./broadcastdirectory. - Verification: If the
--verifyflag is successful, contract source code is linked and readable on Etherscan. - TypeScript Interfaces: Developers can optionally export and publish TypeChain-compatible interfaces to NPM after deployment.
Sources: README.md:100-110, package.json:18
Integration and Path Remappings
The system relies on external libraries and internal paths defined in remappings.txt. These must be correctly resolved during the deployment build process:
contracts/: Maps tosrc/contractsinterfaces/: Maps tosrc/interfaces@safe-smart-account/: Maps to Safe Global's smart account contractssolady/: Maps to Solady utility contracts
Sources: remappings.txt:1-8
The Ethereum deployment of Canon Guard establishes a robust, on-chain security framework for Safe accounts. By utilizing Foundry scripts for automated deployment and verification, the project ensures a repeatable and transparent process for initializing the SafeEntrypoint and its associated action builders.