diff --git a/packages/contracts/script/DeployVaultFactory.s.sol b/packages/contracts/script/DeployVaultFactory.s.sol index 909b91152..c23730108 100644 --- a/packages/contracts/script/DeployVaultFactory.s.sol +++ b/packages/contracts/script/DeployVaultFactory.s.sol @@ -45,18 +45,20 @@ contract DeployVaultFactory is Script { address owner = config.factoryParams.owner; address operator = config.factoryParams.operator; + address[] memory custodians = new address[](1); + custodians[0] = config.factoryParams.custodian; DeployedContracts deployChecker = new DeployedContracts(); vm.startBroadcast(); if (isTestMode || deployChecker.isDeployRequired("CredbullFixedYieldVaultFactory")) { - factory = new CredbullFixedYieldVaultFactory(owner, operator); + factory = new CredbullFixedYieldVaultFactory(owner, operator, custodians); console2.log("!!!!! Deploying CredbullFixedYieldVaultFactory !!!!!"); } if (isTestMode || deployChecker.isDeployRequired("CredbullUpsideVaultFactory")) { - upsideFactory = new CredbullUpsideVaultFactory(owner, operator); + upsideFactory = new CredbullUpsideVaultFactory(owner, operator, custodians); console2.log("!!!!! Deploying CredbullVaultWithUpsideFactory !!!!!"); } diff --git a/packages/contracts/src/factories/CredbullFixedYieldVaultFactory.sol b/packages/contracts/src/factories/CredbullFixedYieldVaultFactory.sol index e64d1f287..44819a5a3 100644 --- a/packages/contracts/src/factories/CredbullFixedYieldVaultFactory.sol +++ b/packages/contracts/src/factories/CredbullFixedYieldVaultFactory.sol @@ -10,8 +10,11 @@ contract CredbullFixedYieldVaultFactory is CredbullVaultFactory { /** * @param owner - The owner of the factory contract * @param operator - The operator of the factory contract + * @param custodians - The custodians allowable for the vaults */ - constructor(address owner, address operator) CredbullVaultFactory(owner, operator) { } + constructor(address owner, address operator, address[] memory custodians) + CredbullVaultFactory(owner, operator, custodians) + { } /** * @notice - Function to create a new vault. Should be called only by the owner diff --git a/packages/contracts/src/factories/CredbullUpsideVaultFactory.sol b/packages/contracts/src/factories/CredbullUpsideVaultFactory.sol index 5ddc165e3..c9efa21bd 100644 --- a/packages/contracts/src/factories/CredbullUpsideVaultFactory.sol +++ b/packages/contracts/src/factories/CredbullUpsideVaultFactory.sol @@ -8,10 +8,13 @@ import { CredbullVaultFactory } from "./CredbullVaultFactory.sol"; contract CredbullUpsideVaultFactory is CredbullVaultFactory { /** - * @param owner - The owner of the Factory contract - * @param operator - The operator of the Factory contract + * @param owner - The owner of the factory contract + * @param operator - The operator of the factory contract + * @param custodians - The custodians allowable for the vaults */ - constructor(address owner, address operator) CredbullVaultFactory(owner, operator) { } + constructor(address owner, address operator, address[] memory custodians) + CredbullVaultFactory(owner, operator, custodians) + { } /** * @notice - Function to create a new upside vault. Should be called only by the owner diff --git a/packages/contracts/src/factories/CredbullVaultFactory.sol b/packages/contracts/src/factories/CredbullVaultFactory.sol index 681f729e3..959a55b3a 100644 --- a/packages/contracts/src/factories/CredbullVaultFactory.sol +++ b/packages/contracts/src/factories/CredbullVaultFactory.sol @@ -28,13 +28,19 @@ abstract contract CredbullVaultFactory is AccessControl { bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE"); /** - * * @param owner - Owner of the factory contract * @param operator - Operator of the factory contract + * @param custodians - Initial set of custodians allowable for the vaults */ - constructor(address owner, address operator) { + constructor(address owner, address operator, address[] memory custodians) { _grantRole(DEFAULT_ADMIN_ROLE, owner); _grantRole(OPERATOR_ROLE, operator); + + // set the allowed custodians directly in the constructor, without access restriction + bool[] memory result = new bool[](custodians.length); + for (uint256 i = 0; i < custodians.length; i++) { + result[i] = allowedCustodians.add(custodians[i]); + } } /**