{"id":"ERC-2266","name":"Atomic Swap Contract","status":"Last Call","chain":"both","category":{"id":"defi","name":"DeFi Patterns","description":"Vaults, bonds, and financial primitives"},"journeyStages":[{"id":"management","name":"Asset Management","description":"Managing assets over time"}],"uxImpact":"ERC-2266 defines an HTLC-based American Call Option with initiator and participant assets, a premium, separate timelocks, and state- and caller-dependent redeem/refund calls. Model the option lifecycle and liveness risk instead of promising one universal atomic swap or instant refund.","officialUrl":"https://ercs.ethereum.org/ERCS/erc-2266","lastReviewed":"2026-09-18","lastUpdated":"2026-09-18","hasDetailedContent":true,"content":{"id":"ERC-2266","summary":"ERC-2266 defines an HTLC-based American Call Option for peer-to-peer token exchanges. It coordinates initiator and participant assets, a premium, separate timelocks, and redeem/refund calls; settlement and refund availability depend on the option state and the relevant deadlines.","applicability":{"whenToUse":["Your product addresses: peer-to-peer trades required trust.","Your product addresses: dEXs charge fees and require liquidity.","The flow should deliver: an explicit HTLC option lifecycle with distinct asset and premium deadlines.","You are designing a create swap offer experience with visible states and recovery paths."],"whenToAvoid":["The flow has no counterparty, premium, secret, or timelock state.","The product only performs an immediate same-party swap without HTLC legs.","The deployed implementation does not expose the required initiate, participate, redeem, or refund actions.","No token balances, swaps, lending, or yield flows appear in the product."]},"designerTakeaways":["You can explain atomic redemption while showing separate option legs, deadlines, and refund conditions.","You can design UI that delivers a direct counterparty swap while disclosing premium, timelock, and liveness risk.","You can show the contract-enforced option conditions while disclosing liveness and deadline risk."],"problemsSolved":[{"problem":"Peer-to-peer trades required trust","oldWay":"One party sends first, hopes other party sends back","newWay":"HTLC redemption can settle the relevant leg while the option keeps separate premium and asset states","impact":"critical"},{"problem":"DEXs charge fees and require liquidity","oldWay":"Pay 0.3% fee to Uniswap, plus slippage on large trades","newWay":"Direct swap with counterparty, no intermediary fees","impact":"high"},{"problem":"Escrow services needed for large trades","oldWay":"Trust third party to hold funds, pay escrow fees","newWay":"Smart contract enforces the swap trustlessly","impact":"high"},{"problem":"No standard for OTC trades","oldWay":"Each platform had custom swap mechanics","newWay":"Standard interface for all atomic swap implementations","impact":"medium"}],"uxPatterns":[{"name":"Create Swap Offer","description":"Initiate an atomic swap with another party","userFlow":["User specifies tokens to swap","Enters counterparty address","Sets time lock duration","Creates and funds the swap","Shares swap ID with counterparty"]},{"name":"Accept Swap","description":"Counterparty accepts and completes the swap","userFlow":["Counterparty receives swap notification","Reviews offer details","Sees funds are locked","Accepts swap, sending their tokens","Show whether the participant has joined and which redeem/refund deadline applies"]},{"name":"Swap Status Tracker","description":"Track swap progress through stages","userFlow":["User checks swap status","Progress shown visually","Initiator and participant asset/premium states displayed separately","Time remaining shown","Show a refund option only when the relevant timelock and state permit it"]},{"name":"Expired Swap Refund","description":"Claim refund when swap expires","userFlow":["Time lock expires without completion","User notified of expiry","A refund becomes claimable only after the relevant timelock and state checks","Show the eligible refund action and its required caller","Confirm funds returned only after the refund transaction settles"]}],"uiComponents":[{"name":"SwapCreator","description":"Form to create new atomic swap","states":["configuring","confirming","creating","created"],"props":["sendToken","receiveToken","counterparty","timelock","onCreate"]},{"name":"SwapAcceptor","description":"UI to review and accept incoming swap","states":["reviewing","accepting","completed"],"props":["swapDetails","onAccept","onDecline"]},{"name":"SwapStatusTracker","description":"Shows progress of active swap","states":["pending","funded","accepted","completed","expired"],"props":["swapId","stages[]","timeRemaining","onRefund"]},{"name":"TimeLockIndicator","description":"Shows time remaining for swap","states":["active","warning","expired"],"props":["expiryTime","warningThreshold"]}],"antiPatterns":[{"pattern":"Not explaining atomic swap protection","why":"Users don't understand why it's safe","instead":"Explain which HTLC leg is atomic and show the separate premium, asset, redeem, and refund states","severity":"high"},{"pattern":"Hiding time lock details","why":"User doesn't know when funds could be stuck","instead":"Prominent countdown and clear expiry explanation","severity":"high"},{"pattern":"Complex refund process","why":"User's funds stuck if they can't figure out refund","instead":"Show the eligible refund call, timelock, and caller conditions with clear instructions","severity":"high"},{"pattern":"No notification when counterparty acts","why":"User misses window to complete","instead":"Push notification or email when swap is funded by counterparty","severity":"medium"}],"relatedStandards":[{"id":"ERC-20","relationship":"Atomic swaps typically exchange ERC-20 tokens"},{"id":"ERC-721","relationship":"Can also swap NFTs atomically"},{"id":"ERC-6105","relationship":"ERC-6105 provides another approach to peer-to-peer NFT trading"},{"id":"ERC-7683","relationship":"Cross-chain intents offer alternative to atomic swaps for bridging"}],"lastUpdated":"2026-09-18","sources":[{"label":"ERC-2266 official specification","url":"https://ercs.ethereum.org/ERCS/erc-2266","type":"official-spec"}],"lastReviewed":"2026-09-18"},"sources":[{"label":"Official specification","url":"https://ercs.ethereum.org/ERCS/erc-2266","type":"official-spec"},{"label":"Discussion","url":"https://ethereum-magicians.org/search?q=ERC-2266","type":"discussion"},{"label":"ERC-2266 official specification","url":"https://ercs.ethereum.org/ERCS/erc-2266","type":"official-spec"}],"urls":{"canonical":"https://www.eipsfordesigners.com/standards/ERC-2266","markdown":"https://www.eipsfordesigners.com/standards/ERC-2266/content.md","agent":"https://www.eipsfordesigners.com/standards/ERC-2266/agent.md","api":"https://www.eipsfordesigners.com/api/standards/ERC-2266","official":"https://ercs.ethereum.org/ERCS/erc-2266","discussion":"https://ethereum-magicians.org/search?q=ERC-2266"},"freshness":{"lastReviewed":"2026-09-18","lastUpdated":"2026-09-18"}}