dpp/tokens/token_payment_info/v0/
v0_accessors.rs

1use crate::balances::credits::TokenAmount;
2use crate::data_contract::TokenContractPosition;
3use crate::tokens::gas_fees_paid_by::GasFeesPaidBy;
4use platform_value::Identifier;
5
6/// Trait providing accessor and mutator methods for `TokenPaymentInfoV0`.
7pub trait TokenPaymentInfoAccessorsV0 {
8    /// Returns a cloned copy of the `payment_token_contract_id` field.
9    fn payment_token_contract_id(&self) -> Option<Identifier>;
10
11    /// Returns a reference to the `payment_token_contract_id` field.
12    ///
13    /// This method avoids copying and can be used when only read access is needed.
14    fn payment_token_contract_id_ref(&self) -> &Option<Identifier>;
15
16    /// Returns the `token_contract_position` field.
17    fn token_contract_position(&self) -> TokenContractPosition;
18
19    /// Returns a copy of the `minimum_token_cost` field.
20    fn minimum_token_cost(&self) -> Option<TokenAmount>;
21
22    /// Returns a copy of the `maximum_token_cost` field.
23    fn maximum_token_cost(&self) -> Option<TokenAmount>;
24
25    /// Sets the `payment_token_contract_id` field to the given value.
26    fn set_payment_token_contract_id(&mut self, id: Option<Identifier>);
27
28    /// Sets the `token_contract_position` field to the given value.
29    fn set_token_contract_position(&mut self, position: TokenContractPosition);
30
31    /// Sets the `minimum_token_cost` field to the given value.
32    fn set_minimum_token_cost(&mut self, cost: Option<TokenAmount>);
33
34    /// Sets the `maximum_token_cost` field to the given value.
35    fn set_maximum_token_cost(&mut self, cost: Option<TokenAmount>);
36
37    /// Returns the `gas_fees_paid_by` strategy.
38    fn gas_fees_paid_by(&self) -> GasFeesPaidBy;
39
40    /// Sets the `gas_fees_paid_by` strategy.
41    fn set_gas_fees_paid_by(&mut self, payer: GasFeesPaidBy);
42}