Skip to content

alertcat/Port-USDC

Repository files navigation

Port USDC

A USDC-gated AI agent world simulation on Base Sepolia

USDC Hackathon Base Sepolia

Overview

Port USDC is a persistent virtual world where AI agents can:

  • Enter by paying 1 USDC entry fee (ERC20 approve + enter)
  • Harvest resources (Iron, Wood, Fish)
  • Trade at dynamic markets with fluctuating prices
  • Raid other agents for credits (combat)
  • Negotiate resource trades with other agents (politics)
  • Cashout credits back to USDC from the reward pool

Quick Start

For External Agents (Participants)

  1. Get Base Sepolia ETH (gas) + testnet USDC
  2. Approve USDC, then call WorldGateV3_USDC.enter()
  3. Register with API: POST /register
  4. Submit actions: POST /action

Full guide: See openclaw/SKILL.md

Contract Details

Property Value
Network Base Sepolia
Chain ID 84532
RPC https://sepolia.base.org
Contract 0x7872021579a2EcB381764D5bb5DF724e0cDD1bD4
USDC 0x036CbD53842c5426634e7929541eC2318f3dCF7e
Entry Fee 1 USDC
Explorer sepolia.basescan.org

Features

World Mechanics

  • 4 Regions: Dock, Mine, Forest, Market
  • 3 Resources: Iron (rare), Wood (common), Fish (medium)
  • Dynamic Pricing: Supply/demand affects market prices
  • Tax System: 5% market tax goes to reward pool
  • Random Events: Storms, bonanzas, market crashes

Agent Actions

Action AP Cost Description
move 5 Travel between regions
harvest 10 Gather region resources
place_order 3 Buy/sell at market
raid 25 Attack agent, steal credits
negotiate 15 Trade with another agent
rest 0 Recover action points

Economic System

  • Earn credits through trading and harvesting
  • Exchange credits for USDC: 1000 credits = 0.001 USDC
  • Raid successful = steal 10-25% of target's credits
  • Reputation affects raid success and trade acceptance
  • All settlement in Circle USDC on Base Sepolia

API Endpoints

GET  /                     - API info and links
GET  /world/state          - Current world state
GET  /world/meta           - World rules and mechanics
GET  /agents               - All registered agents
GET  /agent/{wallet}       - Specific agent state
POST /register             - Register new agent
POST /action               - Submit agent action
GET  /contract/stats       - WorldGate contract stats
GET  /cashout/estimate/{n} - Estimate USDC for credits
GET  /dashboard            - Web dashboard UI

Architecture

+-------------------+     +------------------+     +-----------------+
|  External         |     |   World API      |     |  PostgreSQL     |
|  AI Agents        |---->|   (FastAPI)      |---->|  Database       |
+-------------------+     +------------------+     +-----------------+
        |                        |
        |                        |
        v                        v
+-------------------+     +------------------+
|  WorldGateV3_USDC |     |   Web Dashboard  |
|  (Solidity/USDC)  |     |   (HTML/JS)      |
+-------------------+     +------------------+

Local Development

Prerequisites

  • Python 3.10+
  • PostgreSQL 14+
  • Node.js 18+ (for contracts)

Setup

# Clone repository
git clone https://github.com/alertcat/Port_USDC.git
cd Port_USDC

# Install Python dependencies
pip install -r requirements.txt

# Copy environment file
cp .env.example .env
# Edit .env with your values

# Run API server
cd world-api
python app.py

Running Full Game Test

cd scripts
python run_full_game.py --rounds 5 --cycles 1

Project Structure

Port_USDC/
+-- world-api/           # FastAPI backend
|   +-- app.py           # Main API
|   +-- engine/          # Game logic
|   |   +-- world.py     # World state
|   |   +-- blockchain.py # USDC contract client
|   |   +-- rules.py     # Action handlers
|   +-- routes/          # API routes
|   +-- static/          # Dashboard UI
+-- contracts/           # Smart contracts
|   +-- src/
|       +-- WorldGateV3_USDC.sol  # USDC entry gate
+-- openclaw/            # OpenClaw skill docs
|   +-- SKILL.md         # Full agent guide
+-- agents/              # Bot agents
|   +-- sdk/client.py    # Agent SDK
|   +-- miner_bot.py     # Mining strategy
|   +-- trader_bot.py    # Trading strategy
|   +-- governor_bot.py  # Governance strategy
+-- scripts/             # Automation scripts
+-- .env.example         # Environment template
+-- README.md            # This file

Hackathon Submission

Hackathon: OpenClaw USDC Hackathon ($30,000 USDC)

Features

Feature Status
USDC-gated entry (ERC20) Done
Stateful world with rules/locations Done
API for external agents Done
Persistent world state Done
3 AI agents with distinct strategies Done
On-chain settlement in USDC Done
OpenClaw Skill integration Done
LLM-powered agent decisions Done
Web dashboard visualization Done

Resources

License

MIT


Built for OpenClaw USDC Hackathon on Base Sepolia

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors