blink
blink copied to clipboard
feat: loopout automation
This PR adds the ability to do loop outs.
New Features:
- loopd grpc service
- fully testable regtest environment for swaps (loopserver, loopd)
- trigger.ts server to listen for swap events
- on success records swap fees to the ledger (service fee, miner fee, routing fee)
- cron.ts server to run swap outs on an interval
Quickstart - To test swap out locally in your regtest env
# 1. Start the loop server
make start-loopd
# 2. Monitor loop outs
loopd1_id=$(docker ps -q -f name="loopd1-1")
docker exec -it $loopd1_id loop -n regtest monitor
# 3. Loop out integration test (open a new terminal)
TEST="swap-out" make integration
# 4. Mine a block (or a few) to finish the loop out
make mine-block
make mine-block
make mine-block
# 5. Successful result should look like this: LOOP_OUT INITIATED => LOOP_OUT PREIMAGE_REVEALED => LOOP_OUT SUCCESS
Extra documentation in swap.md
@ntheile a key part that you'll need to add is the routing/loop server fees. this is similar to what we're doing for the miner fees in the rebalance function
because the money on fees is spent (get out of the instance), and we use double entry book-keeping, we want to make sure the liabilities (money owe to users) match the assets/utxo, and loop out means there is less assets overall and this should be accounted for
@ntheile rebase needed
️✅ There are no secrets present in this pull request anymore.
If these secrets were true positive and are still valid, we highly recommend you to revoke them. Once a secret has been leaked into a git repository, you should consider it compromised, even if it was deleted immediately. Find here more information about risks.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Our GitHub checks need improvements? Share your feedbacks!