@etherisc/gif-next 0.0.2-def25d4-556 → 0.0.2-e1f23dc-329
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/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +10 -62
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +0 -52
- 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/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +8 -16
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +8 -64
- 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/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +1 -1
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +1 -1
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1304 -93
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +120 -84
- 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 +162 -38
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +98 -18
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +63 -27
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +56 -2
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +16 -16
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +83 -24
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +26 -18
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +87 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +19 -31
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +926 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +448 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +1094 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +472 -0
- 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/IRegistry.sol/IRegistry.json +2 -110
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +94 -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 +35 -146
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +76 -20
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +26 -34
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +12 -12
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/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/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +4 -4
- 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 +9 -9
- 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/Distribution.sol +8 -15
- package/contracts/components/IDistributionComponent.sol +0 -2
- package/contracts/components/Pool.sol +4 -20
- package/contracts/components/Product.sol +28 -41
- package/contracts/instance/IInstance.sol +28 -6
- package/contracts/instance/Instance.sol +14 -14
- package/contracts/instance/InstanceReader.sol +26 -1
- package/contracts/instance/InstanceService.sol +32 -4
- package/contracts/instance/InstanceServiceManager.sol +6 -5
- package/contracts/instance/base/ComponentServiceBase.sol +95 -2
- package/contracts/instance/module/IBundle.sol +1 -0
- package/contracts/instance/module/ISetup.sol +1 -0
- package/contracts/instance/service/DistributionService.sol +8 -25
- package/contracts/instance/service/DistributionServiceManager.sol +6 -5
- package/contracts/instance/service/IPoolService.sol +4 -0
- package/contracts/instance/service/IProductService.sol +3 -3
- package/contracts/instance/service/PoolService.sol +201 -0
- package/contracts/instance/service/PoolServiceManager.sol +54 -0
- package/contracts/instance/service/ProductService.sol +564 -0
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/IRegistry.sol +5 -18
- package/contracts/registry/IRegistryService.sol +28 -11
- package/contracts/registry/Registry.sol +4 -45
- package/contracts/registry/RegistryService.sol +30 -71
- package/contracts/shared/NftOwnable.sol +2 -4
- package/contracts/shared/Service.sol +1 -0
- package/contracts/types/RoleId.sol +2 -0
- package/package.json +1 -1
@@ -24,6 +24,7 @@ import {TokenHandler} from "../shared/TokenHandler.sol";
|
|
24
24
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
25
25
|
import {ISetup} from "../instance/module/ISetup.sol";
|
26
26
|
import {Pool} from "../components/Pool.sol";
|
27
|
+
import {Distribution} from "../components/Distribution.sol";
|
27
28
|
|
28
29
|
import {zeroNftId} from "../types/NftId.sol";
|
29
30
|
|
@@ -32,7 +33,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
32
33
|
|
33
34
|
IProductService internal _productService;
|
34
35
|
Pool internal _pool;
|
35
|
-
|
36
|
+
Distribution internal _distribution;
|
36
37
|
Fee internal _initialProductFee;
|
37
38
|
Fee internal _initialProcessingFee;
|
38
39
|
|
@@ -51,15 +52,14 @@ contract Product is BaseComponent, IProductComponent {
|
|
51
52
|
address initialOwner
|
52
53
|
) BaseComponent(registry, instanceNftid, token, PRODUCT(), isInterceptor, initialOwner) {
|
53
54
|
// TODO add validation
|
54
|
-
|
55
|
-
// _productService = _instance.getProductService();
|
55
|
+
_productService = _instance.getProductService();
|
56
56
|
_pool = Pool(pool);
|
57
|
-
_distribution = distribution;
|
57
|
+
_distribution = Distribution(distribution);
|
58
58
|
_initialProductFee = productFee;
|
59
59
|
_initialProcessingFee = processingFee;
|
60
60
|
|
61
61
|
_poolNftId = getRegistry().getNftId(address(_pool));
|
62
|
-
_distributionNftId = getRegistry().getNftId(_distribution);
|
62
|
+
_distributionNftId = getRegistry().getNftId(address(_distribution));
|
63
63
|
|
64
64
|
_registerInterface(type(IProductComponent).interfaceId);
|
65
65
|
}
|
@@ -118,13 +118,13 @@ contract Product is BaseComponent, IProductComponent {
|
|
118
118
|
);
|
119
119
|
}
|
120
120
|
|
121
|
-
function
|
121
|
+
function _updateRisk(
|
122
122
|
RiskId id,
|
123
|
-
|
123
|
+
bytes memory data
|
124
124
|
) internal {
|
125
|
-
_productService.
|
125
|
+
_productService.updateRisk(
|
126
126
|
id,
|
127
|
-
|
127
|
+
data
|
128
128
|
);
|
129
129
|
}
|
130
130
|
|
@@ -202,7 +202,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
202
202
|
}
|
203
203
|
|
204
204
|
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
205
|
-
return getRegistry().getNftId(_distribution);
|
205
|
+
return getRegistry().getNftId(address(_distribution));
|
206
206
|
}
|
207
207
|
|
208
208
|
// from product component
|
@@ -218,28 +218,12 @@ contract Product is BaseComponent, IProductComponent {
|
|
218
218
|
}
|
219
219
|
|
220
220
|
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
221
|
-
if (getNftId().eq(zeroNftId())) {
|
222
|
-
return ISetup.ProductSetupInfo(
|
223
|
-
_token,
|
224
|
-
TokenHandler(address(0)),
|
225
|
-
_distributionNftId,
|
226
|
-
_poolNftId,
|
227
|
-
FeeLib.zeroFee(), //_instance.getDistributionFee(_distributionNftId)
|
228
|
-
_initialProductFee,
|
229
|
-
_initialProcessingFee,
|
230
|
-
FeeLib.zeroFee(), //_instance.getPoolFee(_poolNftId)
|
231
|
-
FeeLib.zeroFee(), //_instance.getStakingFee(_poolNftId)
|
232
|
-
FeeLib.zeroFee() //_instance.getPerformanceFee(_poolNftId)
|
233
|
-
);
|
234
|
-
}
|
235
|
-
|
236
221
|
InstanceReader reader = _instance.getInstanceReader();
|
237
222
|
return reader.getProductSetupInfo(getNftId());
|
238
223
|
}
|
239
224
|
|
240
225
|
// from IRegisterable
|
241
226
|
|
242
|
-
// TODO used only once, occupies space
|
243
227
|
function getInitialInfo()
|
244
228
|
public
|
245
229
|
view
|
@@ -251,7 +235,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
251
235
|
IRegistry.ObjectInfo memory productInfo,
|
252
236
|
bytes memory data
|
253
237
|
) = super.getInitialInfo();
|
254
|
-
|
238
|
+
|
255
239
|
// TODO read pool & distribution fees
|
256
240
|
// 1) from pool -> the only option -> pool must be registered first?
|
257
241
|
// 2) from instance -> all fees are set into instance at product registration which is ongoing here
|
@@ -261,35 +245,38 @@ contract Product is BaseComponent, IProductComponent {
|
|
261
245
|
|
262
246
|
// from PoolComponent
|
263
247
|
(
|
264
|
-
|
248
|
+
,
|
265
249
|
bytes memory poolData
|
266
250
|
) = _pool.getInitialInfo();
|
251
|
+
|
252
|
+
(
|
253
|
+
ISetup.PoolSetupInfo memory poolSetupInfo
|
254
|
+
) = abi.decode(poolData, (ISetup.PoolSetupInfo));
|
267
255
|
|
256
|
+
// from DistributionComponent
|
268
257
|
(
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
Fee memory initialPoolFee,
|
273
|
-
Fee memory initialStakingFee,
|
274
|
-
Fee memory initialPerformanceFee
|
275
|
-
) = abi.decode(poolData, (ISetup.PoolSetupInfo, address, IERC20Metadata, Fee, Fee, Fee));
|
258
|
+
,
|
259
|
+
bytes memory distributionData
|
260
|
+
) = _distribution.getInitialInfo();
|
276
261
|
|
277
|
-
|
262
|
+
(
|
263
|
+
ISetup.DistributionSetupInfo memory distributionSetupInfo
|
264
|
+
) = abi.decode(distributionData, (ISetup.DistributionSetupInfo));
|
278
265
|
|
279
266
|
return (
|
280
267
|
productInfo,
|
281
268
|
abi.encode(
|
282
269
|
ISetup.ProductSetupInfo(
|
283
270
|
_token,
|
284
|
-
TokenHandler(address(
|
271
|
+
TokenHandler(address(_token)),
|
285
272
|
_distributionNftId,
|
286
273
|
_poolNftId,
|
287
|
-
|
274
|
+
distributionSetupInfo.distributionFee,
|
288
275
|
_initialProductFee,
|
289
276
|
_initialProcessingFee,
|
290
|
-
|
291
|
-
|
292
|
-
|
277
|
+
poolSetupInfo.poolFee,
|
278
|
+
poolSetupInfo.stakingFee,
|
279
|
+
poolSetupInfo.performanceFee
|
293
280
|
)
|
294
281
|
)
|
295
282
|
);
|
@@ -9,24 +9,46 @@ import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
|
9
9
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
10
10
|
import {IPoolService} from "./service/IPoolService.sol";
|
11
11
|
import {IProductService} from "./service/IProductService.sol";
|
12
|
+
import {IBundle} from "./module/IBundle.sol";
|
12
13
|
import {ISetup} from "./module/ISetup.sol";
|
13
14
|
import {NftId} from "../types/NftId.sol";
|
14
15
|
import {StateId} from "../types/StateId.sol";
|
16
|
+
import {RiskId} from "../types/RiskId.sol";
|
17
|
+
import {IRisk} from "./module/IRisk.sol";
|
18
|
+
import {IPolicy} from "./module/IPolicy.sol";
|
19
|
+
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
15
20
|
|
16
|
-
|
21
|
+
|
22
|
+
interface IInstance is IERC165, IKeyValueStore {
|
17
23
|
|
18
24
|
function getComponentOwnerService() external view returns (IComponentOwnerService);
|
19
25
|
function getDistributionService() external view returns (IDistributionService);
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
function createProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup) external;
|
26
|
+
function getProductService() external view returns (IProductService);
|
27
|
+
function getPoolService() external view returns (IPoolService);
|
24
28
|
|
25
29
|
function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external;
|
26
30
|
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
|
27
31
|
function updateDistributionSetupState(NftId distributionNftId, StateId newState) external;
|
28
32
|
|
29
|
-
function createPoolSetup(NftId
|
33
|
+
function createPoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup) external;
|
34
|
+
function updatePoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup, StateId newState) external;
|
35
|
+
function updatePoolSetupState(NftId poolNftId, StateId newState) external;
|
36
|
+
|
37
|
+
function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external;
|
38
|
+
function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external;
|
39
|
+
function updateBundleState(NftId bundleNftId, StateId newState) external;
|
40
|
+
|
41
|
+
function createProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup) external;
|
42
|
+
function updateProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup, StateId newState) external;
|
43
|
+
function updateProductSetupState(NftId productNftId, StateId newState) external;
|
44
|
+
|
45
|
+
function createRisk(RiskId riskId, IRisk.RiskInfo memory risk) external;
|
46
|
+
function updateRisk(RiskId riskId, IRisk.RiskInfo memory risk, StateId newState) external;
|
47
|
+
function updateRiskState(RiskId riskId, StateId newState) external;
|
48
|
+
|
49
|
+
function createPolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy) external;
|
50
|
+
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
51
|
+
function updatePolicyState(NftId policyNftId, StateId newState) external;
|
30
52
|
|
31
53
|
function getInstanceReader() external view returns (InstanceReader);
|
32
54
|
}
|
@@ -26,6 +26,8 @@ import {Registerable} from "../shared/Registerable.sol";
|
|
26
26
|
import {ComponentOwnerService} from "./service/ComponentOwnerService.sol";
|
27
27
|
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
28
28
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
29
|
+
import {IPoolService} from "./service/IPoolService.sol";
|
30
|
+
import {IProductService} from "./service/IProductService.sol";
|
29
31
|
import {VersionPart} from "../types/Version.sol";
|
30
32
|
|
31
33
|
contract Instance is
|
@@ -220,16 +222,16 @@ contract Instance is
|
|
220
222
|
}
|
221
223
|
|
222
224
|
//--- PoolSetup ------------------------------------------------------//
|
223
|
-
function createPoolSetup(NftId
|
224
|
-
create(_toNftKey32(
|
225
|
+
function createPoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup) external restricted() {
|
226
|
+
create(_toNftKey32(poolNftId, POOL()), abi.encode(setup));
|
225
227
|
}
|
226
228
|
|
227
|
-
function updatePoolSetup(NftId
|
228
|
-
update(_toNftKey32(
|
229
|
+
function updatePoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup, StateId newState) external restricted() {
|
230
|
+
update(_toNftKey32(poolNftId, POOL()), abi.encode(setup), newState);
|
229
231
|
}
|
230
232
|
|
231
|
-
function updatePoolSetupState(NftId
|
232
|
-
updateState(_toNftKey32(
|
233
|
+
function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
|
234
|
+
updateState(_toNftKey32(poolNftId, POOL()), newState);
|
233
235
|
}
|
234
236
|
|
235
237
|
//--- DistributorType ---------------------------------------------------//
|
@@ -422,15 +424,13 @@ contract Instance is
|
|
422
424
|
return IDistributionService(_registry.getServiceAddress("DistributionService", VersionPart.wrap(3)));
|
423
425
|
}
|
424
426
|
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
// }
|
427
|
+
function getProductService() external view returns (IProductService) {
|
428
|
+
return IProductService(_registry.getServiceAddress("ProductService", VersionPart.wrap(3)));
|
429
|
+
}
|
429
430
|
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
// }
|
431
|
+
function getPoolService() external view returns (IPoolService) {
|
432
|
+
return IPoolService(_registry.getServiceAddress("PoolService", VersionPart.wrap(3)));
|
433
|
+
}
|
434
434
|
|
435
435
|
function setInstanceReader(InstanceReader instanceReader) external restricted() {
|
436
436
|
require(address(_instanceReader) == address(0), "InstanceReader is set");
|
@@ -7,14 +7,16 @@ import {DistributorType} from "../types/DistributorType.sol";
|
|
7
7
|
import {Fee, FeeLib} from "../types/Fee.sol";
|
8
8
|
import {Key32} from "../types/Key32.sol";
|
9
9
|
import {NftId} from "../types/NftId.sol";
|
10
|
-
import {ObjectType, DISTRIBUTOR, DISTRIBUTION, INSTANCE, PRODUCT, POLICY, POOL, TREASURY} from "../types/ObjectType.sol";
|
10
|
+
import {ObjectType, DISTRIBUTOR, DISTRIBUTION, INSTANCE, PRODUCT, POLICY, POOL, TREASURY, BUNDLE} from "../types/ObjectType.sol";
|
11
11
|
import {ReferralId, ReferralStatus, ReferralLib, REFERRAL_OK, REFERRAL_ERROR_UNKNOWN, REFERRAL_ERROR_EXPIRED, REFERRAL_ERROR_EXHAUSTED} from "../types/Referral.sol";
|
12
12
|
import {Registerable} from "../shared/Registerable.sol";
|
13
13
|
import {RiskId} from "../types/RiskId.sol";
|
14
14
|
import {UFixed, MathLib, UFixedLib} from "../types/UFixed.sol";
|
15
15
|
import {Version} from "../types/Version.sol";
|
16
|
+
import {StateId} from "../types/StateId.sol";
|
16
17
|
|
17
18
|
import {IRegistry} from "../registry/IRegistry.sol";
|
19
|
+
import {IBundle} from "../instance/module/IBundle.sol";
|
18
20
|
import {IDistribution} from "../instance/module/IDistribution.sol";
|
19
21
|
import {IInstance} from "./IInstance.sol";
|
20
22
|
import {IKeyValueStore} from "../instance/base/IKeyValueStore.sol";
|
@@ -80,6 +82,14 @@ contract InstanceReader {
|
|
80
82
|
}
|
81
83
|
}
|
82
84
|
|
85
|
+
function getPolicyState(NftId policyNftId)
|
86
|
+
public
|
87
|
+
view
|
88
|
+
returns (StateId state)
|
89
|
+
{
|
90
|
+
return _instance.getState(toPolicyKey(policyNftId));
|
91
|
+
}
|
92
|
+
|
83
93
|
function getRiskInfo(RiskId riskId)
|
84
94
|
public
|
85
95
|
view
|
@@ -114,6 +124,17 @@ contract InstanceReader {
|
|
114
124
|
return abi.decode(data, (ITreasury.TreasuryInfo));
|
115
125
|
}
|
116
126
|
}
|
127
|
+
|
128
|
+
function getBundleInfo(NftId bundleNftId)
|
129
|
+
public
|
130
|
+
view
|
131
|
+
returns (IBundle.BundleInfo memory info)
|
132
|
+
{
|
133
|
+
bytes memory data = _store.getData(toBundleKey(bundleNftId));
|
134
|
+
if (data.length > 0) {
|
135
|
+
return abi.decode(data, (IBundle.BundleInfo));
|
136
|
+
}
|
137
|
+
}
|
117
138
|
|
118
139
|
function getDistributorTypeInfo(DistributorType distributorType)
|
119
140
|
public
|
@@ -259,6 +280,10 @@ contract InstanceReader {
|
|
259
280
|
return distributionNftId.toKey32(DISTRIBUTION());
|
260
281
|
}
|
261
282
|
|
283
|
+
function toBundleKey(NftId poolNftId) public pure returns (Key32) {
|
284
|
+
return poolNftId.toKey32(BUNDLE());
|
285
|
+
}
|
286
|
+
|
262
287
|
function toPoolKey(NftId poolNftId) public pure returns (Key32) {
|
263
288
|
return poolNftId.toKey32(POOL());
|
264
289
|
}
|
@@ -17,7 +17,7 @@ import {ContractDeployerLib} from "../shared/ContractDeployerLib.sol";
|
|
17
17
|
import {NftId, NftIdLib, zeroNftId} from "../../contracts/types/NftId.sol";
|
18
18
|
import {RoleId} from "../types/RoleId.sol";
|
19
19
|
import {VersionLib} from "../types/Version.sol";
|
20
|
-
import {ADMIN_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE} from "../types/RoleId.sol";
|
20
|
+
import {ADMIN_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE, PRODUCT_SERVICE_ROLE} from "../types/RoleId.sol";
|
21
21
|
|
22
22
|
contract InstanceService is Service, IInstanceService {
|
23
23
|
|
@@ -73,7 +73,6 @@ contract InstanceService is Service, IInstanceService {
|
|
73
73
|
|
74
74
|
function _grantInitialAuthorizations(AccessManagerSimple clonedAccessManager, Instance clonedInstance) internal {
|
75
75
|
address distributionServiceAddress = _registry.getServiceAddress("DistributionService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
76
|
-
|
77
76
|
clonedAccessManager.grantRole(DISTRIBUTION_SERVICE_ROLE().toInt(), distributionServiceAddress, 0);
|
78
77
|
bytes4[] memory instanceDistributionServiceSelectors = new bytes4[](2);
|
79
78
|
instanceDistributionServiceSelectors[0] = clonedInstance.createDistributionSetup.selector;
|
@@ -82,6 +81,34 @@ contract InstanceService is Service, IInstanceService {
|
|
82
81
|
address(clonedInstance),
|
83
82
|
instanceDistributionServiceSelectors,
|
84
83
|
DISTRIBUTION_SERVICE_ROLE().toInt());
|
84
|
+
|
85
|
+
address poolServiceAddress = _registry.getServiceAddress("PoolService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
86
|
+
clonedAccessManager.grantRole(POOL_SERVICE_ROLE().toInt(), address(poolServiceAddress), 0);
|
87
|
+
bytes4[] memory instancePoolServiceSelectors = new bytes4[](4);
|
88
|
+
instancePoolServiceSelectors[0] = clonedInstance.createPoolSetup.selector;
|
89
|
+
instancePoolServiceSelectors[1] = clonedInstance.updatePoolSetup.selector;
|
90
|
+
instancePoolServiceSelectors[2] = clonedInstance.createBundle.selector;
|
91
|
+
instancePoolServiceSelectors[3] = clonedInstance.updateBundle.selector;
|
92
|
+
clonedAccessManager.setTargetFunctionRole(
|
93
|
+
address(clonedInstance),
|
94
|
+
instancePoolServiceSelectors,
|
95
|
+
POOL_SERVICE_ROLE().toInt());
|
96
|
+
|
97
|
+
address productServiceAddress = _registry.getServiceAddress("ProductService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
98
|
+
clonedAccessManager.grantRole(PRODUCT_SERVICE_ROLE().toInt(), address(productServiceAddress), 0);
|
99
|
+
bytes4[] memory instanceProductServiceSelectors = new bytes4[](9);
|
100
|
+
instanceProductServiceSelectors[0] = clonedInstance.createProductSetup.selector;
|
101
|
+
instanceProductServiceSelectors[1] = clonedInstance.updateProductSetup.selector;
|
102
|
+
instanceProductServiceSelectors[2] = clonedInstance.createRisk.selector;
|
103
|
+
instanceProductServiceSelectors[3] = clonedInstance.updateRisk.selector;
|
104
|
+
instanceProductServiceSelectors[4] = clonedInstance.updateRiskState.selector;
|
105
|
+
instanceProductServiceSelectors[5] = clonedInstance.createPolicy.selector;
|
106
|
+
instanceProductServiceSelectors[6] = clonedInstance.updatePolicy.selector;
|
107
|
+
instanceProductServiceSelectors[7] = clonedInstance.updatePolicyState.selector;
|
108
|
+
clonedAccessManager.setTargetFunctionRole(
|
109
|
+
address(clonedInstance),
|
110
|
+
instanceProductServiceSelectors,
|
111
|
+
PRODUCT_SERVICE_ROLE().toInt());
|
85
112
|
}
|
86
113
|
|
87
114
|
function setAccessManagerMaster(address accessManagerMaster) external {
|
@@ -148,8 +175,9 @@ contract InstanceService is Service, IInstanceService {
|
|
148
175
|
|
149
176
|
address initialOwner = address(0);
|
150
177
|
(_registryAddress, initialOwner) = abi.decode(data, (address, address));
|
151
|
-
|
152
|
-
|
178
|
+
// TODO while InstanceService is not deployed in InstanceServiceManager constructor
|
179
|
+
// owner is InstanceServiceManager deployer
|
180
|
+
_initializeService(_registryAddress, owner);
|
153
181
|
|
154
182
|
_registerInterface(type(IService).interfaceId);
|
155
183
|
_registerInterface(type(IInstanceService).interfaceId);
|
@@ -31,14 +31,15 @@ contract InstanceServiceManager is ProxyManager {
|
|
31
31
|
Registry registry = Registry(registryAddress);
|
32
32
|
address registryServiceAddress = registry.getServiceAddress("RegistryService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
33
33
|
RegistryService registryService = RegistryService(registryServiceAddress);
|
34
|
-
|
35
|
-
registryService.registerService(_instanceService);
|
34
|
+
// TODO this must have a role or own nft to register service
|
35
|
+
//registryService.registerService(_instanceService);
|
36
36
|
// RegistryService registryService = _instanceService.getRegistryService();
|
37
37
|
|
38
|
+
// TODO no nft to link yet
|
38
39
|
// link ownership of instance service manager ot nft owner of instance service
|
39
|
-
_linkToNftOwnable(
|
40
|
-
|
41
|
-
|
40
|
+
//_linkToNftOwnable(
|
41
|
+
// address(registryAddress),
|
42
|
+
// address(_instanceService));
|
42
43
|
|
43
44
|
// implies that after this constructor call only upgrade functionality is available
|
44
45
|
_isDeployed = true;
|
@@ -4,15 +4,108 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
5
|
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
6
6
|
import {IInstance} from "../../instance/IInstance.sol";
|
7
|
-
import {ObjectType, INSTANCE, PRODUCT, POOL} from "../../types/ObjectType.sol";
|
7
|
+
import {ObjectType, INSTANCE, PRODUCT, POOL, DISTRIBUTION, ORACLE} from "../../types/ObjectType.sol";
|
8
8
|
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
9
|
+
import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, DISTRIBUTION_OWNER_ROLE, ORACLE_OWNER_ROLE} from "../../types/RoleId.sol";
|
9
10
|
|
11
|
+
import {BaseComponent} from "../../components/BaseComponent.sol";
|
12
|
+
import {Product} from "../../components/Product.sol";
|
13
|
+
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
10
14
|
import {Service} from "../../shared/Service.sol";
|
15
|
+
import {InstanceService} from "../InstanceService.sol";
|
11
16
|
import {Version, VersionPart, VersionLib} from "../../types/Version.sol";
|
12
17
|
|
13
18
|
abstract contract ComponentServiceBase is Service {
|
14
19
|
|
15
|
-
error
|
20
|
+
error ExpectedRoleMissing(RoleId expected, address caller);
|
21
|
+
error ComponentTypeInvalid(ObjectType componentType);
|
22
|
+
|
23
|
+
mapping (ObjectType => RoleId) internal _objectTypeToExpectedRole;
|
24
|
+
|
25
|
+
/// @dev modifier to check if caller has a role on the instance the component is registered in
|
26
|
+
modifier onlyComponentOwnerRole(address componentAddress) {
|
27
|
+
BaseComponent component = BaseComponent(componentAddress);
|
28
|
+
ObjectType objectType = _getObjectType(component);
|
29
|
+
RoleId expectedRole = _objectTypeToExpectedRole[objectType];
|
30
|
+
|
31
|
+
address componentOwner = msg.sender;
|
32
|
+
INftOwnable nftOwnable = INftOwnable(address(component.getInstance()));
|
33
|
+
if(! getInstanceService().hasRole(componentOwner, expectedRole, nftOwnable.getNftId())) {
|
34
|
+
revert ExpectedRoleMissing(expectedRole, componentOwner);
|
35
|
+
}
|
36
|
+
_;
|
37
|
+
}
|
38
|
+
|
39
|
+
/// @dev modifier to check if caller is a registered service
|
40
|
+
modifier onlyService() {
|
41
|
+
address caller = msg.sender;
|
42
|
+
require(getRegistry().isRegisteredService(caller), "ERROR_NOT_SERVICE");
|
43
|
+
_;
|
44
|
+
}
|
45
|
+
|
46
|
+
function _initializeService(
|
47
|
+
address registry,
|
48
|
+
address initialOwner
|
49
|
+
)
|
50
|
+
internal
|
51
|
+
override
|
52
|
+
{
|
53
|
+
super._initializeService(registry, initialOwner);
|
54
|
+
_objectTypeToExpectedRole[PRODUCT()] = PRODUCT_OWNER_ROLE();
|
55
|
+
_objectTypeToExpectedRole[POOL()] = POOL_OWNER_ROLE();
|
56
|
+
_objectTypeToExpectedRole[DISTRIBUTION()] = DISTRIBUTION_OWNER_ROLE();
|
57
|
+
_objectTypeToExpectedRole[ORACLE()] = ORACLE_OWNER_ROLE();
|
58
|
+
}
|
59
|
+
|
60
|
+
function getInstanceService() public view returns (InstanceService) {
|
61
|
+
return InstanceService(getRegistry().getServiceAddress("InstanceService", getMajorVersion()));
|
62
|
+
}
|
63
|
+
|
64
|
+
function register(address componentAddress)
|
65
|
+
external
|
66
|
+
onlyComponentOwnerRole(componentAddress)
|
67
|
+
returns (NftId componentNftId)
|
68
|
+
{
|
69
|
+
address componentOwner = msg.sender;
|
70
|
+
BaseComponent component = BaseComponent(componentAddress);
|
71
|
+
ObjectType objectType = _getObjectType(component);
|
72
|
+
IRegistryService registryService = getRegistryService();
|
73
|
+
|
74
|
+
IRegistry.ObjectInfo memory objInfo;
|
75
|
+
bytes memory initialObjData;
|
76
|
+
|
77
|
+
if (objectType == DISTRIBUTION()) {
|
78
|
+
(objInfo, initialObjData) = registryService.registerDistribution(component, componentOwner);
|
79
|
+
} else if (objectType == PRODUCT()) {
|
80
|
+
(objInfo, initialObjData) = registryService.registerProduct(component, componentOwner);
|
81
|
+
} else if (objectType == POOL()) {
|
82
|
+
(objInfo, initialObjData) = registryService.registerPool(component, componentOwner);
|
83
|
+
// TODO: implement this for oracle - currently missing in registry
|
84
|
+
// } else if (objectType == ORACLE()) {
|
85
|
+
// (objInfo, initialObjData) = registryService.registerOracle(component, componentOwner);
|
86
|
+
} else {
|
87
|
+
revert ComponentTypeInvalid(objectType);
|
88
|
+
}
|
89
|
+
|
90
|
+
componentNftId = objInfo.nftId;
|
91
|
+
{
|
92
|
+
IInstance instance = _getInstance(objInfo);
|
93
|
+
_finalizeComponentRegistration(componentNftId, initialObjData, instance);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
function _finalizeComponentRegistration(NftId componentNftId, bytes memory initialObjData, IInstance instance) internal virtual;
|
98
|
+
|
99
|
+
function _getObjectType(BaseComponent component) internal view returns (ObjectType) {
|
100
|
+
(IRegistry.ObjectInfo memory compInitialInfo, ) = component.getInitialInfo();
|
101
|
+
return compInitialInfo.objectType;
|
102
|
+
}
|
103
|
+
|
104
|
+
function _getInstance(IRegistry.ObjectInfo memory compObjInfo) internal view returns (IInstance) {
|
105
|
+
IRegistry registry = getRegistry();
|
106
|
+
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(compObjInfo.parentNftId);
|
107
|
+
return IInstance(instanceInfo.objectAddress);
|
108
|
+
}
|
16
109
|
|
17
110
|
function _getAndVerifyComponentInfoAndInstance(
|
18
111
|
ObjectType objectType
|
@@ -13,6 +13,7 @@ interface IBundle {
|
|
13
13
|
uint256 capitalAmount; // net investment capital + net premiums - payouts
|
14
14
|
uint256 lockedAmount; // capital amount linked to collateralizaion of non-closed policies (<= balance)
|
15
15
|
uint256 balanceAmount; // total amount of funds: capitalAmount + fees (balance >= captial)
|
16
|
+
uint256 lifetime;
|
16
17
|
Timestamp expiredAt; // no new policies
|
17
18
|
Timestamp closedAt; // no open policies, locked amount = 0
|
18
19
|
}
|
@@ -5,6 +5,7 @@ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IER
|
|
5
5
|
|
6
6
|
import {Fee} from "../../types/Fee.sol";
|
7
7
|
import {NftId} from "../../types/NftId.sol";
|
8
|
+
import {LibNftIdSet} from "../../types/NftIdSet.sol";
|
8
9
|
import {UFixed} from "../../types/UFixed.sol";
|
9
10
|
import {TokenHandler} from "../../shared/TokenHandler.sol";
|
10
11
|
|
@@ -38,7 +38,6 @@ contract DistributionService is
|
|
38
38
|
string public constant NAME = "DistributionService";
|
39
39
|
|
40
40
|
address internal _registryAddress;
|
41
|
-
InstanceService internal _instanceService;
|
42
41
|
|
43
42
|
function _initialize(
|
44
43
|
address owner,
|
@@ -50,11 +49,9 @@ contract DistributionService is
|
|
50
49
|
{
|
51
50
|
address initialOwner = address(0);
|
52
51
|
(_registryAddress, initialOwner) = abi.decode(data, (address, address));
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
_initializeService(_registryAddress, initialOwner);
|
52
|
+
// TODO while DistributionService is not deployed in DistributionServiceManager constructor
|
53
|
+
// owner is DistributionServiceManager deployer
|
54
|
+
_initializeService(_registryAddress, owner);
|
58
55
|
|
59
56
|
_registerInterface(type(IService).interfaceId);
|
60
57
|
_registerInterface(type(IDistributionService).interfaceId);
|
@@ -65,26 +62,12 @@ contract DistributionService is
|
|
65
62
|
return NAME;
|
66
63
|
}
|
67
64
|
|
68
|
-
function
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
address componentOwner = msg.sender;
|
73
|
-
Distribution distribution = Distribution(distributionComponentAddress);
|
74
|
-
IInstance instance = distribution.getInstance();
|
75
|
-
INftOwnable nftOwnable = INftOwnable(address(instance));
|
76
|
-
|
77
|
-
require(_instanceService.hasRole(componentOwner, DISTRIBUTION_OWNER_ROLE(), nftOwnable.getNftId()), "ERROR:DIS-001:NOT_DISTRIBUTION_OWNER");
|
78
|
-
|
79
|
-
IRegistryService registryService = getRegistryService();
|
80
|
-
(IRegistry.ObjectInfo memory distributionObjInfo, ) = registryService.registerDistribution(
|
81
|
-
distribution,
|
82
|
-
componentOwner
|
65
|
+
function _finalizeComponentRegistration(NftId componentNftId, bytes memory initialObjData, IInstance instance) internal override {
|
66
|
+
ISetup.DistributionSetupInfo memory initialSetup = abi.decode(
|
67
|
+
initialObjData,
|
68
|
+
(ISetup.DistributionSetupInfo)
|
83
69
|
);
|
84
|
-
|
85
|
-
|
86
|
-
ISetup.DistributionSetupInfo memory initialSetup = distribution.getInitialSetupInfo();
|
87
|
-
instance.createDistributionSetup(distributionNftId, initialSetup);
|
70
|
+
instance.createDistributionSetup(componentNftId, initialSetup);
|
88
71
|
}
|
89
72
|
|
90
73
|
function setFees(
|
@@ -29,13 +29,14 @@ contract DistributionServiceManager is ProxyManager {
|
|
29
29
|
Registry registry = Registry(registryAddress);
|
30
30
|
address registryServiceAddress = registry.getServiceAddress("RegistryService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
31
31
|
RegistryService registryService = RegistryService(registryServiceAddress);
|
32
|
+
// TODO this must have a role or own nft to register service
|
33
|
+
//registryService.registerService(_distributionService);
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
+
// TODO no nft to link yet
|
35
36
|
// link ownership of instance service manager ot nft owner of instance service
|
36
|
-
_linkToNftOwnable(
|
37
|
-
|
38
|
-
|
37
|
+
//_linkToNftOwnable(
|
38
|
+
// address(registryAddress),
|
39
|
+
// address(_distributionService));
|
39
40
|
|
40
41
|
// implies that after this constructor call only upgrade functionality is available
|
41
42
|
_isDeployed = true;
|
@@ -3,7 +3,9 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {NftId} from "../../types/NftId.sol";
|
5
5
|
import {Fee} from "../../types/Fee.sol";
|
6
|
+
import {StateId} from "../../types/StateId.sol";
|
6
7
|
import {IService} from "../../shared/IService.sol";
|
8
|
+
import {IBundle} from "../module/IBundle.sol";
|
7
9
|
|
8
10
|
interface IPoolService is IService {
|
9
11
|
function setFees(
|
@@ -25,6 +27,8 @@ interface IPoolService is IService {
|
|
25
27
|
Fee memory fee
|
26
28
|
) external;
|
27
29
|
|
30
|
+
function updateBundle(NftId instanceNftId, NftId bundleNftId, IBundle.BundleInfo memory bundleInfo, StateId state) external;
|
31
|
+
|
28
32
|
// function fundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
29
33
|
|
30
34
|
// function defundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
@@ -24,15 +24,15 @@ interface IProductService is IService {
|
|
24
24
|
) external;
|
25
25
|
|
26
26
|
|
27
|
-
function
|
27
|
+
function updateRisk(
|
28
28
|
RiskId riskId,
|
29
|
-
|
29
|
+
bytes memory data
|
30
30
|
) external;
|
31
31
|
|
32
32
|
|
33
33
|
function updateRiskState(
|
34
34
|
RiskId riskId,
|
35
|
-
StateId
|
35
|
+
StateId newState
|
36
36
|
) external;
|
37
37
|
|
38
38
|
|