diff --git a/contracts/v0.8/migration/BridgeMigration.sol b/contracts/v0.8/migration/BridgeMigration.sol index 68c78e7..1a9bb55 100644 --- a/contracts/v0.8/migration/BridgeMigration.sol +++ b/contracts/v0.8/migration/BridgeMigration.sol @@ -5,12 +5,6 @@ import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IGateway { - function paused() external returns (bool); - - function pause() external; - - function unpause() external; - function withdrawTokenFor( uint256 _withdrawalId, address _user, @@ -24,12 +18,26 @@ interface IGatewayV2 { function receiveEther() external payable; } +interface IPausableAdmin { + function pauseGateway() external; + + function unpauseGateway() external; + + function changeAdmin(address _newAdmin) external; +} + contract BridgeMigration is Ownable { IGateway public gateway; + IPausableAdmin public pausableAdmin; address public weth; - constructor(IGateway _gateway, address _weth) { + constructor( + IGateway _gateway, + IPausableAdmin _pausableAdmin, + address _weth + ) { gateway = _gateway; + pausableAdmin = _pausableAdmin; weth = _weth; } @@ -38,11 +46,15 @@ contract BridgeMigration is Ownable { receive() external payable {} function pauseGateway() external onlyOwner { - gateway.pause(); + pausableAdmin.pauseGateway(); } function unpauseGateway() external onlyOwner { - gateway.unpause(); + pausableAdmin.unpauseGateway(); + } + + function changePausableAdmin(address _newAdmin) external onlyOwner { + pausableAdmin.changeAdmin(_newAdmin); } function migrateAndTransfer( @@ -60,11 +72,11 @@ contract BridgeMigration is Ownable { "BridgeMigration: invalid array length" ); - gateway.unpause(); + pausableAdmin.pauseGateway(); for (uint256 _i; _i < _withdrawalIds.length; _i++) { - gateway.withdrawTokenFor(_withdrawalIds[_i], msg.sender, _tokens[_i], _amounts[_i], _signatures[_i]); + gateway.withdrawTokenFor(_withdrawalIds[_i], address(this), _tokens[_i], _amounts[_i], _signatures[_i]); } - gateway.pause(); + pausableAdmin.unpauseGateway(); for (uint256 _i; _i < _tokens.length; _i++) { if (_tokens[_i] == weth) {