From 84607407f1d29791a4e4bcb6bcb33990e67d7b4a Mon Sep 17 00:00:00 2001 From: Fermin 'Piscu' Carranza Date: Wed, 6 Sep 2023 04:53:00 -0400 Subject: [PATCH] Bridge: Owner (#146) * feat: polygon-mainnet erc20 bridge * chore: update docs * feat: pr updates * feat: use rescuable contract * chore: make ownable * feat: add onlyOwner to bridge * feat: add owner --- src/bridges/AavePolEthERC20Bridge.sol | 4 ++++ src/bridges/AavePolEthERC20BridgeTest.t.sol | 4 ++-- src/bridges/DeployBridges.s.sol | 6 ++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/bridges/AavePolEthERC20Bridge.sol b/src/bridges/AavePolEthERC20Bridge.sol index f32a8c674..e22611a6f 100644 --- a/src/bridges/AavePolEthERC20Bridge.sol +++ b/src/bridges/AavePolEthERC20Bridge.sol @@ -35,6 +35,10 @@ contract AavePolEthERC20Bridge is Ownable, Rescuable, IAavePolEthERC20Bridge { address public constant ROOT_CHAIN_MANAGER = 0xA0c68C638235ee32657e8f720a23ceC1bFc77C77; + constructor(address _owner) { + _transferOwnership(_owner); + } + /* * This function withdraws an ERC20 token from Polygon to Mainnet. exit() needs * to be called on mainnet with the corresponding burnProof in order to complete. diff --git a/src/bridges/AavePolEthERC20BridgeTest.t.sol b/src/bridges/AavePolEthERC20BridgeTest.t.sol index 76da59a97..70036d7cb 100644 --- a/src/bridges/AavePolEthERC20BridgeTest.t.sol +++ b/src/bridges/AavePolEthERC20BridgeTest.t.sol @@ -30,10 +30,10 @@ contract AavePolEthERC20BridgeTest is Test { bytes32 salt = keccak256(abi.encode(tx.origin, uint256(0))); mainnetFork = vm.createSelectFork(vm.rpcUrl('mainnet'), 17921144); - bridgeMainnet = new AavePolEthERC20Bridge{salt: salt}(); + bridgeMainnet = new AavePolEthERC20Bridge{salt: salt}(address(this)); polygonFork = vm.createSelectFork(vm.rpcUrl('polygon'), 46340897); - bridgePolygon = new AavePolEthERC20Bridge{salt: salt}(); + bridgePolygon = new AavePolEthERC20Bridge{salt: salt}(address(this)); } } diff --git a/src/bridges/DeployBridges.s.sol b/src/bridges/DeployBridges.s.sol index 0787f53c7..588fcaddc 100644 --- a/src/bridges/DeployBridges.s.sol +++ b/src/bridges/DeployBridges.s.sol @@ -8,15 +8,13 @@ import {AaveGovernanceV2} from 'aave-address-book/AaveGovernanceV2.sol'; contract DeployEthereum is EthereumScript { function run() external broadcast { bytes32 salt = 'Aave Treasury Bridge'; - AavePolEthERC20Bridge bridge = new AavePolEthERC20Bridge{salt: salt}(); - bridge.transferOwnership(AaveGovernanceV2.SHORT_EXECUTOR); + new AavePolEthERC20Bridge{salt: salt}(AaveGovernanceV2.SHORT_EXECUTOR); } } contract DeployPolygon is PolygonScript { function run() external broadcast { bytes32 salt = 'Aave Treasury Bridge'; - AavePolEthERC20Bridge bridge = new AavePolEthERC20Bridge{salt: salt}(); - bridge.transferOwnership(AaveGovernanceV2.POLYGON_BRIDGE_EXECUTOR); + new AavePolEthERC20Bridge{salt: salt}(AaveGovernanceV2.POLYGON_BRIDGE_EXECUTOR); } }