From 028da6222388a9ea29311070958009c8e7490a4e Mon Sep 17 00:00:00 2001 From: Richard Watts Date: Fri, 20 Dec 2024 17:23:32 +0000 Subject: [PATCH] (feat) Deploy token managers to bsc. --- docs/zilbridge_to_xbridge.md | 1 + .../bsc/deploy/03_registerLockProxy.s.sol | 22 +++++++++++++++++++ smart-contracts/script/mainnetConfig.s.sol | 2 ++ 3 files changed, 25 insertions(+) create mode 100644 smart-contracts/script/bsc/deploy/03_registerLockProxy.s.sol diff --git a/docs/zilbridge_to_xbridge.md b/docs/zilbridge_to_xbridge.md index 559a8f5..e6c8836 100644 --- a/docs/zilbridge_to_xbridge.md +++ b/docs/zilbridge_to_xbridge.md @@ -72,6 +72,7 @@ Same as `zq`: export ETHERSCAN_API_KEY=... export BSC_RPC_URL=.. forge script script/bsc/deploy/02_deployZilbridgeTokenManagers.s.sol --rpc-url ${BSC_RPC_URL} --broadcast --chain-id 56 --verify --legacy +forge script script/bsc/deploy/03_registerLockProxy.s.sol --rpc-url ${BSC_RPC_URL} --broadcast --chain-id 56 --verify --legacy ``` diff --git a/smart-contracts/script/bsc/deploy/03_registerLockProxy.s.sol b/smart-contracts/script/bsc/deploy/03_registerLockProxy.s.sol new file mode 100644 index 0000000..2209293 --- /dev/null +++ b/smart-contracts/script/bsc/deploy/03_registerLockProxy.s.sol @@ -0,0 +1,22 @@ +// 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 {LockProxyTokenManagerUpgradeableV3} from "contracts/periphery/TokenManagerV3/LockProxyTokenManagerUpgradeableV3.sol"; +import {LockAndReleaseOrNativeTokenManagerUpgradeableV3} from "contracts/periphery/TokenManagerV3/LockAndReleaseOrNativeTokenManagerUpgradeableV3.sol"; +import { MainnetConfig } from "script/mainnetConfig.s.sol"; + +contract registerLockProxy is Script, MainnetConfig { + function run() external { + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY_OWNER"); + vm.startBroadcast(deployerPrivateKey); + // The lock proxy token manager needs to know where its lock proxy is. + LockProxyTokenManagerUpgradeableV3 lockProxyTokenManager = LockProxyTokenManagerUpgradeableV3(payable(bscLockProxyTokenManager)); + // LockAndReleaseOrNativeTokenManagerUpgradeableV3 lockAndReleaseOrNativeTokenManager = LockAndReleaseOrNativeTokenManagerUpgradeableV3(payable(bscLockAndReleaseOrNativeTokenManagerUpgradeable)); + + lockProxyTokenManager.setLockProxyData(bscLockProxy, bscLockProxyProxy); + vm.stopBroadcast(); + } + +} diff --git a/smart-contracts/script/mainnetConfig.s.sol b/smart-contracts/script/mainnetConfig.s.sol index d5667a9..68ba0cc 100644 --- a/smart-contracts/script/mainnetConfig.s.sol +++ b/smart-contracts/script/mainnetConfig.s.sol @@ -19,6 +19,8 @@ abstract contract MainnetConfig { address public constant bscLockProxyProxy = 0xD819257C964A78A493DF93D5643E9490b54C5af2; address public constant bscChainGatewayAddress = 0x3967f1a272Ed007e6B6471b942d655C802b42009; address public constant bscTokenManagerMintAndBurn = 0xF391A1Ee7b3ccad9a9451D2B7460Ac646F899f23; + address public constant bscLockAndReleaseOrNativeTokenManagerUpgradeable = 0x1202078D298Ff0358A95b6fbf48Ec166dB414660; + address public constant bscLockProxyTokenManager = 0x2EE8e8D7C113Bb7c180f4755f06ed50bE53BEDe5; address public constant polLockProxy = 0x43138036d1283413035B8eca403559737E8f7980; address public constant polLockProxyProxy = 0x9121A67cA79B6778eAb477c5F76dF6de7C79cC4b;