https://github.com/hirosystems/platform-template-lightning-swaps
https://github.com/hirosystems/platform-template-lightning-swaps
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hirosystems/platform-template-lightning-swaps
- Owner: hirosystems
- License: mit
- Created: 2025-01-22T19:31:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-09T14:52:25.000Z (about 1 year ago)
- Last Synced: 2025-06-26T11:56:55.365Z (about 1 year ago)
- Language: TypeScript
- Size: 43 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lightning Swaps
Submarine swaps are common use cases in a blockchain.
In Stacks, the [LNSwap](https://www.lnswap.org/) protocol provides submarine swaps between Stacks and Bitcoin, including interoperability with on-chain and [Lightning Network](https://lightning.network/).
## Know your Contract
For more details about this production running protocol in Stacks, please refer to [LNSwap's GitHub](https://github.com/LNSwap/lnstxbridge) and the [learning guide](https://www.lnswap.org/learn/how-lnswap-bitcoin-stacks-swaps-work).
The [stxswap_v10.clar](/examples/lightning-swaps/contracts/stxswap_v10.clar) contract includes the following functionality.
+ `lockStx` locks the STX for a swap in the contract
+ `claimStx` claims the STX locked in a contract
+ `refundStx` refunds the STX locked in a contract
To add a new contract, use [Clarinet](https://docs.hiro.so/stacks/clarinet).
## Test your Contract
+ You can manually test your your contracts in the [Clarinet console](https://docs.hiro.so/clarinet/how-to-guides/how-to-test-contract#load-contracts-in-a-console).
+ You can programmatically test your contracts with [unit tests](https://docs.hiro.so/clarinet/how-to-guides/how-to-test-contract).