-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol): add scripts back for testing bridge (#18910)
Co-authored-by: Gavin “yoghurt” Yu <[email protected]>
- Loading branch information
1 parent
a244be2
commit 1151d38
Showing
2 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import "forge-std/src/Script.sol"; | ||
import "forge-std/src/console2.sol"; | ||
|
||
import "src/shared/common/DefaultResolver.sol"; | ||
|
||
contract SetAddress is Script { | ||
uint256 public adminPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
|
||
address public proxyAddress = vm.envAddress("PROXY_ADDRESS"); | ||
|
||
uint64 public domain = uint64(vm.envUint("DOMAIN")); | ||
|
||
bytes32 public name = vm.envBytes32("NAME"); | ||
|
||
address public addr = vm.envAddress("ADDRESS"); | ||
|
||
DefaultResolver proxy; | ||
|
||
function run() external { | ||
require(adminPrivateKey != 0, "PRIVATE_KEY not set"); | ||
require(proxyAddress != address(0), "PROXY_ADDRESS not set"); | ||
require(domain != 0, "DOMAIN NOT SET"); | ||
require(name != bytes32(0), "NAME NOT SET"); | ||
require(addr != address(0), "ADDR NOT SET"); | ||
|
||
vm.startBroadcast(adminPrivateKey); | ||
|
||
proxy = DefaultResolver(payable(proxyAddress)); | ||
|
||
proxy.registerAddress(domain, name, addr); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
packages/protocol/script/shared/SetRemoteBridgeSuites.s.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import "test/shared/DeployCapability.sol"; | ||
|
||
contract SetRemoteBridgeSuites is DeployCapability { | ||
uint256 public privateKey = vm.envUint("PRIVATE_KEY"); | ||
uint256 public securityCouncilPrivateKey = vm.envUint("SECURITY_COUNCIL_PRIVATE_KEY"); | ||
address public addressManagerAddress = vm.envAddress("ADDRESS_MANAGER_ADDRESS"); | ||
uint256[] public remoteChainIDs = vm.envUint("REMOTE_CHAIN_IDS", ","); | ||
address[] public remoteSignalServices = vm.envAddress("REMOTE_SIGNAL_SERVICES", ","); | ||
address[] public remoteBridges = vm.envAddress("REMOTE_BRIDGES", ","); | ||
address[] public remoteERC20Vaults = vm.envAddress("REMOTE_ERC20_VAULTS", ","); | ||
address[] public remoteERC721Vaults = vm.envAddress("REMOTE_ERC721_VAULTS", ","); | ||
address[] public remoteERC1155Vaults = vm.envAddress("REMOTE_ERC1155_VAULTS", ","); | ||
|
||
function run() external { | ||
require( | ||
remoteChainIDs.length == remoteBridges.length, "invalid remote bridge addresses length" | ||
); | ||
require( | ||
remoteChainIDs.length == remoteSignalServices.length, | ||
"invalid remote SignalService addresses length" | ||
); | ||
require( | ||
remoteChainIDs.length == remoteERC20Vaults.length, | ||
"invalid remote ERC20Vault addresses length" | ||
); | ||
require( | ||
remoteChainIDs.length == remoteERC721Vaults.length, | ||
"invalid remote ERC721Vault addresses length" | ||
); | ||
require( | ||
remoteChainIDs.length == remoteERC1155Vaults.length, | ||
"invalid remote ERC1155Vault addresses length" | ||
); | ||
|
||
vm.startBroadcast(privateKey); | ||
|
||
for (uint256 i; i < remoteChainIDs.length; ++i) { | ||
uint64 chainid = uint64(remoteChainIDs[i]); | ||
register(addressManagerAddress, "signal_service", remoteSignalServices[i], chainid); | ||
register(addressManagerAddress, "bridge", remoteBridges[i], chainid); | ||
register(addressManagerAddress, "erc20_vault", remoteERC20Vaults[i], chainid); | ||
register(addressManagerAddress, "erc721_vault", remoteERC721Vaults[i], chainid); | ||
register(addressManagerAddress, "erc1155_vault", remoteERC1155Vaults[i], chainid); | ||
} | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |