IRateLimiter
RateLimitInitialized​
event RateLimitInitialized(uint256 periodInSeconds, uint256 limitInWei, uint256 currentPeriodEnd)
Emitted when the Rate Limit is initialized.
Parameters​
Name | Type | Description |
---|---|---|
periodInSeconds | uint256 | The time period in seconds the rate limiter has been initialized to. |
limitInWei | uint256 | The limit in Wei the rate limiter has been initialized to. |
currentPeriodEnd | uint256 | The 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​
Name | Type | Description |
---|---|---|
resettingAddress | address | The 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​
Name | Type | Description |
---|---|---|
amountChangeBy | address | The indexed address of who changed the rate limit. |
amount | uint256 | The rate limited amount in Wei that was set. |
amountUsedLoweredToLimit | bool | Indicates if the amount used was lowered to the limit to avoid confusion. |
usedAmountResetToZero | bool | Indicates 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​
Name | Type | Description |
---|---|---|
_amount | uint256 | The 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.