Skip to Content
Dive DeeperIReactorFeeManager

IReactorFeeManager Interface

Overview

The IReactorFeeManager interface defines a set of functions to manage and retrieve fee-related configurations for Reactor messages. This includes managing payment tokens, setting per-caller and per-byte fees, and calculating total fees for a given message payload and destination chain.


Interface

interface IReactorFeeManager { function callerFees(string calldata _destinationChainName, address _caller, address _paymentToken) external view returns (uint256); function disablePaymentToken(address _paymentToken) external; function enablePaymentToken(address _paymentToken) external; function feesPerByte(string calldata _destinationChainName, address _paymentToken) external view returns (uint256); function getSendFee(string calldata _destinationChainName, address _caller, address _paymentToken, uint256 _payloadSize) external view returns(uint256); function paymentTokens(address _paymentToken) external view returns (bool); function sendFees(string calldata _destinationChainName, address _paymentToken) external view returns (uint256); function setCallerFees(string calldata _destinationChainName, address _caller, address[] calldata _paymentTokens, uint256[] calldata _fees) external; function setFeesPerByte(string calldata _destinationChainName, address[] calldata _paymentTokens, uint256[] calldata _fees) external; function setSendFees(string calldata _destinationChainName, address[] calldata _paymentTokens, uint256[] calldata _fees) external; }

Function Details

callerFees

function callerFees( string calldata _destinationChainName, address _caller, address _paymentToken ) external view returns (uint256);

Retrieves the fixed fee set for a specific caller for a given payment token and destination chain.

  • _destinationChainName: Name of the target chain.
  • _caller: Address of the caller.
  • _paymentToken: Address of the payment token.

disablePaymentToken

function disablePaymentToken(address _paymentToken) external;

Disables a specific payment token, making it invalid for fee payment.

  • _paymentToken: Address of the token to disable.

enablePaymentToken

function enablePaymentToken(address _paymentToken) external;

Enables a specific token for use in fee payments.

  • _paymentToken: Address of the token to enable.

feesPerByte

function feesPerByte( string calldata _destinationChainName, address _paymentToken ) external view returns (uint256);

Gets the fee per byte of payload data for a specific token and destination chain.

  • _destinationChainName: Target chain’s name.
  • _paymentToken: Address of the token used for payment.

getSendFee

function getSendFee( string calldata _destinationChainName, address _caller, address _paymentToken, uint256 _payloadSize ) external view returns (uint256);

Calculates the total fee to send a message based on the caller, payment token, destination, and payload size.

  • _destinationChainName: Target chain.
  • _caller: Sender’s address.
  • _paymentToken: Token used for payment.
  • _payloadSize: Size of the payload in bytes.

paymentTokens

function paymentTokens(address _paymentToken) external view returns (bool);

Checks whether a token is currently enabled for payments.

  • _paymentToken: Address of the token.

sendFees

function sendFees( string calldata _destinationChainName, address _paymentToken ) external view returns (uint256);

Returns the base fee for sending messages to a specific destination using a given token.

  • _destinationChainName: Name of the destination chain.
  • _paymentToken: Token used for the fee.

setCallerFees

function setCallerFees( string calldata _destinationChainName, address _caller, address[] calldata _paymentTokens, uint256[] calldata _fees ) external;

Sets a fixed fee for a specific caller, token, and destination chain.

  • _destinationChainName: Chain to which the fees applies.
  • _caller: Address for which the fee is configured.
  • _paymentTokens: List of token addresses.
  • _fees: List of fee values to assign.

setFeesPerByte

function setFeesPerByte( string calldata _destinationChainName, address[] calldata _paymentTokens, uint256[] calldata _fees ) external;

Configures the per-byte fee for sending payloads to a specific chain with a given token.

  • _destinationChainName: Chain to which the fees applies.
  • _paymentTokens: List of token addresses.
  • _feePerBytes: List of fee per byte values to assign.

setSendFees

function setSendFees( string calldata _destinationChainName, address[] calldata _paymentTokens, uint256[] calldata _fees ) external;

Sets the base send fee for a specific token and destination chain.

  • _destinationChainName: Chain to which the fees applies.
  • _paymentTokens: List of token addresses.
  • _fees: List of fee values to assign.

Usage Notes

  • This interface is typically implemented by a contract that manages the fee logic for a cross-chain messaging system.
  • Functions like set* are likely to be restricted to only the contract owner or authorized administrators.
  • Always validate that the paymentToken is enabled before proceeding with fee-related calculations.
  • When setting fees, make sure the number of token addresses equal the number of fees and that the position of the token/fee pair are the same (i.e. the fee in the first position of _fees is the fee for the token in the first position of _paymentTokens).

Last updated on