Comment on page
Locker is a decentralized custodian in TeleSwap that assists users with transferring or exchanging their assets across chains. When a user wants to perform a cross-chain settlement, they send their BTC to a Locker on Bitcoin and then provide proof of locking on Polygon to complete the settlement. Lockers ensure that every teleBTC on Polygon is backed by an equivalent amount of native BTC.
Since Bitcoin is a non-programmable chain, Lockers are implemented as multisig wallets. All activities of the wallet are monitored by the smart contract on Polygon to ensure that the TeleSwap protocol is trustless.
A node can become a Locker in the TeleSwap system by locking a certain amount of bond. This bond serves as a security guarantee, meaning that if the Locker acts maliciously, their bond will be slashed. The wallet address of the Locker on Bitcoin is recorded in the TeleSwap smart contract, which users can use to mint teleBTC.
Users can move their BTC from Bitcoin to Polygon by sending their assets to the Locker's wallet. Once the assets are sent, Teleporters provide proof of locking assets to the TeleSwap contract. The TeleSwap contract then uses the TeleportDAO bridge to verify the correctness of the proof. If the proof is valid, the TeleSwap contract mints teleBTC for the user.
Users can redeem their native BTC by burning teleBTC on Polygon. The TeleSwap contract records users' burn requests and gives a limited time to the Locker to send the native BTC to the user. Once the Locker sends the native assets, it needs to provide proof to the TeleSwap contract to confirm the transaction. If the Locker fails to provide proof within the specified time, its bond will be slashed as a penalty.
Lockers are not allowed to move BTCs that have been sent to their wallet unless a user makes a burn request. This ensures that every teleBTC has equally backed BTC, so the price of teleBTC is pegged to that of BTC. If a Locker attempts to steal BTC, the Locker's bond will be slashed. In general, a Locker's bond is slashed in two cases:
- Lazy Locker: If the Locker fails to execute the user's burn request before the determined deadline, a slasher calls the TeleSwap contract to slash the Locker. In this case, part of the Locker's bond with a value equal to the user's burnt teleBTC is sent to the user, and a percentage of that value is also sent to the slasher as a reward.
- Thief Locker: In case the Locker steals BTC from the wallet, a slasher can call the TeleSwap contract to report the incident. The slasher provides the transaction details where the Locker stole native BTC, and the TeleSwap contract verifies that the transaction does not correspond to any valid burn requests. The stolen amount is then calculated, and a portion of the Locker's bond is slashed and put up for sale. The objective of this sale is to raise an amount of teleBTC equal to the stolen BTC. Anyone can participate and purchase the bond at a discount by paying in teleBTC. The collected teleBTCs are then burnt by the TeleSwap contract to ensure that every teleBTC is equally backed by BTC.
In summary, Lockers play a crucial role in ensuring the safety of users' assets and timely response to their requests. The two mechanisms mentioned above are put in place to ensure that Lockers behave appropriately, thereby making the TeleSwap protocol trustless.
Lockers' bonds play a crucial role in incentivizing responsible behaviour. If the value of the bond falls below the amount of BTC held in the Locker's wallet, the Locker has the incentive to steal all the BTCs. To prevent this, TeleSwap has implemented a liquidation mechanism that ensures Locker's bonds always exceed the value held in the wallet.
If the value of a Locker's bond falls below a certain threshold relative to the wallet balance, the liquidation mechanism is triggered. Any user can buy the Locker's bond using teleBTC at a discounted price. The collected teleBTC is then burned in the system, and the Locker is allowed to move an amount of BTC from the wallet equal to the value of the burned teleBTC.
Lockers are motivated to contribute to the TeleSwap protocol by earning fees for facilitating cross-chain settlements. Whenever a mint or burn request is processed, Lockers receive a percentage of the total minted or burnt amount as a fee. The value of a Locker's bond determines its capacity to mint teleBTC, so Lockers can increase their income by locking more bonds in the system and minting more teleBTC.