-
Notifications
You must be signed in to change notification settings - Fork 0
/
ERC20LockingConnector.sol
33 lines (28 loc) · 1.24 KB
/
ERC20LockingConnector.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
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.17;
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ERC20LockingConnectorLogic} from "./ERC20LockingConnectorLogic.sol";
import {Receiver} from "../lib/Receiver.sol";
import {ConnectorUpgradeableBase} from "./ConnectorUpgradeableBase.sol";
import {TokenState} from "./TokenState.sol";
import {BridgeBase} from "../lib/BridgeBase.sol";
contract ERC20LockingConnector is ConnectorUpgradeableBase, Receiver, ERC20LockingConnectorLogic {
using SafeERC20 for IERC20;
function initialize(BridgeBase _bridge, IERC20 tokenAddress, address token_on_other_network)
public
payable
initializer
{
require(
address(_bridge) != address(0) && address(tokenAddress) != address(0)
&& token_on_other_network != address(0),
"TokenConnectorBase: invalid bridge, token, or token_on_other_network"
);
__ConnectorUpgradeableBase_init(address(_bridge));
otherNetworkAddress = token_on_other_network;
token = address(tokenAddress);
state = new TokenState(0);
bridge = _bridge;
}
}