Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/reconfigure test deployments #84

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

689 changes: 270 additions & 419 deletions broadcast/multi/WormholeL2FlexibleVotingDeploy.s.sol-latest/run.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion script/WormholeL2FlexibleVotingDeploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ contract WormholeL2FlexibleVotingDeploy is Script, ScriptConstants {
// Register L1 ERC20 bridge on L2 token
vm.broadcast();
l2Token.setRegisteredSender(
L2_CHAIN.wormholeChainId, _toWormholeAddress(address(l1TokenBridge))
L1_CHAIN.wormholeChainId, _toWormholeAddress(address(l1TokenBridge))
);

vm.broadcast();
Expand Down
4 changes: 2 additions & 2 deletions script/WormholeMintOnL2.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ contract WormholeMintOnL2 is Script, ScriptConstants {

// Mint some L1 token
vm.broadcast();
erc20.mint(msg.sender, 100_000);
erc20.mint(msg.sender, 100_000e18);

// Approve L1 token to be sent to the bridge
vm.broadcast();
erc20.approve(address(bridge), 100_000);
erc20.approve(address(bridge), 100_000e18);

uint256 cost = bridge.quoteDeliveryCost(L2_CHAIN.wormholeChainId);

Expand Down
2 changes: 1 addition & 1 deletion src/WormholeSender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract contract WormholeSender is WormholeBase {
}

/// @param targetChain The chain id of the chain receiving the messages.
function quoteDeliveryCost(uint16 targetChain) public virtual returns (uint256 cost) {
function quoteDeliveryCost(uint16 targetChain) public view virtual returns (uint256 cost) {
(cost,) = WORMHOLE_RELAYER.quoteEVMDeliveryPrice(targetChain, 0, GAS_LIMIT);
}
}
43 changes: 30 additions & 13 deletions test/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ contract BaseConstants is CommonBase {
BaseConstants.ChainConfig L2_CHAIN;
uint256 immutable L1_CHAIN_ID = vm.envOr("L1_CHAIN_ID", uint256(43_113));
uint256 immutable L2_CHAIN_ID = vm.envOr("L2_CHAIN_ID", uint256(80_001));
bool immutable TESTNET = vm.envOr("TESTNET", true);

struct ChainConfig {
uint16 wormholeChainId;
Expand All @@ -26,6 +27,35 @@ contract BaseConstants is CommonBase {
}

function _initChains() internal {
if (TESTNET) {
chainInfos[5] = ChainConfig({
wormholeChainId: 2,
wormholeRelayer: 0x28D8F1Be96f97C1387e94A53e00eCcFb4E75175a,
chainId: 5,
rpcUrl: vm.envOr("GOERLI_RPC_URL", string("https://ethereum-goerli.publicnode.com"))
});
chainInfos[420] = ChainConfig({
wormholeChainId: 24,
wormholeRelayer: 0x01A957A525a5b7A72808bA9D10c389674E459891,
chainId: 420,
rpcUrl: vm.envOr("OPTIMISM_GOERLI_RPC_URL", string("https://optimism.publicnode.com"))
});
chainInfos[43_113] = ChainConfig({
wormholeChainId: 6,
wormholeRelayer: 0xA3cF45939bD6260bcFe3D66bc73d60f19e49a8BB,
chainId: 43_113,
rpcUrl: vm.envOr(
"AVALANCHE_FUJI_RPC_URL", string("https://api.avax-test.network/ext/bc/C/rpc")
)
});
chainInfos[80_001] = ChainConfig({
wormholeChainId: 5,
wormholeRelayer: 0x0591C25ebd0580E0d4F27A82Fc2e24E7489CB5e0,
chainId: 80_001,
rpcUrl: vm.envOr("POLYGON_MUMBAI_RPC_URL", string("https://rpc.ankr.com/polygon_mumbai"))
});
return;
}
chainInfos[1] = ChainConfig({
wormholeChainId: 2,
wormholeRelayer: 0x27428DD2d3DD32A4D7f7C497eAaa23130d894911,
Expand All @@ -50,18 +80,6 @@ contract BaseConstants is CommonBase {
chainId: 420,
rpcUrl: vm.envOr("OPTIMISM_GOERLI_RPC_URL", string("https://optimism-goerli.publicnode.com"))
});
chainInfos[43_113] = ChainConfig({
wormholeChainId: 6,
wormholeRelayer: 0xA3cF45939bD6260bcFe3D66bc73d60f19e49a8BB,
chainId: 43_113,
rpcUrl: vm.envOr("AVALANCHE_FUJI_RPC_URL", string("https://api.avax-test.network/ext/bc/C/rpc"))
});
chainInfos[80_001] = ChainConfig({
wormholeChainId: 5,
wormholeRelayer: 0x0591C25ebd0580E0d4F27A82Fc2e24E7489CB5e0,
chainId: 80_001,
rpcUrl: vm.envOr("POLYGON_MUMBAI_RPC_URL", string("https://rpc.ankr.com/polygon_mumbai"))
});
}

function _toWormholeAddress(address addr) internal pure returns (bytes32) {
Expand All @@ -72,7 +90,6 @@ contract BaseConstants is CommonBase {
contract ScriptConstants is BaseConstants {}

contract TestConstants is BaseConstants, Test {
bool TESTNET = vm.envOr("TESTNET", true);
bytes32 MOCK_WORMHOLE_SERIALIZED_ADDRESS =
bytes32(uint256(uint160(0xEAC5F0d4A9a45E1f9FdD0e7e2882e9f60E301156)));
}
Loading