diff --git a/contracts/scripts/DeployLocal.sol b/contracts/scripts/DeployLocal.sol index 441ab9926c..ab07958951 100644 --- a/contracts/scripts/DeployLocal.sol +++ b/contracts/scripts/DeployLocal.sol @@ -78,6 +78,9 @@ contract DeployLocal is Script { defaultOperatingMode = OperatingMode.Normal; } + // Deploy WETH for testing + address weth = address(new WETH9()); + Gateway.Config memory config = Gateway.Config({ mode: defaultOperatingMode, deliveryCost: uint128(vm.envUint("DELIVERY_COST")), @@ -88,14 +91,12 @@ contract DeployLocal is Script { assetHubReserveTransferFee: uint128(vm.envUint("RESERVE_TRANSFER_FEE")), exchangeRate: ud60x18(vm.envUint("EXCHANGE_RATE")), multiplier: ud60x18(vm.envUint("FEE_MULTIPLIER")), - rescueOperator: address(0) + rescueOperator: address(0), + weth: weth }); GatewayProxy gateway = new GatewayProxy(address(gatewayLogic), abi.encode(config)); - // Deploy WETH for testing - new WETH9(); - // Fund the sovereign account for the BridgeHub parachain. Used to reward relayers // of messages originating from BridgeHub uint256 initialDeposit = vm.envUint("BRIDGE_HUB_INITIAL_DEPOSIT"); diff --git a/contracts/src/Gateway.sol b/contracts/src/Gateway.sol index 685627fe34..f9e01d48df 100644 --- a/contracts/src/Gateway.sol +++ b/contracts/src/Gateway.sol @@ -615,6 +615,8 @@ contract Gateway is IGateway, IInitializable, IUpgradable { UD60x18 multiplier; /// @dev Optional rescueOperator address rescueOperator; + /// @dev The WETH address used for wrapping ETH + address weth; } /// Initialize storage within the `GatewayProxy` contract using this initializer. diff --git a/contracts/src/storage/AssetsStorage.sol b/contracts/src/storage/AssetsStorage.sol index 57b5bab21a..ce461e5198 100644 --- a/contracts/src/storage/AssetsStorage.sol +++ b/contracts/src/storage/AssetsStorage.sol @@ -18,6 +18,8 @@ library AssetsStorage { uint256 registerTokenFee; // Foreign token registry by token ID mapping(bytes32 foreignID => address) tokenAddressOf; + // WETH token address for wrapping ETH + address weth; } bytes32 internal constant SLOT = keccak256("org.snowbridge.storage.assets"); diff --git a/contracts/test/Gateway.t.sol b/contracts/test/Gateway.t.sol index e17c7df1a9..ace3af10fa 100644 --- a/contracts/test/Gateway.t.sol +++ b/contracts/test/Gateway.t.sol @@ -112,6 +112,9 @@ contract GatewayTest is Test { gatewayLogic = new MockGateway( address(0), address(executor), bridgeHubParaID, bridgeHubAgentID, foreignTokenDecimals, maxDestinationFee ); + + token = new WETH9(); + Gateway.Config memory config = Gateway.Config({ mode: OperatingMode.Normal, deliveryCost: outboundFee, @@ -122,7 +125,8 @@ contract GatewayTest is Test { assetHubReserveTransferFee: sendTokenFee, exchangeRate: exchangeRate, multiplier: multiplier, - rescueOperator: 0x4B8a782D4F03ffcB7CE1e95C5cfe5BFCb2C8e967 + rescueOperator: 0x4B8a782D4F03ffcB7CE1e95C5cfe5BFCb2C8e967, + weth: address(token) }); gateway = new GatewayProxy(address(gatewayLogic), abi.encode(config)); MockGateway(address(gateway)).setCommitmentsAreVerified(true); @@ -138,8 +142,6 @@ contract GatewayTest is Test { // Features - token = new WETH9(); - account1 = makeAddr("account1"); account2 = makeAddr("account2");