Skip to content

vikions/opipolix-autotopup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OpiPoliX AutoTopUp πŸš€

Automated balance management for Polymarket, Kalshi, Opinion, and Telegram bots using ERC-7715 Advanced Permissions

Built with Next.js MetaMask ERC-7715 Pimlico


Advanced Permissions Usage: src/lib/smartAccount.js (Lines 48-117) src/lib/smartAccount.js (Lines 127-193) app/page.jsx (Lines 108-128)

πŸ“‹ Overview

OpiPoliX AutoTopUp is an automated balance management system that monitors your prediction market bots and wallets, automatically topping them up when balances run low. Built on ERC-7715 Advanced Permissions, it enables gasless, autonomous top-ups with a single permission grant.

Key Features

  • ⚑ Smart Monitoring: Automatically monitors bot balances every 3 seconds
  • πŸ” One Permission: Grant once, automate forever (30-day permissions)
  • πŸ’° Zero Gas Fees: All top-ups are gasless via Pimlico Paymaster
  • πŸ€– Multi-Platform: Supports Polymarket, Kalshi, Opinion, and Telegram bots
  • πŸ”„ USDC-Only: Focused on USDC transfers (ETH support available)
  • βš™οΈ Configurable: Set custom thresholds and top-up amounts

πŸ› οΈ Tech Stack

  • Frontend: Next.js 15, React, Tailwind CSS
  • Blockchain: Ethereum Sepolia (testnet)
  • Smart Accounts: MetaMask Smart Accounts Kit (Hybrid Implementation)
  • Permissions: ERC-7715 Advanced Permissions
  • Wallet: wagmi, viem
  • Gasless Transactions: Pimlico Paymaster & Bundler
  • Account Abstraction: ERC-4337 UserOperations

πŸš€ Quick Start

Prerequisites

  • MetaMask Flask (required for ERC-7715 support)
  • Node.js 18+ and npm

Installation

# Clone repository
git clone https://github.com/yourusername/opipolix-autotopup.git
cd opipolix-autotopup

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env.local

# Add your Pimlico API key to .env.local
NEXT_PUBLIC_PIMLICO_API_KEY=your_key_here

# Run development server
npm run dev

Open http://localhost:3000


πŸ“– How It Works

1. Session Account Creation

When you connect, OpiPoliX creates a session account (Hybrid Smart Account). This session account will execute top-ups on your behalf.

2. Grant Permissions

You grant the session account two permissions using ERC-7715:

  • ETH Permission: 0.1 ETH per day
  • USDC Permission: 100 USDC per day

These permissions allow the session account to transfer tokens without requiring approval for each transaction.

3. Monitoring

The dashboard monitors your bot's balance every 3 seconds. When the balance drops below your configured threshold, it automatically triggers a top-up.

4. Gasless Top-Ups

Top-ups are executed as UserOperations with delegation:

  • The session account sends the operation
  • Pimlico Paymaster sponsors the gas
  • Your bot receives USDC instantly

πŸ”§ Configuration

Environment Variables

# Pimlico API Key (required)
NEXT_PUBLIC_PIMLICO_API_KEY=pim_xxxxx

# RPC URLs (optional, has defaults)
NEXT_PUBLIC_SEPOLIA_RPC_URL=https://ethereum-sepolia-rpc.publicnode.com

Dashboard Settings

  • USDC Threshold: Minimum balance before top-up triggers (default: 1 USDC)
  • USDC Top-Up Amount: Amount to send per top-up (default: 1 USDC)
  • Cooldown: 30 seconds between top-ups (prevents spam)

πŸ“‚ Project Structure

opipolix-autotopup/
β”œβ”€β”€ app/
β”‚   └── page.jsx                 # Landing page + config modal
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── Dashboard.jsx        # Monitoring dashboard
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ smartAccount.js      # Session accounts & permissions
β”‚   β”‚   └── networks.js          # Network configurations
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ bundlerClient.js     # Pimlico bundler
β”‚   β”‚   └── pimlicoClient.js     # Pimlico paymaster
β”‚   └── providers/
β”‚       └── AppProvider.jsx      # wagmi configuration
β”œβ”€β”€ .env.local                   # Environment variables
└── package.json

Best Practices

βœ… Only grant permissions on Sepolia testnet for testing
βœ… Use small amounts for production testing
βœ… Monitor the Activity Log for all operations
βœ… Revoke permissions when not in use


πŸ§ͺ Testing

Test Flow

  1. Connect MetaMask Flask to Sepolia
  2. Configure bot address (use a test wallet)
  3. Grant permissions (approve in MetaMask Flask)
  4. Fund your main wallet with Sepolia USDC
  5. Set threshold to trigger top-up
  6. Start monitoring and watch Activity Log

Test USDC Address (Sepolia)

0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238

Get test USDC from Sepolia faucets


🚧 Roadmap

  • Polygon Mainnet: Production deployment with real USDC
  • Multi-Token Support: Add support for other ERC-20 tokens
  • Email/Telegram Alerts: Notifications for top-ups and low balance
  • Historical Analytics: Charts and stats for top-up history
  • Mobile App: React Native version

🀝 Contributing

Contributions welcome! Please:

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

πŸ“„ License

MIT License - see LICENSE file


πŸ™ Acknowledgments

  • MetaMask for ERC-7715 Advanced Permissions support
  • Pimlico for gasless transaction infrastructure
  • viem and wagmi for excellent developer tools

πŸ“ž Contact

About

Automated balance top-up for Polymarket, Kalshi, Opinion using ERC-7715 Advanced Permissions

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors