captures the cross-chain capability, atomic swap tech, real-time matching, and 1inch integration
Core Concept: Atomic Cross-Chain Swaps This project implements atomic swaps - a cryptographic protocol that allows two parties to exchange tokens across different blockchains without needing a trusted intermediary. The "atomic" aspect means the swap either completes fully for both parties or fails completely, preventing partial execution. Technical Architecture
Ethereum Side: Smart contracts written in Solidity that handle EVM-compatible tokens Aptos Side: Smart contracts written in Move language that handle Aptos-native tokens Both chains implement identical atomic swap logic with blockchain-specific optimizations
Locks the maker's tokens on the source chain Releases tokens only when the correct secret is revealed Implements timelock for automatic refunds if swap fails
Destination Escrow (EscrowDst):
Holds tokens that the maker will receive on destination chain Uses the same secret hash for verification Allows withdrawal once secret is revealed
Uses cryptographic hash functions (like SHA-256) to create a "lock" Only someone with the original secret can "unlock" the funds Both chains use the same secret hash, ensuring coordination
Timelock:
Implements expiration timestamps Prevents funds from being locked forever Allows automatic refunds if the swap doesn't complete in time
How It Works: Step-by-Step Flow Phase 1: Order Creation & Announcement typescript// User creates an order specifying:
Source Escrow: User's tokens are locked on source chain (e.g., Ethereum) Destination Escrow: Resolver deposits matching tokens on destination chain (e.g., Aptos) Both escrows use the same secret hash as the unlock condition
Phase 3: Secret Revelation & Completion
User reveals the secret to claim tokens from destination escrow This publicly exposes the secret on the destination blockchain Resolver uses the revealed secret to claim tokens from source escrow Swap completes atomically - both parties get their tokens
Phase 4: Safety Mechanisms
If user doesn't reveal secret before timelock expires:
User gets refund from source escrow Resolver gets refund from destination escrow
No party can steal funds from the other
Key Components
Facilitates real-time communication between chains Handles order matching and status updates Manages the coordination between Ethereum and Aptos sides
Built as an extension to 1inch's existing Fusion+ infrastructure Leverages 1inch's liquidity and routing capabilities Uses 1inch's proven security and optimization frameworks
Supports partial fills and multiple resolver scenario Uses Merkle trees for efficient secret management Enables more complex swap scenarios
Security Features Trustless Design
No central authority controls the swaps Cryptographic guarantees prevent fund theft Automatic refund mechanisms protect all parties
Robust Validation
Immutable contract validation ensures correct escrow deployment Type safety through TypeScript and Move's type system Comprehensive error handling for edge cases
Safety Deposits moveconst SAFETY_DEPOSIT_AMOUNT: u64 = 100000; // 0.001 APT
Resolvers must deposit safety amounts to participate Prevents spam and ensures resolver commitment Economic incentives align all parties' interests
Real-World Usage This enables scenarios like:
DeFi Arbitrage: Traders can exploit price differences between Ethereum and Aptos DEXs Portfolio Rebalancing: Users can shift assets between ecosystems seamlessly Cross-Chain Liquidity: Provides liquidity bridges between isolated blockchain ecosystems Institutional Trading: Large trades across chains without centralized exchange risks
Why This Matters This project solves a fundamental problem in the multi-chain world: secure, trustless cross-chain value transfer. Unlike bridges that often have central points of failure or custody risks, atomic swaps provide mathematical guarantees that funds cannot be stolen, only delayed or refunded.
Solidity 0.8.23 - Smart contracts with advanced compiler optimizations OpenZeppelin - Battle-tested security primitives and utilities 1inch Limit Order Protocol - Leveraging existing DEX infrastructure Create2 Deterministic Deployment - Predictable escrow addresses across chains
Aptos Side:
Move Language - Type-safe smart contracts with resource ownership model Aptos Framework - Native coin handling and account management Generic Type System - Enables swaps for any coin type <SrcCoinType>
Searched project for “technical implementation smart contracts Solidity Move blockchain technologies” 8 results
Now I have much more detailed technical information about the project. 1s
Searched project for “WebSocket API implementation Move language Aptos deployment testing” 4 results
Synthesized project details for comprehensive technical explanation. 1s
Based on the codebase analysis, here's the detailed technical breakdown of how this Ethereum ↔ Aptos Bridge project was built:
Technology Stack & Architecture
Solidity 0.8.23 - Smart contracts with advanced compiler optimizations OpenZeppelin - Battle-tested security primitives and utilities 1inch Limit Order Protocol - Leveraging existing DEX infrastructure Create2 Deterministic Deployment - Predictable escrow addresses across chains Aptos Side:
Move Language - Type-safe smart contracts with resource ownership model Aptos Framework - Native coin handling and account management Generic Type System - Enables swaps for any coin type <SrcCoinType> 2. Development & Testing Infrastructure Smart Contract Development:
solidity // Uses Foundry/Forge for testing and deployment contract EscrowFactory is BaseEscrowFactory { constructor( address limitOrderProtocol, IERC20 feeToken, IERC20 accessToken, address owner, uint32 rescueDelaySrc, uint32 rescueDelayDst ) } Testing Framework:
Foundry/Forge for Ethereum contract testing Aptos Move Testing with #[test_only] modules Integration tests with mock resolvers and real transaction flows WebSocket testing using Node.js with ws library 3. Novel Proxy-Based Escrow System Deterministic Address Generation:
solidity // Clever use of Create2 for predictable addresses function computeProxyBytecodeHash(address implementation) internal pure returns (bytes32) { assembly ("memory-safe") { mstore(0x20, 0x5af43d82803e903d91602b57fd5bf3) mstore(0x11, implementation) mstore(0x00, or(shr(0x88, implementation), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) bytecodeHash := keccak256(0x09, 0x37) } } This is particularly hacky but brilliant - they're manually computing proxy bytecode hashes in assembly to enable deterministic escrow deployment across chains.
Particularly Noteworthy "Hacky" Implementations
Atomic Safety Deposit Mechanism solidity // Must send safety deposit to computed address BEFORE escrow exists (bool success,) = address(computed).call{ value: immutablesMem.safetyDeposit }(""); if (!success) revert IBaseEscrow.NativeTokenSendingFailure(); Why this is clever: They send ETH to an address that doesn't exist yet, knowing the escrow will be deployed to that exact address. This prevents race conditions and ensures atomic escrow funding.
Multi-Secret Merkle Tree System
typescript
// Support for partial fills using Merkle proofs
const hashLock = secrets.length === 1
? HashLock.forSingleFill(secrets[0])
: HashLock.forMultipleFills(HashLock.getMerkleLeaves(secrets))
Why this is sophisticated: Instead of simple single-secret swaps, they built a system supporting multiple secrets for partial fills, enabling market maker scenarios.
Cross-Chain Type Safety move // Move's type system prevents runtime errors public entry fun announce_order<SrcCoinType>( maker: &signer, src_amount: u64, min_dst_amount: u64, expires_in_secs: u64, secret_hash: vector<u8> ) Move's resource model ensures coins can't be accidentally duplicated or lost - a significant advantage over Solidity's more permissive model.
Real-Time WebSocket Coordination typescript // WebSocket handles cross-chain state synchronization wsSdk.order.onOrderSecretShared((data) => { // Automatically triggers completion on both chains resArray.push(data) }) Why this is necessary: Cross-chain swaps need real-time coordination. The WebSocket layer handles order matching, secret revelation events, and timeout management across both blockchains.
Partner Technology Integration 1inch Fusion+ Integration Benefits gained:
Existing liquidity - Tap into 1inch's DEX aggregation network Proven security - Leverage battle-tested order book infrastructure Gas optimization - Use 1inch's gas-efficient routing Resolver network - Access to professional market makers
Deployment & Testing Strategy Testnet Implementation
Ethereum Sepolia for EVM testing Aptos Testnet for Move contract testing Cross-chain integration tests with real secret revelation flows
Most Technically Impressive Aspects
Assembly-optimized proxy deployment - Manual bytecode construction for gas efficiency Cross-chain type safety - Move's resource model prevents entire classes of bugs Deterministic addressing - Same escrow addresses computable on both chains Real-time cross-chain coordination - WebSocket layer handling complex state synchronization