<!-- Canonical: https://docs.linea.build/api/linea-smart-contracts/interfaces/iratelimiter -->

> For the complete Linea documentation index, see [llms.txt](/llms.txt).
> Agents can fetch this page as Markdown at [https://docs.linea.build/api/linea-smart-contracts/interfaces/iratelimiter.md](https://docs.linea.build/api/linea-smart-contracts/interfaces/iratelimiter.md).

# IRateLimiter

# `IRateLimiter`

### RateLimitInitialized

```solidity
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

```solidity
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

```solidity
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

```solidity
error RateLimitExceeded()
```

_Thrown when an amount breaches the limit in the period._

### PeriodIsZero

```solidity
error PeriodIsZero()
```

_Thrown when the period is initialised to zero._

### LimitIsZero

```solidity
error LimitIsZero()
```

_Thrown when the limit is initialised to zero._

### resetRateLimitAmount

```solidity
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

```solidity
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](https://github.com/Consensys/linea-monorepo/tree/main/contracts/src). To ensure they accurately match the deployed smart contracts, we cannot accept any contributions that edit these pages.
