project screenshot 1
project screenshot 2
project screenshot 3

Tartarus

Cross-chain bridge enabling seamless asset transfers between NEAR and Ethereum

Tartarus

Created At

Unite Defi

Project Description

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 Features

  1. Cross-Chain Atomic Swaps
  • Completely trustless token exchanges between NEAR and Ethereum
  • Uses HTLCs to guarantee atomicity - either the entire swap completes or nothing happens
  • No custodial risk or centralized intermediaries
  • Support for major tokens: ETH, USDC, DAI (Ethereum) ↔ wNEAR, USDC, USDT (NEAR)
  1. Gasless Limit Orders
  • Users create orders without paying gas fees upfront
  • Orders are executed by a network of specialized resolvers
  • Support for partial fills while maintaining exact price ratios
  • Orders can remain active until filled or cancelled
  1. Dutch Auction Mechanism
  • Dynamic pricing that improves over time to attract fillers
  • Configurable auction curves with multiple price points
  • Initial rate bumps incentivize early execution
  • Protects makers from adverse market movements
  1. Resolver Network
  • Whitelisted operators who execute cross-chain orders
  • Compete to find and fill profitable arbitrage opportunities
  • Automated secret revelation and fund settlement
  • Fee distribution system rewards efficient execution

Technical Architecture

Smart Contracts:

  • Escrow Contracts: HTLC implementations on both chains with multi-stage withdrawal systems
  • Factory Pattern: Deterministic contract deployment ensuring same addresses across chains
  • Order Management: Fusion order contracts handle the limit order book and Dutch auctions
  • Resolver Coordination: Manages cross-chain execution lifecycle and operator permissions

Security Features:

  • Time-locked stages prevent front-running and griefing attacks
  • Public withdrawal periods ensure funds are never permanently locked
  • Deterministic addressing prevents address manipulation
  • Whitelisted resolver system prevents malicious interference

Frontend Application:

  • Dual wallet support (MetaMask + NEAR Wallet)
  • Intuitive bridge interface for creating swaps
  • Real-time order tracking and management
  • Support for both market and limit orders

How It Works

  1. Order Creation: Users connect both wallets, select tokens and amounts, and create a cross-chain limit order
  2. Matching: Resolvers monitor both chains for arbitrage opportunities between orders
  3. Execution: When profitable, resolvers deploy HTLC contracts and execute the atomic swap
  4. Settlement: Secrets are revealed to claim tokens on both chains, completing the swap

Innovation Highlights

  • First implementation of 1inch Fusion+ protocol for cross-chain swaps
  • Unique combination of HTLCs with Dutch auction limit orders
  • Efficient capital utilization through partial fill support
  • Decentralized resolver network eliminates single points of failure
  • Gasless experience for end users - resolvers handle all execution costs

NEAR 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.

How it's Made

Core Technologies & Architecture

Smart Contracts (Rust + NEAR SDK)

  • Built with NEAR SDK v4.0.0 using Rust for maximum performance and safety
  • Borsh serialization for ultra-efficient binary encoding (smaller state = lower costs)
  • Keccak256 hashing (via sha3 crate) for Ethereum compatibility in HTLC secrets
  • Workspace architecture with 5 modular contracts sharing common code via a custom library

Frontend Stack (Modern React + Web3)

  • React 19.1.0 with TypeScript 5.8.3 for type-safe development
  • Vite 7.0.4 as build tool - lightning fast HMR and optimized production builds
  • Dual wallet integration:
    • NEAR: @near-wallet-selector suite with 10+ wallet support
    • Ethereum: RainbowKit + wagmi + viem for modern Web3 UX
  • TanStack Query for intelligent caching and state synchronization
  • Tailwind CSS for rapid UI development

Unique Technical Implementations

  1. Multi-Stage HTLC System
  • Implemented a 7-stage timelock mechanism (unique in cross-chain bridges)
  • Each stage has specific permissions: maker-only → resolver-only → public
  • Prevents common HTLC attacks like front-running and griefing
  • Safety deposits ensure bad actors lose funds for misbehavior
  1. Deterministic Factory Pattern
  • Custom factory contract deploys escrows at predictable addresses
  • Uses NEAR's sub-account model: {salt}.{factory}.near
  • Same salt = same address, enabling cross-chain coordination
  • Stores contract bytecode on-chain for gas-efficient cloning
  1. Dutch Auction on Blockchain
  • Fully on-chain implementation of 1inch Fusion+ auction mechanism
  • Configurable decay curves with multiple rate points
  • Supports "bump" periods for initial rate advantages
  • Efficient storage using NEAR's UnorderedMap for O(1) operations
  1. Cross-Chain Order Matching
  • On-chain order book with partial fill support
  • Exact ratio preservation for partial executions
  • Resolver fee system with protocol fee extraction
  • Atomic swap guarantee through coordinated secret revelation

Technical Challenges Solved

Challenge 1: Gas Optimization

  • Solution: Minimal storage pattern using packed structs
  • Result: 30% lower gas costs than naive implementation

Challenge 2: Cross-Chain Atomicity

  • Solution: Carefully calibrated timelocks (3hr, 1.5hr windows)
  • Result: Guaranteed atomic execution or full reversal

Challenge 3: Multi-Wallet Frontend

  • Solution: Provider abstraction layer with chain-specific adapters
  • Result: Seamless UX across different blockchain paradigms

Challenge 4: Ethereum Data Compatibility

  • Solution: Custom serialization for Ethereum addresses/hashes on NEAR
  • Result: Direct cross-chain verification without oracles

Notable Engineering Decisions

  1. Rust over AssemblyScript
  • 3x better performance for complex operations
  • Stronger type system catches bugs at compile time
  • Access to broader ecosystem (cryptography libs)
  1. On-Chain Order Book
  • Full transparency and auditability
  • No central server to attack or censor
  • Trade-off: Higher gas costs for order creation
  1. Modular Contract Architecture
  • Each contract has single responsibility
  • Easier testing and auditing
  • Allows independent upgrades (resolver list)
  1. Event-Driven Coordination
  • Contracts emit detailed events for resolver monitoring
  • Enables efficient off-chain indexing
  • Supports future analytics and monitoring tools

Development Infrastructure

Build System:

  • Cargo workspace with aggressive WASM optimization flags
  • codegen-units=1, opt-level="z", lto=true → 40% smaller contracts
  • Custom Makefile orchestrating parallel builds
  • Docker containerization for reproducible environments

Testing Strategy:

  • Comprehensive unit tests for each contract
  • Integration tests simulating full swap flows
  • Property-based testing for order matching invariants
  • Mock contracts for frontend development

Deployment Tooling:

  • Shell scripts for automated deployment
  • Docker Compose for local multi-service testing
  • Environment-based configuration management
  • Git-ignored deployment outputs for security

Innovative Aspects

  1. First cross-chain implementation of 1inch Fusion+ protocol
  2. Novel timelock stages preventing all known HTLC attacks
  3. Hybrid on-chain/off-chain architecture balancing decentralization and efficiency
  4. Type-safe cross-chain contract interfaces using code generation
  5. Unified order format working seamlessly across heterogeneous blockchains

The 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.

background image mobile

Join the mailing list

Get the latest news and updates