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/scripts/UpgradeShell.sol b/contracts/scripts/UpgradeShell.sol index 7fc0c9de46..f861e9906d 100644 --- a/contracts/scripts/UpgradeShell.sol +++ b/contracts/scripts/UpgradeShell.sol @@ -59,7 +59,8 @@ contract UpgradeShell is Script { assetHubReserveTransferFee: mDot(100), // 0.1 DOT exchangeRate: ud60x18(0.0024e18), multiplier: ud60x18(1.33e18), - rescueOperator: 0x4B8a782D4F03ffcB7CE1e95C5cfe5BFCb2C8e967 + rescueOperator: 0x4B8a782D4F03ffcB7CE1e95C5cfe5BFCb2C8e967, + weth: address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) }) }); } diff --git a/contracts/scripts/westend/UpgradeShell.sol b/contracts/scripts/westend/UpgradeShell.sol index 01b9cc0cf4..d5a10a71cf 100644 --- a/contracts/scripts/westend/UpgradeShell.sol +++ b/contracts/scripts/westend/UpgradeShell.sol @@ -50,7 +50,8 @@ contract UpgradeShell is Script { assetHubReserveTransferFee: 200000000000, // 0.2 Wnd exchangeRate: ud60x18(2400000000000000), multiplier: ud60x18(1330000000000000000), - rescueOperator: 0x302F0B71B8aD3CF6dD90aDb668E49b2168d652fd + rescueOperator: 0x302F0B71B8aD3CF6dD90aDb668E49b2168d652fd, + weth: address(0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14) }) }); } 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");