UniPortfolio is a decentralized finance (DeFi) application that empowers users to track their crypto portfolio across multiple blockchains, execute optimized swaps using the 1inch API, and seamlessly bridge assets to Sui for cross-chain interoperability (more non-EVM <> EVM swap up-coming).
Built for the Unite DeFi hackathon, UniPortfolio addresses the challenge of fragmented DeFi ecosystems by providing a unified interface for portfolio management and cross-chain operations, with a focus on extending 1inch’s Fusion+ capabilities to Sui.
How UniPortfolio is Built
UniPortfolio is a platform designed for cross-chain portfolio management and token swapping, built with innovative blockchain technology and a modern technical stack.
Core Innovation: Cross-Chain Swaps ETH <> SUI
UniPortfolio’s standout feature is its ability to facilitate cross-chain swaps between Ethereum (ETH) and Sui (SUI). This is achieved through:
- Cryptographic Security: sui::hash::keccak256 for secret verification and hashlock implementation
- Data Structures:
- Timelock struct for recording time-based locks
- Factory struct storing src_escrows and dst_escrows tables
- Access Control:
- Resolver object for authorized operations
- resolver_cap token representing resolver ownership
- Only resolver holders can execute create_dst_escrow() and create_src_escrow()
- Future Enhancements:
- Default timelock configuration during factory creation
- Factory owner-controlled resolver registration
create sui dst escrow: https://testnet.suivision.xyz/txblock/46Nom4YQk1eXMjyQQxRbV46AUzo4RR93wx56wjaR28AM
sui dst escrow withdraw: https://testnet.suivision.xyz/txblock/fFtCBTnWKoMzaRRdEKPcMtbhdP54CBNTumMby7gi7YA?tab=Overview
🏗️ Core Architecture & Technologies
Frontend Framework
- Next.js 14 - React-based full-stack framework with App Router
- TypeScript - Type safety throughout the application
- React 18 - Component library for the UI
- Tailwind CSS - Utility-first CSS framework with custom design system
Authentication & Wallet Integration
- Privy (@privy-io/react-auth) - Primary wallet authentication system (NOT @statechannels)
- Wagmi - Ethereum wallet connection and blockchain interactions
- Multi-chain support: Ethereum, Polygon, BNB Chain, Arbitrum, Optimism, Base, and their testnets
- Sui blockchain support - Custom integration with Suiet and Slush wallets via @mysten/sui.js
State Management
- Zustand - Lightweight state management
- TanStack React Query - Server state management and caching
- React Context - For wallet and chain state
Backend Architecture
- Next.js API Routes - Server-side functions (NOT separate Rust backend)
- Proxy architecture - All external API calls go through Next.js API routes
- No separate backend service - Everything runs within the Next.js application
🔗 API Integrations & Data Sources
1inch API Ecosystem
The project integrates with 5 different 1inch API services:
- Portfolio API (v5.0) - https://api.1inch.dev/portfolio/portfolio/v5.0
- Current portfolio value across chains
- Historical value charts
- Portfolio holdings snapshots
- Swap API (v6.1) - https://api.1inch.dev/swap/v6.1
- DEX aggregation and token swapping
- Swap quotes and execution
- Token allowance management
- Available token listings
- Spot Price API (v1.1) - https://api.1inch.dev/price/v1.1
- Real-time token price data
- Multi-chain price support
- Balance API (v1.2) - https://api.1inch.dev/balance/v1.2
- Token balances for wallet addresses
- Multi-chain balance tracking
- History API (v2.0) - https://api.1inch.dev/history/v2.0
- Transaction history and event tracking
- Swap transaction analysis
- Event-based filtering
Alternative Data Sources
- CoinGecko API - Fallback price data source
- Custom RPC endpoints - Direct blockchain interaction