Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(contracts): add rate limiter #712

Merged
merged 17 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
)

var tag = "v4.1.74"
var tag = "v4.1.75"

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
Expand Down
50 changes: 50 additions & 0 deletions contracts/docs/apis/L1ERC1155Gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,23 @@ function owner() external view returns (address)
*Returns the address of the current owner.*


#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | address | undefined |

### rateLimiter

```solidity
function rateLimiter() external view returns (address)
```

The address of token rate limiter contract.




#### Returns

| Name | Type | Description |
Expand Down Expand Up @@ -354,6 +371,22 @@ function transferOwnership(address newOwner) external nonpayable
|---|---|---|
| newOwner | address | undefined |

### updateRateLimiter

```solidity
function updateRateLimiter(address _newRateLimiter) external nonpayable
```

Update rate limiter contract.

*This function can only called by contract owner.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| _newRateLimiter | address | The address of new rate limiter contract. |

### updateTokenMapping

```solidity
Expand Down Expand Up @@ -530,6 +563,23 @@ Emitted when some ERC1155 token is refunded.
| tokenId | uint256 | undefined |
| amount | uint256 | undefined |

### UpdateRateLimiter

```solidity
event UpdateRateLimiter(address indexed _oldRateLimiter, address indexed _newRateLimiter)
```

Emitted when owner updates rate limiter contract.



#### Parameters

| Name | Type | Description |
|---|---|---|
| _oldRateLimiter `indexed` | address | undefined |
| _newRateLimiter `indexed` | address | undefined |

### UpdateTokenMapping

```solidity
Expand Down
50 changes: 50 additions & 0 deletions contracts/docs/apis/L1ERC721Gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,23 @@ function owner() external view returns (address)
*Returns the address of the current owner.*


#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | address | undefined |

### rateLimiter

```solidity
function rateLimiter() external view returns (address)
```

The address of token rate limiter contract.




#### Returns

| Name | Type | Description |
Expand Down Expand Up @@ -299,6 +316,22 @@ function transferOwnership(address newOwner) external nonpayable
|---|---|---|
| newOwner | address | undefined |

### updateRateLimiter

```solidity
function updateRateLimiter(address _newRateLimiter) external nonpayable
```

Update rate limiter contract.

*This function can only called by contract owner.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| _newRateLimiter | address | The address of new rate limiter contract. |

### updateTokenMapping

```solidity
Expand Down Expand Up @@ -469,6 +502,23 @@ Emitted when some ERC721 token is refunded.
| recipient `indexed` | address | undefined |
| tokenId | uint256 | undefined |

### UpdateRateLimiter

```solidity
event UpdateRateLimiter(address indexed _oldRateLimiter, address indexed _newRateLimiter)
```

Emitted when owner updates rate limiter contract.



#### Parameters

| Name | Type | Description |
|---|---|---|
| _oldRateLimiter `indexed` | address | undefined |
| _newRateLimiter `indexed` | address | undefined |

### UpdateTokenMapping

```solidity
Expand Down
50 changes: 50 additions & 0 deletions contracts/docs/apis/L1ScrollMessenger.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,23 @@ Mapping from queue index to previous replay queue index.
|---|---|---|
| _0 | uint256 | undefined |

### rateLimiter

```solidity
function rateLimiter() external view returns (address)
```

The address of ETH rate limiter contract.




#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | address | undefined |

### relayMessageWithProof

```solidity
Expand Down Expand Up @@ -436,6 +453,22 @@ Update max replay times.
|---|---|---|
| _newMaxReplayTimes | uint256 | The new max replay times. |

### updateRateLimiter

```solidity
function updateRateLimiter(address _newRateLimiter) external nonpayable
```

Update rate limiter contract.

*This function can only called by contract owner.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| _newRateLimiter | address | The address of new rate limiter contract. |

### xDomainMessageSender

```solidity
Expand Down Expand Up @@ -609,5 +642,22 @@ Emitted when the maximum number of times each message can be replayed is updated
| oldMaxReplayTimes | uint256 | undefined |
| newMaxReplayTimes | uint256 | undefined |

### UpdateRateLimiter

```solidity
event UpdateRateLimiter(address indexed _oldRateLimiter, address indexed _newRateLimiter)
```

Emitted when owner updates rate limiter contract.



#### Parameters

| Name | Type | Description |
|---|---|---|
| _oldRateLimiter `indexed` | address | undefined |
| _newRateLimiter `indexed` | address | undefined |



50 changes: 50 additions & 0 deletions contracts/docs/apis/L1StandardERC20Gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,23 @@ function owner() external view returns (address)
*Returns the address of the current owner.*


#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | address | undefined |

### rateLimiter

```solidity
function rateLimiter() external view returns (address)
```

The address of token rate limiter contract.




#### Returns

| Name | Type | Description |
Expand Down Expand Up @@ -275,6 +292,22 @@ function transferOwnership(address newOwner) external nonpayable
|---|---|---|
| newOwner | address | undefined |

### updateRateLimiter

```solidity
function updateRateLimiter(address _newRateLimiter) external nonpayable
```

Update rate limiter contract.

*This function can only called by contract owner.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| _newRateLimiter | address | The address of new rate limiter contract. |



## Events
Expand Down Expand Up @@ -372,5 +405,22 @@ Emitted when some ERC20 token is refunded.
| recipient `indexed` | address | undefined |
| amount | uint256 | undefined |

### UpdateRateLimiter

```solidity
event UpdateRateLimiter(address indexed _oldRateLimiter, address indexed _newRateLimiter)
```

Emitted when owner updates rate limiter contract.



#### Parameters

| Name | Type | Description |
|---|---|---|
| _oldRateLimiter `indexed` | address | undefined |
| _newRateLimiter `indexed` | address | undefined |



50 changes: 50 additions & 0 deletions contracts/docs/apis/L1WETHGateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,23 @@ function owner() external view returns (address)
*Returns the address of the current owner.*


#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | address | undefined |

### rateLimiter

```solidity
function rateLimiter() external view returns (address)
```

The address of token rate limiter contract.




#### Returns

| Name | Type | Description |
Expand Down Expand Up @@ -273,6 +290,22 @@ function transferOwnership(address newOwner) external nonpayable
|---|---|---|
| newOwner | address | undefined |

### updateRateLimiter

```solidity
function updateRateLimiter(address _newRateLimiter) external nonpayable
```

Update rate limiter contract.

*This function can only called by contract owner.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| _newRateLimiter | address | The address of new rate limiter contract. |



## Events
Expand Down Expand Up @@ -370,5 +403,22 @@ Emitted when some ERC20 token is refunded.
| recipient `indexed` | address | undefined |
| amount | uint256 | undefined |

### UpdateRateLimiter

```solidity
event UpdateRateLimiter(address indexed _oldRateLimiter, address indexed _newRateLimiter)
```

Emitted when owner updates rate limiter contract.



#### Parameters

| Name | Type | Description |
|---|---|---|
| _oldRateLimiter `indexed` | address | undefined |
| _newRateLimiter `indexed` | address | undefined |