PayStream
Payroll system automating multi-token, multi-chain employee payouts including PYUSD
Problem Statement
PayStream is a comprehensive decentralized payroll management platform built for ETHGlobal 2025 that revolutionizes how employers pay employees using cryptocurrency. The system enables employers to pay their workforce in any cryptocurrency while employees receive payments in their preferred token and blockchain of choice, all facilitated through intelligent cross-chain infrastructure.Problems It SolvesTraditional crypto payroll forces employers and employees to use the same blockchain and token, resulting in high fees, payment failures, and complex multi-chain management. PayStream eliminates this friction by enabling cross-chain, cross-token payments with intelligent fee optimization, automatic failover routing, and seamless PYUSD-based fiat on/off-ramps.Core Features & FunctionalityMulti-Chain Payment Flexibility with Intelligent RoutingDual Preference System: Employees set primary and secondary payment preferences for token type and blockchain networkCross-Chain Cross-Token Transfers: Since Avail's native transfer function doesn't support cross-chain cross-token transfers, we built custom smart contracts to enable ETH ↔ USDC swaps and facilitate multi-token swaps across different chains, expanding payment flexibility beyond Avail's native capabilitiesIntelligent Fee Optimization: Automatic comparison of transaction fees between preferences, routing through the most cost-effective optionAutomatic Failsafe: If primary preference fails, automatically retries on secondary preferenceSmart Fee Comparison: Evaluates total costs including gas prices, swap fees, and bridge costs2.PYUSD Integration & Fiat On/Off-Ramp SolutionPayStream provides a complete solution for users who want to bridge traditional finance and cryptocurrency through PayPal's PYUSD stablecoin:For Users Without Crypto:Users can onramp directly using PYUSD, providing an accessible entry point for those new to cryptocurrencyOnce onramped, users can make payments across any supported blockchain and in any supported tokenThis removes the barrier of needing to acquire native crypto assets to participate in the ecosystemCross-Chain PYUSD Support:Integration with Layer Zero and the Stargate bridge enables PYUSD transfers from Ethereum to Solana MainnetSupport for PYUSD payments on testnets and additional networks beyond Avail Nexus's current native supportCustom smart contract implementation to handle PYUSD swaps to other currencies when neededOff-Ramp Functionality:Users can consolidate balances from multiple chains onto a single chain with one clickThe consolidated balance can be swapped to PYUSDUsers can then off-ramp PYUSD back to their PayPal account, providing a seamless exit to traditional financeThis creates a complete circular flow: fiat → PYUSD → any crypto → PYUSD → fiatAdvanced Transaction Tracking (Avail Intent Explorer)Complete Payment Trail: BlockScout integration showing full journey from employer to employeeMulti-Step Visibility: Track deposits, conversions, and transfers with transaction hashesAudit Compliance: Full traceability for accounting and regulatory purposesOne-Time Payment LinksQR Code & Link Generation: Create shareable payment links for ad-hoc transactionsNo Account Required: Payers don't need employer accountsFlexible Options: Pay with any available crypto, recipient receives preferred currencyEmployee ManagementGroup-Based Organization: Organize employees into payment groups for batch processingFlexible Configuration: Custom payment amounts and token preferences per employeeComplete Payment History: Full audit trail of all transactionsReal-time Notifications: Push-based updates for instant payment visibilityUnified Balance & Gas ManagementMulti-Chain Balance View: See all holdings across supported chains in one dashboardGas Monitoring: Automatic tracking of gas token balances across all active chainsProactive Alerts: Notifications when gas falls below operational thresholdsOne-Click Refueling: Simplified gas top-ups without manual bridge operations
Solution
Technology StackFrontend & Backend:React-based web application with MetaMask wallet integrationSuperBase PostgreSQL database with real-time subscriptions for employee data, payment schedules, and live notificationsPush-based architecture eliminates polling overheadNo traditional backendBlockchain & Smart Contracts:Avail Nexus Framework: Core payment routing infrastructure providing cross-chain transaction coordination, solver network for currency conversion, and multi-chain balance aggregationCustom PayStream Smart Contracts: Deployed to handle PYUSD conversions to ETH and USDC, cross-currency swaps not yet supported by Avail Nexus, and PYUSD swap routing before Avail Nexus processingSolidity: Smart contract development languageEVM-compatible chains: Ethereum Sepolia, Optimism Sepolia, Base, and moreCross-Chain Infrastructure:Layer Zero Protocol: Cross-chain messaging layerStargate Bridge: Facilitates PYUSD transfers between Ethereum and SolanaAvail Nexus Solver Network: Handles currency conversions and cross-chain routingPayment Integration:PayPal PYUSD: Stablecoin for on-ramp and off-ramp functionalityCustom swap logic for PYUSD on testnets where official support isn't availableBlockchain Exploration:BlockScout API: Transaction tracking, explorer links for verification, solver information extraction, and custom payment flow visualizationTechnical Architecture & ImplementationPayment Flow Pipeline:Preference-Based Routing: Employee preferences stored in SuperBase with primary/secondary chain and token choicesFee Comparison Engine: Before execution, the system queries gas prices and swap costs for both preference options, calculates total transaction costs, and selects the optimal routeToken Allowance Management: Smart contract approvals set for solver interactionsAvail Nexus Integration: Deposit to solver, currency conversion via solver network, and return transfer of converted fundsDirect Transfer: Final transfer to employee on their chosen chainFailsafe Logic: Automatic retry on secondary preference if primary transaction fails, with fee comparison to ensure cost-effectiveness even during failoverTransaction Recording: All steps logged to SuperBase with BlockScout transaction hashesPYUSD Custom Swap Implementation:Since Avail Nexus doesn't natively support PYUSD during the hackathon, we built custom smart contracts to bridge this gap:Swap Contracts: Handle PYUSD → ETH and PyUSD → USDC conversions using DEX integrationsMulti-Step Flow: PYUSD swapped to Avail-supported currency → Avail Nexus processes cross-chain payment → Employee receives preferred tokenLayer Zero Integration: Enables PYUSD movement between Ethereum and Solana via StargateConsolidation Feature: Gathers balances from multiple chains, swaps to PYUSD, and prepares for PayPal off-rampGas Fueling System:Balance Monitoring: Periodic checks of native gas tokens across all chains in user's portfolioThreshold Alerts: Triggers notifications when gas falls below minimum operational levelsAutomated Bridge Integration: One-click refueling uses bridge APIs to transfer gas tokens from high-balance chainsReal-Time Updates:SuperBase real-time subscriptions provide instant payment notifications without polling, reducing server load and improving user experience.Notable Technical Achievements & Hacks1. Avail Nexus Workarounds:During the hackathon, Avail Nexus had limitations with certain token pairs and chains. We implemented custom smart contracts to handle these edge cases, essentially preprocessing payments before they enter the Avail ecosystem.2. BlockScout Integration:We scraped BlockScout transaction data to extract solver addresses and intermediate transaction details, creating a custom visualization showing the complete payment journey across multiple chains and contracts.3. Fee Optimization Algorithm:Built a real-time fee comparison engine that evaluates multiple routes before executing payments, considering gas prices, swap fees, and bridge costs to minimize total transaction costs.4. PYUSD Testnet Support:Since PYUSD wasn't fully supported on all testnets through official channels, we deployed custom contracts and integrated Stargate Bridge to enable PYUSD functionality across our target chains.5. Unified Balance Aggregation:Leveraged Avail Nexus's multi-chain infrastructure to create a single dashboard view of employer funds across all supported networks, simplifying treasury management.6. Failsafe Architecture:Implemented automatic fallback logic that handles transaction failures gracefully, retrying on alternative chains without user intervention while still optimizing for cost.Partner Technology BenefitsAvail Nexus: Eliminated need to build custom cross-chain messaging; provided battle-tested solver networkBlockScout: Comprehensive transaction tracking without building custom indexing infrastructureLayer Zero/Stargate: Enabled Ethereum-Solana PYUSD bridging with proven securityPayPal PYUSD: Provided familiar fiat on/off-ramp for traditional usersSuperBase: Real-time database with built-in subscriptions saved significant backend development timeChallenges & SolutionsChallenge: Avail Nexus didn't support all token/chain combinations needed.Solution: Built preprocessing layer with custom swap contracts.Challenge: Complex multi-step transactions were difficult to track.Solution: Integrated BlockScout API and built custom visualization layer.Challenge: Users needed gas on multiple chains.Solution: Implemented monitoring and one-click refueling system.Challenge: Traditional users hesitant about crypto.Solution: PYUSD integration provides familiar PayPal-based on/off-ramp.
Hackathon
ETHOnline 2025
2025
Prizes
- 🏆
Developer Feedback (Test our Docs)
Avail
Contributors
- juSt-jeLLy
70 contributions
- cryptoKevinL
67 contributions