Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# ZoraPostMarketEscrow Deployment Guide

This guide will help you deploy the ZoraPostMarketEscrow smart contract to Base Layer 2.

## Prerequisites

1. **Node.js and npm/pnpm** - Make sure you have Node.js installed
2. **Base Layer 2 ETH** - You'll need ETH on Base for gas fees
3. **Private Key** - Your wallet's private key for deployment
4. **BaseScan API Key** - For contract verification (optional but recommended)

## Setup

1. **Install dependencies:**
```bash
pnpm install
```

2. **Create environment file:**
```bash
cp .env.example .env
```

3. **Configure your environment variables in `.env`:**
```bash
# Your wallet's private key (without 0x prefix)
PRIVATE_KEY=your_private_key_here

# BaseScan API key for contract verification
BASESCAN_API_KEY=your_basescan_api_key_here

# Contract addresses on Base Layer 2
# You need to provide the actual addresses for these contracts on Base
ZORA_TOKEN_ADDRESS=0x... # ZORA token contract address on Base
ZORA_MARKET_TOKEN_ADDRESS=0x... # Zora Market token contract address on Base
UNIVERSAL_ROUTER_ADDRESS=0x... # Uniswap Universal Router address on Base
PLATFORM_TREASURY_ADDRESS=0x... # Your platform treasury address
ZORA_FACTORY_ADDRESS=0x... # Zora Factory contract address on Base
```

## Getting Base Layer 2 Addresses

You need to find the correct addresses for the following contracts on Base Layer 2:

### 1. ZORA Token
- Check if ZORA token is deployed on Base
- If not, you may need to bridge it or use a different token

### 2. Zora Market Token
- This should be the Zora platform's market token on Base

### 3. Universal Router
- Uniswap's Universal Router on Base: `0x198EF79F1F515F02dFE9e3115eD9fC07183f02fC`

### 4. Zora Factory
- The Zora Factory contract that creates coins on Base

### 5. Platform Treasury
- Your platform's treasury address where fees will be sent

## Deployment

### Test Deployment (Base Sepolia)

First, test your deployment on Base Sepolia testnet:

```bash
# Compile contracts
pnpm compile

# Deploy to Base Sepolia
pnpm deploy:base-sepolia
```

### Production Deployment (Base Mainnet)

Once you've tested on Sepolia, deploy to Base mainnet:

```bash
# Deploy to Base mainnet
pnpm deploy:base
```

## Contract Verification

After deployment, verify your contract on BaseScan:

```bash
# For Base Sepolia
pnpm verify:base-sepolia

# For Base mainnet
pnpm verify:base
```

## Important Notes

1. **Gas Fees**: Base Layer 2 has much lower gas fees than Ethereum mainnet, but you still need ETH for deployment.

2. **Address Validation**: Make sure all the contract addresses you provide are correct and deployed on Base Layer 2.

3. **Security**: Never commit your `.env` file to version control. It contains your private key.

4. **Testing**: Always test on Base Sepolia first before deploying to mainnet.

## Contract Functions

Once deployed, your contract will have the following main functions:

- `createBid()` - Sponsors can create bids with ZORA tokens
- `cancelBid()` - Sponsors can cancel their bids
- `acceptBidAndPost()` - Creators can accept bids and create posts

## Troubleshooting

### Common Issues:

1. **"Insufficient funds"** - Make sure you have enough ETH on Base for gas fees
2. **"Invalid address"** - Check that all contract addresses are correct
3. **"Contract creation failed"** - Verify all constructor parameters are valid

### Getting Base ETH:

- Bridge ETH from Ethereum mainnet to Base
- Use Base's official bridge: https://bridge.base.org/
- Or use other bridges like Hop Protocol

## Support

If you encounter issues:

1. Check the Base documentation: https://docs.base.org/
2. Verify your contract addresses on BaseScan: https://basescan.org/
3. Ensure you have sufficient ETH for gas fees
117 changes: 117 additions & 0 deletions DEPLOYMENT_CHECKLIST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Deployment Checklist for ZoraPostMarketEscrow

## ✅ Pre-Deployment Checklist

### 1. Environment Setup
- [ ] Node.js and pnpm installed
- [ ] `.env` file created from `.env.example`
- [ ] Private key added to `.env` (without 0x prefix)
- [ ] BaseScan API key added to `.env` (optional but recommended)

