Thanks to visit codestin.com
Credit goes to github.com

Skip to content

manja316/drift-subscriptions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drift — Onchain Subscriptions on Base

Drift is an onchain subscription protocol on Base. Creators set a price and period, subscribers pay in ETH, and payments go directly to the creator. No censorship, no middleman. The protocol takes a 2% platform fee.

How It Works

  1. Creator sets up a plan — defines a price (in ETH), billing period (1 day to 365 days), name, and description.
  2. Subscriber pays — sends exact ETH amount to subscribe. Payment goes directly to the creator.
  3. Recurring payments — subscriber calls pay() each period to continue access. The contract tracks payment status onchain.
  4. Unsubscribe anytime — subscriber can cancel at any time. Creator can deactivate a plan (existing subs still honored).

Tech Stack

  • Smart Contract: Solidity 0.8.20, OpenZeppelin (Ownable, ReentrancyGuard)
  • Frontend: Next.js 16, React 19, TypeScript, Tailwind CSS
  • Web3: wagmi, viem, ConnectKit
  • Chain: Base (Ethereum L2, Chain ID 8453)
  • Tooling: Hardhat

Project Structure

drift/
├── contracts/
│   └── Drift.sol            # Subscription smart contract
├── scripts/
│   └── deploy.js            # Deployment script
├── frontend/
│   ├── app/                  # Next.js app router
│   │   ├── page.tsx          # Main subscription UI
│   │   ├── contract.ts       # Contract ABI + address
│   │   ├── providers.tsx     # Web3 providers (wagmi, ConnectKit)
│   │   └── api/              # API routes
│   └── public/               # Static assets
├── hardhat.config.js
└── package.json

Local Development

Smart Contract

npm install
npx hardhat compile

To deploy (requires .env with PRIVATE_KEY):

npx hardhat run scripts/deploy.js --network base

Frontend

cd frontend
pnpm install
pnpm dev

Open http://localhost:3000.

Contract Details

  • Fee: 2% (200 basis points) on every subscription payment
  • Plans: Creator-defined price and period, activatable/deactivatable
  • Subscriptions: Tracked onchain with startedAt, lastPaidAt, nextDueAt
  • Security: ReentrancyGuard on all ETH transfers, Ownable for fee withdrawal

License

MIT

About

Onchain subscriptions on Base. Creators set a price, subscribers pay monthly in ETH. 2% platform fee.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors