@@ -21,6 +21,8 @@ import "../interfaces/IStrategyLogic.sol";
2121
2222/// @notice Platform factory assembling vaults. Stores vault settings, strategy logic, farms.
2323/// Provides the opportunity to upgrade vaults and strategies.
24+ /// Changelog:
25+ /// 1.1.0: getDeploymentKey fix for not farming strategies, strategyAvailableInitParams
2426/// @author Alien Deployer (https://github.com/a17)
2527/// @author Jude (https://github.com/iammrjude)
2628/// @author JodsMigel (https://github.com/JodsMigel)
@@ -31,7 +33,7 @@ contract Factory is Controllable, ReentrancyGuardUpgradeable, IFactory {
3133 //region ----- Constants -----
3234
3335 /// @inheritdoc IControllable
34- string public constant VERSION = "1.0.3 " ;
36+ string public constant VERSION = "1.1.0 " ;
3537
3638 uint internal constant _WEEK = 60 * 60 * 24 * 7 ;
3739
@@ -43,29 +45,6 @@ contract Factory is Controllable, ReentrancyGuardUpgradeable, IFactory {
4345
4446 //endregion -- Constants -----
4547
46- //region ----- Storage -----
47-
48- /// @custom:storage-location erc7201:stability.Factory
49- struct FactoryStorage {
50- /// @inheritdoc IFactory
51- mapping (bytes32 typeHash = > VaultConfig) vaultConfig;
52- /// @inheritdoc IFactory
53- mapping (bytes32 idHash = > StrategyLogicConfig) strategyLogicConfig;
54- /// @inheritdoc IFactory
55- mapping (bytes32 deploymentKey = > address vaultProxy ) deploymentKey;
56- /// @inheritdoc IFactory
57- mapping (address vault = > uint status ) vaultStatus;
58- /// @inheritdoc IFactory
59- mapping (address address_ = > bool isStrategy_ ) isStrategy;
60- EnumerableSet.Bytes32Set vaultTypeHashes;
61- EnumerableSet.Bytes32Set strategyLogicIdHashes;
62- mapping (uint week = > mapping (uint builderPermitTokenId = > uint vaultsBuilt )) vaultsBuiltByPermitTokenId;
63- address [] deployedVaults;
64- Farm[] farms;
65- }
66-
67- //endregion -- Storage -----
68-
6948 //region ----- Data types -----
7049
7150 struct DeployVaultAndStrategyVars {
@@ -100,16 +79,9 @@ contract Factory is Controllable, ReentrancyGuardUpgradeable, IFactory {
10079 /// @inheritdoc IFactory
10180 function setVaultConfig (VaultConfig memory vaultConfig_ ) external onlyOperator {
10281 FactoryStorage storage $ = _getStorage ();
103- string memory type_ = vaultConfig_.vaultType;
104- bytes32 typeHash = keccak256 (abi.encodePacked (type_));
105- $.vaultConfig[typeHash] = vaultConfig_;
106- bool newVaultType = $.vaultTypeHashes.add (typeHash);
107- if (! newVaultType) {
82+ if (FactoryLib.setVaultConfig ($, vaultConfig_)) {
10883 _requireGovernanceOrMultisig ();
10984 }
110- emit VaultConfigChanged (
111- type_, vaultConfig_.implementation, vaultConfig_.deployAllowed, vaultConfig_.upgradeAllowed, newVaultType
112- );
11385 }
11486
11587 /// @inheritdoc IFactory
@@ -165,12 +137,22 @@ contract Factory is Controllable, ReentrancyGuardUpgradeable, IFactory {
165137 emit UpdateFarm (id, farm_);
166138 }
167139
140+ /// @inheritdoc IFactory
141+ function setStrategyAvailableInitParams (
142+ string memory id ,
143+ StrategyAvailableInitParams memory initParams
144+ ) external onlyOperator {
145+ FactoryStorage storage $ = _getStorage ();
146+ bytes32 idHash = keccak256 (abi.encodePacked (id));
147+ $.strategyAvailableInitParams[idHash] = initParams;
148+ emit SetStrategyAvailableInitParams (id, initParams.initAddresses, initParams.initNums, initParams.initTicks);
149+ }
150+
168151 //endregion -- Restricted actions ----
169152
170153 //region ----- User actions -----
171154
172155 /// @inheritdoc IFactory
173-
174156 //slither-disable-next-line cyclomatic-complexity reentrancy-benign
175157 function deployVaultAndStrategy (
176158 string memory vaultType ,
@@ -536,7 +518,7 @@ contract Factory is Controllable, ReentrancyGuardUpgradeable, IFactory {
536518 initStrategyAddresses,
537519 initStrategyNums,
538520 initStrategyTicks,
539- [1 , 0 , 0 , 1 , 0 ]
521+ [1 , 0 , 1 , 1 , 0 ]
540522 );
541523 }
542524
@@ -594,6 +576,12 @@ contract Factory is Controllable, ReentrancyGuardUpgradeable, IFactory {
594576 return _getStorage ().vaultsBuiltByPermitTokenId[week][builderPermitTokenId];
595577 }
596578
579+ /// @inheritdoc IFactory
580+ function strategyAvailableInitParams (bytes32 idHash ) external view returns (StrategyAvailableInitParams memory ) {
581+ FactoryStorage storage $ = _getStorage ();
582+ return $.strategyAvailableInitParams[idHash];
583+ }
584+
597585 //endregion -- View functions -----
598586
599587 //region ----- Internal logic -----
0 commit comments