-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a6dd20
commit f0b3f08
Showing
8 changed files
with
192 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
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
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
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
45 changes: 45 additions & 0 deletions
45
smart-contracts/script/bsc-testnet/deployMockZilBridge.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,45 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
pragma solidity ^0.8.20; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import "forge-std/console.sol"; | ||
import {Tester} from "test/Tester.sol"; | ||
import {TestToken} from "test/Helpers.sol"; | ||
import { LockProxy } from "contracts/zilbridge/1/lockProxy.sol"; | ||
import { EthCrossChainManagerProxy } from "contracts/zilbridge/1/ccmProxy.sol"; | ||
import { EthCrossChainManager } from "contracts/zilbridge/1/ccmCrossChainManager.sol"; | ||
import { EthCrossChainData } from "contracts/zilbridge/1/ethCrossChainData.sol"; | ||
import { EthExtendCrossChainManager } from "contracts/zilbridge/2/ccmExtendCrossChainManager.sol"; | ||
import { LockProxyTokenManagerUpgradeableV3 } from "contracts/zilbridge/2/LockProxyTokenManagerUpgradeableV3.sol"; | ||
import { LockProxyTokenManagerDeployer } from "test/zilbridge/TokenManagerDeployers/LockProxyTokenManagerDeployer.sol"; | ||
|
||
/*** @notice does what ZilBridgeFixture::deployOriginalContracts() does */ | ||
contract deployMockZilBridge is Script { | ||
uint64 constant CHAIN_ID=6; | ||
uint64 constant COUNTERPART_CHAIN_ID=18; | ||
|
||
function run() external { | ||
EthCrossChainManager ccm; | ||
EthCrossChainManagerProxy ccmProxy; | ||
EthCrossChainData eccd; | ||
LockProxy lockProxy; | ||
EthExtendCrossChainManager extendCCM; | ||
|
||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY_ZILBRIDGE"); | ||
address owner = vm.addr(deployerPrivateKey); | ||
address[] memory a = new address[](0); | ||
bytes[] memory b = new bytes[](0); | ||
vm.startBroadcast(deployerPrivateKey); | ||
console.log("Owner: %s", owner); | ||
eccd = new EthCrossChainData(); | ||
console.log("ECCD: %s", address(eccd)); | ||
ccm = new EthCrossChainManager(address(eccd), CHAIN_ID, a, b); | ||
console.log("CCM: %s", address(ccm)); | ||
ccmProxy = new EthCrossChainManagerProxy(address(ccm)); | ||
console.log("CCMProxy: %s", address(ccmProxy)); | ||
ccm.transferOwnership(address(ccmProxy)); | ||
eccd.transferOwnership(address(ccm)); | ||
lockProxy = new LockProxy(address(ccmProxy), COUNTERPART_CHAIN_ID); | ||
console.log("LockProxy: %s",address(lockProxy)); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
smart-contracts/script/bsc-testnet/deployXBridgeOverMockZilBridge.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,38 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
pragma solidity ^0.8.20; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import "forge-std/console.sol"; | ||
import {Tester} from "test/Tester.sol"; | ||
import {TestToken} from "test/Helpers.sol"; | ||
import { LockProxy } from "contracts/zilbridge/1/lockProxy.sol"; | ||
import { EthCrossChainManagerProxy } from "contracts/zilbridge/1/ccmProxy.sol"; | ||
import { EthCrossChainManager } from "contracts/zilbridge/1/ccmCrossChainManager.sol"; | ||
import { EthCrossChainData } from "contracts/zilbridge/1/ethCrossChainData.sol"; | ||
import { EthExtendCrossChainManager } from "contracts/zilbridge/2/ccmExtendCrossChainManager.sol"; | ||
import { LockProxyTokenManagerUpgradeableV3 } from "contracts/zilbridge/2/LockProxyTokenManagerUpgradeableV3.sol"; | ||
import { LockProxyTokenManagerDeployer } from "test/zilbridge/TokenManagerDeployers/LockProxyTokenManagerDeployer.sol"; | ||
|
||
/*** @notice ZilBridgeFixture::installExtendCrossManager() */ | ||
contract deployXBridgeOverMockZilBridge is Script { | ||
// Plug in the data from deployMockZilBridge here. | ||
EthCrossChainData public constant eccd = EthCrossChainData(0xd677494525D25238Fedd554796eEa5733a9B86a2); | ||
EthCrossChainManager public constant ccm = EthCrossChainManager(0xff4AC43f368676765de511F82B816EED9b9D780c); | ||
EthCrossChainManagerProxy public constant ccmProxy = EthCrossChainManagerProxy(0xd7a76e4454c4f4F80E6409DF361B7926a1789d93); | ||
LockProxy public constant lockProxy = LockProxy(payable(0x218D8aFE24bb2a0d1DE483Ff67aCADB45Ac8Bd2d)); | ||
EthExtendCrossChainManager extendCCM; | ||
|
||
function run() external { | ||
address[] memory a = new address[](0); | ||
bytes[] memory b = new bytes[](0); | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY_ZILBRIDGE"); | ||
vm.startBroadcast(deployerPrivateKey); | ||
address owner = vm.addr(deployerPrivateKey); | ||
extendCCM = new EthExtendCrossChainManager(address(eccd), 2, a, b); | ||
ccmProxy.pauseEthCrossChainManager(); | ||
extendCCM.transferOwnership(address(ccmProxy)); | ||
ccmProxy.upgradeEthCrossChainManager(address(extendCCM)); | ||
ccmProxy.unpauseEthCrossChainManager(); | ||
console.log("extendCCM: %s", address(extendCCM)); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
smart-contracts/script/bsc-testnet/deployZilBridgeTokenManagers.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,53 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
pragma solidity ^0.8.20; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import "forge-std/console.sol"; | ||
import {Tester} from "test/Tester.sol"; | ||
import {TestToken} from "test/Helpers.sol"; | ||
import { LockProxy } from "contracts/zilbridge/1/lockProxy.sol"; | ||
import { TestingLockProxy } from "test/zilbridge/TestingLockProxy.sol"; | ||
import { EthCrossChainManagerProxy } from "contracts/zilbridge/1/ccmProxy.sol"; | ||
import { EthCrossChainManager } from "contracts/zilbridge/1/ccmCrossChainManager.sol"; | ||
import { EthCrossChainData } from "contracts/zilbridge/1/ethCrossChainData.sol"; | ||
import { EthExtendCrossChainManager } from "contracts/zilbridge/2/ccmExtendCrossChainManager.sol"; | ||
import { ChainGateway } from "contracts/core/ChainGateway.sol"; | ||
import { LockProxyTokenManagerUpgradeableV3 } from "contracts/zilbridge/2/LockProxyTokenManagerUpgradeableV3.sol"; | ||
import { LockProxyTokenManagerDeployer } from "test/zilbridge/TokenManagerDeployers/LockProxyTokenManagerDeployer.sol"; | ||
import {LockProxyTokenManagerUpgradeableV3} from "contracts/zilbridge/2/LockProxyTokenManagerUpgradeableV3.sol"; | ||
import {LockProxyTokenManagerDeployer} from "test/zilbridge/TokenManagerDeployers/LockProxyTokenManagerDeployer.sol"; | ||
import {MintAndBurnTokenManagerDeployer} from "test/periphery/TokenManagerDeployers/MintAndBurnTokenManagerDeployer.sol"; | ||
import {LockAndReleaseTokenManagerDeployer} from "test/periphery/TokenManagerDeployers/LockAndReleaseTokenManagerDeployer.sol"; | ||
import { SwitcheoToken } from "contracts/zilbridge/token/tokens/SwitcheoTokenETH.sol"; | ||
|
||
/*** @notice Deploy token managers over the extension manager | ||
*/ | ||
contract deployZilBridgeTokenManagers is Script, LockProxyTokenManagerDeployer { | ||
EthExtendCrossChainManager constant extendCCM = EthExtendCrossChainManager(0xF2eeaceDB35776412fe999D45aA81Ea674030aE1); | ||
ChainGateway constant chainGateway = ChainGateway(0xa9A14C90e53EdCD89dFd201A3bF94D867f8098fE); | ||
LockProxy constant lockProxy = LockProxy(payable(0x218D8aFE24bb2a0d1DE483Ff67aCADB45Ac8Bd2d)); | ||
// Different from 0.00025 so that we can tell the difference! | ||
uint fees = 0.00007 ether; | ||
|
||
// This has to be 18, because that is what the original (ZilBridge) contracts were | ||
// deployed with. The mainnet value is 5. | ||
uint64 constant COUNTERPART_CHAIN_ID = 18; | ||
|
||
function run() external { | ||
uint256 validatorPrivateKey = vm.envUint("PRIVATE_KEY_VALIDATOR"); | ||
uint256 bridgePrivateKey = vm.envUint("PRIVATE_KEY_ZILBRIDGE"); | ||
address validator = vm.addr(validatorPrivateKey); | ||
address bridgeOwner = vm.addr(bridgePrivateKey); | ||
// token managers are apparently not pausable, so .. | ||
vm.startBroadcast(validatorPrivateKey); | ||
LockProxyTokenManagerUpgradeableV3 tokenManager = deployLatestLockProxyTokenManager(address(chainGateway), address(lockProxy), fees); | ||
console.log("zilbridge tokenmanager: %s", address(tokenManager)); | ||
vm.stopBroadcast(); | ||
vm.startBroadcast(bridgePrivateKey); | ||
extendCCM.forciblyAddExtension(address(lockProxy), address(tokenManager), COUNTERPART_CHAIN_ID); | ||
vm.stopBroadcast(); | ||
vm.startBroadcast(validatorPrivateKey); | ||
chainGateway.register(address(tokenManager)); | ||
vm.stopBroadcast(); | ||
} | ||
} |
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