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.
lockStxlocks the STX for a swap in the contractclaimStxclaims the STX locked in a contractrefundStxrefunds 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.