Autonomous dollar-cost averaging agent for the Synthesis hackathon MoonPay CLI Agents track. The agent uses the MoonPay CLI MCP server as its execution layer for balances, market data, swaps, and bridge actions, then applies strategy logic for time-weighted buys, value averaging, and dip buying.
- Connects to
mp mcpas the primary action layer - Tracks portfolio balances and rolling P&L across Ethereum, Base, Polygon, and Arbitrum
- Executes scheduled DCA swaps with per-strategy decision logic
- Bridges funding inventory across chains before swapping when the target chain is underfunded
- Enforces safety checks for max spend, stop-loss, gas caps, and slippage
- Includes a
DCALog.solcontract and a gasless deployment script for Status Network Sepolia
- Install MoonPay CLI globally:
npm install -g @moonpay/cli- Install project dependencies:
npm install- Export the environment variables used by the agent:
export MOONPAY_ACCOUNT=0xYourAddress
export MOONPAY_SWAP_TOOL=swap_tokens
export MOONPAY_BRIDGE_TOOL=bridge_assets
export MOONPAY_BALANCES_TOOL=get_balances
export MOONPAY_MARKET_TOOL=get_market_dataThe tool names are configurable because MoonPay CLI MCP tool ids may differ by environment or version.
npm testCreate a DcaAgent, register one or more schedules, and run runCycle() on your preferred cadence. The tests show direct examples with mocked MCP responses. For real execution, create the MoonPay client with:
const client = await MoonPayMcpClient.connectStdio();That launches mp mcp, initializes the MCP session, and uses MoonPay tools for balances, market data, swaps, and bridges.
Set:
export STATUS_PRIVATE_KEY=0x...
export STATUS_GASLESS_RELAY_URL=https://your-relay.exampleThen run:
npm run deploy:statusThe deploy script compiles contracts/DCALog.sol, prepares contract creation bytecode, and submits it to a sponsor relay targeting Status Network Sepolia RPC https://public.sepolia.status.im on chain id 1660.