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.
- 01 · Polygon
Order + source escrow
The maker's Fusion+ order deploys a source escrow on Polygon holding WETH, locked to sha256(secret).
- 02 · NEAR
HTLC created
The resolver htlc.testnet creates a new HTLC on flexlock-1inch.testnet.
- 03 · NEAR
Funded as destination
The resolver deposits NEAR into the HTLC with is_destination = true.
- 04 · NEAR
Secret revealed
The maker reveals the secret and claims the NEAR from the HTLC.
- 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.
PolygonNEAR
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
withdrawal
+30 min · claim deadline: the secret must be revealed before this
public_withdrawal
+1 h · recorded in the HTLC, not yet enforced by the contract
cancellation
+1.5 h · after this the resolver can refund the expired HTLC
public_cancellation
+2 h · recorded in the HTLC, not yet enforced by the contract
See the contracts behind each step.
Contracts →