Submarine swaps are common use cases in a blockchain.
In Stacks, the LNSwap protocol provides submarine swaps between Stacks and Bitcoin, including interoperability with on-chain and Lightning Network.
For more details about this production running protocol in Stacks, please refer to LNSwap's GitHub and the learning guide.
The stxswap_v10.clar contract includes the following functionality.
lockStx
locks the STX for a swap in the contractclaimStx
claims the STX locked in a contractrefundStx
refunds the STX locked in a contract
To add a new contract, use Clarinet.
- You can manually test your your contracts in the Clarinet console.
- You can programmatically test your contracts with unit tests.