@etherisc/gif-next 0.0.2-b643f7e-850 → 0.0.2-b7cfc95-746
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} +51 -6
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +51 -104
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → IComponent.sol/IComponent.json} +51 -6
- 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 +51 -132
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +56 -120
- 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 +45 -32
- 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 +105 -2
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +99 -14
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +68 -602
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +221 -114
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +2 -2
- 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 +166 -173
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +26 -78
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +15 -2
- 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 -56
- 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 +59 -16
- 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 +1094 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +436 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +136 -88
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +14 -34
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/{IComponentOwnerService.sol/IComponentOwnerService.json → IBundleService.sol/IBundleService.json} +295 -41
- 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 +4 -0
- package/artifacts/contracts/{shared/RegisterableUpgradable.sol/RegisterableUpgradable.json → instance/service/IPolicyService.sol/IPolicyService.json} +372 -43
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +12 -241
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +17 -241
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1219 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +492 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +113 -364
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +14 -54
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +124 -423
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +14 -78
- 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 +212 -133
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +97 -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 +224 -234
- 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 +33 -131
- 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 +547 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +10 -39
- 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/Component.sol +177 -0
- package/contracts/components/Distribution.sol +5 -14
- package/contracts/components/{IBaseComponent.sol → IComponent.sol} +12 -6
- package/contracts/components/IProductComponent.sol +2 -2
- package/contracts/components/Pool.sol +15 -24
- package/contracts/components/Product.sol +29 -23
- package/contracts/instance/IInstance.sol +7 -3
- package/contracts/instance/IInstanceBase.sol +0 -1
- package/contracts/instance/IInstanceService.sol +11 -3
- package/contracts/instance/Instance.sol +22 -213
- package/contracts/instance/InstanceAccessManager.sol +92 -77
- package/contracts/instance/InstanceBase.sol +0 -2
- package/contracts/instance/InstanceService.sol +228 -116
- package/contracts/instance/InstanceServiceManager.sol +5 -8
- package/contracts/instance/ObjectManager.sol +7 -1
- package/contracts/instance/base/ComponentService.sol +133 -0
- package/contracts/instance/base/IInstanceBase.sol +0 -2
- package/contracts/instance/module/IAccess.sol +27 -17
- package/contracts/instance/service/BundleService.sol +293 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/DistributionService.sol +50 -23
- package/contracts/instance/service/DistributionServiceManager.sol +6 -9
- package/contracts/instance/service/IBundleService.sol +44 -0
- package/contracts/instance/service/IPolicyService.sol +94 -0
- package/contracts/instance/service/IPoolService.sol +2 -33
- package/contracts/instance/service/IProductService.sol +2 -72
- package/contracts/instance/service/PolicyService.sol +538 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +64 -209
- package/contracts/instance/service/PoolServiceManager.sol +5 -8
- package/contracts/instance/service/ProductService.sol +130 -459
- package/contracts/registry/ChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +34 -17
- package/contracts/registry/IRegistryService.sol +17 -9
- package/contracts/registry/Registry.sol +214 -210
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +54 -92
- package/contracts/registry/RegistryServiceManager.sol +18 -36
- package/contracts/registry/ReleaseManager.sol +352 -0
- package/contracts/registry/TokenRegistry.sol +8 -7
- 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 +10 -10
- 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/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
- 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/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/contracts/components/BaseComponent.sol +0 -132
- package/contracts/instance/IAccessManagerSimple.sol +0 -391
- package/contracts/instance/base/ComponentServiceBase.sol +0 -134
- package/contracts/instance/service/ComponentOwnerService.sol +0 -317
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -0,0 +1,177 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
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";
|
10
|
+
import {IInstance} from "../instance/IInstance.sol";
|
11
|
+
import {InstanceAccessManager} from "../instance/InstanceAccessManager.sol";
|
12
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
13
|
+
import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
|
14
|
+
import {ObjectType, INSTANCE, PRODUCT} from "../types/ObjectType.sol";
|
15
|
+
import {VersionLib} from "../types/Version.sol";
|
16
|
+
import {Registerable} from "../shared/Registerable.sol";
|
17
|
+
import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
18
|
+
import {IAccess} from "../instance/module/IAccess.sol";
|
19
|
+
|
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
|
24
|
+
Registerable,
|
25
|
+
IComponent
|
26
|
+
{
|
27
|
+
IInstanceService internal _instanceService;
|
28
|
+
IProductService internal _productService;
|
29
|
+
|
30
|
+
IInstance internal _instance;
|
31
|
+
IERC20Metadata internal _token;
|
32
|
+
address internal _wallet;
|
33
|
+
NftId internal _productNftId;
|
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
|
43
|
+
modifier onlyInstanceRole(uint64 roleIdNum) {
|
44
|
+
RoleId roleId = RoleIdLib.toRoleId(roleIdNum);
|
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));
|
57
|
+
}
|
58
|
+
_;
|
59
|
+
}
|
60
|
+
|
61
|
+
constructor(
|
62
|
+
address registry,
|
63
|
+
NftId instanceNftId,
|
64
|
+
address token,
|
65
|
+
ObjectType componentType,
|
66
|
+
bool isInterceptor,
|
67
|
+
address initialOwner
|
68
|
+
)
|
69
|
+
{
|
70
|
+
bytes memory data = "";
|
71
|
+
_initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
|
72
|
+
|
73
|
+
IRegistry.ObjectInfo memory instanceInfo = _registry.getObjectInfo(instanceNftId);
|
74
|
+
_instance = IInstance(instanceInfo.objectAddress);
|
75
|
+
require(
|
76
|
+
_instance.supportsInterface(type(IInstance).interfaceId),
|
77
|
+
""
|
78
|
+
);
|
79
|
+
|
80
|
+
_instanceService = IInstanceService(_registry.getServiceAddress(INSTANCE(), VersionLib.toVersion(3, 0, 0).toMajorPart()));
|
81
|
+
_productService = IProductService(_registry.getServiceAddress(PRODUCT(), VersionLib.toVersion(3, 0, 0).toMajorPart()));
|
82
|
+
_wallet = address(this);
|
83
|
+
_token = IERC20Metadata(token);
|
84
|
+
|
85
|
+
_registerInterface(type(IComponent).interfaceId);
|
86
|
+
}
|
87
|
+
|
88
|
+
// TODO discuss replacement with modifier restricted from accessmanaged
|
89
|
+
function lock() external onlyOwner override {
|
90
|
+
_instanceService.setTargetLocked(getName(), true);
|
91
|
+
}
|
92
|
+
|
93
|
+
// TODO discuss replacement with modifier restricted from accessmanaged
|
94
|
+
function unlock() external onlyOwner override {
|
95
|
+
_instanceService.setTargetLocked(getName(), false);
|
96
|
+
}
|
97
|
+
|
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)
|
101
|
+
external
|
102
|
+
override
|
103
|
+
onlyProductService()
|
104
|
+
{
|
105
|
+
if(_productNftId.gtz()) {
|
106
|
+
revert ErrorComponentProductNftAlreadySet();
|
107
|
+
}
|
108
|
+
|
109
|
+
_productNftId = productNftId;
|
110
|
+
}
|
111
|
+
|
112
|
+
/// @dev Sets the wallet address for the component.
|
113
|
+
/// if the current wallet has tokens, these will be transferred.
|
114
|
+
/// if the new wallet address is externally owned, an approval from the
|
115
|
+
/// owner of the external wallet for the component to move all tokens must exist.
|
116
|
+
function setWallet(address newWallet) external override onlyOwner {
|
117
|
+
address currentWallet = _wallet;
|
118
|
+
uint256 currentBalance = _token.balanceOf(currentWallet);
|
119
|
+
|
120
|
+
// checks
|
121
|
+
if (newWallet == currentWallet) {
|
122
|
+
revert ErrorComponentWalletAddressIsSameAsCurrent(newWallet);
|
123
|
+
}
|
124
|
+
|
125
|
+
if (currentBalance > 0) {
|
126
|
+
if (currentWallet == address(this)) {
|
127
|
+
// move tokens from component smart contract to external wallet
|
128
|
+
} else {
|
129
|
+
// move tokens from external wallet to component smart contract or another external wallet
|
130
|
+
uint256 allowance = _token.allowance(currentWallet, address(this));
|
131
|
+
if (allowance < currentBalance) {
|
132
|
+
revert ErrorComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
// effects
|
138
|
+
_wallet = newWallet;
|
139
|
+
emit LogComponentWalletAddressChanged(newWallet);
|
140
|
+
|
141
|
+
// interactions
|
142
|
+
if (currentBalance > 0) {
|
143
|
+
// transfer tokens from current wallet to new wallet
|
144
|
+
if (currentWallet == address(this)) {
|
145
|
+
// transferFrom requires self allowance too
|
146
|
+
_token.approve(address(this), currentBalance);
|
147
|
+
}
|
148
|
+
|
149
|
+
SafeERC20.safeTransferFrom(_token, currentWallet, newWallet, currentBalance);
|
150
|
+
emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
|
151
|
+
}
|
152
|
+
}
|
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
|
+
|
166
|
+
function getToken() public view override returns (IERC20Metadata token) {
|
167
|
+
return _token;
|
168
|
+
}
|
169
|
+
|
170
|
+
function getInstance() public view override returns (IInstance instance) {
|
171
|
+
return _instance;
|
172
|
+
}
|
173
|
+
|
174
|
+
function getProductNftId() public view override returns (NftId productNftId) {
|
175
|
+
return _productNftId;
|
176
|
+
}
|
177
|
+
}
|
@@ -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,15 +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);
|
10
|
+
interface IComponent is IRegisterable {
|
13
11
|
|
14
|
-
|
15
|
-
|
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);
|
16
17
|
|
17
|
-
|
18
|
+
event LogComponentWalletAddressChanged(address newWallet);
|
19
|
+
event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
|
20
|
+
|
21
|
+
function getName() external pure returns (string memory name);
|
18
22
|
|
23
|
+
// TODO remove and replace with accessmanaged target locking mechanism
|
24
|
+
function lock() external;
|
19
25
|
function unlock() external;
|
20
26
|
|
21
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,28 +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
|
-
import {
|
6
|
+
import {IBundleService} from "../instance/service/IBundleService.sol";
|
7
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
8
8
|
import {Fee} from "../types/Fee.sol";
|
9
9
|
import {UFixed} from "../types/UFixed.sol";
|
10
10
|
import {IPoolComponent} from "./IPoolComponent.sol";
|
11
|
-
import {
|
11
|
+
import {Component} from "./Component.sol";
|
12
12
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
13
13
|
import {ISetup} from "../instance/module/ISetup.sol";
|
14
14
|
|
15
15
|
import {IRegistry} from "../registry/IRegistry.sol";
|
16
16
|
|
17
|
-
// import {IPool} from "../instance/module/pool/IPoolModule.sol";
|
18
|
-
import {ITreasury} from "../instance/module/ITreasury.sol";
|
19
17
|
import {ISetup} from "../instance/module/ISetup.sol";
|
20
18
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
21
19
|
|
22
20
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
23
21
|
import {Registerable} from "../shared/Registerable.sol";
|
24
22
|
|
25
|
-
contract Pool is
|
23
|
+
abstract contract Pool is Component, IPoolComponent {
|
26
24
|
using NftIdLib for NftId;
|
27
25
|
|
28
26
|
bool internal _isConfirmingApplication;
|
@@ -36,9 +34,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
36
34
|
|
37
35
|
// may be used to interact with instance by derived contracts
|
38
36
|
IPoolService internal _poolService;
|
39
|
-
|
40
|
-
// only relevant to protect callback functions for "active" pools
|
41
|
-
IProductService private _productService;
|
37
|
+
IBundleService private _bundleService;
|
42
38
|
|
43
39
|
modifier onlyPoolService() {
|
44
40
|
require(
|
@@ -47,13 +43,6 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
47
43
|
_;
|
48
44
|
}
|
49
45
|
|
50
|
-
modifier onlyProductService() {
|
51
|
-
require(
|
52
|
-
msg.sender == address(_productService),
|
53
|
-
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
54
|
-
_;
|
55
|
-
}
|
56
|
-
|
57
46
|
constructor(
|
58
47
|
address registry,
|
59
48
|
NftId instanceNftId,
|
@@ -67,7 +56,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
67
56
|
Fee memory performanceFee,
|
68
57
|
address initialOwner
|
69
58
|
)
|
70
|
-
|
59
|
+
Component(registry, instanceNftId, token, POOL(), isInterceptor, initialOwner)
|
71
60
|
{
|
72
61
|
_isConfirmingApplication = isConfirmingApplication;
|
73
62
|
// TODO add validation
|
@@ -79,7 +68,8 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
79
68
|
_tokenHandler = new TokenHandler(token);
|
80
69
|
|
81
70
|
_poolService = _instance.getPoolService();
|
82
|
-
_productService = _instance.getProductService();
|
71
|
+
// _productService = _instance.getProductService();
|
72
|
+
_bundleService = _instance.getBundleService();
|
83
73
|
|
84
74
|
_registerInterface(type(IPoolComponent).interfaceId);
|
85
75
|
}
|
@@ -95,7 +85,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
95
85
|
returns(NftId bundleNftId)
|
96
86
|
{
|
97
87
|
address owner = msg.sender;
|
98
|
-
bundleNftId =
|
88
|
+
bundleNftId = _bundleService.createBundle(
|
99
89
|
owner,
|
100
90
|
fee,
|
101
91
|
initialAmount,
|
@@ -168,7 +158,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
168
158
|
override
|
169
159
|
// TODO add onlyBundleOwner
|
170
160
|
{
|
171
|
-
|
161
|
+
_bundleService.setBundleFee(bundleNftId, fee);
|
172
162
|
}
|
173
163
|
|
174
164
|
function lockBundle(
|
@@ -178,7 +168,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
178
168
|
override
|
179
169
|
// TODO add onlyBundleOwner
|
180
170
|
{
|
181
|
-
|
171
|
+
_bundleService.lockBundle(bundleNftId);
|
182
172
|
}
|
183
173
|
|
184
174
|
function unlockBundle(
|
@@ -188,7 +178,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
188
178
|
override
|
189
179
|
// TODO add onlyBundleOwner
|
190
180
|
{
|
191
|
-
|
181
|
+
_bundleService.unlockBundle(bundleNftId);
|
192
182
|
}
|
193
183
|
|
194
184
|
function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
|
@@ -213,6 +203,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
213
203
|
return (
|
214
204
|
info,
|
215
205
|
abi.encode(
|
206
|
+
getName(),
|
216
207
|
ISetup.PoolSetupInfo(
|
217
208
|
_productNftId,
|
218
209
|
_tokenHandler,
|
@@ -256,7 +247,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
256
247
|
internal
|
257
248
|
returns(NftId bundleNftId)
|
258
249
|
{
|
259
|
-
bundleNftId =
|
250
|
+
bundleNftId = _bundleService.createBundle(
|
260
251
|
bundleOwner,
|
261
252
|
fee,
|
262
253
|
amount,
|
@@ -4,17 +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 {
|
8
|
-
import {IProductService} from "../instance/service/IProductService.sol";
|
7
|
+
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
9
8
|
import {IProductComponent} from "./IProductComponent.sol";
|
10
|
-
import {NftId,
|
11
|
-
import {
|
9
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
10
|
+
import {PRODUCT} from "../types/ObjectType.sol";
|
12
11
|
import {ReferralId} from "../types/Referral.sol";
|
13
12
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
14
13
|
import {StateId} from "../types/StateId.sol";
|
15
14
|
import {Timestamp} from "../types/Timestamp.sol";
|
16
|
-
import {Fee
|
17
|
-
import {
|
15
|
+
import {Fee} from "../types/Fee.sol";
|
16
|
+
import {Component} from "./Component.sol";
|
18
17
|
|
19
18
|
import {IRegistry} from "../registry/IRegistry.sol";
|
20
19
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
@@ -26,12 +25,10 @@ import {ISetup} from "../instance/module/ISetup.sol";
|
|
26
25
|
import {Pool} from "../components/Pool.sol";
|
27
26
|
import {Distribution} from "../components/Distribution.sol";
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
contract Product is BaseComponent, IProductComponent {
|
28
|
+
abstract contract Product is Component, IProductComponent {
|
32
29
|
using NftIdLib for NftId;
|
33
30
|
|
34
|
-
|
31
|
+
IPolicyService internal _policyService;
|
35
32
|
Pool internal _pool;
|
36
33
|
Distribution internal _distribution;
|
37
34
|
Fee internal _initialProductFee;
|
@@ -51,9 +48,9 @@ contract Product is BaseComponent, IProductComponent {
|
|
51
48
|
Fee memory productFee,
|
52
49
|
Fee memory processingFee,
|
53
50
|
address initialOwner
|
54
|
-
)
|
51
|
+
) Component(registry, instanceNftid, token, PRODUCT(), isInterceptor, initialOwner) {
|
55
52
|
// TODO add validation
|
56
|
-
|
53
|
+
_policyService = _instance.getPolicyService();
|
57
54
|
_pool = Pool(pool);
|
58
55
|
_distribution = Distribution(distribution);
|
59
56
|
_initialProductFee = productFee;
|
@@ -73,15 +70,15 @@ contract Product is BaseComponent, IProductComponent {
|
|
73
70
|
RiskId riskId,
|
74
71
|
uint256 lifetime,
|
75
72
|
bytes memory applicationData,
|
76
|
-
|
77
|
-
|
73
|
+
NftId bundleNftId,
|
74
|
+
ReferralId referralId
|
78
75
|
)
|
79
76
|
external
|
80
77
|
view
|
81
78
|
override
|
82
79
|
returns (uint256 premiumAmount)
|
83
80
|
{
|
84
|
-
(premiumAmount,,,,) =
|
81
|
+
(premiumAmount,,,,) = _policyService.calculatePremium(
|
85
82
|
riskId,
|
86
83
|
sumInsuredAmount,
|
87
84
|
lifetime,
|
@@ -154,7 +151,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
154
151
|
NftId bundleNftId,
|
155
152
|
ReferralId referralId
|
156
153
|
) internal returns (NftId nftId) {
|
157
|
-
nftId =
|
154
|
+
nftId = _policyService.createApplication(
|
158
155
|
applicationOwner,
|
159
156
|
riskId,
|
160
157
|
sumInsuredAmount,
|
@@ -172,7 +169,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
172
169
|
)
|
173
170
|
internal
|
174
171
|
{
|
175
|
-
|
172
|
+
_policyService.underwrite(
|
176
173
|
policyNftId,
|
177
174
|
requirePremiumPayment,
|
178
175
|
activateAt);
|
@@ -184,7 +181,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
184
181
|
)
|
185
182
|
internal
|
186
183
|
{
|
187
|
-
|
184
|
+
_policyService.collectPremium(
|
188
185
|
policyNftId,
|
189
186
|
activateAt);
|
190
187
|
}
|
@@ -195,11 +192,19 @@ contract Product is BaseComponent, IProductComponent {
|
|
195
192
|
)
|
196
193
|
internal
|
197
194
|
{
|
198
|
-
|
195
|
+
_policyService.activate(
|
199
196
|
policyNftId,
|
200
197
|
activateAt);
|
201
198
|
}
|
202
199
|
|
200
|
+
function _close(
|
201
|
+
NftId policyNftId
|
202
|
+
)
|
203
|
+
internal
|
204
|
+
{
|
205
|
+
_policyService.close(policyNftId);
|
206
|
+
}
|
207
|
+
|
203
208
|
function getPoolNftId() external view override returns (NftId poolNftId) {
|
204
209
|
return getRegistry().getNftId(address(_pool));
|
205
210
|
}
|
@@ -253,8 +258,8 @@ contract Product is BaseComponent, IProductComponent {
|
|
253
258
|
) = _pool.getInitialInfo();
|
254
259
|
|
255
260
|
(
|
256
|
-
ISetup.PoolSetupInfo memory poolSetupInfo
|
257
|
-
) = abi.decode(poolData, (ISetup.PoolSetupInfo));
|
261
|
+
, ISetup.PoolSetupInfo memory poolSetupInfo
|
262
|
+
) = abi.decode(poolData, (string, ISetup.PoolSetupInfo));
|
258
263
|
|
259
264
|
// from DistributionComponent
|
260
265
|
(
|
@@ -263,12 +268,13 @@ contract Product is BaseComponent, IProductComponent {
|
|
263
268
|
) = _distribution.getInitialInfo();
|
264
269
|
|
265
270
|
(
|
266
|
-
ISetup.DistributionSetupInfo memory distributionSetupInfo
|
267
|
-
) = abi.decode(distributionData, (ISetup.DistributionSetupInfo));
|
271
|
+
, ISetup.DistributionSetupInfo memory distributionSetupInfo
|
272
|
+
) = abi.decode(distributionData, (string, ISetup.DistributionSetupInfo));
|
268
273
|
|
269
274
|
return (
|
270
275
|
productInfo,
|
271
276
|
abi.encode(
|
277
|
+
getName(),
|
272
278
|
ISetup.ProductSetupInfo(
|
273
279
|
_token,
|
274
280
|
_tokenHandler,
|
@@ -2,14 +2,17 @@
|
|
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
|
|
9
|
-
import {
|
10
|
+
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
10
11
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
11
12
|
import {IPoolService} from "./service/IPoolService.sol";
|
12
13
|
import {IProductService} from "./service/IProductService.sol";
|
14
|
+
import {IPolicyService} from "./service/IPolicyService.sol";
|
15
|
+
import {IBundleService} from "./service/IBundleService.sol";
|
13
16
|
import {IBundle} from "./module/IBundle.sol";
|
14
17
|
import {ISetup} from "./module/ISetup.sol";
|
15
18
|
import {NftId} from "../types/NftId.sol";
|
@@ -20,12 +23,13 @@ import {IPolicy} from "./module/IPolicy.sol";
|
|
20
23
|
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
21
24
|
|
22
25
|
|
23
|
-
interface IInstance is IERC165, IKeyValueStore {
|
26
|
+
interface IInstance is IERC165, IKeyValueStore, IAccessManaged {
|
24
27
|
|
25
|
-
function getComponentOwnerService() external view returns (IComponentOwnerService);
|
26
28
|
function getDistributionService() external view returns (IDistributionService);
|
27
29
|
function getProductService() external view returns (IProductService);
|
28
30
|
function getPoolService() external view returns (IPoolService);
|
31
|
+
function getPolicyService() external view returns (IPolicyService);
|
32
|
+
function getBundleService() external view returns (IBundleService);
|
29
33
|
|
30
34
|
function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external;
|
31
35
|
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
|
@@ -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";
|
@@ -8,25 +8,33 @@ 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
|
-
import {
|
13
|
+
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
14
14
|
import {Instance} from "./Instance.sol";
|
15
15
|
import {InstanceReader} from "./InstanceReader.sol";
|
16
16
|
import {BundleManager} from "./BundleManager.sol";
|
17
17
|
|
18
18
|
interface IInstanceService is IService {
|
19
19
|
|
20
|
+
error ErrorInstanceServiceRequestUnauhorized(address caller);
|
21
|
+
error ErrorInstanceServiceNotInstanceOwner(address caller, NftId instanceNftId);
|
22
|
+
error ErrorInstanceServiceComponentNotRegistered(address componentAddress);
|
23
|
+
|
20
24
|
event LogInstanceCloned(address clonedAccessManagerAddress, address clonedInstanceAddress, address clonedInstanceReaderAddress, NftId clonedInstanceNftId);
|
21
25
|
|
22
26
|
function createInstanceClone()
|
23
27
|
external
|
24
28
|
returns (
|
25
|
-
|
29
|
+
InstanceAccessManager clonedAccessManager,
|
26
30
|
Instance clonedInstance,
|
27
31
|
NftId instanceNftId,
|
28
32
|
InstanceReader clonedInstanceReader,
|
29
33
|
BundleManager clonedBundleManager
|
30
34
|
);
|
35
|
+
|
36
|
+
function hasRole(address account, RoleId role, address instanceAddress) external returns (bool);
|
37
|
+
function setTargetLocked(string memory targetName, bool locked) external;
|
38
|
+
|
31
39
|
}
|
32
40
|
|