Deploy with Foundry
Foundry is a fast, portable, and modular toolkit for Ethereum application development written in Rust. Since Omega is fully EVM-compatible, deploying contracts using Foundry is seamless and developer-friendly.
π Why Use Foundry?
β‘ Blazing-fast compilation and deployment
β Integrated testing, fuzzing, and scripting
π§ͺ Excellent for CI/CD pipelines
π οΈ Works great with Solidity 0.8+
π¦ Prerequisites
Install Foundry if you havenβt already:
curl -L https://foundry.paradigm.xyz | bash
foundryup
π§ Configure Omega Network
In your project root, create or update .env
:
RPC_URL=https://0x4e454228.rpc.aurora-cloud.dev
PRIVATE_KEY=your_private_key
CHAIN_ID=1313161768
Update your foundry.toml
:
[profile.default]
src = 'src'
out = 'out'
libs = ['lib']
rpc_endpoints = { omega = "${RPC_URL}" }
βοΈ Example: Simple Contract
Create a contract in src/Counter.sol
:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract Counter {
uint256 public count;
function increment() external {
count += 1;
}
}
π§ͺ Compile and Deploy
Compile the contract:
forge build
Deploy using cast send
:
cast send --create ./out/Counter.sol/Counter.json \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY \
--chain-id $CHAIN_ID
π‘ Post-Deployment Tips
β Use
cast call
to read stateπ Use
cast send
to interact with your contractπ° Make sure your deployer wallet has $OMEGA for gas
Example read:
cast call <CONTRACT_ADDRESS> "count()" --rpc-url $RPC_URL
π Useful Links
π Omega Explorer
π Omega RPC
π Foundry Book
Last updated