feat(asb): Disabled-by-default developer tip (#566)

* wip

* filter out destinations with zero amount

* add changelog entry

* do not use subtract_fee_from_outputs for multi lock tx

* make developer tip address configurable

* create developer_tip_monero_wallet in integration test

* add happy_path_alice_developer_tip integration test

* run happy_path_alice_developer_tip integration test in ci

* make stub tests

* document `developer_tip` and add log at startup

* take tip consideration when crafting quote

* remove double g++

* fix bash

* full stack trace in logs

* add DEFAULT_DEVELOPER_TIP_ADDRESS_STAGENET

* fix issue where --testnet could not be detected

* triple bitcoin testnet timelocks

* assert hardcoded developer tip address is on the correct network

* fix: interpret developer_tip = 0 as no tip in log at startup

* change developer_tip type to non-option, clamp tips below 100_00 piconero to 0

* create dedidcated TipConfig struct to replace (Decimal, monero::Address)

* small refactorings

* move tip config init out of of function call params

* refactoring

* unit tests wrong arguments passed in

* document `developer_tip` allows configuring your maker to donate a small part of swaps to funding further development of the project. This is disabled by default. You can manually enable it if you choose to do so. Set it to a number between 0 and 1. Setting it to 0.02 will donate 2% of each swap to the donation address of the project. The tip is sent by adding an additional output the Monero lock transaction of a swap. This means this will not impact document `maker.developer_tip` in docs/pages/becoming_a_maker/overview.mdx

* do not panic if cxx_addrs / cxx_amounts is null

* formatting, full error stack trace in swap/src/asb/event_loop.rs when we cannot construct a quote

* increase MIN_USEFUL_TIP_AMOUNT_PICONERO to 30m piconero (usd), correct params in unit tests

* prompt for developer_tip in orchestrator and asb wizard

* just fmt

* fmt

* address comments

* fmt

* spelling mistakes

---------

Co-authored-by: binarybaron <binarybaron@mail.mail>
This commit is contained in:
Mohan 2025-09-24 07:07:24 -04:00 committed by GitHub
parent 5f2c737a85
commit 2ec6323c45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 690 additions and 148 deletions

View file

@ -120,6 +120,7 @@ max_buy_btc = 0.0001
ask_spread = 0.02
price_ticker_ws_url = "wss://ws.kraken.com"
external_bitcoin_address = "bc1..."
developer_tip = 0.02
```
The minimum and maximum amount as well as a spread, that is added on top of the price fetched from a central exchange, can be configured.
@ -127,6 +128,8 @@ The minimum and maximum amount as well as a spread, that is added on top of the
`external_bitcoin_address` allows to specify the Bitcoin address that the ASB will use to redeem or punish swaps.
If the option is not set, a new address from the internal wallet is used for every swap.
`developer_tip` allows configuring your maker to donate a small part of swaps to funding further development of the project. This is disabled by default. You can manually enable it if you choose to do so. Set it to a number between 0 and 1. Setting it to 0.02 will donate 2% of each swap to the donation address of the project. The tip is sent by adding an additional output to the Monero lock transaction of a swap. This means this will not impact the availability of your UTXOs (unlocked funds) as it does not require an additonal transaction.
In order to be able to trade, the ASB must define a price to be able to agree on the amounts to be swapped with a CLI.
The `XMR<>BTC` price is currently determined by the price from the central exchange Kraken.
Upon startup the ASB connects to the Kraken price websocket and listens on the stream for price updates.