diff --git a/.github/workflows/deploy-sepolia-strategy.yaml b/.github/workflows/deploy-sepolia-strategy.yaml index 24b694ef..864e326a 100644 --- a/.github/workflows/deploy-sepolia-strategy.yaml +++ b/.github/workflows/deploy-sepolia-strategy.yaml @@ -30,6 +30,14 @@ on: description: 'Required reserve ratio' required: false default: '0.01' + collateralTokens: + description: 'Collateral tokens comma separated' + required: false + default: '0x' + minCollateralRatios: + description: 'Minimum collateral ratio comma separated' + required: false + default: '0.01' jobs: deploy: @@ -66,4 +74,6 @@ jobs: GOVERNOR_ROLE_ADDRESS: ${{ vars.GOVERNANCE_FACTORY }} STRATEGY_MANAGEMENT_ADDRESS: ${{ github.event.inputs.strategyManagementAddress }} NEW_REQUIRED_RESERVE_RATIO: ${{ github.event.inputs.requiredReserveRatio }} + COLLATERAL_TOKENS: ${{ github.event.inputs.collateralTokens }} + MIN_COLLATERAL_RATIOS: ${{ github.event.inputs.minCollateralRatios }} \ No newline at end of file diff --git a/script/Strategy.s.sol b/script/Strategy.s.sol index 12ca6015..4e1dbce3 100644 --- a/script/Strategy.s.sol +++ b/script/Strategy.s.sol @@ -128,7 +128,6 @@ contract DeployStrategy is Script { function run() external { uint256 deployerPK = vm.envUint("PRIVATE_KEY"); - uint256 governorDeployerPK = vm.envUint("GOVERNOR_DEPLOYER_KEY"); // Set up the RPC URL (optional if you're using the default foundry config) string memory rpcUrl = vm.envString("RPC_URL"); @@ -138,18 +137,29 @@ contract DeployStrategy is Script { // Retrieve environment variables string memory name = vm.envString("STRATEGY_NAME"); address strategyManagement = vm.envAddress("STRATEGY_MANAGEMENT_ADDRESS"); + address[] memory collateralTokens = stringToAddressArray(vm.envString("COLLATERAL_TOKEN_ADDRESSES")); + uint256[] memory minCollateralRatios = stringToUintArray(vm.envString("MIN_COLLATERAL_RATIO")); + address governorRoleAddress = vm.envAddress("GOVERNOR_ROLE_ADDRESS"); + bool isTest = vm.envBool("IS_TEST"); TermVaultEventEmitter eventEmitter = _deployEventEmitter(); - Strategy.StrategyParams memory params = buildStrategyParams(address(eventEmitter)); + address deployer = vm.addr(deployerPK); + + Strategy.StrategyParams memory params = buildStrategyParams(address(eventEmitter), deployer); Strategy strategy = new Strategy( name, params ); + for (uint256 i = 0; i < collateralTokens.length; i++) { + strategy.setCollateralTokenParams(collateralTokens[i], minCollateralRatios[i]); + } + + console.log("deployed strategy contract to"); console.log(address(strategy)); @@ -157,6 +167,10 @@ contract DeployStrategy is Script { console.log("set pending management"); console.log(strategyManagement); + strategy.setPendingGovernor(governorRoleAddress); + console.log("set pending governor"); + console.log(governorRoleAddress); + if (isTest) { eventEmitter.pairVaultContract(address(strategy)); console.log("paired strategy contract with event emitter"); @@ -165,13 +179,12 @@ contract DeployStrategy is Script { vm.stopBroadcast(); } - function buildStrategyParams(address eventEmitter) internal returns(Strategy.StrategyParams memory) { + function buildStrategyParams(address eventEmitter, address deployer) internal returns(Strategy.StrategyParams memory) { address asset = vm.envAddress("ASSET_ADDRESS"); address yearnVaultAddress = vm.envAddress("YEARN_VAULT_ADDRESS"); address discountRateAdapterAddress = vm.envAddress("DISCOUNT_RATE_ADAPTER_ADDRESS"); address termController = vm.envAddress("TERM_CONTROLLER_ADDRESS"); uint256 discountRateMarkup = vm.envUint("DISCOUNT_RATE_MARKUP"); - address governorRoleAddress = vm.envAddress("GOVERNOR_ROLE_ADDRESS"); uint256 timeToMaturityThreshold = vm.envUint("TIME_TO_MATURITY_THRESHOLD"); uint256 repoTokenConcentrationLimit = vm.envUint("REPOTOKEN_CONCENTRATION_LIMIT"); uint256 newRequiredReserveRatio = vm.envUint("NEW_REQUIRED_RESERVE_RATIO"); @@ -183,7 +196,7 @@ contract DeployStrategy is Script { yearnVaultAddress, discountRateAdapterAddress, address(eventEmitter), - governorRoleAddress, + deployer, termController, repoTokenConcentrationLimit, timeToMaturityThreshold,