@etherisc/gif-next 0.0.2-f034782-101 → 0.0.2-f080b71-868
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 +6 -83
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +10 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +10 -0
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +100 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +100 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +110 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +100 -0
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +20 -0
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +10 -0
- 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 +2 -2
- 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 +214 -1988
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +101 -14
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +379 -2729
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +95 -58
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +124 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +45 -25
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +157 -126
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +30 -58
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2677 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +108 -21
- 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/KeyValueStore.sol/KeyValueStore.json +2 -2
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +6 -6
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.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/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +119 -227
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +11 -35
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +330 -147
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +70 -14
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +127 -32
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +11 -7
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +193 -386
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +38 -74
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +68 -149
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +163 -113
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +80 -14
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +89 -231
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +132 -24
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +430 -14
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.json +518 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +80 -14
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +210 -65
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +27 -19
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +493 -48
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +18 -14
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.json +988 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.json +689 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +139 -44
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +16 -12
- 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/IRegistryService.sol/IRegistryService.json +0 -24
- 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 +2 -2
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +17 -36
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +7 -7
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +23 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- 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/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +80 -14
- 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/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.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/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +86 -15
- 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/TestFee.sol/TestFee.json +2 -2
- 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 +101 -26
- 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/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +161 -0
- 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/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +40 -9
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- 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/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- 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/Seconds.sol/SecondsLib.dbg.json +1 -1
- 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 +4 -2
- package/contracts/components/IComponent.sol +3 -1
- package/contracts/components/Pool.sol +8 -4
- package/contracts/components/Product.sol +8 -5
- package/contracts/instance/IInstance.sol +16 -54
- package/contracts/instance/IInstanceService.sol +14 -2
- package/contracts/instance/Instance.sol +88 -188
- package/contracts/instance/InstanceAccessManager.sol +41 -23
- package/contracts/instance/InstanceAuthorizationsLib.sol +299 -0
- package/contracts/instance/InstanceReader.sol +15 -6
- package/contracts/instance/InstanceService.sol +59 -234
- package/contracts/instance/InstanceStore.sol +219 -0
- package/contracts/instance/base/ComponentService.sol +51 -38
- package/contracts/instance/base/KeyValueStore.sol +8 -3
- package/contracts/instance/module/IAccess.sol +2 -2
- package/contracts/instance/module/IBundle.sol +6 -4
- package/contracts/instance/module/IComponents.sol +6 -0
- package/contracts/instance/service/ApplicationService.sol +35 -202
- package/contracts/instance/service/BundleService.sol +165 -70
- package/contracts/instance/service/ClaimService.sol +2 -8
- package/contracts/instance/service/DistributionService.sol +30 -151
- package/contracts/instance/service/IApplicationService.sol +0 -18
- package/contracts/instance/service/IBundleService.sol +54 -22
- package/contracts/instance/service/IDistributionService.sol +1 -14
- package/contracts/instance/service/IPolicyService.sol +2 -0
- package/contracts/instance/service/IPoolService.sol +65 -1
- package/contracts/instance/service/IPricingService.sol +36 -0
- package/contracts/instance/service/PolicyService.sol +88 -115
- package/contracts/instance/service/PoolService.sol +136 -53
- package/contracts/instance/service/PricingService.sol +275 -0
- package/contracts/instance/service/PricingServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +25 -56
- package/contracts/registry/IRegistryService.sol +4 -3
- package/contracts/registry/RegistryService.sol +25 -22
- package/contracts/registry/ReleaseManager.sol +20 -18
- package/contracts/shared/IService.sol +4 -6
- package/contracts/shared/Service.sol +21 -7
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +60 -0
- package/contracts/types/Fee.sol +12 -5
- package/contracts/types/ObjectType.sol +4 -0
- package/package.json +1 -1
@@ -16,30 +16,31 @@ import {InstanceAccessManager} from "../InstanceAccessManager.sol";
|
|
16
16
|
|
17
17
|
abstract contract ComponentService is Service {
|
18
18
|
|
19
|
-
error ErrorComponentServiceAlreadyRegistered(address component, NftId nftId);
|
20
19
|
error ErrorComponentServiceNotComponent(address component);
|
21
20
|
error ErrorComponentServiceInvalidType(address component, ObjectType requiredType, ObjectType componentType);
|
22
21
|
error ErrorComponentServiceSenderNotOwner(address component, address initialOwner, address sender);
|
23
22
|
error ErrorComponentServiceExpectedRoleMissing(NftId instanceNftId, RoleId requiredRole, address sender);
|
24
23
|
error ErrorComponentServiceComponentLocked(address component);
|
24
|
+
error ErrorComponentServiceSenderNotService(address sender);
|
25
|
+
error ErrorComponentServiceComponentTypeInvalid(address component, ObjectType expectedType, ObjectType foundType);
|
25
26
|
|
26
27
|
/// @dev modifier to check if caller is a registered service
|
27
28
|
modifier onlyService() {
|
28
29
|
address caller = msg.sender;
|
29
|
-
|
30
|
+
if(!getRegistry().isRegisteredService(caller)) {
|
31
|
+
revert ErrorComponentServiceSenderNotService(caller);
|
32
|
+
}
|
30
33
|
_;
|
31
34
|
}
|
32
35
|
|
33
36
|
// view functions
|
34
37
|
|
35
38
|
function getRegistryService() public view virtual returns (IRegistryService) {
|
36
|
-
|
37
|
-
return IRegistryService(service);
|
39
|
+
return IRegistryService(_getServiceAddress(REGISTRY()));
|
38
40
|
}
|
39
41
|
|
40
42
|
function getInstanceService() public view returns (InstanceService) {
|
41
|
-
|
42
|
-
return InstanceService(service);
|
43
|
+
return InstanceService(_getServiceAddress(INSTANCE()));
|
43
44
|
}
|
44
45
|
|
45
46
|
// internal functions
|
@@ -60,12 +61,6 @@ abstract contract ComponentService is Service {
|
|
60
61
|
// component may only be registerd by initial owner of component
|
61
62
|
owner = msg.sender;
|
62
63
|
|
63
|
-
// check component has not already been registerd
|
64
|
-
NftId compoentNftId = getRegistry().getNftId(componentAddress);
|
65
|
-
if(compoentNftId.gtz()) {
|
66
|
-
revert ErrorComponentServiceAlreadyRegistered(componentAddress, compoentNftId);
|
67
|
-
}
|
68
|
-
|
69
64
|
// check this is a component
|
70
65
|
component = IComponent(componentAddress);
|
71
66
|
if(!component.supportsInterface(type(IComponent).interfaceId)) {
|
@@ -87,48 +82,66 @@ abstract contract ComponentService is Service {
|
|
87
82
|
// check instance has assigned required role to owner
|
88
83
|
instanceNftId = componentInfo.parentNftId;
|
89
84
|
instance = _getInstance(instanceNftId);
|
90
|
-
|
91
|
-
bool hasRole = accessManager.hasRole(
|
92
|
-
requiredRole,
|
93
|
-
owner);
|
94
|
-
|
95
|
-
if(!hasRole) {
|
85
|
+
if(!instance.getInstanceAccessManager().hasRole(requiredRole, owner)) {
|
96
86
|
revert ErrorComponentServiceExpectedRoleMissing(instanceNftId, requiredRole, owner);
|
97
87
|
}
|
98
88
|
}
|
99
89
|
|
100
90
|
// internal view functions
|
91
|
+
function _getAndVerifyCallingComponentAndInstance(
|
92
|
+
ObjectType expectedType // assume always of `component` type
|
93
|
+
)
|
94
|
+
internal
|
95
|
+
view
|
96
|
+
returns(
|
97
|
+
NftId componentNftId,
|
98
|
+
IRegistry.ObjectInfo memory componentInfo,
|
99
|
+
IInstance instance
|
100
|
+
)
|
101
|
+
{
|
102
|
+
componentNftId = getRegistry().getNftId(msg.sender);
|
103
|
+
(componentInfo, instance) = _getAndVerifyComponentInfoAndInstance(componentNftId, expectedType);
|
101
104
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
+
if (instance.getInstanceAccessManager().isTargetLocked(componentInfo.objectAddress)) {
|
106
|
+
revert IAccess.ErrorIAccessTargetLocked(componentInfo.objectAddress);
|
107
|
+
}
|
105
108
|
}
|
106
109
|
|
107
110
|
function _getAndVerifyComponentInfoAndInstance(
|
108
|
-
|
109
|
-
ObjectType expectedType
|
111
|
+
NftId componentNftId,
|
112
|
+
ObjectType expectedType // assume always of `component` type
|
110
113
|
)
|
111
114
|
internal
|
112
115
|
view
|
113
116
|
returns(
|
114
|
-
IRegistry.ObjectInfo memory
|
117
|
+
IRegistry.ObjectInfo memory componentInfo,
|
115
118
|
IInstance instance
|
116
119
|
)
|
117
120
|
{
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
require(info.objectType == expectedType, "OBJECT_TYPE_INVALID");
|
125
|
-
|
126
|
-
address instanceAddress = registry.getObjectInfo(info.parentNftId).objectAddress;
|
127
|
-
instance = IInstance(instanceAddress);
|
128
|
-
|
129
|
-
InstanceAccessManager accessManager = instance.getInstanceAccessManager();
|
130
|
-
if (accessManager.isTargetLocked(info.objectAddress)) {
|
131
|
-
revert IAccess.ErrorIAccessTargetLocked(info.objectAddress);
|
121
|
+
componentInfo = getRegistry().getObjectInfo(componentNftId);
|
122
|
+
if(componentInfo.objectType != expectedType) {
|
123
|
+
revert ErrorComponentServiceComponentTypeInvalid(
|
124
|
+
componentInfo.objectAddress,
|
125
|
+
expectedType,
|
126
|
+
componentInfo.objectType);
|
132
127
|
}
|
128
|
+
|
129
|
+
instance = _getInstance(componentInfo.parentNftId);
|
130
|
+
}
|
131
|
+
// assume componentNftId is always of `instance` type
|
132
|
+
function _getInstance(NftId instanceNftId) internal view returns (IInstance) {
|
133
|
+
return IInstance(
|
134
|
+
getRegistry().getObjectInfo(
|
135
|
+
instanceNftId).objectAddress);
|
136
|
+
}
|
137
|
+
// assume componentNftId is always of `component` type
|
138
|
+
/*function _getInstanceForComponent(NftId componentNftId) internal view returns (IInstance) {
|
139
|
+
NftId instanceNftId = getRegistry().getObjectInfo(componentNftId).parentNftId;
|
140
|
+
address instanceAddress = getRegistry().getObjectInfo(instanceNftId).objectAddress;
|
141
|
+
return IInstance(instanceAddress);
|
142
|
+
}*/
|
143
|
+
|
144
|
+
function _getServiceAddress(ObjectType domain) internal view returns (address) {
|
145
|
+
return getRegistry().getServiceAddress(domain, getVersion().toMajorPart());
|
133
146
|
}
|
134
147
|
}
|
@@ -5,7 +5,7 @@ import {Blocknumber, blockBlocknumber, zeroBlocknumber} from "../../types/Blockn
|
|
5
5
|
import {Key32, KeyId, Key32Lib} from "../../types/Key32.sol";
|
6
6
|
import {NftId} from "../../types/NftId.sol";
|
7
7
|
import {ObjectType} from "../../types/ObjectType.sol";
|
8
|
-
import {StateId, ACTIVE} from "../../types/StateId.sol";
|
8
|
+
import {StateId, ACTIVE, KEEP_STATE} from "../../types/StateId.sol";
|
9
9
|
import {Timestamp, TimestampLib} from "../../types/Timestamp.sol";
|
10
10
|
|
11
11
|
import {Lifecycle} from "./Lifecycle.sol";
|
@@ -79,10 +79,15 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
|
|
79
79
|
// update data
|
80
80
|
_value[key32].data = data;
|
81
81
|
|
82
|
-
// update
|
82
|
+
// update state
|
83
|
+
if(state != KEEP_STATE()) {
|
84
|
+
metadata.state = state;
|
85
|
+
}
|
86
|
+
|
87
|
+
// update reest of metadata
|
83
88
|
address updatedBy = msg.sender;
|
84
89
|
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
85
|
-
|
90
|
+
|
86
91
|
metadata.updatedBy = updatedBy;
|
87
92
|
metadata.updatedIn = blockBlocknumber();
|
88
93
|
|
@@ -43,9 +43,9 @@ interface IAccess {
|
|
43
43
|
error ErrorIAccessRoleTypeInvalid(RoleId roleId, Type rtype);
|
44
44
|
|
45
45
|
error ErrorIAccessTargetAddressZero();
|
46
|
-
error ErrorIAccessTargetDoesNotExist(
|
46
|
+
error ErrorIAccessTargetDoesNotExist(address target);
|
47
47
|
error ErrorIAccessTargetExists(address target, ShortString name);
|
48
|
-
error ErrorIAccessTargetTypeInvalid(
|
48
|
+
error ErrorIAccessTargetTypeInvalid(address target, Type ttype);
|
49
49
|
error ErrorIAccessTargetNameEmpty(address target);
|
50
50
|
error ErrorIAccessTargetNameExists(address target, address existingTarget, ShortString name);
|
51
51
|
error ErrorIAccessTargetLocked(address target);
|
@@ -1,21 +1,23 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {Amount} from "../../types/Amount.sol";
|
4
5
|
import {NftId} from "../../types/NftId.sol";
|
5
6
|
import {Fee} from "../../types/Fee.sol";
|
6
7
|
import {Seconds} from "../../types/Seconds.sol";
|
7
8
|
import {Timestamp} from "../../types/Timestamp.sol";
|
8
9
|
|
9
10
|
interface IBundle {
|
11
|
+
|
10
12
|
struct BundleInfo {
|
11
13
|
NftId poolNftId;
|
12
14
|
Fee fee; // bundle fee on net premium amounts
|
13
15
|
bytes filter; // required conditions for applications to be considered for collateralization by this bundle
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
Amount capitalAmount; // net stakings + net premiums - payouts
|
17
|
+
Amount lockedAmount; // capital amount linked to collateralizaion of non-closed policies (<= capital amount)
|
18
|
+
Amount feeAmount; // accumulated fee amount
|
17
19
|
Seconds lifetime;
|
18
|
-
Timestamp expiredAt; // no new policies
|
20
|
+
Timestamp expiredAt; // no new policies starting with this timestamp
|
19
21
|
Timestamp closedAt; // no open policies, locked amount = 0
|
20
22
|
}
|
21
23
|
}
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
|
+
import {Amount} from "../../types/Amount.sol";
|
6
7
|
import {Fee} from "../../types/Fee.sol";
|
7
8
|
import {NftId} from "../../types/NftId.sol";
|
8
9
|
import {RoleId} from "../../types/RoleId.sol";
|
@@ -16,13 +17,18 @@ interface IComponents {
|
|
16
17
|
IERC20Metadata token;
|
17
18
|
TokenHandler tokenHandler;
|
18
19
|
address wallet;
|
20
|
+
Amount balanceAmount; // calculated balance (may not necessarily match withg wallet balance)
|
21
|
+
Amount feeAmount; // accumulated fees belonging to component owner
|
19
22
|
bytes data; // will hold component type specific additional info (eg encoded pool info)
|
20
23
|
}
|
21
24
|
|
22
25
|
struct PoolInfo {
|
23
26
|
NftId productNftId; // the nft of the product this pool is linked to
|
24
27
|
RoleId bundleOwnerRole; // the required role for bundle owners
|
28
|
+
// TODO maxCapitalAmount -> maxBalanceAmount
|
25
29
|
uint256 maxCapitalAmount; // max capital amount allowed for pool
|
30
|
+
uint256 balanceAmount; // current pool balance (accounting view)
|
31
|
+
uint256 feeAmount; // accumulated fee amount
|
26
32
|
bool isInterceptingBundleTransfers; // intercepts nft transfers for bundles
|
27
33
|
bool isExternallyManaged; // funding bundles is restricted to book keeping, actual funds may be provided as needed to support payouts
|
28
34
|
bool isVerifyingApplications; // underwriting requires the pool component checks/confirms the applications
|
@@ -27,7 +27,7 @@ import {Seconds} from "../../types/Seconds.sol";
|
|
27
27
|
import {Timestamp, TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
28
28
|
import {UFixed, UFixedLib} from "../../types/UFixed.sol";
|
29
29
|
import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
|
30
|
-
import {ObjectType, DISTRIBUTION, INSTANCE, PRODUCT, POOL, APPLICATION, POLICY, BUNDLE} from "../../types/ObjectType.sol";
|
30
|
+
import {ObjectType, DISTRIBUTION, INSTANCE, PRODUCT, POOL, APPLICATION, POLICY, BUNDLE, PRICE} from "../../types/ObjectType.sol";
|
31
31
|
import {APPLIED, REVOKED, UNDERWRITTEN, ACTIVE, KEEP_STATE, CLOSED} from "../../types/StateId.sol";
|
32
32
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
33
33
|
import {Fee, FeeLib} from "../../types/Fee.sol";
|
@@ -44,6 +44,7 @@ import {IDistributionService} from "./IDistributionService.sol";
|
|
44
44
|
import {IPoolService} from "./IPoolService.sol";
|
45
45
|
import {IService} from "../../shared/IService.sol";
|
46
46
|
import {Service} from "../../shared/Service.sol";
|
47
|
+
import {IPricingService} from "./IPricingService.sol";
|
47
48
|
|
48
49
|
|
49
50
|
contract ApplicationService is
|
@@ -51,6 +52,7 @@ contract ApplicationService is
|
|
51
52
|
IApplicationService
|
52
53
|
{
|
53
54
|
IDistributionService internal _distributionService;
|
55
|
+
IPricingService internal _pricingService;
|
54
56
|
|
55
57
|
function _initialize(
|
56
58
|
address owner,
|
@@ -65,14 +67,15 @@ contract ApplicationService is
|
|
65
67
|
address initialOwner;
|
66
68
|
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
67
69
|
|
68
|
-
initializeService(registryAddress, owner);
|
70
|
+
initializeService(registryAddress, address(0), owner);
|
69
71
|
registerInterface(type(IApplicationService).interfaceId);
|
70
72
|
|
71
|
-
_distributionService = IDistributionService(
|
73
|
+
_distributionService = IDistributionService(_getServiceAddress(DISTRIBUTION()));
|
74
|
+
_pricingService = IPricingService(_getServiceAddress(PRICE()));
|
72
75
|
}
|
73
76
|
|
74
77
|
|
75
|
-
function getDomain() public pure override
|
78
|
+
function getDomain() public pure override returns(ObjectType) {
|
76
79
|
return APPLICATION();
|
77
80
|
}
|
78
81
|
|
@@ -90,13 +93,13 @@ contract ApplicationService is
|
|
90
93
|
virtual
|
91
94
|
returns (NftId applicationNftId)
|
92
95
|
{
|
93
|
-
(
|
96
|
+
(NftId productNftId,, IInstance instance) = _getAndVerifyCallingComponentAndInstance(PRODUCT());
|
94
97
|
// TODO: add validations (see create bundle in pool service)
|
95
98
|
|
96
99
|
applicationNftId = getRegistryService().registerPolicy(
|
97
100
|
IRegistry.ObjectInfo(
|
98
101
|
zeroNftId(),
|
99
|
-
|
102
|
+
productNftId,
|
100
103
|
POLICY(),
|
101
104
|
false, // intercepting property for policies is defined on product
|
102
105
|
address(0),
|
@@ -106,36 +109,36 @@ contract ApplicationService is
|
|
106
109
|
);
|
107
110
|
|
108
111
|
// (uint256 premiumAmount,,,,,) = calculatePremium(
|
109
|
-
IPolicy.Premium memory premium = calculatePremium(
|
110
|
-
|
111
|
-
riskId,
|
112
|
-
sumInsuredAmount,
|
113
|
-
lifetime,
|
114
|
-
applicationData,
|
112
|
+
IPolicy.Premium memory premium = _pricingService.calculatePremium(
|
113
|
+
productNftId,
|
115
114
|
bundleNftId,
|
116
|
-
referralId
|
117
|
-
);
|
118
|
-
|
119
|
-
IPolicy.PolicyInfo memory policyInfo = IPolicy.PolicyInfo(
|
120
|
-
productInfo.nftId,
|
121
|
-
bundleNftId,
|
122
|
-
referralId,
|
123
115
|
riskId,
|
116
|
+
referralId,
|
124
117
|
sumInsuredAmount,
|
125
|
-
premium.premiumAmount,
|
126
|
-
0,
|
127
118
|
lifetime,
|
128
|
-
applicationData
|
129
|
-
"",
|
130
|
-
0,
|
131
|
-
0,
|
132
|
-
0,
|
133
|
-
zeroTimestamp(),
|
134
|
-
zeroTimestamp(),
|
135
|
-
zeroTimestamp()
|
119
|
+
applicationData
|
136
120
|
);
|
121
|
+
|
122
|
+
IPolicy.PolicyInfo memory policyInfo = IPolicy.PolicyInfo({
|
123
|
+
productNftId: productNftId,
|
124
|
+
bundleNftId: bundleNftId,
|
125
|
+
referralId: referralId,
|
126
|
+
riskId: riskId,
|
127
|
+
sumInsuredAmount: sumInsuredAmount,
|
128
|
+
premiumAmount: premium.premiumAmount,
|
129
|
+
premiumPaidAmount: 0,
|
130
|
+
lifetime: lifetime,
|
131
|
+
applicationData: applicationData,
|
132
|
+
policyData: "",
|
133
|
+
claimsCount: 0,
|
134
|
+
openClaimsCount: 0,
|
135
|
+
payoutAmount: 0,
|
136
|
+
activatedAt: zeroTimestamp(),
|
137
|
+
expiredAt: zeroTimestamp(),
|
138
|
+
closedAt: zeroTimestamp()
|
139
|
+
});
|
137
140
|
|
138
|
-
instance.createApplication(applicationNftId, policyInfo);
|
141
|
+
instance.getInstanceStore().createApplication(applicationNftId, policyInfo);
|
139
142
|
|
140
143
|
// TODO: add logging
|
141
144
|
}
|
@@ -172,179 +175,9 @@ contract ApplicationService is
|
|
172
175
|
external
|
173
176
|
virtual override
|
174
177
|
{
|
175
|
-
(
|
176
|
-
instance.updateApplicationState(applicationNftId, REVOKED());
|
178
|
+
(,, IInstance instance) = _getAndVerifyCallingComponentAndInstance(PRODUCT());
|
179
|
+
instance.getInstanceStore().updateApplicationState(applicationNftId, REVOKED());
|
177
180
|
}
|
178
181
|
|
179
|
-
// TODO: maybe move this to a pricing service later
|
180
|
-
function calculatePremium(
|
181
|
-
NftId productNftId,
|
182
|
-
RiskId riskId,
|
183
|
-
uint256 sumInsuredAmount,
|
184
|
-
Seconds lifetime,
|
185
|
-
bytes memory applicationData,
|
186
|
-
NftId bundleNftId,
|
187
|
-
ReferralId referralId
|
188
|
-
)
|
189
|
-
public
|
190
|
-
view
|
191
|
-
virtual override
|
192
|
-
returns (
|
193
|
-
IPolicy.Premium memory premium
|
194
|
-
)
|
195
|
-
{
|
196
|
-
uint256 netPremiumAmount = _getAndVerifyProduct(productNftId).calculateNetPremium(
|
197
|
-
sumInsuredAmount,
|
198
|
-
riskId,
|
199
|
-
lifetime,
|
200
|
-
applicationData
|
201
|
-
);
|
202
|
-
|
203
|
-
premium = _getFixedFeeAmounts(
|
204
|
-
netPremiumAmount,
|
205
|
-
_getAndVerifyProduct(productNftId),
|
206
|
-
bundleNftId,
|
207
|
-
referralId
|
208
|
-
);
|
209
|
-
|
210
|
-
(
|
211
|
-
premium
|
212
|
-
) = _calculateVariableFeeAmounts(
|
213
|
-
premium,
|
214
|
-
_getAndVerifyProduct(productNftId),
|
215
|
-
bundleNftId,
|
216
|
-
referralId
|
217
|
-
);
|
218
|
-
}
|
219
|
-
|
220
|
-
|
221
182
|
// internal functions
|
222
|
-
function _getFixedFeeAmounts(
|
223
|
-
uint256 netPremiumAmount,
|
224
|
-
Product product,
|
225
|
-
NftId bundleNftId,
|
226
|
-
ReferralId referralId
|
227
|
-
)
|
228
|
-
internal
|
229
|
-
view
|
230
|
-
returns (
|
231
|
-
IPolicy.Premium memory premium
|
232
|
-
)
|
233
|
-
{
|
234
|
-
InstanceReader instanceReader;
|
235
|
-
{
|
236
|
-
IInstance instance = product.getInstance();
|
237
|
-
instanceReader = instance.getInstanceReader();
|
238
|
-
}
|
239
|
-
|
240
|
-
NftId poolNftId = product.getPoolNftId();
|
241
|
-
premium = IPolicy.Premium(
|
242
|
-
netPremiumAmount, // net premium
|
243
|
-
netPremiumAmount, // full premium
|
244
|
-
0, // premium
|
245
|
-
0, 0, 0, 0, // fix fees
|
246
|
-
0, 0, 0, 0, // variable fees
|
247
|
-
0, 0, 0, 0); // distribution owner fee/commission/discount
|
248
|
-
|
249
|
-
{
|
250
|
-
{
|
251
|
-
ISetup.ProductSetupInfo memory productSetupInfo = instanceReader.getProductSetupInfo(product.getProductNftId());
|
252
|
-
uint256 t = productSetupInfo.productFee.fixedFee;
|
253
|
-
premium.productFeeFixAmount = t;
|
254
|
-
premium.fullPremiumAmount += t;
|
255
|
-
}
|
256
|
-
{
|
257
|
-
bytes memory componentData = instanceReader.getComponentInfo(poolNftId).data;
|
258
|
-
uint256 t = abi.decode(componentData, (IComponents.PoolInfo)).poolFee.fixedFee;
|
259
|
-
premium.poolFeeFixAmount = t;
|
260
|
-
premium.fullPremiumAmount += t;
|
261
|
-
}
|
262
|
-
{
|
263
|
-
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
264
|
-
if(bundleInfo.poolNftId != poolNftId) {
|
265
|
-
revert IApplicationServiceBundlePoolMismatch(bundleNftId, bundleInfo.poolNftId, poolNftId);
|
266
|
-
}
|
267
|
-
uint256 t = bundleInfo.fee.fixedFee;
|
268
|
-
premium.bundleFeeFixAmount = t;
|
269
|
-
premium.fullPremiumAmount += t;
|
270
|
-
}
|
271
|
-
{
|
272
|
-
ISetup.DistributionSetupInfo memory distInto = instanceReader.getDistributionSetupInfo(product.getDistributionNftId());
|
273
|
-
uint256 t = distInto.distributionFee.fixedFee;
|
274
|
-
premium.distributionFeeFixAmount = t;
|
275
|
-
premium.fullPremiumAmount += t;
|
276
|
-
}
|
277
|
-
}
|
278
|
-
|
279
|
-
}
|
280
|
-
|
281
|
-
function _calculateVariableFeeAmounts(
|
282
|
-
IPolicy.Premium memory premium,
|
283
|
-
Product product,
|
284
|
-
NftId bundleNftId,
|
285
|
-
ReferralId referralId
|
286
|
-
)
|
287
|
-
internal
|
288
|
-
view
|
289
|
-
returns (
|
290
|
-
IPolicy.Premium memory finalPremium
|
291
|
-
)
|
292
|
-
{
|
293
|
-
InstanceReader instanceReader;
|
294
|
-
{
|
295
|
-
IInstance instance = product.getInstance();
|
296
|
-
instanceReader = instance.getInstanceReader();
|
297
|
-
}
|
298
|
-
|
299
|
-
NftId poolNftId = product.getPoolNftId();
|
300
|
-
uint256 netPremiumAmount = premium.netPremiumAmount;
|
301
|
-
|
302
|
-
{
|
303
|
-
{
|
304
|
-
ISetup.ProductSetupInfo memory productSetupInfo = instanceReader.getProductSetupInfo(product.getProductNftId());
|
305
|
-
uint256 t = (UFixedLib.toUFixed(netPremiumAmount) * productSetupInfo.productFee.fractionalFee).toInt();
|
306
|
-
premium.productFeeVarAmount = t;
|
307
|
-
premium.fullPremiumAmount += t;
|
308
|
-
}
|
309
|
-
{
|
310
|
-
bytes memory componentData = instanceReader.getComponentInfo(poolNftId).data;
|
311
|
-
UFixed poolFractionalFee = abi.decode(componentData, (IComponents.PoolInfo)).poolFee.fractionalFee;
|
312
|
-
uint256 t = (UFixedLib.toUFixed(netPremiumAmount) * poolFractionalFee).toInt();
|
313
|
-
premium.poolFeeVarAmount = t;
|
314
|
-
premium.fullPremiumAmount += t;
|
315
|
-
}
|
316
|
-
{
|
317
|
-
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
318
|
-
if(bundleInfo.poolNftId != poolNftId) {
|
319
|
-
revert IApplicationServiceBundlePoolMismatch(bundleNftId, bundleInfo.poolNftId, poolNftId);
|
320
|
-
}
|
321
|
-
uint256 t = (UFixedLib.toUFixed(netPremiumAmount) * bundleInfo.fee.fractionalFee).toInt();
|
322
|
-
premium.bundleFeeVarAmount = t;
|
323
|
-
premium.fullPremiumAmount += t;
|
324
|
-
}
|
325
|
-
{
|
326
|
-
premium = _distributionService.calculateFeeAmount(
|
327
|
-
product.getDistributionNftId(),
|
328
|
-
referralId,
|
329
|
-
premium
|
330
|
-
);
|
331
|
-
}
|
332
|
-
}
|
333
|
-
|
334
|
-
return premium;
|
335
|
-
}
|
336
|
-
|
337
|
-
|
338
|
-
function _getAndVerifyInstanceAndProduct() internal view returns (Product product) {
|
339
|
-
IRegistry.ObjectInfo memory productInfo;
|
340
|
-
(productInfo,) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
341
|
-
product = Product(productInfo.objectAddress);
|
342
|
-
}
|
343
|
-
|
344
|
-
function _getAndVerifyProduct(NftId productNftId) internal view returns (Product product) {
|
345
|
-
IRegistry registry = getRegistry();
|
346
|
-
IRegistry.ObjectInfo memory productInfo = registry.getObjectInfo(productNftId);
|
347
|
-
require(productInfo.objectType == PRODUCT(), "OBJECT_TYPE_INVALID");
|
348
|
-
product = Product(productInfo.objectAddress);
|
349
|
-
}
|
350
183
|
}
|