Skip to content

Commit

Permalink
add WETH to storage
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair-singh committed Dec 5, 2024
1 parent c7ae26f commit e1a8578
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
9 changes: 5 additions & 4 deletions contracts/scripts/DeployLocal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand All @@ -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");
Expand Down
3 changes: 2 additions & 1 deletion contracts/scripts/UpgradeShell.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
});
}
Expand Down
3 changes: 2 additions & 1 deletion contracts/scripts/westend/UpgradeShell.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
});
}
Expand Down
2 changes: 2 additions & 0 deletions contracts/src/Gateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions contracts/src/storage/AssetsStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 5 additions & 3 deletions contracts/test/Gateway.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand All @@ -138,8 +142,6 @@ contract GatewayTest is Test {

// Features

token = new WETH9();

account1 = makeAddr("account1");
account2 = makeAddr("account2");

Expand Down

0 comments on commit e1a8578

Please sign in to comment.