@@ -5,12 +5,6 @@ import "@openzeppelin/contracts/access/Ownable.sol";
5
5
import "@openzeppelin/contracts/token/ERC20/IERC20.sol " ;
6
6
7
7
interface IGateway {
8
- function paused () external returns (bool );
9
-
10
- function pause () external ;
11
-
12
- function unpause () external ;
13
-
14
8
function withdrawTokenFor (
15
9
uint256 _withdrawalId ,
16
10
address _user ,
@@ -24,12 +18,26 @@ interface IGatewayV2 {
24
18
function receiveEther () external payable ;
25
19
}
26
20
21
+ interface IPausableAdmin {
22
+ function pauseGateway () external ;
23
+
24
+ function unpauseGateway () external ;
25
+
26
+ function changeAdmin (address _newAdmin ) external ;
27
+ }
28
+
27
29
contract BridgeMigration is Ownable {
28
30
IGateway public gateway;
31
+ IPausableAdmin public pausableAdmin;
29
32
address public weth;
30
33
31
- constructor (IGateway _gateway , address _weth ) {
34
+ constructor (
35
+ IGateway _gateway ,
36
+ IPausableAdmin _pausableAdmin ,
37
+ address _weth
38
+ ) {
32
39
gateway = _gateway;
40
+ pausableAdmin = _pausableAdmin;
33
41
weth = _weth;
34
42
}
35
43
@@ -38,11 +46,15 @@ contract BridgeMigration is Ownable {
38
46
receive () external payable {}
39
47
40
48
function pauseGateway () external onlyOwner {
41
- gateway. pause ();
49
+ pausableAdmin. pauseGateway ();
42
50
}
43
51
44
52
function unpauseGateway () external onlyOwner {
45
- gateway.unpause ();
53
+ pausableAdmin.unpauseGateway ();
54
+ }
55
+
56
+ function changePausableAdmin (address _newAdmin ) external onlyOwner {
57
+ pausableAdmin.changeAdmin (_newAdmin);
46
58
}
47
59
48
60
function migrateAndTransfer (
@@ -60,11 +72,11 @@ contract BridgeMigration is Ownable {
60
72
"BridgeMigration: invalid array length "
61
73
);
62
74
63
- gateway. unpause ();
75
+ pausableAdmin. pauseGateway ();
64
76
for (uint256 _i; _i < _withdrawalIds.length ; _i++ ) {
65
- gateway.withdrawTokenFor (_withdrawalIds[_i], msg . sender , _tokens[_i], _amounts[_i], _signatures[_i]);
77
+ gateway.withdrawTokenFor (_withdrawalIds[_i], address ( this ) , _tokens[_i], _amounts[_i], _signatures[_i]);
66
78
}
67
- gateway. pause ();
79
+ pausableAdmin. unpauseGateway ();
68
80
69
81
for (uint256 _i; _i < _tokens.length ; _i++ ) {
70
82
if (_tokens[_i] == weth) {
0 commit comments