RateRegistry

Git Source

Inherits: IRateRegistry, Migratable, Initializable

This contract handles functionality for updating the rates, tracking them historically.

State Variables

parameterRegistry

The address of the parameter registry.

address public immutable parameterRegistry;

_RATE_REGISTRY_STORAGE_LOCATION

bytes32 internal constant _RATE_REGISTRY_STORAGE_LOCATION =
    0x988e236e2caf5758fdf811320ba1d2fca453cb71bd6049ebba876b68af505000;

Functions

_getRateRegistryStorage

function _getRateRegistryStorage() internal pure returns (RateRegistryStorage storage $);

constructor

Constructor for the implementation contract, such that the implementation cannot be initialized.

The parameter registry must not be the zero address.

The parameter registry is immutable so that it is inlined in the contract code, and has minimal gas cost.

constructor(address parameterRegistry_);

Parameters

NameTypeDescription
parameterRegistry_addressThe address of the parameter registry.

initialize

Initializes the contract.

function initialize() public initializer;

updateRates

Updates the rates.

function updateRates() external;

migrate

Initiates a migration of the proxy, in a way defined by the implementation.

Normally, the implementation has a way of determining the migrator that needs to be delegatecalled.

function migrate() external;

messageFeeParameterKey

The parameter registry key used to fetch the message fee.

function messageFeeParameterKey() public pure returns (string memory key_);

storageFeeParameterKey

The parameter registry key used to fetch the storage fee.

function storageFeeParameterKey() public pure returns (string memory key_);

congestionFeeParameterKey

The parameter registry key used to fetch the congestion fee.

function congestionFeeParameterKey() public pure returns (string memory key_);

targetRatePerMinuteParameterKey

The parameter registry key used to fetch the target rate per minute.

function targetRatePerMinuteParameterKey() public pure returns (string memory key_);

migratorParameterKey

The parameter registry key used to fetch the migrator.

function migratorParameterKey() public pure returns (string memory key_);

getRates

Returns a slice of the Rates list for pagination.

function getRates(uint256 fromIndex_, uint256 count_) external view returns (Rates[] memory rates_);

Parameters

NameTypeDescription
fromIndex_uint256Index from which to start (must be < allRates.length).
count_uint256The number of items to return.

Returns

NameTypeDescription
rates_Rates[]The subset of Rates.

getRatesCount

The total number of Rates stored.

function getRatesCount() external view returns (uint256 count_);

_isZero

function _isZero(address input_) internal pure returns (bool isZero_);

_revertIfNoRateChange

Reverts if none of the rates have changed.

function _revertIfNoRateChange(
    uint64 messageFee_,
    uint64 storageFee_,
    uint64 congestionFee_,
    uint64 targetRatePerMinute_
) internal view;

Structs

RateRegistryStorage

The UUPS storage for the rate registry.

Note: storage-location: erc7201:xmtp.storage.RateRegistry

struct RateRegistryStorage {
    Rates[] allRates;
}

Properties

NameTypeDescription
allRatesRates[]The array of all historical rates.