A Rust-based deployment tool for Cairo contracts on StarkNet, specifically designed for deploying and managing L3 network contracts.
This tool automates the deployment process for a suite of Cairo contracts to StarkNet, including:
- Account contracts (OpenZeppelin implementation)
- Token contracts (ERC20)
- Upgrade mechanisms (EIC - External Initialization Contract)
- Counter contract (for testing purposes)
- StarkNet core contract
- Rust 1.70+
- Scarb 2.8.4 for Cairo contracts
- Access to a StarkNet RPC node
- Copy
exemple.envto.envand configure your environment:
# RPC Endpoints
RPC_URL=https://your-rpc-endpoint.com/
RPC_ADMIN_URL=https://your-admin-rpc-endpoint.com/
RPC_STARKNET_URL=https://starknet-sepolia.g.alchemy.com/starknet/version/rpc/v0_7/your_api_key
# Account Configuration
DEPLOYER_SECRET_KEY=0xYOUR_SECRET_KEY
STARKNET_ACCOUNT_ADDRESS=0xYOUR_ACCOUNT_ADDRESS
- Automatic declaration and deployment of Cairo contracts
- Support for UDC (Universal Deployer Contract)
- Fee-free deployments for testnets
- STRK token deployment with upgrade capability
- Custom token deployment with minting capabilities
- ERC20 standard compliance
- OpenZeppelin Account contract support
- Account deployment and management
- External Initialization Contract (EIC) pattern
- Storage migration support
# Build the Rust project
cargo build --release
# Build Cairo contracts (if they haven't been compiled)
cd cairo && scarb buildcargo run --releaseThis will:
- Declare all necessary contracts
- Deploy the UDC (Universal Deployer Contract)
- Deploy an OpenZeppelin account
- Deploy STRK and QUAZA tokens
- Set up the token contracts with proper permissions
- Mint initial token supplies
- Deploy a sample counter contract
- Optionally deploy the StarkNet core contract
- Add your Cairo contract to
cairo/src/ - Add it to the exports in
cairo/src/lib.cairo - Compile using
scarb build - Add deployment logic to the Rust code in
src/main.rs
The main deployment sequence is in src/main.rs. You can modify this file to change the deployment order or add additional contracts.