Skip to content

shpak-vlad/PayDrip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

137 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PayDrip 💧

Programmable micro-payment pipeline on Base L2. Create recurring payments, subscriptions, vesting, and more with fiat on-ramp support.

Base Solidity License

🚀 Features

Core Functionality

  • 📅 Discrete Step Payments - Execute payments at specific intervals or events
  • 💰 Fiat On-Ramp - Pay with credit card via Base Pay integration
  • 🔗 Payment Links - Share payment links for easy subscriptions
  • 💱 Real-time Quotes - Fiat-to-crypto conversion with multiple currencies
  • 🔄 UUPS Upgradeable - Future-proof smart contracts
  • ⚡ Gas Optimized - Efficient on Base L2

Use Cases

  • 📺 Creator Subscriptions - Monthly payments to content creators
  • 👥 Team Vesting - Token distribution for team members
  • 🏢 Service Payments - Weekly/monthly service invoices
  • 💳 Usage-Based Billing - Event-driven payment execution
  • 🎁 Recurring Donations - Automated charitable giving

📦 Quick Start

For Users

1. Create a Drip with Crypto

import { PayDrip } from '@paydrip/sdk';

const drip = await payDrip.createDrip({
  receiver: '0xReceiverAddress',
  amountPerStep: '100', // 100 USDC
  totalSteps: 12,
  interval: 30 * 24 * 60 * 60, // 30 days
  token: USDC_ADDRESS
});
// 💸 12 monthly payments of 100 USDC

2. Create a Drip with Fiat (Credit Card)

const { paymentId, checkoutUrl } = await basePayDrip.initiateDripWithFiat({
  receiver: '0xReceiverAddress',
  amountPerStep: '50',
  totalSteps: 6,
  interval: 7 * 24 * 60 * 60, // 7 days
  returnUrl: 'https://yourapp.com/success'
});

// Redirect user to checkoutUrl for credit card payment
window.location.href = checkoutUrl;

3. Create a Payment Link

const linkId = await linkFactory.createPaymentLink({
  receiver: '0xReceiverAddress',
  amountPerStep: '25',
  totalSteps: 4,
  interval: 14 * 24 * 60 * 60, // 14 days
  expiry: Date.now() + 30 * 24 * 60 * 60 * 1000, // 30 days
  memo: 'Premium Subscription',
  multiUse: true
});

// Share link: https://paydrip.app/pay/{linkId}

For Developers

# Clone repository
git clone https://github.com/shpak-vlad/PayDrip.git
cd PayDrip/contracts

# Install dependencies
forge install

# Run tests
forge test -vv

# Deploy
forge script script/Deploy.s.sol --rpc-url base --broadcast

🏗️ Architecture

Core Contracts

PayDrip.sol

Main contract for drip creation and execution.

struct Drip {
  address sender;
  address receiver;
  address token;
  uint96 amountPerStep;
  uint32 totalSteps;
  uint32 currentStep;
  uint32 interval;
  uint64 lastExecuted;
  bool active;
}

BasePayDrip.sol

Fiat on-ramp integration via Base Pay API.

Features:

  • Credit card to crypto conversion
  • Oracle-based payment confirmation
  • Automatic drip creation after payment

PaymentLinkFactory.sol

Generate shareable payment links.

Features:

  • Single-use or multi-use links
  • Crypto and fiat payment options
  • Link expiration and validation

FiatQuoter.sol

Real-time fiat-to-crypto quotes.

Features:

  • Support for USD, EUR, GBP
  • Oracle-based rate updates
  • Fee calculation

Execution Flow

┌──────────────┐
│ User creates │
│    drip      │
└──────┬───────┘
       │
       ▼
┌──────────────┐     ┌─────────────┐
│ Lock funds   │────▶│ Step 1      │
│ (1000 USDC)  │     │ Transfer    │
└──────────────┘     │ 100 USDC    │
                     └──────┬──────┘
                            │ Wait 30 days
                            ▼
                     ┌─────────────┐
                     │ Step 2      │
                     │ Transfer    │
                     │ 100 USDC    │
                     └──────┬──────┘
                            │ ...
                            ▼
                     ┌─────────────┐
                     │ Step 10     │
                     │ Completed   │
                     └─────────────┘

🌐 Deployments

Base Mainnet

  • PayDrip Proxy: 0x6f2bd18433b0aea1a10be7af88d3a6bbdd0f8b1e
  • USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
  • BasePayDrip: TBD
  • PaymentLinkFactory: TBD
  • FiatQuoter: TBD

Base Sepolia (Testnet)

  • PayDrip Proxy: See contracts/deployments/base-sepolia.json

📖 Documentation

🔐 Security

  • ✅ UUPS Upgradeable pattern
  • ✅ ReentrancyGuard on all external functions
  • ✅ Oracle verification for fiat payments
  • ✅ Payment timeout protection (24 hours)
  • ✅ Comprehensive test coverage

Audit Status: Pending

🛠️ Tech Stack

  • Blockchain: Base L2 (Optimistic Rollup)
  • Language: Solidity 0.8.23
  • Framework: Foundry
  • Libraries: OpenZeppelin Upgradeable
  • Integration: Base Pay API

💡 Examples

Monthly Subscription

// User subscribes to premium content
payDrip.createDrip(
    10e6,        // 10 USDC/month
    12,          // 12 months
    30 days,     // Monthly
    creator,
    USDC
);

Team Vesting

// 100k tokens vesting quarterly over 1 year
payDrip.createDrip(
    25000e18,    // 25k tokens
    4,           // 4 quarters
    90 days,     // Quarterly
    teamMember,
    TOKEN
);

Service Payment

// Weekly service payment for 6 months
payDrip.createDrip(
    100e6,       // 100 USDC/week
    24,          // 24 weeks
    7 days,      // Weekly
    provider,
    USDC
);

🤝 Contributing

Contributions are welcome! Please read our contributing guidelines.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

MIT License - see LICENSE file for details

🔗 Links

🙏 Acknowledgments

Built on Base - the secure, low-cost, builder-friendly Ethereum L2 by Coinbase.


Made with ❤️ for the Base ecosystem

About

Micro‑payment and vesting pipeline on Base that streams funds as discrete “drips” funded by crypto or Base Pay.

Topics

Resources

License

Stars

21 stars

Watchers

4 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors