ERC20 → BTC Swap Flow
Step 1: User signs intent to swap ERC20 → cbBTC via DEX
The user signs an intent to swap their ERC20 tokens to cbBTC through a DEX.
Step 2: Limit price is hit, ERC20 swapped and cbBTC sent to TEE
Once the limit price is reached, the ERC20 is swapped to cbBTC and sent to the TEE to be swapped for BTC.
Step 3: BTC sent to user, cbBTC unlocked to MM
BTC is sent to the user. After 2 Bitcoin confirmation blocks, the cbBTC is unlocked to the market maker.
BTC → ERC20 Swap Flow
Step 1: User sends BTC to TEE
The user sends BTC to the TEE. Upon 2 Bitcoin confirmation blocks, it is swapped into cbBTC.
Step 2: Limit price is hit, TEE swaps cbBTC → ERC20
Once the limit price is reached, the TEE swaps cbBTC to the target ERC20 via a DEX and sends it to the user.
Limit Order Nuances
How long until orders are active?
- ERC20 → BTC orders are active as soon as the signed intent reaches solver broadcasting service (currently CoWSwap, a few seconds)
- BTC → ERC20 orders are active after 2 Bitcoin confirmation blocks (~20-40 minutes)
Cost of creating and cancelling orders
Since orders are created by on-chain transfers, they are not free to create and cancel. Users pre-pay the starting chain’s network fee so funds can be sent back to them in case of cancellation.How to cancel an order?
Orders are cancelled with the EVM wallet associated with the order (even if this is the recipient address).- Call
/order/<id>/cancel/prepareto get EIP-712 data to sign - Call
/order/<id>/cancelwith the signed data