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.


Interface

interface IReactorFeeManager { function actionFeeDiscounts(string calldata _action, address _paymentToken) external view returns (uint256); function actionFees(string calldata _destinationName, string calldata _action, address _paymentToken) external view returns (uint256); function callerFeeDiscounts(address _caller, address _paymentToken) external view returns (uint256); function callerFees(string calldata _destinationName, address _caller, address _paymentToken) external view returns (uint256); function destinationFeeDiscounts(string calldata _destinationName, address _paymentToken) external view returns (uint256); function disablePaymentToken(address _paymentToken) external; function enablePaymentToken(address _paymentToken) external; function feeDiscounts(address _paymentToken) external view returns (uint256); function feesPerByte(string calldata _destinationName, address _paymentToken) external view returns (uint256); function getSendFee(string calldata _destinationName, string calldata _action, address _caller, address _paymentToken, uint256 _payloadSize) external view returns(uint256); function maxPayloadSize() external view returns (uint256); function paymentTokens(address _paymentToken) external view returns (bool); function sendFees(string calldata _destinationName, address _paymentToken) external view returns (uint256); function setActionFeeDiscounts(string[] calldata _actions, address[] calldata _paymentTokens, uint256[] calldata _discounts) external; function setActionFees(string[] calldata _destinationNames, string[] calldata _actions, address[] calldata _paymentTokens, uint256[] calldata _fees) external; function setCallerFeeDiscounts(address[] calldata _callers, address[] calldata _paymentTokens, uint256[] calldata _discounts) external; function setCallerFees(string[] calldata _destinationNames, address[] calldata _callers, address[] calldata _paymentTokens, uint256[] calldata _fees) external; function setDestinationFeeDiscounts(string[] calldata _destinationNames, address[] calldata _paymentTokens, uint256[] calldata _discounts) external; function setFeeDiscounts(address[] calldata _paymentTokens, uint256[] calldata _discounts) external; function setFeesPerByte(string[] calldata _destinationNames, address[] calldata _paymentTokens, uint256[] calldata _fees) external; function setMaxPayloadSize(uint256 _maxPayloadSize) external; function setSendFees(string[] calldata _destinationNames, address[] calldata _paymentTokens, uint256[] calldata _fees) external; }

Function Details

actionFeeDiscounts

function actionFeeDiscounts( string calldata _action, address _paymentToken ) external view returns (uint256);

Returns the fee discount applied to a specific action for a given payment token.

  • _action: The action name.
  • _paymentToken: Address of the payment token.

actionFees

function actionFees( string calldata _destinationName, string calldata _action, address _paymentToken ) external view returns (uint256);

Returns the fee set for a specific action on a given destination and payment token.

  • _destinationName: Name of the target chain.
  • _action: The action name.
  • _paymentToken: Address of the payment token.

callerFeeDiscounts

function callerFeeDiscounts( address _caller, address _paymentToken ) external view returns (uint256);

Returns the fee discount applied to a specific caller for a given payment token.

  • _caller: Address of the caller.
  • _paymentToken: Address of the payment token.

callerFees

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

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

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

destinationFeeDiscounts

function destinationFeeDiscounts( string calldata _destinationName, address _paymentToken ) external view returns (uint256);

Returns the fee discount applied to a specific destination for a given payment token.

  • _destinationName: Name of the target chain.
  • _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.

feeDiscounts

function feeDiscounts(address _paymentToken) external view returns (uint256);

Returns the global fee discount for a given payment token, applied across all destinations and callers.

  • _paymentToken: Address of the payment token.

feesPerByte

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

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

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

getSendFee

function getSendFee( string calldata _destinationName, string calldata _action, 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.

  • _destinationName: Target chain.
  • _action: Action to be performed.
  • _caller: Sender’s address.
  • _paymentToken: Token used for payment.
  • _payloadSize: Size of the payload in bytes.

maxPayloadSize

function maxPayloadSize() external view returns (uint256);

Returns the maximum allowed payload size 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 _destinationName, address _paymentToken ) external view returns (uint256);

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

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

setActionFeeDiscounts

function setActionFeeDiscounts( string[] calldata _actions, address[] calldata _paymentTokens, uint256[] calldata _discounts ) external;

Sets fee discounts for specific actions and payment tokens.

  • _actions: List of action names.
  • _paymentTokens: List of payment token addresses.
  • _discounts: List of discount values to assign.

setActionFees

function setActionFees( string[] calldata _destinationNames, string[] calldata _actions, address[] calldata _paymentTokens, uint256[] calldata _fees ) external;

Sets fees for specific actions on given destinations and payment tokens.

  • _destinationNames: List of destination chain names.
  • _actions: List of action names.
  • _paymentTokens: List of payment token addresses.
  • _fees: List of fee values to assign.

setCallerFeeDiscounts

function setCallerFeeDiscounts( address[] calldata _callers, address[] calldata _paymentTokens, uint256[] calldata _discounts ) external;

Sets fee discounts for specific callers and payment tokens.

  • _callers: List of caller addresses.
  • _paymentTokens: List of payment token addresses.
  • _discounts: List of discount values to assign.

setCallerFees

function setCallerFees( string[] calldata _destinationNames, address[] calldata _callers, address[] calldata _paymentTokens, uint256[] calldata _fees ) external;

Sets a fixed fee for specific callers, tokens, and destinations.

  • _destinationNames: List of destination chain names.
  • _callers: List of caller addresses for which the fees are configured.
  • _paymentTokens: List of token addresses.
  • _fees: List of fee values to assign.

setDestinationFeeDiscounts

function setDestinationFeeDiscounts( string[] calldata _destinationNames, address[] calldata _paymentTokens, uint256[] calldata _discounts ) external;

Sets fee discounts for specific destinations and payment tokens.

  • _destinationNames: List of destination chain names.
  • _paymentTokens: List of payment token addresses.
  • _discounts: List of discount values to assign.

setFeeDiscounts

function setFeeDiscounts( address[] calldata _paymentTokens, uint256[] calldata _discounts ) external;

Sets global fee discounts for given payment tokens, applied across all destinations and callers.

  • _paymentTokens: List of payment token addresses.
  • _discounts: List of discount values to assign.

setFeesPerByte

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

Configures the per-byte fee for sending payloads to specific chains with given tokens.

  • _destinationNames: List of destination chain names.
  • _paymentTokens: List of token addresses.
  • _fees: List of fee per byte values to assign.

setMaxPayloadSize

function setMaxPayloadSize(uint256 _maxPayloadSize) external;

Sets the maximum allowed payload size in bytes.

  • _maxPayloadSize: The new maximum payload size.

setSendFees

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

Sets the base send fee for specific tokens and destinations.

  • _destinationNames: List of destination chain names.
  • _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 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