aztec_fee/
fee_payment_method.rs

1use async_trait::async_trait;
2use aztec_core::tx::ExecutionPayload;
3use aztec_core::types::AztecAddress;
4use aztec_core::Error;
5
6/// Trait that all fee payment strategies implement.
7///
8/// Each implementation produces an [`ExecutionPayload`] containing the
9/// function calls needed to set up fee payment. This payload is merged
10/// with the user's transaction payload before submission.
11#[async_trait]
12pub trait FeePaymentMethod: Send + Sync {
13    /// Returns the address of the asset used for fee payment.
14    /// For fee juice methods, this is the FeeJuice protocol contract address.
15    async fn get_asset(&self) -> Result<AztecAddress, Error>;
16
17    /// Returns the address of the entity paying the fee.
18    async fn get_fee_payer(&self) -> Result<AztecAddress, Error>;
19
20    /// Builds an [`ExecutionPayload`] containing the function calls and
21    /// auth witnesses needed to pay the transaction fee.
22    async fn get_fee_execution_payload(&self) -> Result<ExecutionPayload, Error>;
23}