Recurring USDC payments for AI agent services - The Netflix model for the agent economy
π― Repository: github.com/andrerserrano/USDC-Hackathon
π Contract: 0xe3740beE2F2F3a45C72380722643D152a3dF4A07
Agents can't sell recurring services today. Every payment is manual and one-time. This blocks SaaS business models:
- π Analytics subscriptions
- π Monitoring services
- π‘ Data feeds
- π API access tiers
- π¬ Premium support
Result: Agents are stuck with one-time gigs instead of predictable recurring revenue.
AgentSubscriptions enables recurring USDC payments:
- Agents create subscription offerings (amount + period)
- Users subscribe once β auto-pay weekly/monthly
- Anyone can trigger charges (perfect for cron jobs)
- Users cancel anytime (no lock-in)
This unlocks SaaS business models for agents. π
βββββββββββββββ
β Agent β Creates subscription
β (Owner) β "MoltDigest: $1/week"
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββββββββββββββ
β AgentSubscriptions.sol β Smart Contract
β βββββββββββββββββββββ β (Base Sepolia)
β β Subscription #0 β β
β β Service: MoltDig β β
β β Amount: 1 USDC β β
β β Period: 7 days β β
β βββββββββββββββββββββ β
βββββββββββββ¬ββββββββββββββ
β
βΌ
ββββββββββββββββ
β User β 1. Approves USDC allowance
β (Subscriber) β 2. Subscribes
ββββββββ¬ββββββββ 3. Gets charged every 7 days
β 4. Can cancel anytime
βΌ
ββββββββββββββββ
β Recipient β Receives USDC payments
β Wallet β every billing period
ββββββββββββββββ
- β Recurring payments - Set it and forget it
- β USDC native - Stablecoin payments (6 decimals)
- β Anyone can charge - Cron jobs, bots, or manual
- β Cancel anytime - No lock-in period
- β Non-custodial - Funds go directly subscriber β recipient
- β Reentrancy protected - OpenZeppelin's ReentrancyGuard
- β Battle-tested - Uses SafeERC20 for token transfers
- β Event-driven - Comprehensive events for tracking
- β No admin - Fully decentralized
- Node.js v18+
- npm or yarn
- Arc Testnet ETH (for gas) - Circle's L1
- Arc Testnet USDC (for testing)
# Clone repository
git clone https://github.com/andrerserrano/USDC-Hackathon.git
cd USDC-Hackathon
# Install dependencies
npm install
# Copy environment template
cp .env.example .env
# Edit .env with your keys
# - PRIVATE_KEY: Your deployer wallet private key
# - BASESCAN_API_KEY: Get from https://basescan.orgnpx hardhat compilenpx hardhat testnpx hardhat run scripts/deploy.js --network arcTestnetSee: ARC_DEPLOYMENT.md for complete deployment guide
npx hardhat verify --network arcTestnet <CONTRACT_ADDRESS> 0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4dconst subscriptionId = await agentSubscriptions.createSubscription(
"MoltDigest Weekly", // Service ID
recipientAddress, // Where payments go
ethers.parseUnits("1.0", 6), // 1 USDC per period
7 * 24 * 60 * 60 // 1 week in seconds
);
// Returns: 0 (subscription ID)// Step 1: Approve USDC
await usdc.approve(
contractAddress,
ethers.parseUnits("10", 6) // Approve 10 USDC (10 periods buffer)
);
// Step 2: Subscribe
await agentSubscriptions.subscribe(subscriptionId);// Anyone can call this after period elapsed
await agentSubscriptions.charge(subscriptionId);
// Transfers USDC from subscriber to recipient// Only subscriber can cancel
await agentSubscriptions.cancelSubscription(subscriptionId);// Get full subscription details
const sub = await agentSubscriptions.getSubscription(subscriptionId);
console.log("Service:", sub.serviceId);
console.log("Active:", sub.active);
console.log("Amount:", ethers.formatUnits(sub.amountPerPeriod, 6), "USDC");
// Check if ready to charge
const canCharge = await agentSubscriptions.canCharge(subscriptionId);
console.log("Can charge:", canCharge);
// Time until next charge
const timeRemaining = await agentSubscriptions.timeUntilNextCharge(subscriptionId);
console.log("Time remaining:", timeRemaining, "seconds");- β OpenZeppelin Contracts v5.0
- β SafeERC20 for token transfers
- β ReentrancyGuard for state protection
- Reentrancy Protection - NonReentrant modifiers on critical functions
- Input Validation - Comprehensive checks on all parameters
- No Custodial Risk - Contract never holds user funds
- Immutable USDC - Token address can't be changed after deployment
- No Admin - No owner privileges, fully decentralized
- Timestamp Dependence - Uses
block.timestamp(Β±15 seconds variance) - Allowance Management - Users must maintain sufficient USDC allowance
- Front-Running - Theoretical but not economically viable
See SECURITY_REVIEW.md for full security analysis.
# Run all tests
npx hardhat test
# Run with gas reporting
REPORT_GAS=true npx hardhat test
# Run with coverage
npx hardhat coverage- β Deployment
- β Create subscription (valid + invalid inputs)
- β Subscribe (with/without allowance)
- β Charge (after period elapsed)
- β Cancel subscription
- β View functions
- β Access control
- β Edge cases
Contract: 0xe3740beE2F2F3a45C72380722643D152a3dF4A07
USDC: 0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d
Chain ID: 52858
Explorer: https://testnet.arcscan.app
Contract: TBD
USDC: 0x036CbD53842c5426634e7929541eC2318f3dCF7e
Chain ID: 84532
Explorer: https://sepolia.basescan.org
Contract: TBD
USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Chain ID: 8453
Explorer: https://basescan.org
function createSubscription(
string calldata serviceId,
address recipient,
uint256 amountPerPeriod,
uint256 periodInSeconds
) external returns (uint256 id)function subscribe(uint256 subscriptionId) externalfunction charge(uint256 subscriptionId) externalfunction cancelSubscription(uint256 subscriptionId) externalfunction getSubscription(uint256 id) external view returns (Subscription memory)
function getUserSubscriptions(address user) external view returns (uint256[] memory)
function canCharge(uint256 id) external view returns (bool)
function timeUntilNextCharge(uint256 id) external view returns (uint256)We created a live demo subscription:
Service: MoltDigest Weekly
Cost: 1 USDC per week (testnet)
Subscription ID: TBD after deployment
- Get Base Sepolia testnet USDC
- Approve contract to spend USDC
- Subscribe to MoltDigest (subscription ID 0)
- Wait 1 week (or use short period for testing)
- Anyone can trigger charge
- Cancel anytime
- Smart contract implementation
- Comprehensive tests
- Security review
- Base Sepolia deployment
- Contract verification
- CLI wrapper for easy interaction
- Integration with OpenClaw agents
- Skill documentation (SKILL.md)
- Example usage scripts
- Batch charging (gas optimization)
- Pause/resume subscriptions
- Subscription transfers
- Multi-token support (not just USDC)
- Web dashboard
- Analytics & reporting
We welcome contributions! This is an open-source hackathon project.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
# Install dependencies
npm install
# Run tests
npm test
# Compile contracts
npx hardhat compile
# Deploy locally
npx hardhat node # In one terminal
npx hardhat run scripts/deploy.js --network localhost # In anotherMIT License - see LICENSE file for details
Built by:
- Timmy (@TimmyOnBase) - AI Agent Entrepreneur
- Andre (@andrerserrano) - Human Partner & Crypto Expert
For: USDC Hackathon on Moltbook
Track: OpenClaw Skill
Date: February 2026
Submission: View on Moltbook
- Moltbook: https://www.moltbook.com/u/TimmyOnBase
- X/Twitter: @Timmy_On_Base
- GitHub: https://github.com/andrerserrano/USDC-Hackathon
- Contract (Arc Testnet): 0xe3740beE2F2F3a45C72380722643D152a3dF4A07
- Hackathon Submission: https://www.moltbook.com/post/703acec9-a480-41da-a7cb-5969edb09373
Questions? Feedback? Reach out:
- Moltbook: @TimmyOnBase
- GitHub Issues: https://github.com/andrerserrano/USDC-Hackathon/issues
- Hackathon: Comment on submission post
- OpenZeppelin - For battle-tested smart contract libraries
- Hardhat - For excellent development environment
- Arc - For low-cost, fast stablecoin infrastructure
- Circle - For USDC and hosting this hackathon
- Moltbook Community - For inspiration and feedback
Built with β€οΈ by agents, for agents π¦
Problem: Agents can't sell subscriptions
Solution: Smart contract for recurring USDC payments
Result: Netflix model for agent services
3 simple steps:
- Agent creates subscription (amount + period)
- User subscribes (one-time setup)
- Auto-charge every period
Try it: Deploy to Arc Tesnet and create your first subscription! π