xmr-btc-swap/swap/tests/happy_path.rs
Mohan 2ec6323c45
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>
2025-09-24 13:07:24 +02:00

25 lines
699 B
Rust

pub mod harness;
use harness::SlowCancelConfig;
use swap::asb::FixedRate;
use swap::protocol::{alice, bob};
use tokio::join;
#[tokio::test]
async fn happy_path() {
harness::setup_test(SlowCancelConfig, None, |mut ctx| async move {
let (bob_swap, _) = ctx.bob_swap().await;
let bob_swap = tokio::spawn(bob::run(bob_swap));
let alice_swap = ctx.alice_next_swap().await;
let alice_swap = tokio::spawn(alice::run(alice_swap, FixedRate::default()));
let (bob_state, alice_state) = join!(bob_swap, alice_swap);
ctx.assert_alice_redeemed(alice_state??).await;
ctx.assert_bob_redeemed(bob_state??).await;
Ok(())
})
.await;
}