Skip to main content

send_amount_affordable

Function send_amount_affordable 

Source
async fn send_amount_affordable<GrossUp, Quote, Fut>(
    amount: Amount,
    balance: Amount,
    gross_up: &GrossUp,
    fee_quote: &Quote,
) -> bool
where GrossUp: Fn(Amount) -> Amount, Quote: Fn(Amount) -> Fut, Fut: Future<Output = Result<FeeQuote>>,
Expand description

Whether sending amount is payable in full out of balance: the funded value gross_up(amount) plus its federation fee_quote must fit within the balance. A quote error (the balance cannot fund a value this large) counts as unaffordable, making this safe as the monotone predicate for max_affordable_send_amount.