|
| 1 | +// SPDX-License-Identifier: UNLICENSED |
| 2 | +pragma solidity ^0.8.23; |
| 3 | + |
| 4 | +import {Script} from "forge-std/Script.sol"; |
| 5 | +import {VmSafe} from "forge-std/Vm.sol"; |
| 6 | + |
| 7 | +import {IBytecodeRepository} from "@gearbox-protocol/permissionless/contracts/interfaces/IBytecodeRepository.sol"; |
| 8 | +import {Domain} from "@gearbox-protocol/permissionless/contracts/libraries/Domain.sol"; |
| 9 | + |
| 10 | +import {AccountMigratorBot} from "../contracts/migration/AccountMigratorBot.sol"; |
| 11 | +import {AccountMigratorPreviewer} from "../contracts/migration/AccountMigratorPreviewer.sol"; |
| 12 | + |
| 13 | +import {IConvexV1BaseRewardPoolAdapter} from |
| 14 | + "@gearbox-protocol/integrations-v3/contracts/interfaces/convex/IConvexV1BaseRewardPoolAdapter.sol"; |
| 15 | +import {IStakingRewardsAdapter} from |
| 16 | + "@gearbox-protocol/integrations-v3/contracts/interfaces/sky/IStakingRewardsAdapter.sol"; |
| 17 | + |
| 18 | +import {console} from "forge-std/console.sol"; |
| 19 | + |
| 20 | +address constant stkcvxRLUSD_USDC = 0x444FA0ffb033265591895b66c81c2e5fF606E097; |
| 21 | +address constant stkcvxllamathena = 0x72eD19788Bce2971A5ed6401662230ee57e254B7; |
| 22 | +address constant stkUSDS = 0xcB5D10A57Aeb622b92784D53F730eE2210ab370E; |
| 23 | + |
| 24 | +address constant stkcvxRLUSD_USDC_new = 0x87FA6c0296c986D1C901d72571282D57916B964a; |
| 25 | +address constant stkcvxllamathena_new = 0xB5528130B1d5D24aD172bF54CeeD062232AfbFBe; |
| 26 | +address constant stkUSDS_new = 0x00F7C0d39B05089e93858A82439EA17dE7160B5a; |
| 27 | + |
| 28 | +address constant cvxRLUSD_USDC = 0xBd5D4c539B3773086632416A4EC8ceF57c945319; |
| 29 | +address constant cvxllamathena = 0x237926E55f9deee89833a42dEb92d3a6970850B4; |
| 30 | +address constant USDS = 0xdC035D45d973E3EC169d2276DDab16f1e407384F; |
| 31 | + |
| 32 | +contract SetUpMigrationBot is Script { |
| 33 | + address constant mcFactory = 0x7D60CfaF7c2cec210638A5e46E4000894830C034; |
| 34 | + address constant router = 0x00aDE38841AB8c6e236E232041e43B41d74B8B45; |
| 35 | + address constant ioProxy = 0xBcD875f0D62B9AA22481c81975F9AE1753Fc559A; |
| 36 | + address contractsRegisterOld; |
| 37 | + VmSafe.Wallet deployer; |
| 38 | + |
| 39 | + bool setUpOverrides; |
| 40 | + |
| 41 | + function run() external { |
| 42 | + contractsRegisterOld = vm.envAddress("CONTRACTS_REGISTER_OLD"); |
| 43 | + setUpOverrides = vm.envBool("SET_UP_OVERRIDES"); |
| 44 | + |
| 45 | + deployer = vm.createWallet(vm.envUint("DEPLOYER_PRIVATE_KEY")); |
| 46 | + |
| 47 | + vm.startBroadcast(deployer.privateKey); |
| 48 | + AccountMigratorBot accountMigratorBot = new AccountMigratorBot(mcFactory, deployer.addr, contractsRegisterOld); |
| 49 | + AccountMigratorPreviewer accountMigratorPreviewer = |
| 50 | + new AccountMigratorPreviewer(address(accountMigratorBot), router); |
| 51 | + |
| 52 | + if (setUpOverrides) { |
| 53 | + accountMigratorBot.setPhantomTokenOverride( |
| 54 | + stkcvxRLUSD_USDC, |
| 55 | + stkcvxRLUSD_USDC_new, |
| 56 | + cvxRLUSD_USDC, |
| 57 | + abi.encodeCall(IConvexV1BaseRewardPoolAdapter.withdrawDiff, (0, false)) |
| 58 | + ); |
| 59 | + |
| 60 | + accountMigratorBot.setPhantomTokenOverride( |
| 61 | + stkcvxllamathena, |
| 62 | + stkcvxllamathena_new, |
| 63 | + cvxllamathena, |
| 64 | + abi.encodeCall(IConvexV1BaseRewardPoolAdapter.withdrawDiff, (0, false)) |
| 65 | + ); |
| 66 | + |
| 67 | + accountMigratorBot.setPhantomTokenOverride( |
| 68 | + stkUSDS, stkUSDS_new, USDS, abi.encodeCall(IStakingRewardsAdapter.withdrawDiff, (0)) |
| 69 | + ); |
| 70 | + } |
| 71 | + |
| 72 | + accountMigratorBot.transferOwnership(ioProxy); |
| 73 | + vm.stopBroadcast(); |
| 74 | + |
| 75 | + console.log("AccountMigratorBot deployed to", address(accountMigratorBot)); |
| 76 | + console.log("AccountMigratorPreviewer deployed to", address(accountMigratorPreviewer)); |
| 77 | + } |
| 78 | +} |
0 commit comments