@etherisc/gif-next 0.0.2-979c9aa-391 → 0.0.2-984cc08-642
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/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → Component.sol/Component.json} +36 -7
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +38 -119
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → IComponent.sol/IComponent.json} +36 -7
- 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/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +5 -5
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +38 -147
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +43 -135
- 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 +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +261 -26
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +171 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +42 -13
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +56 -82
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +101 -111
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +11 -11
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +41 -82
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +116 -183
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +26 -90
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +111 -37
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -13
- 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/IAccess.sol/IAccess.json +11 -0
- 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 +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +232 -61
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +20 -24
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +140 -60
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +17 -21
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +64 -13
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -13
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +120 -13
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +13 -13
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +13 -13
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +321 -86
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +51 -23
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +140 -60
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +17 -21
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +146 -66
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +17 -13
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +132 -133
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +102 -68
- 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/Registry.sol/Registry.json +145 -227
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +37 -143
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +38 -104
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +530 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +14 -27
- 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/IService.sol/IService.json +13 -13
- 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/NftOwnable.sol/NftOwnable.json +2 -2
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +13 -13
- 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/TestRegisterable.sol/TestRegisterable.json +2 -2
- 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/TestService.sol/TestService.json +31 -31
- 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/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 → Component.sol} +69 -40
- package/contracts/components/Distribution.sol +5 -14
- package/contracts/components/{IBaseComponent.sol → IComponent.sol} +12 -7
- package/contracts/components/IProductComponent.sol +2 -2
- package/contracts/components/Pool.sol +7 -20
- package/contracts/components/Product.sol +21 -18
- package/contracts/instance/BundleManager.sol +7 -11
- package/contracts/instance/IInstance.sol +4 -4
- package/contracts/instance/IInstanceBase.sol +3 -2
- package/contracts/instance/IInstanceService.sol +4 -2
- package/contracts/instance/Instance.sol +11 -28
- package/contracts/instance/InstanceAccessManager.sol +15 -16
- package/contracts/instance/InstanceBase.sol +0 -3
- package/contracts/instance/InstanceReader.sol +3 -25
- package/contracts/instance/InstanceService.sol +115 -47
- package/contracts/instance/InstanceServiceManager.sol +5 -8
- package/contracts/instance/ObjectManager.sol +7 -24
- package/contracts/instance/base/ComponentService.sol +133 -0
- package/contracts/instance/base/IInstanceBase.sol +0 -2
- package/contracts/instance/module/IAccess.sol +1 -1
- package/contracts/instance/service/BundleService.sol +41 -8
- package/contracts/instance/service/BundleServiceManager.sol +5 -8
- package/contracts/instance/service/DistributionService.sol +36 -39
- package/contracts/instance/service/DistributionServiceManager.sol +6 -9
- package/contracts/instance/service/IBundleService.sol +5 -6
- package/contracts/instance/service/IPolicyService.sol +7 -0
- package/contracts/instance/service/PolicyService.sol +67 -37
- package/contracts/instance/service/PoolService.sol +49 -31
- package/contracts/instance/service/PoolServiceManager.sol +5 -8
- package/contracts/instance/service/ProductService.sol +106 -38
- package/contracts/registry/ChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +26 -16
- package/contracts/registry/IRegistryService.sol +17 -10
- package/contracts/registry/Registry.sol +149 -201
- package/contracts/registry/RegistryAccessManager.sol +210 -0
- package/contracts/registry/RegistryService.sol +55 -96
- package/contracts/registry/RegistryServiceManager.sol +18 -36
- package/contracts/registry/ReleaseManager.sol +342 -0
- package/contracts/registry/TokenRegistry.sol +5 -6
- package/contracts/shared/IRegisterable.sol +0 -2
- package/contracts/shared/IService.sol +2 -1
- package/contracts/shared/NftOwnable.sol +2 -0
- package/contracts/shared/ProxyManager.sol +1 -1
- package/contracts/shared/Service.sol +13 -8
- package/contracts/test/TestService.sol +3 -2
- package/contracts/types/RoleId.sol +4 -5
- package/package.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +0 -442
- package/contracts/instance/base/ComponentServiceBase.sol +0 -72
- package/contracts/instance/service/ComponentOwnerService.sol +0 -317
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -1,40 +1,59 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
5
|
-
import {IComponentOwnerService} from "../instance/service/IComponentOwnerService.sol";
|
6
|
-
import {IInstanceService} from "../instance/IInstanceService.sol";
|
4
|
+
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
7
5
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
6
|
+
|
7
|
+
import {IComponent} from "./IComponent.sol";
|
8
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
9
|
+
import {IInstanceService} from "../instance/IInstanceService.sol";
|
8
10
|
import {IInstance} from "../instance/IInstance.sol";
|
9
11
|
import {InstanceAccessManager} from "../instance/InstanceAccessManager.sol";
|
10
12
|
import {IRegistry} from "../registry/IRegistry.sol";
|
11
13
|
import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
|
12
|
-
import {ObjectType} from "../types/ObjectType.sol";
|
14
|
+
import {ObjectType, INSTANCE, PRODUCT} from "../types/ObjectType.sol";
|
13
15
|
import {VersionLib} from "../types/Version.sol";
|
14
16
|
import {Registerable} from "../shared/Registerable.sol";
|
15
17
|
import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
16
|
-
import {
|
18
|
+
import {IAccess} from "../instance/module/IAccess.sol";
|
17
19
|
|
18
|
-
|
20
|
+
// TODO discuss to inherit from oz accessmanaged
|
21
|
+
// TODO make contract upgradeable, then add ComponentUpradeable that also intherits from Versionable
|
22
|
+
// same pattern as for Service which is also upgradeable
|
23
|
+
abstract contract Component is
|
19
24
|
Registerable,
|
20
|
-
|
25
|
+
IComponent
|
21
26
|
{
|
22
|
-
using NftIdLib for NftId;
|
23
|
-
|
24
|
-
IComponentOwnerService internal _componentOwnerService;
|
25
27
|
IInstanceService internal _instanceService;
|
28
|
+
IProductService internal _productService;
|
26
29
|
|
27
|
-
address internal _deployer;
|
28
|
-
address internal _wallet;
|
29
|
-
IERC20Metadata internal _token;
|
30
30
|
IInstance internal _instance;
|
31
|
-
|
31
|
+
IERC20Metadata internal _token;
|
32
|
+
address internal _wallet;
|
32
33
|
NftId internal _productNftId;
|
33
34
|
|
35
|
+
modifier onlyProductService() {
|
36
|
+
if(msg.sender != address(_productService)) {
|
37
|
+
revert ErrorComponentNotProductService(msg.sender);
|
38
|
+
}
|
39
|
+
_;
|
40
|
+
}
|
41
|
+
|
42
|
+
// TODO discuss replacement with modifier restricted from accessmanaged
|
34
43
|
modifier onlyInstanceRole(uint64 roleIdNum) {
|
35
44
|
RoleId roleId = RoleIdLib.toRoleId(roleIdNum);
|
36
|
-
|
37
|
-
|
45
|
+
InstanceAccessManager accessManager = InstanceAccessManager(_instance.authority());
|
46
|
+
if( !accessManager.hasRole(roleId, msg.sender)) {
|
47
|
+
revert ErrorComponentUnauthorized(msg.sender, roleIdNum);
|
48
|
+
}
|
49
|
+
_;
|
50
|
+
}
|
51
|
+
|
52
|
+
// TODO discuss replacement with modifier restricted from accessmanaged
|
53
|
+
modifier isNotLocked() {
|
54
|
+
InstanceAccessManager accessManager = InstanceAccessManager(_instance.authority());
|
55
|
+
if (accessManager.isTargetLocked(address(this))) {
|
56
|
+
revert IAccess.ErrorIAccessTargetLocked(address(this));
|
38
57
|
}
|
39
58
|
_;
|
40
59
|
}
|
@@ -51,40 +70,43 @@ abstract contract BaseComponent is
|
|
51
70
|
bytes memory data = "";
|
52
71
|
_initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
|
53
72
|
|
54
|
-
IRegistry.ObjectInfo memory instanceInfo =
|
73
|
+
IRegistry.ObjectInfo memory instanceInfo = _registry.getObjectInfo(instanceNftId);
|
55
74
|
_instance = IInstance(instanceInfo.objectAddress);
|
56
|
-
_instanceAccessManager = _instance.getInstanceAccessManager();
|
57
75
|
require(
|
58
76
|
_instance.supportsInterface(type(IInstance).interfaceId),
|
59
77
|
""
|
60
78
|
);
|
61
79
|
|
62
|
-
|
63
|
-
|
80
|
+
_instanceService = IInstanceService(_registry.getServiceAddress(INSTANCE(), VersionLib.toVersion(3, 0, 0).toMajorPart()));
|
81
|
+
_productService = IProductService(_registry.getServiceAddress(PRODUCT(), VersionLib.toVersion(3, 0, 0).toMajorPart()));
|
64
82
|
_wallet = address(this);
|
65
83
|
_token = IERC20Metadata(token);
|
66
84
|
|
67
|
-
_registerInterface(type(
|
85
|
+
_registerInterface(type(IComponent).interfaceId);
|
68
86
|
}
|
69
87
|
|
70
|
-
// from
|
71
|
-
// TODO consider to remove/replace with access manager contract locking
|
88
|
+
// TODO discuss replacement with modifier restricted from accessmanaged
|
72
89
|
function lock() external onlyOwner override {
|
73
|
-
|
90
|
+
_instanceService.setTargetLocked(getName(), true);
|
74
91
|
}
|
75
|
-
|
76
|
-
// TODO
|
92
|
+
|
93
|
+
// TODO discuss replacement with modifier restricted from accessmanaged
|
77
94
|
function unlock() external onlyOwner override {
|
78
|
-
|
95
|
+
_instanceService.setTargetLocked(getName(), false);
|
79
96
|
}
|
80
97
|
|
81
|
-
|
98
|
+
// TODO discuss to split this base contract into a minimal component base (eg oracle)
|
99
|
+
// and a component base that is linked to a product component (all others in v3)
|
100
|
+
function setProductNftId(NftId productNftId)
|
82
101
|
external
|
83
|
-
view
|
84
102
|
override
|
85
|
-
|
103
|
+
onlyProductService()
|
86
104
|
{
|
87
|
-
|
105
|
+
if(_productNftId.gtz()) {
|
106
|
+
revert ErrorComponentProductNftAlreadySet();
|
107
|
+
}
|
108
|
+
|
109
|
+
_productNftId = productNftId;
|
88
110
|
}
|
89
111
|
|
90
112
|
/// @dev Sets the wallet address for the component.
|
@@ -97,7 +119,7 @@ abstract contract BaseComponent is
|
|
97
119
|
|
98
120
|
// checks
|
99
121
|
if (newWallet == currentWallet) {
|
100
|
-
revert
|
122
|
+
revert ErrorComponentWalletAddressIsSameAsCurrent(newWallet);
|
101
123
|
}
|
102
124
|
|
103
125
|
if (currentBalance > 0) {
|
@@ -107,14 +129,14 @@ abstract contract BaseComponent is
|
|
107
129
|
// move tokens from external wallet to component smart contract or another external wallet
|
108
130
|
uint256 allowance = _token.allowance(currentWallet, address(this));
|
109
131
|
if (allowance < currentBalance) {
|
110
|
-
revert
|
132
|
+
revert ErrorComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
|
111
133
|
}
|
112
134
|
}
|
113
135
|
}
|
114
136
|
|
115
137
|
// effects
|
116
138
|
_wallet = newWallet;
|
117
|
-
emit
|
139
|
+
emit LogComponentWalletAddressChanged(newWallet);
|
118
140
|
|
119
141
|
// interactions
|
120
142
|
if (currentBalance > 0) {
|
@@ -125,10 +147,22 @@ abstract contract BaseComponent is
|
|
125
147
|
}
|
126
148
|
|
127
149
|
SafeERC20.safeTransferFrom(_token, currentWallet, newWallet, currentBalance);
|
128
|
-
emit
|
150
|
+
emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
|
129
151
|
}
|
130
152
|
}
|
131
153
|
|
154
|
+
// TODO set name via constructor or initialization, pure function likely too restrictive
|
155
|
+
function getName() public pure virtual returns (string memory name);
|
156
|
+
|
157
|
+
function getWallet()
|
158
|
+
external
|
159
|
+
view
|
160
|
+
override
|
161
|
+
returns (address walletAddress)
|
162
|
+
{
|
163
|
+
return _wallet;
|
164
|
+
}
|
165
|
+
|
132
166
|
function getToken() public view override returns (IERC20Metadata token) {
|
133
167
|
return _token;
|
134
168
|
}
|
@@ -137,11 +171,6 @@ abstract contract BaseComponent is
|
|
137
171
|
return _instance;
|
138
172
|
}
|
139
173
|
|
140
|
-
function setProductNftId(NftId productNftId) public override onlyOwner {
|
141
|
-
require(_productNftId.eq(zeroNftId()), "product nft id already set");
|
142
|
-
_productNftId = productNftId;
|
143
|
-
}
|
144
|
-
|
145
174
|
function getProductNftId() public view override returns (NftId productNftId) {
|
146
175
|
return _productNftId;
|
147
176
|
}
|
@@ -7,7 +7,7 @@ import {IProductService} from "../instance/service/IProductService.sol";
|
|
7
7
|
import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
|
8
8
|
import {ReferralId} from "../types/Referral.sol";
|
9
9
|
import {Fee, FeeLib} from "../types/Fee.sol";
|
10
|
-
import {
|
10
|
+
import {Component} from "./Component.sol";
|
11
11
|
import {IDistributionComponent} from "./IDistributionComponent.sol";
|
12
12
|
import {IRegistry} from "../registry/IRegistry.sol";
|
13
13
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
@@ -16,8 +16,8 @@ import {Registerable} from "../shared/Registerable.sol";
|
|
16
16
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
17
17
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
18
18
|
|
19
|
-
contract Distribution is
|
20
|
-
|
19
|
+
abstract contract Distribution is
|
20
|
+
Component,
|
21
21
|
IDistributionComponent
|
22
22
|
{
|
23
23
|
using NftIdLib for NftId;
|
@@ -28,14 +28,6 @@ contract Distribution is
|
|
28
28
|
TokenHandler internal _tokenHandler;
|
29
29
|
|
30
30
|
IDistributionService private _distributionService;
|
31
|
-
IProductService private _productService;
|
32
|
-
|
33
|
-
modifier onlyProductService() {
|
34
|
-
require(
|
35
|
-
msg.sender == address(_productService),
|
36
|
-
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
37
|
-
_;
|
38
|
-
}
|
39
31
|
|
40
32
|
constructor(
|
41
33
|
address registry,
|
@@ -46,15 +38,13 @@ contract Distribution is
|
|
46
38
|
Fee memory distributionFee,
|
47
39
|
address initialOwner
|
48
40
|
)
|
49
|
-
|
41
|
+
Component(registry, instanceNftId, token, DISTRIBUTION(), true, initialOwner)
|
50
42
|
{
|
51
43
|
_isVerifying = verifying;
|
52
44
|
_initialDistributionFee = distributionFee;
|
53
45
|
|
54
46
|
_tokenHandler = TokenHandler(token);
|
55
|
-
|
56
47
|
_distributionService = _instance.getDistributionService();
|
57
|
-
_productService = _instance.getProductService();
|
58
48
|
|
59
49
|
_registerInterface(type(IDistributionComponent).interfaceId);
|
60
50
|
}
|
@@ -150,6 +140,7 @@ contract Distribution is
|
|
150
140
|
return (
|
151
141
|
info,
|
152
142
|
abi.encode(
|
143
|
+
getName(),
|
153
144
|
ISetup.DistributionSetupInfo(
|
154
145
|
_productNftId,
|
155
146
|
_tokenHandler,
|
@@ -7,16 +7,21 @@ import {IRegisterable} from "../shared/IRegisterable.sol";
|
|
7
7
|
import {IInstance} from "../instance/IInstance.sol";
|
8
8
|
import {NftId} from "../types/NftId.sol";
|
9
9
|
|
10
|
-
interface
|
11
|
-
error ErrorBaseComponentWalletAddressIsSameAsCurrent(address newWallet);
|
12
|
-
error ErrorBaseComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
|
13
|
-
error ErrorBaseComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
|
10
|
+
interface IComponent is IRegisterable {
|
14
11
|
|
15
|
-
|
16
|
-
|
12
|
+
error ErrorComponentProductNftAlreadySet();
|
13
|
+
error ErrorComponentWalletAddressIsSameAsCurrent(address newWallet);
|
14
|
+
error ErrorComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
|
15
|
+
error ErrorComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
|
16
|
+
error ErrorComponentNotProductService(address caller);
|
17
17
|
|
18
|
-
|
18
|
+
event LogComponentWalletAddressChanged(address newWallet);
|
19
|
+
event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
|
20
|
+
|
21
|
+
function getName() external pure returns (string memory name);
|
19
22
|
|
23
|
+
// TODO remove and replace with accessmanaged target locking mechanism
|
24
|
+
function lock() external;
|
20
25
|
function unlock() external;
|
21
26
|
|
22
27
|
function getToken() external view returns (IERC20Metadata token);
|
@@ -18,8 +18,8 @@ interface IProductComponent {
|
|
18
18
|
RiskId riskId,
|
19
19
|
uint256 lifetime,
|
20
20
|
bytes memory applicationData,
|
21
|
-
|
22
|
-
|
21
|
+
NftId bundleNftId,
|
22
|
+
ReferralId referralId
|
23
23
|
) external view returns (uint256 premiumAmount);
|
24
24
|
|
25
25
|
function calculateNetPremium(
|
@@ -1,29 +1,26 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
5
|
-
import {IProductService} from "../instance/service/IProductService.sol";
|
4
|
+
import {POOL} from "../types/ObjectType.sol";
|
6
5
|
import {IPoolService} from "../instance/service/IPoolService.sol";
|
7
6
|
import {IBundleService} from "../instance/service/IBundleService.sol";
|
8
|
-
import {NftId,
|
7
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
9
8
|
import {Fee} from "../types/Fee.sol";
|
10
9
|
import {UFixed} from "../types/UFixed.sol";
|
11
10
|
import {IPoolComponent} from "./IPoolComponent.sol";
|
12
|
-
import {
|
11
|
+
import {Component} from "./Component.sol";
|
13
12
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
14
13
|
import {ISetup} from "../instance/module/ISetup.sol";
|
15
14
|
|
16
15
|
import {IRegistry} from "../registry/IRegistry.sol";
|
17
16
|
|
18
|
-
// import {IPool} from "../instance/module/pool/IPoolModule.sol";
|
19
|
-
import {ITreasury} from "../instance/module/ITreasury.sol";
|
20
17
|
import {ISetup} from "../instance/module/ISetup.sol";
|
21
18
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
22
19
|
|
23
20
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
24
21
|
import {Registerable} from "../shared/Registerable.sol";
|
25
22
|
|
26
|
-
contract Pool is
|
23
|
+
abstract contract Pool is Component, IPoolComponent {
|
27
24
|
using NftIdLib for NftId;
|
28
25
|
|
29
26
|
bool internal _isConfirmingApplication;
|
@@ -37,10 +34,6 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
37
34
|
|
38
35
|
// may be used to interact with instance by derived contracts
|
39
36
|
IPoolService internal _poolService;
|
40
|
-
|
41
|
-
// only relevant to protect callback functions for "active" pools
|
42
|
-
IProductService private _productService;
|
43
|
-
|
44
37
|
IBundleService private _bundleService;
|
45
38
|
|
46
39
|
modifier onlyPoolService() {
|
@@ -50,13 +43,6 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
50
43
|
_;
|
51
44
|
}
|
52
45
|
|
53
|
-
modifier onlyProductService() {
|
54
|
-
require(
|
55
|
-
msg.sender == address(_productService),
|
56
|
-
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
57
|
-
_;
|
58
|
-
}
|
59
|
-
|
60
46
|
constructor(
|
61
47
|
address registry,
|
62
48
|
NftId instanceNftId,
|
@@ -70,7 +56,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
70
56
|
Fee memory performanceFee,
|
71
57
|
address initialOwner
|
72
58
|
)
|
73
|
-
|
59
|
+
Component(registry, instanceNftId, token, POOL(), isInterceptor, initialOwner)
|
74
60
|
{
|
75
61
|
_isConfirmingApplication = isConfirmingApplication;
|
76
62
|
// TODO add validation
|
@@ -82,7 +68,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
82
68
|
_tokenHandler = new TokenHandler(token);
|
83
69
|
|
84
70
|
_poolService = _instance.getPoolService();
|
85
|
-
_productService = _instance.getProductService();
|
71
|
+
// _productService = _instance.getProductService();
|
86
72
|
_bundleService = _instance.getBundleService();
|
87
73
|
|
88
74
|
_registerInterface(type(IPoolComponent).interfaceId);
|
@@ -217,6 +203,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
217
203
|
return (
|
218
204
|
info,
|
219
205
|
abi.encode(
|
206
|
+
getName(),
|
220
207
|
ISetup.PoolSetupInfo(
|
221
208
|
_productNftId,
|
222
209
|
_tokenHandler,
|
@@ -4,18 +4,16 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
6
|
import {IRisk} from "../instance/module/IRisk.sol";
|
7
|
-
import {ITreasury} from "../instance/module/ITreasury.sol";
|
8
|
-
import {IProductService} from "../instance/service/IProductService.sol";
|
9
7
|
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
10
8
|
import {IProductComponent} from "./IProductComponent.sol";
|
11
|
-
import {NftId,
|
12
|
-
import {
|
9
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
10
|
+
import {PRODUCT} from "../types/ObjectType.sol";
|
13
11
|
import {ReferralId} from "../types/Referral.sol";
|
14
12
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
15
13
|
import {StateId} from "../types/StateId.sol";
|
16
14
|
import {Timestamp} from "../types/Timestamp.sol";
|
17
|
-
import {Fee
|
18
|
-
import {
|
15
|
+
import {Fee} from "../types/Fee.sol";
|
16
|
+
import {Component} from "./Component.sol";
|
19
17
|
|
20
18
|
import {IRegistry} from "../registry/IRegistry.sol";
|
21
19
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
@@ -27,12 +25,9 @@ import {ISetup} from "../instance/module/ISetup.sol";
|
|
27
25
|
import {Pool} from "../components/Pool.sol";
|
28
26
|
import {Distribution} from "../components/Distribution.sol";
|
29
27
|
|
30
|
-
|
31
|
-
|
32
|
-
contract Product is BaseComponent, IProductComponent {
|
28
|
+
abstract contract Product is Component, IProductComponent {
|
33
29
|
using NftIdLib for NftId;
|
34
30
|
|
35
|
-
IProductService internal _productService;
|
36
31
|
IPolicyService internal _policyService;
|
37
32
|
Pool internal _pool;
|
38
33
|
Distribution internal _distribution;
|
@@ -53,9 +48,8 @@ contract Product is BaseComponent, IProductComponent {
|
|
53
48
|
Fee memory productFee,
|
54
49
|
Fee memory processingFee,
|
55
50
|
address initialOwner
|
56
|
-
)
|
51
|
+
) Component(registry, instanceNftid, token, PRODUCT(), isInterceptor, initialOwner) {
|
57
52
|
// TODO add validation
|
58
|
-
_productService = _instance.getProductService();
|
59
53
|
_policyService = _instance.getPolicyService();
|
60
54
|
_pool = Pool(pool);
|
61
55
|
_distribution = Distribution(distribution);
|
@@ -76,8 +70,8 @@ contract Product is BaseComponent, IProductComponent {
|
|
76
70
|
RiskId riskId,
|
77
71
|
uint256 lifetime,
|
78
72
|
bytes memory applicationData,
|
79
|
-
|
80
|
-
|
73
|
+
NftId bundleNftId,
|
74
|
+
ReferralId referralId
|
81
75
|
)
|
82
76
|
external
|
83
77
|
view
|
@@ -203,6 +197,14 @@ contract Product is BaseComponent, IProductComponent {
|
|
203
197
|
activateAt);
|
204
198
|
}
|
205
199
|
|
200
|
+
function _close(
|
201
|
+
NftId policyNftId
|
202
|
+
)
|
203
|
+
internal
|
204
|
+
{
|
205
|
+
_policyService.close(policyNftId);
|
206
|
+
}
|
207
|
+
|
206
208
|
function getPoolNftId() external view override returns (NftId poolNftId) {
|
207
209
|
return getRegistry().getNftId(address(_pool));
|
208
210
|
}
|
@@ -256,8 +258,8 @@ contract Product is BaseComponent, IProductComponent {
|
|
256
258
|
) = _pool.getInitialInfo();
|
257
259
|
|
258
260
|
(
|
259
|
-
ISetup.PoolSetupInfo memory poolSetupInfo
|
260
|
-
) = abi.decode(poolData, (ISetup.PoolSetupInfo));
|
261
|
+
, ISetup.PoolSetupInfo memory poolSetupInfo
|
262
|
+
) = abi.decode(poolData, (string, ISetup.PoolSetupInfo));
|
261
263
|
|
262
264
|
// from DistributionComponent
|
263
265
|
(
|
@@ -266,12 +268,13 @@ contract Product is BaseComponent, IProductComponent {
|
|
266
268
|
) = _distribution.getInitialInfo();
|
267
269
|
|
268
270
|
(
|
269
|
-
ISetup.DistributionSetupInfo memory distributionSetupInfo
|
270
|
-
) = abi.decode(distributionData, (ISetup.DistributionSetupInfo));
|
271
|
+
, ISetup.DistributionSetupInfo memory distributionSetupInfo
|
272
|
+
) = abi.decode(distributionData, (string, ISetup.DistributionSetupInfo));
|
271
273
|
|
272
274
|
return (
|
273
275
|
productInfo,
|
274
276
|
abi.encode(
|
277
|
+
getName(),
|
275
278
|
ISetup.ProductSetupInfo(
|
276
279
|
_token,
|
277
280
|
_tokenHandler,
|
@@ -32,17 +32,13 @@ contract BundleManager is
|
|
32
32
|
|
33
33
|
mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
|
34
34
|
|
35
|
-
constructor() ObjectManager() {
|
36
|
-
}
|
37
|
-
|
38
|
-
|
39
35
|
/// @dev links a policy with its bundle
|
40
36
|
// to link a policy it MUST NOT yet have been activated
|
41
37
|
// the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
|
42
38
|
function linkPolicy(NftId policyNftId) external restricted() {
|
43
|
-
NftId bundleNftId =
|
39
|
+
NftId bundleNftId = _instance.getInstanceReader().getPolicyInfo(policyNftId).bundleNftId;
|
44
40
|
// decision will likely depend on the decision what to check here and what in the service
|
45
|
-
NftId poolNftId =
|
41
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
46
42
|
|
47
43
|
// ensure bundle is unlocked (in active set) and registered with this instance
|
48
44
|
if (!_isActive(poolNftId, bundleNftId)) {
|
@@ -59,11 +55,11 @@ contract BundleManager is
|
|
59
55
|
// - the policy MUST be past its expiry period and it MUST NOT have any open claims
|
60
56
|
// - the policy's payoutAmount MUST be equal to its sumInsuredAmount and MUST NOT have any open claims
|
61
57
|
function unlinkPolicy(NftId policyNftId) external restricted() {
|
62
|
-
IPolicy.PolicyInfo memory policyInfo =
|
58
|
+
IPolicy.PolicyInfo memory policyInfo = _instance.getInstanceReader().getPolicyInfo(policyNftId);
|
63
59
|
|
64
60
|
NftId bundleNftId = policyInfo.bundleNftId;
|
65
61
|
// decision will likely depend on the decision what to check here and what in the service
|
66
|
-
NftId poolNftId =
|
62
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
67
63
|
|
68
64
|
// ensure bundle is registered with this instance
|
69
65
|
if (!_contains(poolNftId, bundleNftId)) {
|
@@ -78,7 +74,7 @@ contract BundleManager is
|
|
78
74
|
/// @dev add a new bundle to a riskpool registerd with this instance
|
79
75
|
// the corresponding pool is fetched via instance reader
|
80
76
|
function add(NftId bundleNftId) external restricted() {
|
81
|
-
NftId poolNftId =
|
77
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
82
78
|
|
83
79
|
// ensure pool is registered with instance
|
84
80
|
if(poolNftId.eqz()) {
|
@@ -91,14 +87,14 @@ contract BundleManager is
|
|
91
87
|
|
92
88
|
/// @dev unlocked (active) bundles are available to underwrite new policies
|
93
89
|
function unlock(NftId bundleNftId) external restricted() {
|
94
|
-
NftId poolNftId =
|
90
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
95
91
|
_activate(poolNftId, bundleNftId);
|
96
92
|
emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
|
97
93
|
}
|
98
94
|
|
99
95
|
/// @dev locked (deactivated) bundles may not underwrite any new policies
|
100
96
|
function lock(NftId bundleNftId) external restricted() {
|
101
|
-
NftId poolNftId =
|
97
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
102
98
|
_deactivate(poolNftId, bundleNftId);
|
103
99
|
emit LogBundleManagerBundleLocked(poolNftId, bundleNftId);
|
104
100
|
}
|
@@ -2,12 +2,14 @@
|
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
|
+
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
5
6
|
|
6
7
|
import {BundleManager} from "./BundleManager.sol";
|
7
8
|
import {InstanceReader} from "./InstanceReader.sol";
|
8
9
|
|
10
|
+
import {IInstanceBase} from "./IInstanceBase.sol";
|
11
|
+
|
9
12
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
10
|
-
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
11
13
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
12
14
|
import {IPoolService} from "./service/IPoolService.sol";
|
13
15
|
import {IProductService} from "./service/IProductService.sol";
|
@@ -23,9 +25,8 @@ import {IPolicy} from "./module/IPolicy.sol";
|
|
23
25
|
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
24
26
|
|
25
27
|
|
26
|
-
interface IInstance is
|
28
|
+
interface IInstance is IInstanceBase, IAccessManaged {
|
27
29
|
|
28
|
-
function getComponentOwnerService() external view returns (IComponentOwnerService);
|
29
30
|
function getDistributionService() external view returns (IDistributionService);
|
30
31
|
function getProductService() external view returns (IProductService);
|
31
32
|
function getPoolService() external view returns (IPoolService);
|
@@ -56,7 +57,6 @@ interface IInstance is IERC165, IKeyValueStore {
|
|
56
57
|
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
57
58
|
function updatePolicyState(NftId policyNftId, StateId newState) external;
|
58
59
|
|
59
|
-
function getInstanceAccessManager() external view returns (InstanceAccessManager);
|
60
60
|
function getInstanceReader() external view returns (InstanceReader);
|
61
61
|
function getBundleManager() external view returns (BundleManager);
|
62
62
|
}
|
@@ -6,7 +6,6 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
6
6
|
import {BundleManager} from "./BundleManager.sol";
|
7
7
|
import {InstanceReader} from "./InstanceReader.sol";
|
8
8
|
|
9
|
-
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
10
9
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
11
10
|
import {IPoolService} from "./service/IPoolService.sol";
|
12
11
|
import {IProductService} from "./service/IProductService.sol";
|
@@ -19,8 +18,10 @@ import {IRisk} from "./module/IRisk.sol";
|
|
19
18
|
import {IPolicy} from "./module/IPolicy.sol";
|
20
19
|
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
21
20
|
|
21
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
22
22
|
|
23
|
-
|
23
|
+
|
24
|
+
interface IInstanceBase is IRegisterable, IKeyValueStore {
|
24
25
|
|
25
26
|
|
26
27
|
}
|
@@ -8,7 +8,7 @@ import {IService} from "../shared/IService.sol";
|
|
8
8
|
import {IRegistry} from "../registry/IRegistry.sol";
|
9
9
|
|
10
10
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
11
|
-
import {
|
11
|
+
import {IComponent} from "../components/IComponent.sol";
|
12
12
|
|
13
13
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
14
14
|
import {Instance} from "./Instance.sol";
|
@@ -19,7 +19,8 @@ interface IInstanceService is IService {
|
|
19
19
|
|
20
20
|
error ErrorInstanceServiceRequestUnauhorized(address caller);
|
21
21
|
error ErrorInstanceServiceNotInstanceOwner(address caller, NftId instanceNftId);
|
22
|
-
|
22
|
+
error ErrorInstanceServiceComponentNotRegistered(address componentAddress);
|
23
|
+
|
23
24
|
event LogInstanceCloned(address clonedAccessManagerAddress, address clonedInstanceAddress, address clonedInstanceReaderAddress, NftId clonedInstanceNftId);
|
24
25
|
|
25
26
|
function createInstanceClone()
|
@@ -33,6 +34,7 @@ interface IInstanceService is IService {
|
|
33
34
|
);
|
34
35
|
|
35
36
|
function hasRole(address account, RoleId role, address instanceAddress) external returns (bool);
|
37
|
+
function setTargetLocked(string memory targetName, bool locked) external;
|
36
38
|
|
37
39
|
}
|
38
40
|
|