An OTC intent marketplace for humans and agents to trade any tokens onchain. BartMart enables intent-based orders for ETH and ERC20 token swaps without requiring AMM liquidity pools or complex SDK integrations.
AI agents that want to swap tokens require difficult to maintain SDK integrations and don't support new protocols. They must manage Uniswap V3, V4, Aerodrome, etc. This is especially problematic for agents deployed to TEE environments like
Eigen Compute where updating the agent implementation frequently is not desirable for user trust and verifiability.
Intent-based OTC market onchain via BartMart.sol. Agents/users provide tokens and amounts they want to buy/sell, and the market fulfills orders when conditions are favorable.
Agents can be deployed to TEEs with one simple trading tool - using the BartMart.sol contract deployed onchain. No need to manage multiple protocol SDKs, enabling stable and verifiable agent implementations.
This repository is organized as a monorepo with two main components:
Contains the Solidity smart contracts for BartMart's intent-based swap system. This directory includes:
- Smart Contracts: The
BartMart.solcontract that handles order creation, fulfillment, and cancellation - Deployment Scripts: Scripts for deploying to Base mainnet
- Tests: Comprehensive test suite for the contracts
- CI/CD: GitHub Actions workflow for automated testing
For detailed information about the contracts, deployment, and usage, see the Foundry README.
Key Features:
- Intent-based order system
- Support for ETH → Token, Token → ETH, and Token → Token swaps
- Secure order cancellation by creators
- No AMM required - direct peer-to-peer swaps
The main Next.js application for interacting with BartMart contracts. This is the user-facing interface where users can:
- Create swap orders
- Browse available orders
- Fulfill orders
- Manage their own orders
Tech Stack:
- Next.js 16
- React 19
- TypeScript
- Tailwind CSS
- Biome (linting & formatting)
Pitch Deck:
- Interactive presentation available at
/deckroute - Showcases BartMart's purpose, problem, solution, and result
- Navigate with arrow keys, spacebar, or click navigation controls
- Foundry - for smart contract development
- Bun - JavaScript runtime and package manager
- Node.js 20+ (if not using Bun)
- A Base-compatible wallet with ETH for gas fees
-
Clone the repository:
git clone <repository-url> cd x420-agent
-
Install dependencies:
For smart contracts:
cd foundry bun installFor the frontend app:
cd ../next-app bun install -
Configure environment variables:
In
foundry/:cp foundry/.env.example foundry/.env # Edit foundry/.env with your valuesIn
next-app/(when needed):cp next-app/.env.example next-app/.env # Edit next-app/.env with your values
- Foundry README - Complete documentation for smart contracts, deployment, and contract usage
- Next.js App README - Frontend application documentation (when available)
cd foundry
# Build contracts
forge build
# Run tests
forge test
# Format code
forge fmt
# Deploy to Base mainnet
./deploy.shcd next-app
# Start development server
bun dev
# Build for production
bun build
# Run linter
bun lint
# Format code
bun formatThe pitch deck is available as a route in the Next.js application:
cd next-app
# Start development server
bun dev
# Navigate to http://localhost:3000/deckNavigation:
- Use arrow keys (← →) or spacebar to navigate between slides
- Click the navigation dots at the bottom to jump to specific slides
- Use Home/End keys to jump to first/last slide
x420-agent/
├── foundry/ # Smart contracts (Solidity + Foundry)
│ ├── src/ # Contract source code
│ ├── test/ # Contract tests
│ ├── script/ # Deployment scripts
│ └── README.md # Contract documentation
│
└── next-app/ # Frontend application (Next.js)
├── app/ # Next.js app directory
├── public/ # Static assets
└── README.md # App documentation
⚠️ Never commit private keys or.envfiles to version control- ✅ Use hardware wallets for production deployments
- ✅ Test thoroughly on testnets before mainnet deployment
- ✅ Review contract code and understand the risks
- ✅ Consider getting a security audit before mainnet deployment
MIT
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
For issues or questions:
- Check the Foundry README for contract-related questions
- Review test cases in
foundry/test/ - Open an issue on the repository
