Comment on page
To initiate a cross-chain exchange, the user sends a request to exchange their teleBTC for another token on the Polygon network. Within the request, the user specifies various data including the chain ID, app ID, recipient address, Teleporter fee, exchange token address, minimum expected amount, and more. Once the request is finalized on the Bitcoin network, a Teleporter collects the request and submits it to the TeleSwap contract. The contract proceeds with executing the request after verifying its inclusion on the Bitcoin network. The execution of the request involves two steps:
- 1.Upon finalizing the request on Bitcoin, teleBTC is minted on Polygon as per the specified request.
- 2.The minted teleBTC tokens are then exchanged using an existing DEX, which is determined by the user through the app ID setting. The exchange process ensures that the teleBTC tokens are converted into the desired token as specified by the user. Finally, the exchanged tokens are sent to the predetermined recipient address.
The minting process in the cross-chain exchange is similar to that of a normal cross-chain transfer. In the second part, the TeleSwap contract leverages the registered DEXs to facilitate the token exchange. However, if the exchange process encounters any issues such as price volatility or insufficient liquidity, and the exchange is unsuccessful, the minted tokens will be directly sent to the recipient's address. This ensures that users' assets, which were initially locked on the source chain, do not get stuck within the TeleSwap system.