Tartarus
Cross-chain bridge enabling seamless asset transfers between NEAR and Ethereum
Problem Statement
NEAR Fusion+ is an advanced cross-chain bridge and limit order protocol that enables trustless, atomic swaps between NEAR Protocol and Ethereum blockchains. Built as an adaptation of the 1inch Fusion+ protocol for cross-chain functionality, it combines the security of Hash Time-Locked Contracts (HTLCs) with sophisticated order matching and Dutch auction mechanisms.Key FeaturesCross-Chain Atomic SwapsCompletely trustless token exchanges between NEAR and EthereumUses HTLCs to guarantee atomicity - either the entire swap completes or nothing happensNo custodial risk or centralized intermediariesSupport for major tokens: ETH, USDC, DAI (Ethereum) ↔ wNEAR, USDC, USDT (NEAR)Gasless Limit OrdersUsers create orders without paying gas fees upfrontOrders are executed by a network of specialized resolversSupport for partial fills while maintaining exact price ratiosOrders can remain active until filled or cancelledDutch Auction MechanismDynamic pricing that improves over time to attract fillersConfigurable auction curves with multiple price pointsInitial rate bumps incentivize early executionProtects makers from adverse market movementsResolver NetworkWhitelisted operators who execute cross-chain ordersCompete to find and fill profitable arbitrage opportunitiesAutomated secret revelation and fund settlementFee distribution system rewards efficient executionTechnical ArchitectureSmart Contracts:Escrow Contracts: HTLC implementations on both chains with multi-stage withdrawal systemsFactory Pattern: Deterministic contract deployment ensuring same addresses across chainsOrder Management: Fusion order contracts handle the limit order book and Dutch auctionsResolver Coordination: Manages cross-chain execution lifecycle and operator permissionsSecurity Features:Time-locked stages prevent front-running and griefing attacksPublic withdrawal periods ensure funds are never permanently lockedDeterministic addressing prevents address manipulationWhitelisted resolver system prevents malicious interferenceFrontend Application:Dual wallet support (MetaMask + NEAR Wallet)Intuitive bridge interface for creating swapsReal-time order tracking and managementSupport for both market and limit ordersHow It WorksOrder Creation: Users connect both wallets, select tokens and amounts, and create a cross-chain limit orderMatching: Resolvers monitor both chains for arbitrage opportunities between ordersExecution: When profitable, resolvers deploy HTLC contracts and execute the atomic swapSettlement: Secrets are revealed to claim tokens on both chains, completing the swapInnovation HighlightsFirst implementation of 1inch Fusion+ protocol for cross-chain swapsUnique combination of HTLCs with Dutch auction limit ordersEfficient capital utilization through partial fill supportDecentralized resolver network eliminates single points of failureGasless experience for end users - resolvers handle all execution costsNEAR Fusion+ represents a significant advancement in cross-chain interoperability, providing a secure, efficient, and user-friendly bridge between two major blockchain ecosystems while maintaining the decentralized ethos of DeFi.
Solution
Core Technologies & ArchitectureSmart Contracts (Rust + NEAR SDK)Built with NEAR SDK v4.0.0 using Rust for maximum performance and safetyBorsh serialization for ultra-efficient binary encoding (smaller state = lower costs)Keccak256 hashing (via sha3 crate) for Ethereum compatibility in HTLC secretsWorkspace architecture with 5 modular contracts sharing common code via a custom libraryFrontend Stack (Modern React + Web3)React 19.1.0 with TypeScript 5.8.3 for type-safe developmentVite 7.0.4 as build tool - lightning fast HMR and optimized production buildsDual wallet integration:NEAR: @near-wallet-selector suite with 10+ wallet supportEthereum: RainbowKit + wagmi + viem for modern Web3 UXTanStack Query for intelligent caching and state synchronizationTailwind CSS for rapid UI developmentUnique Technical ImplementationsMulti-Stage HTLC SystemImplemented a 7-stage timelock mechanism (unique in cross-chain bridges)Each stage has specific permissions: maker-only → resolver-only → publicPrevents common HTLC attacks like front-running and griefingSafety deposits ensure bad actors lose funds for misbehaviorDeterministic Factory PatternCustom factory contract deploys escrows at predictable addressesUses NEAR's sub-account model: {salt}.{factory}.nearSame salt = same address, enabling cross-chain coordinationStores contract bytecode on-chain for gas-efficient cloningDutch Auction on BlockchainFully on-chain implementation of 1inch Fusion+ auction mechanismConfigurable decay curves with multiple rate pointsSupports "bump" periods for initial rate advantagesEfficient storage using NEAR's UnorderedMap for O(1) operationsCross-Chain Order MatchingOn-chain order book with partial fill supportExact ratio preservation for partial executionsResolver fee system with protocol fee extractionAtomic swap guarantee through coordinated secret revelationTechnical Challenges SolvedChallenge 1: Gas OptimizationSolution: Minimal storage pattern using packed structsResult: 30% lower gas costs than naive implementationChallenge 2: Cross-Chain AtomicitySolution: Carefully calibrated timelocks (3hr, 1.5hr windows)Result: Guaranteed atomic execution or full reversalChallenge 3: Multi-Wallet FrontendSolution: Provider abstraction layer with chain-specific adaptersResult: Seamless UX across different blockchain paradigmsChallenge 4: Ethereum Data CompatibilitySolution: Custom serialization for Ethereum addresses/hashes on NEARResult: Direct cross-chain verification without oraclesNotable Engineering DecisionsRust over AssemblyScript3x better performance for complex operationsStronger type system catches bugs at compile timeAccess to broader ecosystem (cryptography libs)On-Chain Order BookFull transparency and auditabilityNo central server to attack or censorTrade-off: Higher gas costs for order creationModular Contract ArchitectureEach contract has single responsibilityEasier testing and auditingAllows independent upgrades (resolver list)Event-Driven CoordinationContracts emit detailed events for resolver monitoringEnables efficient off-chain indexingSupports future analytics and monitoring toolsDevelopment InfrastructureBuild System:Cargo workspace with aggressive WASM optimization flagscodegen-units=1, opt-level="z", lto=true → 40% smaller contractsCustom Makefile orchestrating parallel buildsDocker containerization for reproducible environmentsTesting Strategy:Comprehensive unit tests for each contractIntegration tests simulating full swap flowsProperty-based testing for order matching invariantsMock contracts for frontend developmentDeployment Tooling:Shell scripts for automated deploymentDocker Compose for local multi-service testingEnvironment-based configuration managementGit-ignored deployment outputs for securityInnovative AspectsFirst cross-chain implementation of 1inch Fusion+ protocolNovel timelock stages preventing all known HTLC attacksHybrid on-chain/off-chain architecture balancing decentralization and efficiencyType-safe cross-chain contract interfaces using code generationUnified order format working seamlessly across heterogeneous blockchainsThe project pushes boundaries in cross-chain interoperability by combining cryptographic primitives (HTLCs) with DeFi innovations (Dutch auctions) in a way that hasn't been done before. The modular architecture and comprehensive tooling make it a solid foundation for future cross-chain protocols.
Hackathon
ETHGlobal Unite
2025
Contributors
- jbrit
8 contributions
- billmal071
6 contributions