# 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:

```bash
curl -L https://foundry.paradigm.xyz | bash
foundryup
```

***

### 🔧 Configure Omega Network

In your project root, create or update `.env`:

```env
RPC_URL=https://0x4e454228.rpc.aurora-cloud.dev
PRIVATE_KEY=your_private_key
CHAIN_ID=1313161768
```

Update your `foundry.toml`:

```toml
[profile.default]
src = 'src'
out = 'out'
libs = ['lib']
rpc_endpoints = { omega = "${RPC_URL}" }
```

***

### ✍️ Example: Simple Contract

Create a contract in `src/Counter.sol`:

```solidity
// 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:

```bash
forge build
```

Deploy using `cast send`:

```bash
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:

```bash
cast call <CONTRACT_ADDRESS> "count()" --rpc-url $RPC_URL
```

***

### 🔗 Useful Links

* 🔍 [Omega Explorer](https://0x4e454228.explorer.aurora-cloud.dev)
* 🌐 [Omega RPC](https://0x4e454228.rpc.aurora-cloud.dev)
* 📘 [Foundry Book](https://book.getfoundry.sh/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://omega-6.gitbook.io/omega/guides/deploy-with-foundry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
