|
| 1 | +pragma solidity ^0.8.12; |
| 2 | + |
| 3 | +import "forge-std/Script.sol"; |
| 4 | +import "forge-std/StdJson.sol"; |
| 5 | + |
| 6 | +import {IStrategyManager} from |
| 7 | + "../../eigenlayer_contracts/eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol"; |
| 8 | +import {IStrategy} from "../../eigenlayer_contracts/eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol"; |
| 9 | +import {PauserRegistry} from |
| 10 | + "../../eigenlayer_contracts/eigenlayer-contracts/src/contracts/permissions/PauserRegistry.sol"; |
| 11 | +import {StrategyBaseTVLLimits} from |
| 12 | + "../../eigenlayer_contracts/eigenlayer-contracts/src/contracts/strategies/StrategyBaseTVLLimits.sol"; |
| 13 | +import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol"; |
| 14 | + |
| 15 | +contract AlignedStrategyDeployerScript is Script { |
| 16 | + function run(string calldata configFile, string calldata eigenOutputFile) external { |
| 17 | + string memory configData = vm.readFile(configFile); |
| 18 | + string memory outputData = vm.readFile(eigenOutputFile); |
| 19 | + |
| 20 | + address strategyManagerAddress = stdJson.readAddress(outputData, ".address.alignedAggregatorAddress"); |
| 21 | + IStrategyManager strategyManager = IStrategyManager(strategyManagerAddress); |
| 22 | + |
| 23 | + address eigenLayerPauserRegAddress = stdJson.readAddress(outputData, ".address.eigenLayerPauserReg"); |
| 24 | + PauserRegistry eigenLayerPauserReg = PauserRegistry(eigenLayerPauserRegAddress); |
| 25 | + |
| 26 | + string calldata strategyVersion = stdJson.readString(configData, ".strategy.version"); |
| 27 | + string calldata strategyMaxPerDeposit = stdJson.readString(configData, ".strategy.maxPerDeposit"); |
| 28 | + string calldata strategyMaxDeposits = stdJson.readString(configData, ".strategy.maxDeposits"); |
| 29 | + string calldata tokenOwner = stdJson.readString(configData, ".strategy.token.owner"); |
| 30 | + string calldata tokenName = stdJson.readString(configData, ".strategy.token.name"); |
| 31 | + string calldata tokenSymbol = stdJson.readString(configData, ".strategy.token.symbol"); |
| 32 | + |
| 33 | + vm.startBroadcast(); |
| 34 | + |
| 35 | + IStrategy[] memory strategiesToWhitelist; |
| 36 | + |
| 37 | + // Deploy Aligned strategy |
| 38 | + IStrategy alignedStrategyImplementation = |
| 39 | + new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg, strategyVersion); |
| 40 | + IERC20 alignedStrategyToken = |
| 41 | + new ERC20PresetFixedSupply(tokenName, tokenSymbol, uint256(type(uint128).max), tokenOwner); |
| 42 | + IStrategy alignedStrategy = IStrategy( |
| 43 | + new TransparentUpgradeableProxy( |
| 44 | + address(alignedStrategyImplementation), |
| 45 | + address(eigenLayerProxyAdmin), |
| 46 | + abi.encodeWithSelector( |
| 47 | + StrategyBaseTVLLimits.initialize.selector, |
| 48 | + strategyMaxPerDeposit, |
| 49 | + strategyMaxDeposits, |
| 50 | + IERC20(address(alignedStrategyToken)) |
| 51 | + ) |
| 52 | + ) |
| 53 | + ); |
| 54 | + |
| 55 | + // Whitelist strategy |
| 56 | + strategiesToWhitelist[0] = alignedStrategy; |
| 57 | + strategyManager.addStrategiesToDepositWhitelist(strategiesToWhitelist); |
| 58 | + |
| 59 | + vm.stopBroadcast(); |
| 60 | + |
| 61 | + vm.writeJson(eigenOutputFile, ".strategy.alignedStrategy", address(alignedStrategy)); |
| 62 | + vm.writeJson(eigenOutputFile, ".strategy.alignedStrategyImplementation", address(alignedStrategyImplementation)); |
| 63 | + vm.writeJson(eigenOutputFile, ".strategy.token.address", address(alignedStrategyToken)); |
| 64 | + } |
| 65 | +} |
0 commit comments