Skip to main content

IRateLimiter

RateLimitInitialized​

event RateLimitInitialized(uint256 periodInSeconds, uint256 limitInWei, uint256 currentPeriodEnd)

Emitted when the Rate Limit is initialized.

Parameters​

NameTypeDescription
periodInSecondsuint256The time period in seconds the rate limiter has been initialized to.
limitInWeiuint256The limit in Wei the rate limiter has been initialized to.
currentPeriodEnduint256The time the current rate limit period will end.

AmountUsedInPeriodReset​

event AmountUsedInPeriodReset(address resettingAddress)

Emitted when the amount in the period is reset to zero.

Parameters​

NameTypeDescription
resettingAddressaddressThe indexed address of who reset the used amount back to zero.

LimitAmountChanged​

event LimitAmountChanged(address amountChangeBy, uint256 amount, bool amountUsedLoweredToLimit, bool usedAmountResetToZero)

Emitted when the limit is changed.

If the current used amount is higher than the new limit, the used amount is lowered to the limit. amountUsedLoweredToLimit and usedAmountResetToZero cannot be true at the same time.

Parameters​

NameTypeDescription
amountChangeByaddressThe indexed address of who changed the rate limit.
amountuint256The rate limited amount in Wei that was set.
amountUsedLoweredToLimitboolIndicates if the amount used was lowered to the limit to avoid confusion.
usedAmountResetToZeroboolIndicates if the amount used was set to zero because of the current period expiring.

RateLimitExceeded​

error RateLimitExceeded()

Thrown when an amount breaches the limit in the period.

PeriodIsZero​

error PeriodIsZero()

Thrown when the period is initialised to zero.

LimitIsZero​

error LimitIsZero()

Thrown when the limit is initialised to zero.

resetRateLimitAmount​

function resetRateLimitAmount(uint256 _amount) external

Resets the rate limit amount.

If the used amount is higher, it is set to the limit to avoid confusion/issues. Only the RATE_LIMIT_SETTER_ROLE is allowed to execute this function. Emits the LimitAmountChanged event. usedLimitAmountToSet will use the default value of zero if period has expired.

Parameters​

NameTypeDescription
_amountuint256The amount to reset the limit to.

resetAmountUsedInPeriod​

function resetAmountUsedInPeriod() external

Resets the amount used to zero.

Only the USED_RATE_LIMIT_RESETTER_ROLE is allowed to execute this function. Emits the AmountUsedInPeriodReset event.

Contributions not accepted
These reference pages are automatically generated based on Linea's smart contracts. To ensure they accurately match the deployed smart contracts, we cannot accept any contributions that edit these pages.