ProxyPal

EIP-7702 delegation & subscriptions with ENS for ETH/PYUSD. Replaces bank subscriptions with wallet!

ProxyPal

Created At

ETHGlobal New Delhi

Project Description

ProxyPal is a decentralized Ethereum Mechanism leveraging EIP-7702 for secure, time-bound asset delegation and automated subscriptions using ETH or PYUSD (PayPal’s ERC20 stablecoin). It solves the critical problem of trust-heavy, centralized subscription systems (e.g., bank-linked auto-payments) and risky DeFi delegation by offering a wallet-only, user-controlled alternative with seamless UX via ENS integration.

Problem Solved: Traditional subscriptions rely on bank accounts, exposing users to risks like data breaches, hidden fees, or loss of control. In DeFi, asset delegation often lacks time limits or easy revocation, risking indefinite exposure. ProxyPal addresses these by:

Wallet-based subscriptions: Users deposit PYUSD into the contract for recurring payments (e.g., monthly), replacing bank accounts. They can pause, resume, or cancel subscriptions, with instant refunds for unused funds, all manageable via wallets. Safe delegation: Users delegate ETH or PYUSD to another address for a set period (1 hour to 1 year), with automatic return of unused assets upon expiration or revocation, minimizing trust and risk. Seamless UX with ENS: Users interact using ENS names (e.g., "goodfriend.eth") instead of raw addresses, making delegation and subscriptions intuitive and error-free, especially for non-technical users.

For example, User can delegate 100 PYUSD to "goodfriend.eth" for 30 days via the frontend; Then that goodfriend.eth can spend it within that period, and unspent funds auto-return.

Similarly, User can set up a 6-month subscription paying 10 PYUSD monthly to "ottplatform.eth" or "streamplatform.eth", with options to pause or cancel. The frontend simplifies these actions, letting users connect via MetaMask, input ENS names, and manage delegations/subscriptions with ease.

PYUSD’s fiat-like stability bridges crypto to real-world use cases (e.g., paying for services), while ENS ensures accessibility.

ProxyPal is secure (non-custodial, ReentrancyGuard-protected), transparent (event-driven), and efficient (batch processing), redefining DeFi automation.

How it's Made

ProxyPal is a mechanism built for the ETHGlobal New Delhi Hackathon, combining Solidity smart contracts, a frontend, ENS integration, and EIP-7702 to deliver wallet-based asset delegation and subscriptions, replacing traditional bank-linked systems with seamless UX.

Problem Solved:

Centralized subscription risks: Bank-based auto-payments expose users to breaches and loss of control. ProxyPal uses Ethereum wallets with ETH/PYUSD for secure, transparent subscriptions, with user controls (pause/resume/cancel) and instant refunds. DeFi delegation risks: Existing delegation lacks time limits or revocation, risking assets. ProxyPal’s time-bound delegations (1 hour to 1 year) will return unused funds, enhancing safety. Poor UX in some dapps: Complex addresses deter non-technical users. ProxyPal integrates ENS, allowing interactions via names (e.g., "user.eth"), making the app intuitive and error-resistant.

Tech Stack and Implementation:

Smart Contracts:

EIP7702DelegationManager: Core contract for delegations and subscriptions. Users deposit ETH (via payable functions) or PYUSD (via SafeERC20) for time-bound delegations or recurring payments. Features:

Delegations: Lock assets with start/end times (block.timestamp), tracked via mappings (IDs, user/delegate lists), with auto-return on expiration. Subscriptions: Deposit total amount upfront, automate interval-based payments (e.g., monthly PYUSD), with pause/resume/cancel and refunds. Security: Uses OpenZeppelin’s Ownable, ReentrancyGuard, and SafeERC20 for safe PYUSD handling. Efficiency: Batch functions (e.g., batchProcessSubscriptionPayments) optimize gas.

EIP7702AuthorizedCode: Upgrades EOAs with EIP-7702, enabling delegated calls, ETH/PYUSD transfers, and subscription management. Uses assembly for efficient storage (manager/owner slots) and call for flexibility.

ENS Integration: Added ENS resolution (via ENS contracts) in the frontend and smart contracts. Users input ENS names (e.g., "goodfriend.eth") for delegates or recipients, resolved to addresses via ENS’s resolver and addr functions. This simplifies UX, reduces address errors, and enhances accessibility. In contracts, ENS names are resolved before processing (e.g., createDelegation or createSubscription accepts resolved addresses). Frontend: Built a React app with ethers.js for contract interaction and ENS.js for name resolution. Features:

Connect MetaMask to interact on Ethereum testnets. Input ENS names for delegates/recipients (e.g., "goodfriend.eth"). Create/revoke delegations (e.g., 50 PYUSD for 7 days) and subscriptions (e.g., 1 ETH/month for 6 months). Monitor active delegations/subscriptions and trigger payments/expirations.

Partner Technologies:

ENS: Enhanced UX by allowing human-readable names, making ProxyPal user-friendly and reducing errors (e.g., mistyping addresses). Integrated via wagmi in the frontend and ENS resolver calls in contracts. PYUSD: Used PayPal’s stablecoin for fiat-like subscriptions, enabling real-world use cases (e.g., USD-pegged payments). Its stability adds trust for non-crypto users.

Development Tools:

Hardhat: For local dev, testing, and deployment on Sepolia. Unit tests covered edge cases (e.g., ENS resolution failures, mid-delegation revocations). ethers.js/wagmi: Handled wallet connections, contract calls, and ENS resolution in the frontend.

Hacky Highlights:

ENS Integration: Added ENS resolution in the frontend with fallback to raw addresses, ensuring compatibility for non-ENS users while prioritizing seamless UX. Pause/Resume Logic: Used modulo-based nextPaymentTime calculation to maintain subscription interval alignment post-pause, avoiding drift. Batch Robustness: Implemented try-catch in batchProcessSubscriptionPayments to skip failed transfers, ensuring batch operations don’t halt.

Architecture: Three layers:

Frontend (Next.js): Users interact via a web app, inputting ENS names or addresses, connecting via MetaMask. Smart Contracts (Solidity): EIP7702DelegationManager handles logic/storage; EIP7702AuthorizedCode enables EOA functionality. Ethereum Testnet: Deployed on Sepolia, with PYUSD mocked (real PYUSD for mainnet).

ProxyPal combines security, usability (via ENS), and innovation (EIP-7702) for automation.

Future Plans:

Launch an SDK that can be integrated into any decentralized app featuring subscription plans, enabling seamless implementation of time-bound asset delegations and recurring payments. Extend the SDK for use in lending and borrowing platforms, supporting stablecoins and other assets like mini-loans, where users can delegate collateral or automate repayments with built-in revocation and auto-return mechanisms. Implement automation of transaction execution for key activities (e.g., automatic payment triggering or delegation expirations) to provide a more seamless user experience, reducing manual interventions. Introduce gas sponsorship mechanisms, allowing users to perform delegations, subscriptions, and other activities without paying gas fees themselves, potentially through partnerships with relayers or protocol-level optimizations to lower barriers for mainstream adoption.

background image mobile

Join the mailing list

Get the latest news and updates