forked from scroll-tech/scroll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIL1GatewayRouter.sol
70 lines (56 loc) · 2.99 KB
/
IL1GatewayRouter.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {IL1ETHGateway} from "./IL1ETHGateway.sol";
import {IL1ERC20Gateway} from "./IL1ERC20Gateway.sol";
interface IL1GatewayRouter is IL1ETHGateway, IL1ERC20Gateway {
/**********
* Events *
**********/
/// @notice Emitted when the address of ETH Gateway is updated.
/// @param oldETHGateway The address of the old ETH Gateway.
/// @param newEthGateway The address of the new ETH Gateway.
event SetETHGateway(address indexed oldETHGateway, address indexed newEthGateway);
/// @notice Emitted when the address of default ERC20 Gateway is updated.
/// @param oldDefaultERC20Gateway The address of the old default ERC20 Gateway.
/// @param newDefaultERC20Gateway The address of the new default ERC20 Gateway.
event SetDefaultERC20Gateway(address indexed oldDefaultERC20Gateway, address indexed newDefaultERC20Gateway);
/// @notice Emitted when the `gateway` for `token` is updated.
/// @param token The address of token updated.
/// @param oldGateway The corresponding address of the old gateway.
/// @param newGateway The corresponding address of the new gateway.
event SetERC20Gateway(address indexed token, address indexed oldGateway, address indexed newGateway);
/*************************
* Public View Functions *
*************************/
/// @notice Return the corresponding gateway address for given token address.
/// @param _token The address of token to query.
function getERC20Gateway(address _token) external view returns (address);
/*****************************
* Public Mutating Functions *
*****************************/
/// @notice Request ERC20 token transfer from users to gateways.
/// @param sender The address of sender to request fund.
/// @param token The address of token to request.
/// @param amount The amount of token to request.
function requestERC20(
address sender,
address token,
uint256 amount
) external returns (uint256);
/************************
* Restricted Functions *
************************/
/// @notice Update the address of ETH gateway contract.
/// @dev This function should only be called by contract owner.
/// @param _ethGateway The address to update.
function setETHGateway(address _ethGateway) external;
/// @notice Update the address of default ERC20 gateway contract.
/// @dev This function should only be called by contract owner.
/// @param _defaultERC20Gateway The address to update.
function setDefaultERC20Gateway(address _defaultERC20Gateway) external;
/// @notice Update the mapping from token address to gateway address.
/// @dev This function should only be called by contract owner.
/// @param _tokens The list of addresses of tokens to update.
/// @param _gateways The list of addresses of gateways to update.
function setERC20Gateway(address[] calldata _tokens, address[] calldata _gateways) external;
}