@etherisc/gif-next 0.0.2-98b8042-396 → 0.0.2-9a02a95-445
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +126 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +136 -10
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +88 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +26 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +160 -8
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +134 -8
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +788 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +39 -0
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +448 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +17 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +133 -157
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +275 -50
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +763 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +2 -2
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +183 -107
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +52 -36
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +285 -0
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +0 -19
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +923 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +440 -0
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +2 -2
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +16 -48
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +8 -24
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +669 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +664 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +9 -179
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +9 -233
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +984 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +464 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +20 -273
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +10 -42
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +20 -399
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +10 -78
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +2 -2
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +2 -2
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/BaseComponent.sol +49 -8
- package/contracts/components/IBaseComponent.sol +6 -0
- package/contracts/components/IPoolComponent.sol +4 -0
- package/contracts/components/Pool.sol +27 -3
- package/contracts/components/Product.sol +8 -5
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +23 -0
- package/contracts/instance/BundleManager.sol +129 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +6 -0
- package/contracts/instance/IInstanceBase.sol +26 -0
- package/contracts/instance/IInstanceService.sol +7 -3
- package/contracts/instance/Instance.sol +43 -18
- package/contracts/instance/InstanceAccessManager.sol +71 -20
- package/contracts/instance/InstanceBase.sol +41 -0
- package/contracts/instance/InstanceService.sol +167 -81
- package/contracts/instance/ObjectManager.sol +101 -0
- package/contracts/instance/base/ComponentServiceBase.sol +15 -77
- package/contracts/instance/module/ISetup.sol +0 -1
- package/contracts/instance/service/BundleService.sol +260 -0
- package/contracts/instance/service/BundleServiceManager.sol +54 -0
- package/contracts/instance/service/DistributionService.sol +38 -8
- package/contracts/instance/service/IBundleService.sol +45 -0
- package/contracts/instance/service/IPolicyService.sol +87 -0
- package/contracts/instance/service/IPoolService.sol +3 -26
- package/contracts/instance/service/IProductService.sol +2 -72
- package/contracts/instance/service/PolicyService.sol +508 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +41 -121
- package/contracts/instance/service/ProductService.sol +50 -438
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/RoleId.sol +6 -4
- package/package.json +1 -1
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1132
- package/contracts/instance/AccessManagedSimple.sol +0 -115
- package/contracts/instance/AccessManagerSimple.sol +0 -692
@@ -0,0 +1,129 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IInstance} from "./IInstance.sol";
|
5
|
+
import {INSTANCE} from "../types/ObjectType.sol";
|
6
|
+
import {InstanceReader} from "./InstanceReader.sol";
|
7
|
+
import {IPolicy} from "../instance/module/IPolicy.sol";
|
8
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
9
|
+
import {LibNftIdSet} from "../types/NftIdSet.sol";
|
10
|
+
import {NftId} from "../types/NftId.sol";
|
11
|
+
import {TimestampLib} from "../types/Timestamp.sol";
|
12
|
+
|
13
|
+
import {ObjectManager} from "./ObjectManager.sol";
|
14
|
+
|
15
|
+
contract BundleManager is
|
16
|
+
ObjectManager
|
17
|
+
{
|
18
|
+
|
19
|
+
event LogBundleManagerPolicyLinked(NftId bundleNftId, NftId policyNftId);
|
20
|
+
event LogBundleManagerPolicyUnlinked(NftId bundleNftId, NftId policyNftId);
|
21
|
+
|
22
|
+
event LogBundleManagerBundleAdded(NftId poolNftId, NftId bundleNftId);
|
23
|
+
event LogBundleManagerBundleUnlocked(NftId poolNftId, NftId bundleNftId);
|
24
|
+
event LogBundleManagerBundleLocked(NftId poolNftId, NftId bundleNftId);
|
25
|
+
|
26
|
+
error ErrorBundleManagerErrorPolicyAlreadyActivated(NftId policyNftId);
|
27
|
+
error ErrorBundleManagerErrorBundleLocked(NftId bundleNftId, NftId policyNftId);
|
28
|
+
error ErrorBundleManagerPolicyWithOpenClaims(NftId policyNftId, uint256 openClaimsCount);
|
29
|
+
error ErrorBundleManagerPolicyNotCloseable(NftId policyNftId);
|
30
|
+
error ErrorBundleManagerBundleUnknown(NftId bundleNftId);
|
31
|
+
error ErrorBundleManagerBundleNotRegistered(NftId bundleNftId);
|
32
|
+
|
33
|
+
mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
|
34
|
+
|
35
|
+
constructor() ObjectManager() {
|
36
|
+
}
|
37
|
+
|
38
|
+
|
39
|
+
/// @dev links a policy with its bundle
|
40
|
+
// to link a policy it MUST NOT yet have been activated
|
41
|
+
// the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
|
42
|
+
function linkPolicy(NftId policyNftId) external restricted() {
|
43
|
+
NftId bundleNftId = _instanceReader.getPolicyInfo(policyNftId).bundleNftId;
|
44
|
+
// decision will likely depend on the decision what to check here and what in the service
|
45
|
+
NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
|
46
|
+
|
47
|
+
// ensure bundle is unlocked (in active set) and registered with this instance
|
48
|
+
if (!_isActive(poolNftId, bundleNftId)) {
|
49
|
+
revert ErrorBundleManagerErrorBundleLocked(bundleNftId, policyNftId);
|
50
|
+
}
|
51
|
+
|
52
|
+
LibNftIdSet.add(_activePolicies[bundleNftId], policyNftId);
|
53
|
+
emit LogBundleManagerPolicyLinked(bundleNftId, policyNftId);
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
/// @dev unlinks a policy from its bundle
|
58
|
+
// to unlink a policy it must closable, ie. meet one of the following criterias
|
59
|
+
// - the policy MUST be past its expiry period and it MUST NOT have any open claims
|
60
|
+
// - the policy's payoutAmount MUST be equal to its sumInsuredAmount and MUST NOT have any open claims
|
61
|
+
function unlinkPolicy(NftId policyNftId) external restricted() {
|
62
|
+
IPolicy.PolicyInfo memory policyInfo = _instanceReader.getPolicyInfo(policyNftId);
|
63
|
+
|
64
|
+
NftId bundleNftId = policyInfo.bundleNftId;
|
65
|
+
// decision will likely depend on the decision what to check here and what in the service
|
66
|
+
NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
|
67
|
+
|
68
|
+
// ensure bundle is registered with this instance
|
69
|
+
if (!_contains(poolNftId, bundleNftId)) {
|
70
|
+
revert ErrorBundleManagerBundleUnknown(bundleNftId);
|
71
|
+
}
|
72
|
+
|
73
|
+
LibNftIdSet.remove(_activePolicies[bundleNftId], policyNftId);
|
74
|
+
emit LogBundleManagerPolicyUnlinked(policyInfo.bundleNftId, policyNftId);
|
75
|
+
}
|
76
|
+
|
77
|
+
|
78
|
+
/// @dev add a new bundle to a riskpool registerd with this instance
|
79
|
+
// the corresponding pool is fetched via instance reader
|
80
|
+
function add(NftId bundleNftId) external restricted() {
|
81
|
+
NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
|
82
|
+
|
83
|
+
// ensure pool is registered with instance
|
84
|
+
if(poolNftId.eqz()) {
|
85
|
+
revert ErrorBundleManagerBundleNotRegistered(bundleNftId);
|
86
|
+
}
|
87
|
+
|
88
|
+
_add(poolNftId, bundleNftId);
|
89
|
+
emit LogBundleManagerBundleAdded(poolNftId, bundleNftId);
|
90
|
+
}
|
91
|
+
|
92
|
+
/// @dev unlocked (active) bundles are available to underwrite new policies
|
93
|
+
function unlock(NftId bundleNftId) external restricted() {
|
94
|
+
NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
|
95
|
+
_activate(poolNftId, bundleNftId);
|
96
|
+
emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
|
97
|
+
}
|
98
|
+
|
99
|
+
/// @dev locked (deactivated) bundles may not underwrite any new policies
|
100
|
+
function lock(NftId bundleNftId) external restricted() {
|
101
|
+
NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
|
102
|
+
_deactivate(poolNftId, bundleNftId);
|
103
|
+
emit LogBundleManagerBundleLocked(poolNftId, bundleNftId);
|
104
|
+
}
|
105
|
+
|
106
|
+
function bundles(NftId poolNftId) external view returns(uint256) {
|
107
|
+
return _objects(poolNftId);
|
108
|
+
}
|
109
|
+
|
110
|
+
function getBundleNftId(NftId poolNftId, uint256 idx) external view returns(NftId bundleNftId) {
|
111
|
+
return _getObject(poolNftId, idx);
|
112
|
+
}
|
113
|
+
|
114
|
+
function activeBundles(NftId poolNftId) external view returns(uint256) {
|
115
|
+
return _activeObjs(poolNftId);
|
116
|
+
}
|
117
|
+
|
118
|
+
function getActiveBundleNftId(NftId poolNftId, uint256 idx) external view returns(NftId bundleNftId) {
|
119
|
+
return _getActiveObject(poolNftId, idx);
|
120
|
+
}
|
121
|
+
|
122
|
+
function activePolicies(NftId bundleNftId) external view returns(uint256) {
|
123
|
+
return LibNftIdSet.size(_activePolicies[bundleNftId]);
|
124
|
+
}
|
125
|
+
|
126
|
+
function getActivePolicy(NftId bundleNftId, uint256 idx) external view returns(NftId policyNftId) {
|
127
|
+
return LibNftIdSet.getElementAt(_activePolicies[bundleNftId], idx);
|
128
|
+
}
|
129
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
5
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
6
|
+
|
7
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
8
|
+
|
9
|
+
abstract contract Cloneable is
|
10
|
+
AccessManagedUpgradeable
|
11
|
+
{
|
12
|
+
event CloneableInitialized(address authority, address registry);
|
13
|
+
|
14
|
+
error CloneableRegistryInvalid(address registry);
|
15
|
+
|
16
|
+
IRegistry internal _registry;
|
17
|
+
|
18
|
+
constructor() {
|
19
|
+
_registry = IRegistry(address(0));
|
20
|
+
}
|
21
|
+
|
22
|
+
/// @dev call to initialize MUST be made in the same transaction as cloning of the contract
|
23
|
+
function initialize(
|
24
|
+
address authority,
|
25
|
+
address registry
|
26
|
+
)
|
27
|
+
public
|
28
|
+
initializer
|
29
|
+
{
|
30
|
+
// check/handle access managed
|
31
|
+
__AccessManaged_init(authority);
|
32
|
+
|
33
|
+
// check/handle registry
|
34
|
+
if (registry.code.length == 0) {
|
35
|
+
revert CloneableRegistryInvalid(registry);
|
36
|
+
}
|
37
|
+
|
38
|
+
_registry = IRegistry(registry);
|
39
|
+
|
40
|
+
emit CloneableInitialized(authority, registry);
|
41
|
+
}
|
42
|
+
|
43
|
+
function getRegistry() external view returns (IRegistry) {
|
44
|
+
return _registry;
|
45
|
+
}
|
46
|
+
}
|
@@ -3,12 +3,15 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
5
|
|
6
|
+
import {BundleManager} from "./BundleManager.sol";
|
6
7
|
import {InstanceReader} from "./InstanceReader.sol";
|
7
8
|
|
8
9
|
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
9
10
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
10
11
|
import {IPoolService} from "./service/IPoolService.sol";
|
11
12
|
import {IProductService} from "./service/IProductService.sol";
|
13
|
+
import {IPolicyService} from "./service/IPolicyService.sol";
|
14
|
+
import {IBundleService} from "./service/IBundleService.sol";
|
12
15
|
import {IBundle} from "./module/IBundle.sol";
|
13
16
|
import {ISetup} from "./module/ISetup.sol";
|
14
17
|
import {NftId} from "../types/NftId.sol";
|
@@ -25,6 +28,8 @@ interface IInstance is IERC165, IKeyValueStore {
|
|
25
28
|
function getDistributionService() external view returns (IDistributionService);
|
26
29
|
function getProductService() external view returns (IProductService);
|
27
30
|
function getPoolService() external view returns (IPoolService);
|
31
|
+
function getPolicyService() external view returns (IPolicyService);
|
32
|
+
function getBundleService() external view returns (IBundleService);
|
28
33
|
|
29
34
|
function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external;
|
30
35
|
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
|
@@ -51,4 +56,5 @@ interface IInstance is IERC165, IKeyValueStore {
|
|
51
56
|
function updatePolicyState(NftId policyNftId, StateId newState) external;
|
52
57
|
|
53
58
|
function getInstanceReader() external view returns (InstanceReader);
|
59
|
+
function getBundleManager() external view returns (BundleManager);
|
54
60
|
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
|
+
|
6
|
+
import {BundleManager} from "./BundleManager.sol";
|
7
|
+
import {InstanceReader} from "./InstanceReader.sol";
|
8
|
+
|
9
|
+
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
10
|
+
import {IDistributionService} from "./service/IDistributionService.sol";
|
11
|
+
import {IPoolService} from "./service/IPoolService.sol";
|
12
|
+
import {IProductService} from "./service/IProductService.sol";
|
13
|
+
import {IBundle} from "./module/IBundle.sol";
|
14
|
+
import {ISetup} from "./module/ISetup.sol";
|
15
|
+
import {NftId} from "../types/NftId.sol";
|
16
|
+
import {StateId} from "../types/StateId.sol";
|
17
|
+
import {RiskId} from "../types/RiskId.sol";
|
18
|
+
import {IRisk} from "./module/IRisk.sol";
|
19
|
+
import {IPolicy} from "./module/IPolicy.sol";
|
20
|
+
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
21
|
+
|
22
|
+
|
23
|
+
interface IInstanceBase is IERC165, IKeyValueStore {
|
24
|
+
|
25
|
+
|
26
|
+
}
|
@@ -10,21 +10,25 @@ import {IRegistry} from "../registry/IRegistry.sol";
|
|
10
10
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
11
11
|
import {IBaseComponent} from "../components/IBaseComponent.sol";
|
12
12
|
|
13
|
-
import {
|
13
|
+
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
14
14
|
import {Instance} from "./Instance.sol";
|
15
15
|
import {InstanceReader} from "./InstanceReader.sol";
|
16
|
+
import {BundleManager} from "./BundleManager.sol";
|
16
17
|
|
17
18
|
interface IInstanceService is IService {
|
18
19
|
|
20
|
+
error ErrorInstanceServiceRequestUnauhorized(address caller);
|
21
|
+
|
19
22
|
event LogInstanceCloned(address clonedAccessManagerAddress, address clonedInstanceAddress, address clonedInstanceReaderAddress, NftId clonedInstanceNftId);
|
20
23
|
|
21
24
|
function createInstanceClone()
|
22
25
|
external
|
23
26
|
returns (
|
24
|
-
|
27
|
+
InstanceAccessManager clonedAccessManager,
|
25
28
|
Instance clonedInstance,
|
26
29
|
NftId instanceNftId,
|
27
|
-
InstanceReader clonedInstanceReader
|
30
|
+
InstanceReader clonedInstanceReader,
|
31
|
+
BundleManager clonedBundleManager
|
28
32
|
);
|
29
33
|
}
|
30
34
|
|
@@ -3,9 +3,9 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
5
5
|
import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
|
6
|
+
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
|
7
|
+
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
6
8
|
|
7
|
-
import {AccessManagedSimple} from "./AccessManagedSimple.sol";
|
8
|
-
import {AccessManagerSimple} from "./AccessManagerSimple.sol";
|
9
9
|
import {IAccess} from "./module/IAccess.sol";
|
10
10
|
import {IBundle} from "./module/IBundle.sol";
|
11
11
|
import {IPolicy} from "./module/IPolicy.sol";
|
@@ -15,6 +15,8 @@ import {Key32, KeyId, Key32Lib} from "../types/Key32.sol";
|
|
15
15
|
import {KeyValueStore} from "./base/KeyValueStore.sol";
|
16
16
|
import {IInstance} from "./IInstance.sol";
|
17
17
|
import {InstanceReader} from "./InstanceReader.sol";
|
18
|
+
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
19
|
+
import {BundleManager} from "./BundleManager.sol";
|
18
20
|
import {NftId} from "../types/NftId.sol";
|
19
21
|
import {NumberId} from "../types/NumberId.sol";
|
20
22
|
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET} from "../types/ObjectType.sol";
|
@@ -28,14 +30,16 @@ import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
|
28
30
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
29
31
|
import {IPoolService} from "./service/IPoolService.sol";
|
30
32
|
import {IProductService} from "./service/IProductService.sol";
|
33
|
+
import {IPolicyService} from "./service/IPolicyService.sol";
|
34
|
+
import {IBundleService} from "./service/IBundleService.sol";
|
31
35
|
import {VersionPart} from "../types/Version.sol";
|
36
|
+
import {InstanceBase} from "./InstanceBase.sol";
|
32
37
|
|
33
38
|
contract Instance is
|
34
|
-
|
35
|
-
KeyValueStore,
|
39
|
+
AccessManagedUpgradeable,
|
36
40
|
IInstance,
|
37
|
-
|
38
|
-
|
41
|
+
// Initializable,
|
42
|
+
InstanceBase
|
39
43
|
{
|
40
44
|
|
41
45
|
uint64 public constant ADMIN_ROLE = type(uint64).min;
|
@@ -52,20 +56,19 @@ contract Instance is
|
|
52
56
|
|
53
57
|
mapping(ShortString name => address target) internal _target;
|
54
58
|
|
55
|
-
|
59
|
+
InstanceAccessManager internal _accessManager;
|
56
60
|
InstanceReader internal _instanceReader;
|
61
|
+
BundleManager internal _bundleManager;
|
57
62
|
|
58
|
-
|
63
|
+
function initialize(address accessManagerAddress, address registryAddress, NftId registryNftId, address initialOwner)
|
64
|
+
public
|
65
|
+
initializer
|
59
66
|
{
|
60
|
-
initialize(accessManagerAddress, registryAddress, registryNftId, msg.sender);
|
61
|
-
}
|
62
|
-
|
63
|
-
function initialize(address accessManagerAddress, address registryAddress, NftId registryNftId, address initialOwner) public {
|
64
67
|
require(!_initialized, "Contract instance has already been initialized");
|
65
68
|
|
66
|
-
|
69
|
+
__AccessManaged_init(accessManagerAddress);
|
67
70
|
|
68
|
-
_accessManager =
|
71
|
+
_accessManager = InstanceAccessManager(accessManagerAddress);
|
69
72
|
_createRole(RoleIdLib.toRoleId(ADMIN_ROLE), "AdminRole", false, false);
|
70
73
|
_createRole(RoleIdLib.toRoleId(PUBLIC_ROLE), "PublicRole", false, false);
|
71
74
|
|
@@ -106,7 +109,7 @@ contract Instance is
|
|
106
109
|
}
|
107
110
|
|
108
111
|
if (!EnumerableSet.contains(_roleMembers[roleId], member)) {
|
109
|
-
_accessManager.grantRole(roleId
|
112
|
+
_accessManager.grantRole(roleId, member);
|
110
113
|
EnumerableSet.add(_roleMembers[roleId], member);
|
111
114
|
return true;
|
112
115
|
}
|
@@ -122,7 +125,7 @@ contract Instance is
|
|
122
125
|
}
|
123
126
|
|
124
127
|
if (EnumerableSet.contains(_roleMembers[roleId], member)) {
|
125
|
-
_accessManager.revokeRole(roleId
|
128
|
+
_accessManager.revokeRole(roleId, member);
|
126
129
|
EnumerableSet.remove(_roleMembers[roleId], member);
|
127
130
|
return true;
|
128
131
|
}
|
@@ -141,7 +144,7 @@ contract Instance is
|
|
141
144
|
}
|
142
145
|
|
143
146
|
if (EnumerableSet.contains(_roleMembers[roleId], member)) {
|
144
|
-
_accessManager.
|
147
|
+
_accessManager.revokeRole(roleId, member);
|
145
148
|
EnumerableSet.remove(_roleMembers[roleId], member);
|
146
149
|
return true;
|
147
150
|
}
|
@@ -432,12 +435,34 @@ contract Instance is
|
|
432
435
|
return IPoolService(_registry.getServiceAddress("PoolService", VersionPart.wrap(3)));
|
433
436
|
}
|
434
437
|
|
438
|
+
function getPolicyService() external view returns (IPolicyService) {
|
439
|
+
return IPolicyService(_registry.getServiceAddress("PolicyService", VersionPart.wrap(3)));
|
440
|
+
}
|
441
|
+
|
442
|
+
function getBundleService() external view returns (IBundleService) {
|
443
|
+
return IBundleService(_registry.getServiceAddress("BundleService", VersionPart.wrap(3)));
|
444
|
+
}
|
445
|
+
|
446
|
+
function getInstanceAccessManager() external view returns (InstanceAccessManager) {
|
447
|
+
return _accessManager;
|
448
|
+
}
|
449
|
+
|
435
450
|
function setInstanceReader(InstanceReader instanceReader) external restricted() {
|
436
|
-
require(
|
451
|
+
require(instanceReader.getInstanceNftId() == getNftId(), "NFT ID of InstanceReader does not match");
|
437
452
|
_instanceReader = instanceReader;
|
438
453
|
}
|
439
454
|
|
440
455
|
function getInstanceReader() external view returns (InstanceReader) {
|
441
456
|
return _instanceReader;
|
442
457
|
}
|
458
|
+
|
459
|
+
function setBundleManager(BundleManager bundleManager) external restricted() {
|
460
|
+
require(address(_bundleManager) == address(0), "BundleManager is set");
|
461
|
+
require(bundleManager.getInstanceNftId() == getNftId(), "NFT ID of BundleManager does not match");
|
462
|
+
_bundleManager = bundleManager;
|
463
|
+
}
|
464
|
+
|
465
|
+
function getBundleManager() external view returns (BundleManager) {
|
466
|
+
return _bundleManager;
|
467
|
+
}
|
443
468
|
}
|
@@ -3,26 +3,17 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
5
5
|
import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
|
6
|
+
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
6
7
|
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {IBundle} from "./module/IBundle.sol";
|
10
|
-
import {IPolicy} from "./module/IPolicy.sol";
|
11
|
-
import {IRisk} from "./module/IRisk.sol";
|
12
|
-
import {ISetup} from "./module/ISetup.sol";
|
13
|
-
import {Key32, KeyId, Key32Lib} from "../types/Key32.sol";
|
14
|
-
import {KeyValueStore} from "./base/KeyValueStore.sol";
|
15
|
-
import {NftId} from "../types/NftId.sol";
|
16
|
-
import {NumberId} from "../types/NumberId.sol";
|
17
|
-
import {ObjectType, BUNDLE, DISTRIBUTION, POLICY, POOL, ROLE, PRODUCT, TARGET} from "../types/ObjectType.sol";
|
18
|
-
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
19
|
-
import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
20
|
-
import {StateId, ACTIVE} from "../types/StateId.sol";
|
8
|
+
import {AccessManagerUpgradeableInitializeable} from "../../contracts/instance/AccessManagerUpgradeableInitializeable.sol";
|
9
|
+
import {RoleId, RoleIdLib, DISTRIBUTION_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE, PRODUCT_SERVICE_ROLE, POLICY_SERVICE_ROLE, BUNDLE_SERVICE_ROLE, INSTANCE_SERVICE_ROLE } from "../types/RoleId.sol";
|
21
10
|
import {Timestamp, TimestampLib} from "../types/Timestamp.sol";
|
22
11
|
|
23
12
|
contract InstanceAccessManager is
|
24
|
-
|
13
|
+
AccessManagedUpgradeable
|
25
14
|
{
|
15
|
+
using RoleIdLib for RoleId;
|
16
|
+
|
26
17
|
string public constant ADMIN_ROLE_NAME = "AdminRole";
|
27
18
|
string public constant PUBLIC_ROLE_NAME = "PublicRole";
|
28
19
|
|
@@ -56,7 +47,7 @@ contract InstanceAccessManager is
|
|
56
47
|
error ErrorRoleIsCustomIsImmutable(RoleId roleId, bool isCustom, bool isCustomExisting);
|
57
48
|
error ErrorSetLockedForNonexstentRole(RoleId roleId);
|
58
49
|
error ErrorGrantNonexstentRole(RoleId roleId);
|
59
|
-
error ErrorRevokeNonexstentRole(RoleId roleId);
|
50
|
+
error ErrorRevokeNonexstentRole(RoleId roleId);
|
60
51
|
error ErrorRenounceNonexstentRole(RoleId roleId);
|
61
52
|
|
62
53
|
error ErrorTargetAddressZero();
|
@@ -76,15 +67,36 @@ contract InstanceAccessManager is
|
|
76
67
|
mapping(ShortString name => address target) internal _targetForName;
|
77
68
|
address [] internal _targets;
|
78
69
|
|
79
|
-
|
70
|
+
AccessManagerUpgradeableInitializeable internal _accessManager;
|
80
71
|
|
81
|
-
|
72
|
+
function __InstanceAccessManager_initialize(address initialAdmin) external initializer
|
82
73
|
{
|
83
|
-
|
84
|
-
|
74
|
+
// if size of the contract gets too large, this can be externalized which will reduce the contract size considerably
|
75
|
+
_accessManager = new AccessManagerUpgradeableInitializeable();
|
76
|
+
// this service required adin rights to access manager to be able to grant/revoke roles
|
77
|
+
_accessManager.__AccessManagerUpgradeableInitializeable_init(address(this));
|
78
|
+
_accessManager.grantRole(_accessManager.ADMIN_ROLE(), initialAdmin, 0);
|
79
|
+
|
80
|
+
__AccessManaged_init(address(_accessManager));
|
85
81
|
|
86
82
|
_createRole(RoleIdLib.toRoleId(_accessManager.ADMIN_ROLE()), ADMIN_ROLE_NAME, false, false);
|
87
83
|
_createRole(RoleIdLib.toRoleId(_accessManager.PUBLIC_ROLE()), PUBLIC_ROLE_NAME, false, false);
|
84
|
+
|
85
|
+
createDefaultGifRoles();
|
86
|
+
}
|
87
|
+
|
88
|
+
function createDefaultGifRoles() public restricted() {
|
89
|
+
// DISTRIBUTION_OWNER_ROLE
|
90
|
+
_createRole(DISTRIBUTION_OWNER_ROLE(), "DistributionOwnerRole", false, true);
|
91
|
+
_createRole(POOL_OWNER_ROLE(), "PoolOwnerRole", false, true);
|
92
|
+
_createRole(PRODUCT_OWNER_ROLE(), "ProductOwnerRole", false, true);
|
93
|
+
|
94
|
+
_createRole(DISTRIBUTION_SERVICE_ROLE(), "DistributionServiceRole", false, true);
|
95
|
+
_createRole(POOL_SERVICE_ROLE(), "PoolServiceRole", false, true);
|
96
|
+
_createRole(PRODUCT_SERVICE_ROLE(), "ProductServiceRole", false, true);
|
97
|
+
_createRole(POLICY_SERVICE_ROLE(), "PolicyServiceRole", false, true);
|
98
|
+
_createRole(BUNDLE_SERVICE_ROLE(), "BundleServiceRole", false, true);
|
99
|
+
_createRole(INSTANCE_SERVICE_ROLE(), "InstanceServiceRole", false, true);
|
88
100
|
}
|
89
101
|
|
90
102
|
//--- Role ------------------------------------------------------//
|
@@ -283,6 +295,45 @@ contract InstanceAccessManager is
|
|
283
295
|
}
|
284
296
|
|
285
297
|
function _validateTargetParameters(address target, string memory name, bool isCustom) internal view {
|
298
|
+
// TODO: implement
|
299
|
+
}
|
300
|
+
|
301
|
+
function setTargetFunctionRole(
|
302
|
+
address target,
|
303
|
+
bytes4[] calldata selectors,
|
304
|
+
uint64 roleId
|
305
|
+
) public virtual restricted() {
|
306
|
+
_accessManager.setTargetFunctionRole(target, selectors, roleId);
|
307
|
+
}
|
308
|
+
|
309
|
+
function setTargetFunctionRole(
|
310
|
+
string memory targetName,
|
311
|
+
bytes4[] calldata selectors,
|
312
|
+
RoleId roleId
|
313
|
+
) public virtual restricted() {
|
314
|
+
address target = _targetForName[ShortStrings.toShortString(targetName)];
|
315
|
+
uint64 roleIdInt = RoleId.unwrap(roleId);
|
316
|
+
_accessManager.setTargetFunctionRole(target, selectors, roleIdInt);
|
317
|
+
}
|
318
|
+
|
319
|
+
function getAccessManager() public restricted() returns (AccessManagerUpgradeableInitializeable) {
|
320
|
+
return _accessManager;
|
321
|
+
}
|
322
|
+
|
323
|
+
function setTargetClosed(address target, bool closed) public restricted() {
|
324
|
+
_accessManager.setTargetClosed(target, closed);
|
325
|
+
}
|
326
|
+
|
327
|
+
function setTargetClosed(string memory targetName, bool closed) public restricted() {
|
328
|
+
address target = _targetForName[ShortStrings.toShortString(targetName)];
|
329
|
+
_accessManager.setTargetClosed(target, closed);
|
330
|
+
}
|
286
331
|
|
332
|
+
function canCall(
|
333
|
+
address caller,
|
334
|
+
address target,
|
335
|
+
bytes4 selector
|
336
|
+
) public view virtual returns (bool immediate, uint32 delay) {
|
337
|
+
return _accessManager.canCall(caller, target, selector);
|
287
338
|
}
|
288
339
|
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
5
|
+
import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
|
6
|
+
|
7
|
+
import {IAccess} from "./module/IAccess.sol";
|
8
|
+
import {IBundle} from "./module/IBundle.sol";
|
9
|
+
import {IPolicy} from "./module/IPolicy.sol";
|
10
|
+
import {IRisk} from "./module/IRisk.sol";
|
11
|
+
import {ISetup} from "./module/ISetup.sol";
|
12
|
+
import {Key32, KeyId, Key32Lib} from "../types/Key32.sol";
|
13
|
+
import {KeyValueStore} from "./base/KeyValueStore.sol";
|
14
|
+
import {IInstance} from "./IInstance.sol";
|
15
|
+
import {InstanceReader} from "./InstanceReader.sol";
|
16
|
+
import {BundleManager} from "./BundleManager.sol";
|
17
|
+
import {NftId} from "../types/NftId.sol";
|
18
|
+
import {NumberId} from "../types/NumberId.sol";
|
19
|
+
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET} from "../types/ObjectType.sol";
|
20
|
+
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
21
|
+
import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
22
|
+
import {StateId, ACTIVE} from "../types/StateId.sol";
|
23
|
+
import {ERC165} from "../shared/ERC165.sol";
|
24
|
+
import {Registerable} from "../shared/Registerable.sol";
|
25
|
+
import {ComponentOwnerService} from "./service/ComponentOwnerService.sol";
|
26
|
+
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
27
|
+
import {IDistributionService} from "./service/IDistributionService.sol";
|
28
|
+
import {IPoolService} from "./service/IPoolService.sol";
|
29
|
+
import {IProductService} from "./service/IProductService.sol";
|
30
|
+
import {VersionPart} from "../types/Version.sol";
|
31
|
+
import {IInstanceBase} from "./IInstanceBase.sol";
|
32
|
+
|
33
|
+
contract InstanceBase is
|
34
|
+
IInstanceBase,
|
35
|
+
KeyValueStore,
|
36
|
+
ERC165,
|
37
|
+
Registerable
|
38
|
+
{
|
39
|
+
|
40
|
+
|
41
|
+
}
|