### 2. Contract Addresses on Base Layer 2
You need to provide the actual addresses for these contracts on Base:

- [ ] **ZORA_TOKEN_ADDRESS** - ZORA token contract on Base
- [ ] **ZORA_MARKET_TOKEN_ADDRESS** - Zora Market token on Base
- [ ] **UNIVERSAL_ROUTER_ADDRESS** - Uniswap Universal Router on Base (`0x198EF79F1F515F02dFE9e3115eD9fC07183f02fC`)
- [ ] **PLATFORM_TREASURY_ADDRESS** - Your platform's treasury address
- [ ] **ZORA_FACTORY_ADDRESS** - Zora Factory contract on Base

### 3. Base Layer 2 Setup
- [ ] ETH balance on Base mainnet (for gas fees)
- [ ] ETH balance on Base Sepolia (for testing)
- [ ] Wallet connected to Base network

### 4. Testing
- [ ] Contract compiles successfully (`pnpm compile`)
- [ ] Deployment test passes (`pnpm test:deploy`)
- [ ] All environment variables are set correctly

## 🚀 Deployment Steps

### Step 1: Test Deployment (Base Sepolia)
```bash
# 1. Compile the contract
pnpm compile

# 2. Deploy to Base Sepolia testnet
pnpm deploy:base-sepolia
```

### Step 2: Verify on BaseScan (Sepolia)
```bash
# Verify the contract on BaseScan Sepolia
pnpm verify:base-sepolia
```

### Step 3: Production Deployment (Base Mainnet)
```bash
# Deploy to Base mainnet
pnpm deploy:base
```

### Step 4: Verify on BaseScan (Mainnet)
```bash
# Verify the contract on BaseScan mainnet
pnpm verify:base
```

## 📋 Post-Deployment Checklist

- [ ] Contract deployed successfully
- [ ] Contract verified on BaseScan
- [ ] Contract address saved
- [ ] Contract functions tested
- [ ] Events are firing correctly
- [ ] Gas costs are acceptable

## 🔍 Contract Verification

After deployment, verify your contract on BaseScan:
- **Base Sepolia**: https://sepolia.basescan.org/
- **Base Mainnet**: https://basescan.org/

## 🛠️ Contract Functions

Once deployed, your contract will have these main functions:

### For Sponsors:
- `createBid()` - Create a bid with ZORA tokens
- `cancelBid()` - Cancel an active bid

### For Creators:
- `acceptBidAndPost()` - Accept a bid and create a post

### View Functions:
- `bids(uint256)` - Get bid details
- `nextBidId()` - Get the next bid ID

## ⚠️ Important Notes

1. **Gas Fees**: Base Layer 2 has much lower gas fees than Ethereum mainnet
2. **Address Validation**: Double-check all contract addresses before deployment
3. **Security**: Never commit your `.env` file to version control
4. **Testing**: Always test on Base Sepolia first
5. **Backup**: Keep your private key and contract addresses safe

## 🆘 Troubleshooting

### Common Issues:

1. **"Insufficient funds"**
- Solution: Add more ETH to your wallet on Base

2. **"Invalid address"**
- Solution: Check that all contract addresses are correct and deployed on Base

3. **"Contract creation failed"**
- Solution: Verify all constructor parameters are valid

4. **"Verification failed"**
- Solution: Check your BaseScan API key and try again

### Getting Help:

- Base Documentation: https://docs.base.org/
- BaseScan: https://basescan.org/
- Base Bridge: https://bridge.base.org/
131 changes: 131 additions & 0 deletions README_DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# ZoraPostMarketEscrow - Base Layer 2 Deployment

This repository contains the ZoraPostMarketEscrow smart contract designed for deployment on Base Layer 2. The contract enables sponsors to bid with ZORA tokens, creators to accept bids, and automatically creates posts via ZoraFactory while performing swaps through Uniswap's UniversalRouter.

## 🚀 Quick Start

### 1. Install Dependencies
```bash
pnpm install
```

### 2. Set Up Environment
```bash
cp .env.example .env
# Edit .env with your configuration
```

### 3. Test Compilation
```bash
pnpm compile
pnpm test:deploy
```

### 4. Deploy to Base Sepolia (Testnet)
```bash
pnpm deploy:base-sepolia
```

### 5. Deploy to Base Mainnet
```bash
pnpm deploy:base
```

## 📋 Required Environment Variables

