@etherisc/gif-next 0.0.2-eb98db7-932 → 0.0.2-ebf1a6b-485
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 +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +10 -89
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +67 -134
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +7 -73
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +46 -117
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +238 -96
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +11 -145
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +241 -112
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +15 -162
- 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 +84 -146
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +11 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +149 -211
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +2 -2
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +79 -110
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +44 -33
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +17 -17
- 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 +12 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +172 -62
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +33 -25
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +34 -23
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +9 -9
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +14 -3
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +2 -2
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +535 -69
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +96 -32
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +121 -27
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +17 -6
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +11 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +344 -6
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +11 -64
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +11 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +11 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +48 -157
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +19 -47
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +22 -11
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +6 -6
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +14 -3
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +2 -2
- 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 +11 -0
- 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 +24 -13
- 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 +2 -2
- 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 +11 -0
- 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 +3 -3
- 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 +12 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +3 -3
- 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 +14 -3
- 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/ClaimId.sol/ClaimIdLib.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/PayoutId.sol/PayoutIdLib.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/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- 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/Timestamp.sol/TimestampLib.json +25 -7
- 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 +68 -88
- package/contracts/components/Distribution.sol +12 -6
- package/contracts/components/IComponent.sol +31 -17
- package/contracts/components/IDistributionComponent.sol +1 -14
- package/contracts/components/IPoolComponent.sol +89 -25
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +216 -92
- package/contracts/components/Product.sol +24 -20
- package/contracts/instance/BundleManager.sol +1 -1
- package/contracts/instance/InstanceService.sol +15 -1
- package/contracts/instance/module/IBundle.sol +2 -1
- package/contracts/instance/module/IDistribution.sol +2 -1
- package/contracts/instance/module/IPolicy.sol +26 -1
- package/contracts/instance/module/ISetup.sol +5 -7
- package/contracts/instance/service/ApplicationService.sol +121 -40
- package/contracts/instance/service/BundleService.sol +4 -3
- package/contracts/instance/service/DistributionService.sol +91 -43
- package/contracts/instance/service/IApplicationService.sol +7 -7
- package/contracts/instance/service/IBundleService.sol +3 -2
- package/contracts/instance/service/IDistributionService.sol +15 -2
- package/contracts/instance/service/IPolicyService.sol +1 -20
- package/contracts/instance/service/PolicyService.sol +31 -105
- package/contracts/registry/RegistryService.sol +5 -5
- package/contracts/shared/IService.sol +2 -0
- package/contracts/shared/Registerable.sol +2 -2
- package/contracts/types/RoleId.sol +7 -2
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/Timestamp.sol +12 -13
- package/package.json +1 -1
@@ -6,12 +6,14 @@ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IER
|
|
6
6
|
import {IRisk} from "../instance/module/IRisk.sol";
|
7
7
|
import {IApplicationService} from "../instance/service/IApplicationService.sol";
|
8
8
|
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
9
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
9
10
|
import {IClaimService} from "../instance/service/IClaimService.sol";
|
10
11
|
import {IProductComponent} from "./IProductComponent.sol";
|
11
12
|
import {NftId, NftIdLib} from "../types/NftId.sol";
|
12
13
|
import {PRODUCT, APPLICATION, POLICY, CLAIM } from "../types/ObjectType.sol";
|
13
14
|
import {ReferralId} from "../types/Referral.sol";
|
14
15
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
16
|
+
import {Seconds} from "../types/Seconds.sol";
|
15
17
|
import {StateId} from "../types/StateId.sol";
|
16
18
|
import {Timestamp} from "../types/Timestamp.sol";
|
17
19
|
import {Fee} from "../types/Fee.sol";
|
@@ -20,6 +22,7 @@ import {Component} from "./Component.sol";
|
|
20
22
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
21
23
|
|
22
24
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
25
|
+
import {IPolicy} from "../instance/module/IPolicy.sol";
|
23
26
|
import {ISetup} from "../instance/module/ISetup.sol";
|
24
27
|
import {Pool} from "../components/Pool.sol";
|
25
28
|
import {Distribution} from "../components/Distribution.sol";
|
@@ -32,6 +35,7 @@ abstract contract Product is
|
|
32
35
|
bytes32 public constant PRODUCT_STORAGE_LOCATION_V1 = 0x0bb7aafdb8e380f81267337bc5b5dfdf76e6d3a380ecadb51ec665246d9d6800;
|
33
36
|
|
34
37
|
struct ProductStorage {
|
38
|
+
IProductService _productService;
|
35
39
|
IApplicationService _applicationService;
|
36
40
|
IPolicyService _policyService;
|
37
41
|
IClaimService _claimService;
|
@@ -55,20 +59,21 @@ abstract contract Product is
|
|
55
59
|
Fee memory productFee,
|
56
60
|
Fee memory processingFee,
|
57
61
|
address initialOwner,
|
58
|
-
bytes memory data
|
62
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
59
63
|
)
|
60
64
|
public
|
61
65
|
virtual
|
62
66
|
onlyInitializing()
|
63
67
|
{
|
64
|
-
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner,
|
68
|
+
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, registryData);
|
65
69
|
|
66
70
|
ProductStorage storage $ = _getProductStorage();
|
67
71
|
// TODO add validation
|
68
72
|
// TODO refactor to go via registry
|
69
|
-
$.
|
70
|
-
$.
|
71
|
-
$.
|
73
|
+
$._productService = IProductService(_getServiceAddress(PRODUCT()));
|
74
|
+
$._applicationService = IApplicationService(_getServiceAddress(APPLICATION()));
|
75
|
+
$._policyService = IPolicyService(_getServiceAddress(POLICY()));
|
76
|
+
$._claimService = IClaimService(_getServiceAddress(CLAIM()));
|
72
77
|
$._pool = Pool(pool);
|
73
78
|
$._distribution = Distribution(distribution);
|
74
79
|
$._initialProductFee = productFee;
|
@@ -84,7 +89,7 @@ abstract contract Product is
|
|
84
89
|
function calculatePremium(
|
85
90
|
uint256 sumInsuredAmount,
|
86
91
|
RiskId riskId,
|
87
|
-
|
92
|
+
Seconds lifetime,
|
88
93
|
bytes memory applicationData,
|
89
94
|
NftId bundleNftId,
|
90
95
|
ReferralId referralId
|
@@ -94,7 +99,8 @@ abstract contract Product is
|
|
94
99
|
override
|
95
100
|
returns (uint256 premiumAmount)
|
96
101
|
{
|
97
|
-
|
102
|
+
IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
|
103
|
+
getNftId(),
|
98
104
|
riskId,
|
99
105
|
sumInsuredAmount,
|
100
106
|
lifetime,
|
@@ -102,13 +108,14 @@ abstract contract Product is
|
|
102
108
|
bundleNftId,
|
103
109
|
referralId
|
104
110
|
);
|
111
|
+
premiumAmount = premium.premiumAmount;
|
105
112
|
}
|
106
113
|
|
107
114
|
|
108
115
|
function calculateNetPremium(
|
109
116
|
uint256 sumInsuredAmount,
|
110
117
|
RiskId riskId,
|
111
|
-
|
118
|
+
Seconds lifetime,
|
112
119
|
bytes memory applicationData
|
113
120
|
)
|
114
121
|
external
|
@@ -128,7 +135,7 @@ abstract contract Product is
|
|
128
135
|
RiskId id,
|
129
136
|
bytes memory data
|
130
137
|
) internal {
|
131
|
-
|
138
|
+
_getProductService().createRisk(
|
132
139
|
id,
|
133
140
|
data
|
134
141
|
);
|
@@ -138,7 +145,7 @@ abstract contract Product is
|
|
138
145
|
RiskId id,
|
139
146
|
bytes memory data
|
140
147
|
) internal {
|
141
|
-
|
148
|
+
_getProductService().updateRisk(
|
142
149
|
id,
|
143
150
|
data
|
144
151
|
);
|
@@ -148,7 +155,7 @@ abstract contract Product is
|
|
148
155
|
RiskId id,
|
149
156
|
StateId state
|
150
157
|
) internal {
|
151
|
-
|
158
|
+
_getProductService().updateRiskState(
|
152
159
|
id,
|
153
160
|
state
|
154
161
|
);
|
@@ -162,7 +169,7 @@ abstract contract Product is
|
|
162
169
|
address applicationOwner,
|
163
170
|
RiskId riskId,
|
164
171
|
uint256 sumInsuredAmount,
|
165
|
-
|
172
|
+
Seconds lifetime,
|
166
173
|
NftId bundleNftId,
|
167
174
|
ReferralId referralId,
|
168
175
|
bytes memory applicationData
|
@@ -242,7 +249,7 @@ abstract contract Product is
|
|
242
249
|
restricted()
|
243
250
|
override
|
244
251
|
{
|
245
|
-
|
252
|
+
_getProductService().setFees(productFee, processingFee);
|
246
253
|
}
|
247
254
|
|
248
255
|
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
@@ -258,20 +265,13 @@ abstract contract Product is
|
|
258
265
|
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
259
266
|
ProductStorage storage $ = _getProductStorage();
|
260
267
|
|
261
|
-
ISetup.DistributionSetupInfo memory distributionSetupInfo = $._distribution.getSetupInfo();
|
262
|
-
ISetup.PoolSetupInfo memory poolSetupInfo = $._pool.getSetupInfo();
|
263
|
-
|
264
268
|
return ISetup.ProductSetupInfo(
|
265
269
|
getToken(),
|
266
270
|
$._tokenHandler,
|
267
271
|
$._distributionNftId,
|
268
272
|
$._poolNftId,
|
269
|
-
distributionSetupInfo.distributionFee,
|
270
273
|
$._initialProductFee,
|
271
274
|
$._initialProcessingFee,
|
272
|
-
poolSetupInfo.poolFee,
|
273
|
-
poolSetupInfo.stakingFee,
|
274
|
-
poolSetupInfo.performanceFee,
|
275
275
|
false,
|
276
276
|
getWallet()
|
277
277
|
);
|
@@ -282,4 +282,8 @@ abstract contract Product is
|
|
282
282
|
$.slot := PRODUCT_STORAGE_LOCATION_V1
|
283
283
|
}
|
284
284
|
}
|
285
|
+
|
286
|
+
function _getProductService() internal view returns (IProductService) {
|
287
|
+
return _getProductStorage()._productService;
|
288
|
+
}
|
285
289
|
}
|
@@ -71,7 +71,7 @@ contract BundleManager is
|
|
71
71
|
}
|
72
72
|
|
73
73
|
|
74
|
-
/// @dev add a new bundle to a
|
74
|
+
/// @dev add a new bundle to a pool registerd with this instance
|
75
75
|
// the corresponding pool is fetched via instance reader
|
76
76
|
function add(NftId bundleNftId) external restricted() {
|
77
77
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
@@ -16,7 +16,7 @@ import {Service} from "../../contracts/shared/Service.sol";
|
|
16
16
|
import {IService} from "../shared/IService.sol";
|
17
17
|
import {NftId} from "../../contracts/types/NftId.sol";
|
18
18
|
import {RoleId} from "../types/RoleId.sol";
|
19
|
-
import {ADMIN_ROLE, DISTRIBUTION_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE, PRODUCT_SERVICE_ROLE, APPLICATION_SERVICE_ROLE, POLICY_SERVICE_ROLE, CLAIM_SERVICE_ROLE, BUNDLE_SERVICE_ROLE} from "../types/RoleId.sol";
|
19
|
+
import {ADMIN_ROLE, DISTRIBUTION_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE, PUBLIC_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE, PRODUCT_SERVICE_ROLE, APPLICATION_SERVICE_ROLE, POLICY_SERVICE_ROLE, CLAIM_SERVICE_ROLE, BUNDLE_SERVICE_ROLE} from "../types/RoleId.sol";
|
20
20
|
import {ObjectType, INSTANCE, BUNDLE, APPLICATION, POLICY, CLAIM, PRODUCT, DISTRIBUTION, REGISTRY, POOL} from "../types/ObjectType.sol";
|
21
21
|
import {IDistributionComponent} from "../components/IDistributionComponent.sol";
|
22
22
|
import {IPoolComponent} from "../components/IPoolComponent.sol";
|
@@ -435,6 +435,20 @@ contract InstanceService is
|
|
435
435
|
bytes4[] memory fctSelectors2 = new bytes4[](1);
|
436
436
|
fctSelectors2[0] = IPoolComponent.verifyApplication.selector;
|
437
437
|
instanceAccessManager.setTargetFunctionRole(poolName, fctSelectors2, POLICY_SERVICE_ROLE());
|
438
|
+
|
439
|
+
// bundle owner specific functions
|
440
|
+
bytes4[] memory fctSelectors3 = new bytes4[](7);
|
441
|
+
fctSelectors3[0] = IPoolComponent.stake.selector;
|
442
|
+
fctSelectors3[1] = IPoolComponent.unstake.selector;
|
443
|
+
fctSelectors3[2] = IPoolComponent.extend.selector;
|
444
|
+
fctSelectors3[3] = IPoolComponent.lockBundle.selector;
|
445
|
+
fctSelectors3[4] = IPoolComponent.unlockBundle.selector;
|
446
|
+
fctSelectors3[5] = IPoolComponent.close.selector;
|
447
|
+
fctSelectors3[6] = IPoolComponent.setBundleFee.selector;
|
448
|
+
instanceAccessManager.setTargetFunctionRole(
|
449
|
+
poolName,
|
450
|
+
fctSelectors3,
|
451
|
+
IPoolComponent(poolAddress).getBundleOwnerRole());
|
438
452
|
}
|
439
453
|
|
440
454
|
function grantProductDefaultPermissions(NftId instanceNftId, address productAddress, string memory productName) external onlyRegisteredService {
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {NftId} from "../../types/NftId.sol";
|
5
5
|
import {Fee} from "../../types/Fee.sol";
|
6
|
+
import {Seconds} from "../../types/Seconds.sol";
|
6
7
|
import {Timestamp} from "../../types/Timestamp.sol";
|
7
8
|
|
8
9
|
interface IBundle {
|
@@ -13,7 +14,7 @@ interface IBundle {
|
|
13
14
|
uint256 capitalAmount; // net investment capital + net premiums - payouts
|
14
15
|
uint256 lockedAmount; // capital amount linked to collateralizaion of non-closed policies (<= balance)
|
15
16
|
uint256 balanceAmount; // total amount of funds: capitalAmount + fees (balance >= captial)
|
16
|
-
|
17
|
+
Seconds lifetime;
|
17
18
|
Timestamp expiredAt; // no new policies
|
18
19
|
Timestamp closedAt; // no open policies, locked amount = 0
|
19
20
|
}
|
@@ -5,10 +5,35 @@ import {NftId} from "../../types/NftId.sol";
|
|
5
5
|
import {ClaimId} from "../../types/ClaimId.sol";
|
6
6
|
import {ReferralId} from "../../types/Referral.sol";
|
7
7
|
import {RiskId} from "../../types/RiskId.sol";
|
8
|
+
import {Seconds} from "../../types/Seconds.sol";
|
8
9
|
import {Timestamp} from "../../types/Timestamp.sol";
|
9
10
|
|
10
11
|
interface IPolicy {
|
11
12
|
|
13
|
+
struct Premium {
|
14
|
+
// this is the net premium calculated by the product
|
15
|
+
uint256 netPremiumAmount;
|
16
|
+
// fullPremium = netPremium + all fixed amounts + all variable amounts (excl commission and minDistribtuionOwnerFee variable part)
|
17
|
+
uint256 fullPremiumAmount;
|
18
|
+
// premium = fullPremium - discount
|
19
|
+
uint256 premiumAmount;
|
20
|
+
uint256 productFeeFixAmount;
|
21
|
+
uint256 poolFeeFixAmount;
|
22
|
+
uint256 bundleFeeFixAmount;
|
23
|
+
uint256 distributionFeeFixAmount;
|
24
|
+
uint256 productFeeVarAmount;
|
25
|
+
uint256 poolFeeVarAmount;
|
26
|
+
uint256 bundleFeeVarAmount;
|
27
|
+
uint256 distributionFeeVarAmount;
|
28
|
+
uint256 distributionOwnerFeeFixAmount;
|
29
|
+
// this is the remaining amount when the commission and discount are subtracted from the distribution fee variable part (must be at least the minDistributionOwnerFee)
|
30
|
+
uint256 distributionOwnerFeeVarAmount;
|
31
|
+
// this value is based on distributor type referenced in the referral
|
32
|
+
uint256 commissionAmount;
|
33
|
+
// this is based on referral used
|
34
|
+
uint256 discountAmount;
|
35
|
+
}
|
36
|
+
|
12
37
|
/// @dev policy data for the full policy lifecycle
|
13
38
|
struct PolicyInfo {
|
14
39
|
NftId productNftId;
|
@@ -18,7 +43,7 @@ interface IPolicy {
|
|
18
43
|
uint256 sumInsuredAmount;
|
19
44
|
uint256 premiumAmount;
|
20
45
|
uint256 premiumPaidAmount;
|
21
|
-
|
46
|
+
Seconds lifetime;
|
22
47
|
bytes applicationData;
|
23
48
|
bytes policyData;
|
24
49
|
uint16 claimsCount;
|
@@ -14,12 +14,8 @@ interface ISetup {
|
|
14
14
|
TokenHandler tokenHandler;
|
15
15
|
NftId distributionNftId;
|
16
16
|
NftId poolNftId;
|
17
|
-
Fee distributionFee; // default distribution fee (no referral id)
|
18
17
|
Fee productFee; // product fee on net premium
|
19
|
-
Fee processingFee; // product fee on payout amounts
|
20
|
-
Fee poolFee; // pool fee on net premium
|
21
|
-
Fee stakingFee; // pool fee on staked capital from investor
|
22
|
-
Fee performanceFee; // pool fee on profits from capital investors
|
18
|
+
Fee processingFee; // product fee on payout amounts
|
23
19
|
bool isIntercepting; // intercepts nft transfers (for products)
|
24
20
|
address wallet;
|
25
21
|
}
|
@@ -27,14 +23,16 @@ interface ISetup {
|
|
27
23
|
struct DistributionSetupInfo {
|
28
24
|
NftId productNftId;
|
29
25
|
TokenHandler tokenHandler;
|
30
|
-
Fee
|
26
|
+
Fee minDistributionOwnerFee;
|
27
|
+
Fee distributionFee; // recalculated whenever any fee on the product/pool/dist/disttype is changed
|
31
28
|
address wallet;
|
32
|
-
|
29
|
+
uint256 sumDistributionFees;
|
33
30
|
}
|
34
31
|
|
35
32
|
struct PoolSetupInfo {
|
36
33
|
NftId productNftId;
|
37
34
|
TokenHandler tokenHandler;
|
35
|
+
uint256 maxCapitalAmount; // max capital amount allowed for pool
|
38
36
|
bool isInterceptingBundleTransfers; // intercepts nft transfers for bundles
|
39
37
|
bool isExternallyManaged; // funding bundles is restricted to book keeping, actual funds may be provided as needed to support payouts
|
40
38
|
bool isVerifyingApplications; // underwriting requires the pool component checks/confirms the applications
|
@@ -22,10 +22,11 @@ import {TokenHandler} from "../../shared/TokenHandler.sol";
|
|
22
22
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
23
23
|
import {Versionable} from "../../shared/Versionable.sol";
|
24
24
|
|
25
|
+
import {Seconds} from "../../types/Seconds.sol";
|
25
26
|
import {Timestamp, TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
26
27
|
import {UFixed, UFixedLib} from "../../types/UFixed.sol";
|
27
28
|
import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
|
28
|
-
import {ObjectType, INSTANCE, PRODUCT, POOL, APPLICATION, POLICY, BUNDLE} from "../../types/ObjectType.sol";
|
29
|
+
import {ObjectType, DISTRIBUTION, INSTANCE, PRODUCT, POOL, APPLICATION, POLICY, BUNDLE} from "../../types/ObjectType.sol";
|
29
30
|
import {APPLIED, REVOKED, UNDERWRITTEN, ACTIVE, KEEP_STATE, CLOSED} from "../../types/StateId.sol";
|
30
31
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
31
32
|
import {Fee, FeeLib} from "../../types/Fee.sol";
|
@@ -38,6 +39,7 @@ import {ComponentService} from "../base/ComponentService.sol";
|
|
38
39
|
import {InstanceReader} from "../InstanceReader.sol";
|
39
40
|
import {IApplicationService} from "./IApplicationService.sol";
|
40
41
|
import {IBundleService} from "./IBundleService.sol";
|
42
|
+
import {IDistributionService} from "./IDistributionService.sol";
|
41
43
|
import {IPoolService} from "./IPoolService.sol";
|
42
44
|
import {IService} from "../../shared/IService.sol";
|
43
45
|
import {Service} from "../../shared/Service.sol";
|
@@ -47,6 +49,7 @@ contract ApplicationService is
|
|
47
49
|
ComponentService,
|
48
50
|
IApplicationService
|
49
51
|
{
|
52
|
+
IDistributionService internal _distributionService;
|
50
53
|
|
51
54
|
function _initialize(
|
52
55
|
address owner,
|
@@ -63,6 +66,8 @@ contract ApplicationService is
|
|
63
66
|
|
64
67
|
initializeService(registryAddress, owner);
|
65
68
|
registerInterface(type(IApplicationService).interfaceId);
|
69
|
+
|
70
|
+
_distributionService = IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), getMajorVersion()));
|
66
71
|
}
|
67
72
|
|
68
73
|
|
@@ -75,7 +80,7 @@ contract ApplicationService is
|
|
75
80
|
address applicationOwner,
|
76
81
|
RiskId riskId,
|
77
82
|
uint256 sumInsuredAmount,
|
78
|
-
|
83
|
+
Seconds lifetime,
|
79
84
|
NftId bundleNftId,
|
80
85
|
ReferralId referralId,
|
81
86
|
bytes memory applicationData
|
@@ -99,7 +104,9 @@ contract ApplicationService is
|
|
99
104
|
)
|
100
105
|
);
|
101
106
|
|
102
|
-
(uint256 premiumAmount
|
107
|
+
// (uint256 premiumAmount,,,,,) = calculatePremium(
|
108
|
+
IPolicy.Premium memory premium = calculatePremium(
|
109
|
+
productInfo.nftId,
|
103
110
|
riskId,
|
104
111
|
sumInsuredAmount,
|
105
112
|
lifetime,
|
@@ -114,7 +121,7 @@ contract ApplicationService is
|
|
114
121
|
referralId,
|
115
122
|
riskId,
|
116
123
|
sumInsuredAmount,
|
117
|
-
premiumAmount,
|
124
|
+
premium.premiumAmount,
|
118
125
|
0,
|
119
126
|
lifetime,
|
120
127
|
applicationData,
|
@@ -169,11 +176,12 @@ contract ApplicationService is
|
|
169
176
|
instance.updateApplicationState(applicationNftId, REVOKED());
|
170
177
|
}
|
171
178
|
|
172
|
-
|
179
|
+
// TODO: maybe move this to a pricing service later
|
173
180
|
function calculatePremium(
|
181
|
+
NftId productNftId,
|
174
182
|
RiskId riskId,
|
175
183
|
uint256 sumInsuredAmount,
|
176
|
-
|
184
|
+
Seconds lifetime,
|
177
185
|
bytes memory applicationData,
|
178
186
|
NftId bundleNftId,
|
179
187
|
ReferralId referralId
|
@@ -182,42 +190,36 @@ contract ApplicationService is
|
|
182
190
|
view
|
183
191
|
virtual override
|
184
192
|
returns (
|
185
|
-
|
186
|
-
uint256 distributionFeeAmount,
|
187
|
-
uint256 productFeeAmount,
|
188
|
-
uint256 poolFeeAmount,
|
189
|
-
uint256 bundleFeeAmount
|
193
|
+
IPolicy.Premium memory premium
|
190
194
|
)
|
191
195
|
{
|
192
|
-
|
193
|
-
uint256 netPremiumAmount = product.calculateNetPremium(
|
196
|
+
uint256 netPremiumAmount = _getAndVerifyProduct(productNftId).calculateNetPremium(
|
194
197
|
sumInsuredAmount,
|
195
198
|
riskId,
|
196
199
|
lifetime,
|
197
200
|
applicationData
|
198
201
|
);
|
199
202
|
|
200
|
-
(
|
201
|
-
productFeeAmount,
|
202
|
-
poolFeeAmount,
|
203
|
-
bundleFeeAmount,
|
204
|
-
distributionFeeAmount
|
205
|
-
) = _calculateFeeAmounts(
|
203
|
+
premium = _getFixedFeeAmounts(
|
206
204
|
netPremiumAmount,
|
207
|
-
|
205
|
+
_getAndVerifyProduct(productNftId),
|
208
206
|
bundleNftId,
|
209
207
|
referralId
|
210
208
|
);
|
211
209
|
|
212
|
-
|
213
|
-
|
214
|
-
|
210
|
+
(
|
211
|
+
premium
|
212
|
+
) = _calculateVariableFeeAmounts(
|
213
|
+
premium,
|
214
|
+
_getAndVerifyProduct(productNftId),
|
215
|
+
bundleNftId,
|
216
|
+
referralId
|
217
|
+
);
|
215
218
|
}
|
216
219
|
|
217
220
|
|
218
221
|
// internal functions
|
219
|
-
|
220
|
-
function _calculateFeeAmounts(
|
222
|
+
function _getFixedFeeAmounts(
|
221
223
|
uint256 netPremiumAmount,
|
222
224
|
Product product,
|
223
225
|
NftId bundleNftId,
|
@@ -226,10 +228,7 @@ contract ApplicationService is
|
|
226
228
|
internal
|
227
229
|
view
|
228
230
|
returns (
|
229
|
-
|
230
|
-
uint256 poolFeeAmount,
|
231
|
-
uint256 bundleFeeAmount,
|
232
|
-
uint256 distributionFeeAmount
|
231
|
+
IPolicy.Premium memory premium
|
233
232
|
)
|
234
233
|
{
|
235
234
|
InstanceReader instanceReader;
|
@@ -239,24 +238,99 @@ contract ApplicationService is
|
|
239
238
|
}
|
240
239
|
|
241
240
|
NftId poolNftId = product.getPoolNftId();
|
242
|
-
|
243
|
-
|
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
|
244
248
|
|
245
249
|
{
|
246
|
-
|
247
|
-
|
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
|
+
ISetup.PoolSetupInfo memory poolSetupInfo = instanceReader.getPoolSetupInfo(poolNftId);
|
258
|
+
uint256 t = poolSetupInfo.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
|
+
}
|
248
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;
|
249
294
|
{
|
250
|
-
|
251
|
-
|
295
|
+
IInstance instance = product.getInstance();
|
296
|
+
instanceReader = instance.getInstanceReader();
|
252
297
|
}
|
298
|
+
|
299
|
+
NftId poolNftId = product.getPoolNftId();
|
300
|
+
uint256 netPremiumAmount = premium.netPremiumAmount;
|
301
|
+
|
253
302
|
{
|
254
|
-
|
255
|
-
|
256
|
-
|
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
|
+
ISetup.PoolSetupInfo memory poolSetupInfo = instanceReader.getPoolSetupInfo(poolNftId);
|
311
|
+
uint256 t = (UFixedLib.toUFixed(netPremiumAmount) * poolSetupInfo.poolFee.fractionalFee).toInt();
|
312
|
+
premium.poolFeeVarAmount = t;
|
313
|
+
premium.fullPremiumAmount += t;
|
314
|
+
}
|
315
|
+
{
|
316
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
317
|
+
if(bundleInfo.poolNftId != poolNftId) {
|
318
|
+
revert IApplicationServiceBundlePoolMismatch(bundleNftId, bundleInfo.poolNftId, poolNftId);
|
319
|
+
}
|
320
|
+
uint256 t = (UFixedLib.toUFixed(netPremiumAmount) * bundleInfo.fee.fractionalFee).toInt();
|
321
|
+
premium.bundleFeeVarAmount = t;
|
322
|
+
premium.fullPremiumAmount += t;
|
323
|
+
}
|
324
|
+
{
|
325
|
+
premium = _distributionService.calculateFeeAmount(
|
326
|
+
product.getDistributionNftId(),
|
327
|
+
referralId,
|
328
|
+
premium
|
329
|
+
);
|
330
|
+
}
|
257
331
|
}
|
258
|
-
|
259
|
-
|
332
|
+
|
333
|
+
return premium;
|
260
334
|
}
|
261
335
|
|
262
336
|
|
@@ -265,4 +339,11 @@ contract ApplicationService is
|
|
265
339
|
(productInfo,) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
266
340
|
product = Product(productInfo.objectAddress);
|
267
341
|
}
|
342
|
+
|
343
|
+
function _getAndVerifyProduct(NftId productNftId) internal view returns (Product product) {
|
344
|
+
IRegistry registry = getRegistry();
|
345
|
+
IRegistry.ObjectInfo memory productInfo = registry.getObjectInfo(productNftId);
|
346
|
+
require(productInfo.objectType == PRODUCT(), "OBJECT_TYPE_INVALID");
|
347
|
+
product = Product(productInfo.objectAddress);
|
348
|
+
}
|
268
349
|
}
|
@@ -10,16 +10,17 @@ import {ISetup} from "../module/ISetup.sol";
|
|
10
10
|
import {IPolicy} from "../module/IPolicy.sol";
|
11
11
|
|
12
12
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
13
|
-
import {Versionable} from "../../shared/Versionable.sol";
|
14
13
|
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
15
14
|
|
16
15
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
17
16
|
import {ObjectType, POOL, BUNDLE} from "../../types/ObjectType.sol";
|
18
17
|
import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
|
19
18
|
import {Fee, FeeLib} from "../../types/Fee.sol";
|
20
|
-
import {Version, VersionLib} from "../../types/Version.sol";
|
21
19
|
import {KEEP_STATE, StateId} from "../../types/StateId.sol";
|
20
|
+
import {Seconds} from "../../types/Seconds.sol";
|
22
21
|
import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
22
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
23
|
+
import {Versionable} from "../../shared/Versionable.sol";
|
23
24
|
|
24
25
|
import {IService} from "../../shared/IService.sol";
|
25
26
|
import {Service} from "../../shared/Service.sol";
|
@@ -67,7 +68,7 @@ contract BundleService is
|
|
67
68
|
address owner,
|
68
69
|
Fee memory fee,
|
69
70
|
uint256 stakingAmount,
|
70
|
-
|
71
|
+
Seconds lifetime,
|
71
72
|
bytes calldata filter
|
72
73
|
)
|
73
74
|
external
|