Deployment

Deploying Meridian contracts and infrastructure to Base and 0G.

Contract Deployment

Base Sepolia (Development)

cd packages/contracts

# Deploy factory and registry
forge script script/DeployBaseSepolia.s.sol \
  --rpc-url base_sepolia \
  --broadcast

# Deploy hook (requires address mining)
forge script script/DeployHook.s.sol \
  --rpc-url base_sepolia \
  --broadcast

Hook Address Mining

Uniswap V4 hook permissions are encoded in the contract address bits. Deployment uses HookMiner.find() with CREATE2 to mine an address matching the required permission flags:

uint160 flags = uint160(
    Hooks.BEFORE_INITIALIZE_FLAG
    | Hooks.BEFORE_ADD_LIQUIDITY_FLAG
    | Hooks.AFTER_ADD_LIQUIDITY_FLAG
    | Hooks.BEFORE_REMOVE_LIQUIDITY_FLAG
    | Hooks.BEFORE_SWAP_FLAG
    | Hooks.AFTER_SWAP_FLAG
    | Hooks.BEFORE_SWAP_RETURNS_DELTA_FLAG
);

On testnet, you can use deployCodeTo to bypass mining. On mainnet, start mining early as it may take time to find a valid salt.

0G Chain (Agent Identity)

# Deploy iNFT contract to 0G Galileo testnet
forge script script/Deploy0G.s.sol \
  --rpc-url og_galileo \
  --broadcast

Deployed Addresses

Uniswap V4 (Pre-deployed)

ContractBase MainnetBase Sepolia
PoolManager0x498581ff...0x05E73354...
PositionManager0x7c5f5a4b...0x4b2c77d2...
UniversalRouter0x6ff5693b...0x492e6456...
Quoter0x0d5e0f97...0x4a6513c8...

0G Chain

PropertyGalileo Testnet
RPChttps://evmrpc-testnet.0g.ai
Chain ID16602
EVM Versioncancun

Frontend Deployment

The web frontend deploys to Vercel. Connect the repository and set the root directory to packages/web. Required environment variables:

  • NEXT_PUBLIC_FACTORY_ADDRESS
  • NEXT_PUBLIC_HOOK_ADDRESS
  • NEXT_PUBLIC_REGISTRY_ADDRESS
  • NEXT_PUBLIC_AGENT_URL
  • NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID

Agent Server Deployment

The agent server can be deployed to any Node.js hosting provider. It runs as a standard Express application on port 4021. Ensure all environment variables are configured and the server has access to Base RPC endpoints.

Verification

Post-deployment verification steps:

  1. Verify contracts on Basescan/Blockscout with forge verify-contract
  2. Check ERC-8021 builder codes are visible in Basescan transaction input data
  3. Test market creation, proposal submission, and trading through the UI
  4. Verify agent registration flow: mint iNFT on 0G, attest, register on Base
  5. Confirm x402 payment flow: 402 response, payment header, resource delivery