dpp/address_funds/fee_strategy/
mod.rs

1pub mod deduct_fee_from_inputs_and_outputs;
2
3pub use deduct_fee_from_inputs_and_outputs::FeeDeductionResult;
4
5use bincode::{Decode, Encode};
6#[cfg(feature = "serde-conversion")]
7use serde::{Deserialize, Serialize};
8
9#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq, Hash)]
10#[cfg_attr(
11    feature = "serde-conversion",
12    derive(Serialize, Deserialize),
13    serde(rename_all = "camelCase")
14)]
15pub enum AddressFundsFeeStrategyStep {
16    /// Deduct fee from a specific input address by index.
17    /// The input must have remaining balance after its contribution to outputs.
18    DeductFromInput(u16),
19    /// Reduce a specific output by the fee amount.
20    /// The output amount will be reduced to cover the fee.
21    ReduceOutput(u16),
22}
23
24impl Default for AddressFundsFeeStrategyStep {
25    fn default() -> Self {
26        AddressFundsFeeStrategyStep::DeductFromInput(0)
27    }
28}
29
30pub type AddressFundsFeeStrategy = Vec<AddressFundsFeeStrategyStep>;