Create a `.env` file with the following variables:

```bash
# Your wallet's private key (without 0x prefix)
PRIVATE_KEY=your_private_key_here

# BaseScan API key for contract verification
BASESCAN_API_KEY=your_basescan_api_key_here

# Contract addresses on Base Layer 2
ZORA_TOKEN_ADDRESS=0x... # ZORA token contract address on Base
ZORA_MARKET_TOKEN_ADDRESS=0x... # Zora Market token contract address on Base
UNIVERSAL_ROUTER_ADDRESS=0x198EF79F1F515F02dFE9e3115eD9fC07183f02fC # Uniswap Universal Router on Base
PLATFORM_TREASURY_ADDRESS=0x... # Your platform treasury address
ZORA_FACTORY_ADDRESS=0x... # Zora Factory contract address on Base
```

## 🔧 Available Scripts

| Script | Description |
|--------|-------------|
| `pnpm compile` | Compile all contracts |
| `pnpm compile:zora` | Compile only ZoraPostMarketEscrow |
| `pnpm test:deploy` | Test deployment parameters |
| `pnpm deploy:base-sepolia` | Deploy to Base Sepolia testnet |
| `pnpm deploy:base` | Deploy to Base mainnet |
| `pnpm verify:base-sepolia` | Verify contract on BaseScan Sepolia |
| `pnpm verify:base` | Verify contract on BaseScan mainnet |

## 📄 Contract Overview

### Key Features
- **Bid Creation**: Sponsors can create bids with ZORA tokens
- **Bid Cancellation**: Sponsors can cancel active bids
- **Post Creation**: Creators can accept bids and create posts via ZoraFactory
- **Atomic Swaps**: Automatic token swaps via Uniswap UniversalRouter
- **Event Tracking**: Comprehensive event logging for all actions

### Main Functions
- `createBid()` - Create a new bid with ZORA tokens
- `cancelBid()` - Cancel an active bid (sponsor only)
- `acceptBidAndPost()` - Accept bid and create post (creator only)

### Events
- `BidCreated` - Emitted when a new bid is created
- `BidCancelled` - Emitted when a bid is cancelled
- `DealExecuted` - Emitted when a bid is accepted and post is created

## 🌐 Base Layer 2 Information

### Network Details
- **Chain ID**: 8453 (mainnet), 84532 (Sepolia)
- **RPC URL**: https://mainnet.base.org
- **Block Explorer**: https://basescan.org/

### Getting Base ETH
1. Bridge ETH from Ethereum mainnet to Base
2. Use Base's official bridge: https://bridge.base.org/
3. Or use other bridges like Hop Protocol

## 🔍 Contract Addresses on Base

You need to find the correct addresses for these contracts on Base Layer 2:

1. **ZORA Token** - Check if ZORA token is deployed on Base
2. **Zora Market Token** - Zora platform's market token on Base
3. **Universal Router** - Uniswap's Universal Router: `0x198EF79F1F515F02dFE9e3115eD9fC07183f02fC`
4. **Zora Factory** - Zora Factory contract that creates coins
5. **Platform Treasury** - Your platform's treasury address

## 🛡️ Security Considerations

1. **Private Key Security**: Never commit your `.env` file to version control
2. **Address Validation**: Double-check all contract addresses before deployment
3. **Testing**: Always test on Base Sepolia before mainnet deployment
4. **Gas Fees**: Ensure sufficient ETH balance on Base for deployment

## 📚 Documentation

- [Deployment Guide](DEPLOYMENT.md) - Detailed deployment instructions
- [Deployment Checklist](DEPLOYMENT_CHECKLIST.md) - Step-by-step checklist
- [Base Documentation](https://docs.base.org/) - Official Base documentation
- [BaseScan](https://basescan.org/) - Block explorer for Base

## 🆘 Support

If you encounter issues:

1. Check the [Base Documentation](https://docs.base.org/)
2. Verify contract addresses on [BaseScan](https://basescan.org/)
3. Ensure sufficient ETH balance for gas fees
4. Test on Base Sepolia before mainnet deployment

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
1 change: 1 addition & 0 deletions artifacts/build-info/6c66af95c3275a2003b2b5f3d5a8226b.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions artifacts/contracts/ZoraPostMarketEscrow.sol/IERC20.dbg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../build-info/6c66af95c3275a2003b2b5f3d5a8226b.json"
}
Loading