Near·FusionSwap

    Hash time-locked contracts · 1inch Fusion+



    A cross-chain swap is two escrows that can only open with the same secret. Pick a direction and scroll: each step lights up on the chain where it happens.

    Live in the swap UI
    1. 01 · Polygon

      Order + source escrow

      The maker's Fusion+ order deploys a source escrow on Polygon holding WETH, locked to sha256(secret).

    2. 02 · NEAR

      HTLC created

      The resolver htlc.testnet creates a new HTLC on flexlock-1inch.testnet.

    3. 03 · NEAR

      Funded as destination

      The resolver deposits NEAR into the HTLC with is_destination = true.

    4. 04 · NEAR

      Secret revealed

      The maker reveals the secret and claims the NEAR from the HTLC.

    5. 05 · NEAR → Polygon

      Cross-chain claim

      The revealed secret is now public on NEAR, so the resolver uses it to claim WETH from the Polygon escrow.

      Polygon
      NEAR

    Why it can't half-happen

    01

    Hash secrets

    Both chains lock to the same sha256 hash. Revealing the preimage to claim on one chain publishes it for the other.

    02

    Time locks

    Every HTLC carries deadlines. If the secret never appears, the locked funds go back instead of getting stuck.

    03

    No counterparty risk

    Neither the maker nor the resolver can take funds without the secret, and nobody else ever custodies them.

    NEAR HTLC timelocks · from creation

    1. withdrawal

      +30 min · claim deadline: the secret must be revealed before this

    2. public_withdrawal

      +1 h · recorded in the HTLC, not yet enforced by the contract

    3. cancellation

      +1.5 h · after this the resolver can refund the expired HTLC

    4. public_cancellation

      +2 h · recorded in the HTLC, not yet enforced by the contract

    See the contracts behind each step.

    Contracts →