@etherisc/gif-next 0.0.2-7f35518-483 → 0.0.2-81ba549-396
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 -99
- 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 +484 -0
- 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 +94 -81
- 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 +2 -2
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +48 -8
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +48 -32
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +36 -6
- 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 +61 -26
- 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/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 +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +63 -44
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +27 -27
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +1086 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +468 -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 +0 -127
- 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 +31 -169
- 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 +25 -37
- 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 +11 -16
- package/contracts/components/Product.sol +28 -41
- package/contracts/instance/IInstance.sol +17 -3
- package/contracts/instance/Instance.sol +4 -4
- package/contracts/instance/InstanceService.sol +18 -3
- package/contracts/instance/InstanceServiceManager.sol +6 -5
- package/contracts/instance/base/ComponentServiceBase.sol +75 -8
- package/contracts/instance/service/DistributionService.sol +8 -19
- package/contracts/instance/service/DistributionServiceManager.sol +6 -5
- package/contracts/instance/service/IProductService.sol +3 -3
- package/contracts/instance/service/PoolService.sol +9 -20
- package/contracts/instance/service/PoolServiceManager.sol +6 -5
- package/contracts/instance/service/ProductService.sol +563 -0
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/IRegistry.sol +4 -19
- package/contracts/registry/IRegistryService.sol +28 -11
- package/contracts/registry/Registry.sol +2 -47
- 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 +1 -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
|
);
|
@@ -13,16 +13,18 @@ import {IBundle} from "./module/IBundle.sol";
|
|
13
13
|
import {ISetup} from "./module/ISetup.sol";
|
14
14
|
import {NftId} from "../types/NftId.sol";
|
15
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
|
+
|
16
20
|
|
17
21
|
interface IInstance is IERC165 {
|
18
22
|
|
19
23
|
function getComponentOwnerService() external view returns (IComponentOwnerService);
|
20
24
|
function getDistributionService() external view returns (IDistributionService);
|
21
|
-
|
25
|
+
function getProductService() external view returns (IProductService);
|
22
26
|
function getPoolService() external view returns (IPoolService);
|
23
27
|
|
24
|
-
function createProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup) external;
|
25
|
-
|
26
28
|
function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external;
|
27
29
|
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
|
28
30
|
function updateDistributionSetupState(NftId distributionNftId, StateId newState) external;
|
@@ -35,5 +37,17 @@ interface IInstance is IERC165 {
|
|
35
37
|
function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external;
|
36
38
|
function updateBundleState(NftId bundleNftId, StateId newState) external;
|
37
39
|
|
40
|
+
function createProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup) external;
|
41
|
+
function updateProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup, StateId newState) external;
|
42
|
+
function updateProductSetupState(NftId productNftId, StateId newState) external;
|
43
|
+
|
44
|
+
function createRisk(RiskId riskId, IRisk.RiskInfo memory risk) external;
|
45
|
+
function updateRisk(RiskId riskId, IRisk.RiskInfo memory risk, StateId newState) external;
|
46
|
+
function updateRiskState(RiskId riskId, StateId newState) external;
|
47
|
+
|
48
|
+
function createPolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy) external;
|
49
|
+
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
50
|
+
function updatePolicyState(NftId policyNftId, StateId newState) external;
|
51
|
+
|
38
52
|
function getInstanceReader() external view returns (InstanceReader);
|
39
53
|
}
|
@@ -27,6 +27,7 @@ import {ComponentOwnerService} from "./service/ComponentOwnerService.sol";
|
|
27
27
|
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
28
28
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
29
29
|
import {IPoolService} from "./service/IPoolService.sol";
|
30
|
+
import {IProductService} from "./service/IProductService.sol";
|
30
31
|
import {VersionPart} from "../types/Version.sol";
|
31
32
|
|
32
33
|
contract Instance is
|
@@ -423,10 +424,9 @@ contract Instance is
|
|
423
424
|
return IDistributionService(_registry.getServiceAddress("DistributionService", VersionPart.wrap(3)));
|
424
425
|
}
|
425
426
|
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
// }
|
427
|
+
function getProductService() external view returns (IProductService) {
|
428
|
+
return IProductService(_registry.getServiceAddress("ProductService", VersionPart.wrap(3)));
|
429
|
+
}
|
430
430
|
|
431
431
|
function getPoolService() external view returns (IPoolService) {
|
432
432
|
return IPoolService(_registry.getServiceAddress("PoolService", VersionPart.wrap(3)));
|
@@ -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, POOL_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
|
|
@@ -94,6 +94,20 @@ contract InstanceService is Service, IInstanceService {
|
|
94
94
|
instancePoolServiceSelectors,
|
95
95
|
POOL_SERVICE_ROLE().toInt());
|
96
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[](7);
|
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
|
+
clonedAccessManager.setTargetFunctionRole(
|
108
|
+
address(clonedInstance),
|
109
|
+
instanceProductServiceSelectors,
|
110
|
+
PRODUCT_SERVICE_ROLE().toInt());
|
97
111
|
}
|
98
112
|
|
99
113
|
function setAccessManagerMaster(address accessManagerMaster) external {
|
@@ -160,8 +174,9 @@ contract InstanceService is Service, IInstanceService {
|
|
160
174
|
|
161
175
|
address initialOwner = address(0);
|
162
176
|
(_registryAddress, initialOwner) = abi.decode(data, (address, address));
|
163
|
-
|
164
|
-
|
177
|
+
// TODO while InstanceService is not deployed in InstanceServiceManager constructor
|
178
|
+
// owner is InstanceServiceManager deployer
|
179
|
+
_initializeService(_registryAddress, owner);
|
165
180
|
|
166
181
|
_registerInterface(type(IService).interfaceId);
|
167
182
|
_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,11 +4,12 @@ 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} from "../../types/RoleId.sol";
|
10
|
-
import {BaseComponent} from "../../components/BaseComponent.sol";
|
9
|
+
import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, DISTRIBUTION_OWNER_ROLE, ORACLE_OWNER_ROLE} from "../../types/RoleId.sol";
|
11
10
|
|
11
|
+
import {BaseComponent} from "../../components/BaseComponent.sol";
|
12
|
+
import {Product} from "../../components/Product.sol";
|
12
13
|
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
13
14
|
import {Service} from "../../shared/Service.sol";
|
14
15
|
import {InstanceService} from "../InstanceService.sol";
|
@@ -16,23 +17,89 @@ import {Version, VersionPart, VersionLib} from "../../types/Version.sol";
|
|
16
17
|
|
17
18
|
abstract contract ComponentServiceBase is Service {
|
18
19
|
|
19
|
-
error
|
20
|
+
error ExpectedRoleMissing(RoleId expected, address caller);
|
21
|
+
error ComponentTypeInvalid(ObjectType componentType);
|
22
|
+
|
23
|
+
mapping (ObjectType => RoleId) internal _objectTypeToExpectedRole;
|
20
24
|
|
21
25
|
/// @dev modifier to check if caller has a role on the instance the component is registered in
|
22
|
-
modifier
|
23
|
-
address componentOwner = msg.sender;
|
26
|
+
modifier onlyComponentOwnerRole(address componentAddress) {
|
24
27
|
BaseComponent component = BaseComponent(componentAddress);
|
28
|
+
ObjectType objectType = _getObjectType(component);
|
29
|
+
RoleId expectedRole = _objectTypeToExpectedRole[objectType];
|
30
|
+
|
31
|
+
address componentOwner = msg.sender;
|
25
32
|
INftOwnable nftOwnable = INftOwnable(address(component.getInstance()));
|
26
|
-
if(! getInstanceService().hasRole(componentOwner,
|
27
|
-
revert
|
33
|
+
if(! getInstanceService().hasRole(componentOwner, expectedRole, nftOwnable.getNftId())) {
|
34
|
+
revert ExpectedRoleMissing(expectedRole, componentOwner);
|
28
35
|
}
|
29
36
|
_;
|
30
37
|
}
|
31
38
|
|
39
|
+
function _initializeService(
|
40
|
+
address registry,
|
41
|
+
address initialOwner
|
42
|
+
)
|
43
|
+
internal
|
44
|
+
override
|
45
|
+
{
|
46
|
+
super._initializeService(registry, initialOwner);
|
47
|
+
_objectTypeToExpectedRole[PRODUCT()] = PRODUCT_OWNER_ROLE();
|
48
|
+
_objectTypeToExpectedRole[POOL()] = POOL_OWNER_ROLE();
|
49
|
+
_objectTypeToExpectedRole[DISTRIBUTION()] = DISTRIBUTION_OWNER_ROLE();
|
50
|
+
_objectTypeToExpectedRole[ORACLE()] = ORACLE_OWNER_ROLE();
|
51
|
+
}
|
52
|
+
|
32
53
|
function getInstanceService() public view returns (InstanceService) {
|
33
54
|
return InstanceService(getRegistry().getServiceAddress("InstanceService", getMajorVersion()));
|
34
55
|
}
|
35
56
|
|
57
|
+
function register(address componentAddress)
|
58
|
+
external
|
59
|
+
onlyComponentOwnerRole(componentAddress)
|
60
|
+
returns (NftId componentNftId)
|
61
|
+
{
|
62
|
+
address componentOwner = msg.sender;
|
63
|
+
BaseComponent component = BaseComponent(componentAddress);
|
64
|
+
ObjectType objectType = _getObjectType(component);
|
65
|
+
IRegistryService registryService = getRegistryService();
|
66
|
+
|
67
|
+
IRegistry.ObjectInfo memory objInfo;
|
68
|
+
bytes memory initialObjData;
|
69
|
+
|
70
|
+
if (objectType == DISTRIBUTION()) {
|
71
|
+
(objInfo, initialObjData) = registryService.registerDistribution(component, componentOwner);
|
72
|
+
} else if (objectType == PRODUCT()) {
|
73
|
+
(objInfo, initialObjData) = registryService.registerProduct(component, componentOwner);
|
74
|
+
} else if (objectType == POOL()) {
|
75
|
+
(objInfo, initialObjData) = registryService.registerPool(component, componentOwner);
|
76
|
+
// TODO: implement this for oracle - currently missing in registry
|
77
|
+
// } else if (objectType == ORACLE()) {
|
78
|
+
// (objInfo, initialObjData) = registryService.registerOracle(component, componentOwner);
|
79
|
+
} else {
|
80
|
+
revert ComponentTypeInvalid(objectType);
|
81
|
+
}
|
82
|
+
|
83
|
+
componentNftId = objInfo.nftId;
|
84
|
+
{
|
85
|
+
IInstance instance = _getInstance(objInfo);
|
86
|
+
_finalizeComponentRegistration(componentNftId, initialObjData, instance);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
function _finalizeComponentRegistration(NftId componentNftId, bytes memory initialObjData, IInstance instance) internal virtual;
|
91
|
+
|
92
|
+
function _getObjectType(BaseComponent component) internal view returns (ObjectType) {
|
93
|
+
(IRegistry.ObjectInfo memory compInitialInfo, ) = component.getInitialInfo();
|
94
|
+
return compInitialInfo.objectType;
|
95
|
+
}
|
96
|
+
|
97
|
+
function _getInstance(IRegistry.ObjectInfo memory compObjInfo) internal view returns (IInstance) {
|
98
|
+
IRegistry registry = getRegistry();
|
99
|
+
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(compObjInfo.parentNftId);
|
100
|
+
return IInstance(instanceInfo.objectAddress);
|
101
|
+
}
|
102
|
+
|
36
103
|
function _getAndVerifyComponentInfoAndInstance(
|
37
104
|
ObjectType objectType
|
38
105
|
)
|
@@ -49,8 +49,9 @@ contract DistributionService is
|
|
49
49
|
{
|
50
50
|
address initialOwner = address(0);
|
51
51
|
(_registryAddress, initialOwner) = abi.decode(data, (address, address));
|
52
|
-
|
53
|
-
|
52
|
+
// TODO while DistributionService is not deployed in DistributionServiceManager constructor
|
53
|
+
// owner is DistributionServiceManager deployer
|
54
|
+
_initializeService(_registryAddress, owner);
|
54
55
|
|
55
56
|
_registerInterface(type(IService).interfaceId);
|
56
57
|
_registerInterface(type(IDistributionService).interfaceId);
|
@@ -61,24 +62,12 @@ contract DistributionService is
|
|
61
62
|
return NAME;
|
62
63
|
}
|
63
64
|
|
64
|
-
function
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
{
|
69
|
-
address componentOwner = msg.sender;
|
70
|
-
Distribution distribution = Distribution(distributionComponentAddress);
|
71
|
-
IInstance instance = distribution.getInstance();
|
72
|
-
|
73
|
-
IRegistryService registryService = getRegistryService();
|
74
|
-
(IRegistry.ObjectInfo memory distributionObjInfo, ) = registryService.registerDistribution(
|
75
|
-
distribution,
|
76
|
-
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)
|
77
69
|
);
|
78
|
-
|
79
|
-
|
80
|
-
ISetup.DistributionSetupInfo memory initialSetup = distribution.getInitialSetupInfo();
|
81
|
-
instance.createDistributionSetup(distributionNftId, initialSetup);
|
70
|
+
instance.createDistributionSetup(componentNftId, initialSetup);
|
82
71
|
}
|
83
72
|
|
84
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;
|
@@ -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
|
|
@@ -51,8 +51,9 @@ contract PoolService is
|
|
51
51
|
{
|
52
52
|
address initialOwner = address(0);
|
53
53
|
(_registryAddress, initialOwner) = abi.decode(data, (address, address));
|
54
|
-
|
55
|
-
|
54
|
+
// TODO while PoolService is not deployed in PoolServiceManager constructor
|
55
|
+
// owner is PoolServiceManager deployer
|
56
|
+
_initializeService(_registryAddress, owner);
|
56
57
|
|
57
58
|
_registerInterface(type(IService).interfaceId);
|
58
59
|
_registerInterface(type(IPoolService).interfaceId);
|
@@ -62,24 +63,12 @@ contract PoolService is
|
|
62
63
|
return NAME;
|
63
64
|
}
|
64
65
|
|
65
|
-
function
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
{
|
70
|
-
address componentOwner = msg.sender;
|
71
|
-
Pool pool = Pool(poolComponentAddress);
|
72
|
-
IInstance instance = pool.getInstance();
|
73
|
-
|
74
|
-
IRegistryService registryService = getRegistryService();
|
75
|
-
(IRegistry.ObjectInfo memory poolObjInfo, ) = registryService.registerPool(
|
76
|
-
pool,
|
77
|
-
componentOwner
|
66
|
+
function _finalizeComponentRegistration(NftId componentNftId, bytes memory initialObjData, IInstance instance) internal override {
|
67
|
+
ISetup.PoolSetupInfo memory initialSetup = abi.decode(
|
68
|
+
initialObjData,
|
69
|
+
(ISetup.PoolSetupInfo)
|
78
70
|
);
|
79
|
-
|
80
|
-
|
81
|
-
ISetup.PoolSetupInfo memory initialSetup = pool.getInitialSetupInfo();
|
82
|
-
instance.createPoolSetup(poolNftId, initialSetup);
|
71
|
+
instance.createPoolSetup(componentNftId, initialSetup);
|
83
72
|
}
|
84
73
|
|
85
74
|
function setFees(
|
@@ -119,7 +108,7 @@ contract PoolService is
|
|
119
108
|
|
120
109
|
IBundle.BundleInfo memory bundleInfo = IBundle.BundleInfo(
|
121
110
|
poolNftId,
|
122
|
-
|
111
|
+
fee,
|
123
112
|
filter,
|
124
113
|
stakingAmount,
|
125
114
|
0,
|
@@ -29,13 +29,14 @@ contract PoolServiceManager 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(_poolService);
|
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(_poolService));
|
39
40
|
|
40
41
|
// implies that after this constructor call only upgrade functionality is available
|
41
42
|
_isDeployed = true;
|