The first fully decentralized subscription infrastructure on Base L2 Automate recurring payments with on-chain guarantees, zero intermediaries, and Chainlink Automation integration.
SubBase is a permissionless subscription protocol that enables creators, businesses, and DAOs to monetize their services with automated recurring payments on Base L2.
- ✅ Zero Platform Fees — No intermediaries, 100% revenue goes to creators
- ✅ Automated Billing — Chainlink Automation handles recurring charges
- ✅ Grace Periods — 7-day grace period for failed payments
- ✅ UUPS Upgradeable — Protocol can evolve without migration
- ✅ Gas Efficient — Batch processing up to 50 subscriptions per transaction
- ✅ Open Source — MIT licensed, fully auditable
| Metric | Value |
|---|---|
| Network | Base Mainnet (Chain ID: 8453) |
| Contract Address | 0xfa34E4c68c77D54dD8B694c8395953465129E3c9 |
| Payment Token | USDC |
| Grace Period | 7 days |
| Max Retries | 3 attempts |
| Version | 2.0.0 |
Create a subscription plan in 3 steps:
import { SubBase } from '@subbase/sdk';
// 1. Initialize SubBase
const subbase = new SubBase({
network: 'base-mainnet',
privateKey: process.env.PRIVATE_KEY
});
// 2. Create a plan
const plan = await subbase.createPlan({
price: '10000000', // 10 USDC (6 decimals)
billingPeriod: 30 * 24 * 60 * 60, // 30 days in seconds
metadata: 'Premium Membership'
});
console.log(`Plan created: ${plan.id}`);Subscribe to any plan:
// 1. Approve USDC
await subbase.approveUSDC();
// 2. Subscribe to a plan
const subscription = await subbase.subscribe(planId);
console.log(`Subscribed! Next billing: ${subscription.nextBillingTime}`);SubBase is built with a modular, upgradeable architecture:
┌─────────────────────────────────────────┐
│ SubBaseV2 (Proxy) │
│ 0xfa34E4c68c77D54dD8B694c8395953465129E3c9 │
└─────────────────────────────────────────┘
│
├─── PlanModule
│ └── Create & manage subscription plans
│
├─── SubscriptionModule
│ └── Subscribe & cancel subscriptions
│
├─── ChargeModule
│ └── Process recurring payments
│ └── Handle failed payments
│ └── Grace period management
│
└─── AutomationModule
└── Chainlink Automation integration
└── Batch processing (50 subs/tx)
Creators define their own terms:
- Custom pricing (any USDC amount)
- Flexible billing cycles (daily, weekly, monthly, yearly)
- Metadata support (plan descriptions, benefits, etc.)
Powered by Chainlink Automation:
- Subscriptions automatically renew
- No manual intervention required
- Up to 50 subscriptions charged per transaction
Failed payments don't mean immediate cancellation:
- 7-day grace period after first failure
- 3 retry attempts before suspension
- Subscribers can reactivate suspended subscriptions
Active ──(payment fails)──> PastDue ──(3 failures)──> Suspended
↑ │
└────(payment success)───────┘
└────(manual reactivate)─────────────────────┘
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
interface ISubBase {
function createPlan(
uint256 price,
uint256 billingPeriod,
string memory metadata
) external returns (uint256 planId);
function subscribe(uint256 planId) external returns (uint256 subscriptionId);
function charge(uint256 subscriptionId) external returns (bool success);
}
contract YourContract {
ISubBase public subbase = ISubBase(0xfa34E4c68c77D54dD8B694c8395953465129E3c9);
function createSubscription() external {
// Create plan: 10 USDC/month
uint256 planId = subbase.createPlan(
10_000000, // 10 USDC
30 days,
"Monthly Plan"
);
}
}import { ethers } from 'ethers';
import SubBaseABI from './deployments.json';
const provider = new ethers.JsonRpcProvider('https://mainnet.base.org');
const signer = new ethers.Wallet(privateKey, provider);
const subbase = new ethers.Contract(
'0xfa34E4c68c77D54dD8B694c8395953465129E3c9',
SubBaseABI,
signer
);
// Get subscription details
const subscription = await subbase.getSubscription(subscriptionId);
console.log('Next billing:', new Date(subscription.nextBillingTime * 1000));
// Check if chargeable
const isChargeable = await subbase.isChargeable(subscriptionId);SubBase is Chainlink Automation compatible out of the box.
- Go to Chainlink Automation
- Click "Register New Upkeep"
- Use these parameters:
- Contract address:
0xfa34E4c68c77D54dD8B694c8395953465129E3c9 - Upkeep name: SubBase Auto-Billing
- Gas limit: 2,000,000
- Check data:
0x(empty)
- Contract address:
SubBase will automatically:
- Detect subscriptions due for billing
- Process up to 50 subscriptions per execution
- Handle partial failures gracefully
See deployments.json for all contract addresses across networks.
# Install dependencies
forge install
# Run tests
forge test
# Run tests with gas report
forge test --gas-report
# Run specific test
forge test --match-test testCharge_Success -vvv# Start local node
anvil
# Deploy to local
forge script script/DeployV1.s.sol --rpc-url http://localhost:8545 --broadcastSubBase prioritizes security:
- ✅ OpenZeppelin contracts for upgrade safety
- ✅ Reentrancy guards on all state-changing functions
- ✅ Access control with owner-only admin functions
- ✅ UUPS proxy pattern for secure upgrades
- ✅ Comprehensive test coverage
Audit Status: Self-audited. Professional audit coming soon.
- Developer tools subscriptions
- API access tiers
- Cloud services billing
- Online course access
- Premium content memberships
- Newsletter subscriptions
- Battle pass systems
- VIP memberships
- In-game item subscriptions
- Membership dues
- Governance participation fees
- Community access tiers
- V1: Core subscription functionality
- V2: Auto-charge billing engine
- V2: Chainlink Automation integration
- V2: Grace periods & retry logic
- V3: Multi-token support (ETH, other ERC20s)
- V3: Discount codes & trials
- V3: Refund mechanisms
- V3: Analytics dashboard
We welcome contributions! Please see our Contributing Guide for details.
# Clone repo
git clone https://github.com/karinasvatk/SubBase.git
cd SubBase
# Install dependencies
forge install
# Run tests
forge testSubBase is MIT licensed.
- Website: Coming soon
- Documentation: docs.subbase.xyz (Coming soon)
- Twitter: @SubBaseProtocol (Coming soon)
- Discord: Join our community (Coming soon)
- BaseScan: View Contract
Need help? Reach out:
- GitHub Issues: Report bugs or request features
- Email: savitskayakarrina@outlook.com
Built with ❤️ on Base
Making subscriptions truly decentralized