@etherisc/gif-next 0.0.2-b9e43cf-870 → 0.0.2-bb1081a-994
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → Component.sol/Component.json} +230 -14
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +141 -10
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → IComponent.sol/IComponent.json} +107 -87
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +543 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +623 -45
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +643 -5
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +227 -73
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +146 -15
- 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/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
- 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 +181 -15
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +0 -5
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +113 -76
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +47 -60
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +42 -83
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +59 -58
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +37 -24
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +102 -31
- 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/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +229 -93
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +31 -18
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +126 -47
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +31 -14
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +98 -38
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +0 -5
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +0 -5
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +0 -5
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +0 -5
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +153 -82
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +44 -31
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +126 -47
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +31 -14
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +126 -47
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +31 -14
- 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 +83 -3
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +33 -28
- 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 +96 -24
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +18 -18
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +61 -56
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +28 -15
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +70 -53
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +23 -26
- 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/IRegisterable.sol/IRegisterable.json +0 -5
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +0 -5
- 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 +19 -6
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +19 -6
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +19 -11
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +13 -5
- 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 +19 -11
- 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 +29 -21
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Component.sol +247 -0
- package/contracts/components/Distribution.sol +27 -48
- package/contracts/components/IComponent.sol +50 -0
- package/contracts/components/IDistributionComponent.sol +5 -2
- package/contracts/components/IPoolComponent.sol +40 -29
- package/contracts/components/IProductComponent.sol +7 -3
- package/contracts/components/Pool.sol +123 -138
- package/contracts/components/Product.sol +48 -86
- package/contracts/instance/BundleManager.sol +7 -11
- package/contracts/instance/IInstance.sol +20 -10
- package/contracts/instance/IInstanceService.sol +1 -1
- package/contracts/instance/Instance.sol +28 -31
- package/contracts/instance/InstanceAccessManager.sol +6 -11
- package/contracts/instance/InstanceReader.sol +3 -25
- package/contracts/instance/InstanceService.sol +31 -14
- package/contracts/instance/ObjectManager.sol +7 -24
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/module/ISetup.sol +2 -2
- package/contracts/instance/service/BundleService.sol +11 -6
- package/contracts/instance/service/DistributionService.sol +22 -36
- package/contracts/instance/service/IBundleService.sol +11 -1
- package/contracts/instance/service/PolicyService.sol +56 -76
- package/contracts/instance/service/PoolService.sol +19 -55
- package/contracts/instance/service/ProductService.sol +49 -30
- package/contracts/registry/IRegistry.sol +13 -6
- package/contracts/registry/IRegistryService.sol +16 -9
- package/contracts/registry/Registry.sol +100 -44
- package/contracts/registry/RegistryAccessManager.sol +31 -25
- package/contracts/registry/RegistryService.sol +27 -85
- package/contracts/registry/ReleaseManager.sol +72 -82
- package/contracts/registry/TokenRegistry.sol +5 -3
- package/contracts/shared/IRegisterable.sol +1 -3
- package/contracts/shared/NftOwnable.sol +5 -0
- package/contracts/shared/Registerable.sol +10 -14
- package/contracts/shared/Service.sol +4 -2
- package/contracts/types/RoleId.sol +2 -2
- package/package.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -814
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +0 -442
- package/contracts/components/BaseComponent.sol +0 -159
- package/contracts/components/IBaseComponent.sol +0 -34
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +0 -23
- package/contracts/instance/IInstanceBase.sol +0 -26
- package/contracts/instance/InstanceBase.sol +0 -41
- package/contracts/instance/base/ComponentServiceBase.sol +0 -76
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/service/ComponentOwnerService.sol +0 -315
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -4,18 +4,16 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
6
|
import {IRisk} from "../instance/module/IRisk.sol";
|
7
|
-
import {ITreasury} from "../instance/module/ITreasury.sol";
|
8
|
-
import {IProductService} from "../instance/service/IProductService.sol";
|
9
7
|
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
10
8
|
import {IProductComponent} from "./IProductComponent.sol";
|
11
|
-
import {NftId,
|
12
|
-
import {
|
9
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
10
|
+
import {PRODUCT} from "../types/ObjectType.sol";
|
13
11
|
import {ReferralId} from "../types/Referral.sol";
|
14
12
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
15
13
|
import {StateId} from "../types/StateId.sol";
|
16
14
|
import {Timestamp} from "../types/Timestamp.sol";
|
17
|
-
import {Fee
|
18
|
-
import {
|
15
|
+
import {Fee} from "../types/Fee.sol";
|
16
|
+
import {Component} from "./Component.sol";
|
19
17
|
|
20
18
|
import {IRegistry} from "../registry/IRegistry.sol";
|
21
19
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
@@ -27,12 +25,10 @@ import {ISetup} from "../instance/module/ISetup.sol";
|
|
27
25
|
import {Pool} from "../components/Pool.sol";
|
28
26
|
import {Distribution} from "../components/Distribution.sol";
|
29
27
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
IProductService internal _productService;
|
28
|
+
abstract contract Product is
|
29
|
+
Component,
|
30
|
+
IProductComponent
|
31
|
+
{
|
36
32
|
IPolicyService internal _policyService;
|
37
33
|
Pool internal _pool;
|
38
34
|
Distribution internal _distribution;
|
@@ -45,18 +41,22 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
45
41
|
|
46
42
|
constructor(
|
47
43
|
address registry,
|
48
|
-
NftId
|
44
|
+
NftId instanceNftId,
|
45
|
+
string memory name,
|
49
46
|
address token,
|
50
47
|
bool isInterceptor,
|
51
48
|
address pool,
|
52
49
|
address distribution,
|
53
50
|
Fee memory productFee,
|
54
51
|
Fee memory processingFee,
|
55
|
-
address initialOwner
|
56
|
-
|
52
|
+
address initialOwner,
|
53
|
+
bytes memory data
|
54
|
+
)
|
55
|
+
{
|
56
|
+
_initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, data);
|
57
|
+
|
57
58
|
// TODO add validation
|
58
|
-
|
59
|
-
_policyService = _instance.getPolicyService();
|
59
|
+
_policyService = getInstance().getPolicyService();
|
60
60
|
_pool = Pool(pool);
|
61
61
|
_distribution = Distribution(distribution);
|
62
62
|
_initialProductFee = productFee;
|
@@ -76,8 +76,8 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
76
76
|
RiskId riskId,
|
77
77
|
uint256 lifetime,
|
78
78
|
bytes memory applicationData,
|
79
|
-
|
80
|
-
|
79
|
+
NftId bundleNftId,
|
80
|
+
ReferralId referralId
|
81
81
|
)
|
82
82
|
external
|
83
83
|
view
|
@@ -118,7 +118,7 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
118
118
|
RiskId id,
|
119
119
|
bytes memory data
|
120
120
|
) internal {
|
121
|
-
|
121
|
+
getProductService().createRisk(
|
122
122
|
id,
|
123
123
|
data
|
124
124
|
);
|
@@ -128,7 +128,7 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
128
128
|
RiskId id,
|
129
129
|
bytes memory data
|
130
130
|
) internal {
|
131
|
-
|
131
|
+
getProductService().updateRisk(
|
132
132
|
id,
|
133
133
|
data
|
134
134
|
);
|
@@ -138,14 +138,14 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
138
138
|
RiskId id,
|
139
139
|
StateId state
|
140
140
|
) internal {
|
141
|
-
|
141
|
+
getProductService().updateRiskState(
|
142
142
|
id,
|
143
143
|
state
|
144
144
|
);
|
145
145
|
}
|
146
146
|
|
147
147
|
function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
|
148
|
-
return
|
148
|
+
return getInstance().getInstanceReader().getRiskInfo(id);
|
149
149
|
}
|
150
150
|
|
151
151
|
function _createApplication(
|
@@ -228,74 +228,36 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
228
228
|
onlyOwner
|
229
229
|
override
|
230
230
|
{
|
231
|
-
|
231
|
+
getProductService().setFees(productFee, processingFee);
|
232
232
|
}
|
233
233
|
|
234
234
|
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
235
|
-
InstanceReader reader =
|
236
|
-
|
237
|
-
}
|
235
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
236
|
+
setupInfo = reader.getProductSetupInfo(getNftId());
|
238
237
|
|
239
|
-
|
238
|
+
// fallback to initial setup info (wallet is always != address(0))
|
239
|
+
if(setupInfo.wallet == address(0)) {
|
240
|
+
setupInfo = _getInitialSetupInfo();
|
241
|
+
}
|
242
|
+
}
|
240
243
|
|
241
|
-
function
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
//require(getRegistry().getObjectInfo(_distributionNftId).objectType == DISTRIBUTION(), "DISTRIBUTION_NOT_REGISTERED");
|
259
|
-
|
260
|
-
// from PoolComponent
|
261
|
-
(
|
262
|
-
,
|
263
|
-
bytes memory poolData
|
264
|
-
) = _pool.getInitialInfo();
|
265
|
-
|
266
|
-
(
|
267
|
-
, ISetup.PoolSetupInfo memory poolSetupInfo
|
268
|
-
) = abi.decode(poolData, (string, ISetup.PoolSetupInfo));
|
269
|
-
|
270
|
-
// from DistributionComponent
|
271
|
-
(
|
272
|
-
,
|
273
|
-
bytes memory distributionData
|
274
|
-
) = _distribution.getInitialInfo();
|
275
|
-
|
276
|
-
(
|
277
|
-
, ISetup.DistributionSetupInfo memory distributionSetupInfo
|
278
|
-
) = abi.decode(distributionData, (string, ISetup.DistributionSetupInfo));
|
279
|
-
|
280
|
-
return (
|
281
|
-
productInfo,
|
282
|
-
abi.encode(
|
283
|
-
getName(),
|
284
|
-
ISetup.ProductSetupInfo(
|
285
|
-
_token,
|
286
|
-
_tokenHandler,
|
287
|
-
_distributionNftId,
|
288
|
-
_poolNftId,
|
289
|
-
distributionSetupInfo.distributionFee,
|
290
|
-
_initialProductFee,
|
291
|
-
_initialProcessingFee,
|
292
|
-
poolSetupInfo.poolFee,
|
293
|
-
poolSetupInfo.stakingFee,
|
294
|
-
poolSetupInfo.performanceFee,
|
295
|
-
false,
|
296
|
-
_wallet
|
297
|
-
)
|
298
|
-
)
|
244
|
+
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
245
|
+
ISetup.DistributionSetupInfo memory distributionSetupInfo = _distribution.getSetupInfo();
|
246
|
+
ISetup.PoolSetupInfo memory poolSetupInfo = _pool.getSetupInfo();
|
247
|
+
|
248
|
+
return ISetup.ProductSetupInfo(
|
249
|
+
getToken(),
|
250
|
+
_tokenHandler,
|
251
|
+
_distributionNftId,
|
252
|
+
_poolNftId,
|
253
|
+
distributionSetupInfo.distributionFee,
|
254
|
+
_initialProductFee,
|
255
|
+
_initialProcessingFee,
|
256
|
+
poolSetupInfo.poolFee,
|
257
|
+
poolSetupInfo.stakingFee,
|
258
|
+
poolSetupInfo.performanceFee,
|
259
|
+
false,
|
260
|
+
getWallet()
|
299
261
|
);
|
300
262
|
}
|
301
263
|
}
|
@@ -32,17 +32,13 @@ contract BundleManager is
|
|
32
32
|
|
33
33
|
mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
|
34
34
|
|
35
|
-
constructor() ObjectManager() {
|
36
|
-
}
|
37
|
-
|
38
|
-
|
39
35
|
/// @dev links a policy with its bundle
|
40
36
|
// to link a policy it MUST NOT yet have been activated
|
41
37
|
// the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
|
42
38
|
function linkPolicy(NftId policyNftId) external restricted() {
|
43
|
-
NftId bundleNftId =
|
39
|
+
NftId bundleNftId = _instance.getInstanceReader().getPolicyInfo(policyNftId).bundleNftId;
|
44
40
|
// decision will likely depend on the decision what to check here and what in the service
|
45
|
-
NftId poolNftId =
|
41
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
46
42
|
|
47
43
|
// ensure bundle is unlocked (in active set) and registered with this instance
|
48
44
|
if (!_isActive(poolNftId, bundleNftId)) {
|
@@ -59,11 +55,11 @@ contract BundleManager is
|
|
59
55
|
// - the policy MUST be past its expiry period and it MUST NOT have any open claims
|
60
56
|
// - the policy's payoutAmount MUST be equal to its sumInsuredAmount and MUST NOT have any open claims
|
61
57
|
function unlinkPolicy(NftId policyNftId) external restricted() {
|
62
|
-
IPolicy.PolicyInfo memory policyInfo =
|
58
|
+
IPolicy.PolicyInfo memory policyInfo = _instance.getInstanceReader().getPolicyInfo(policyNftId);
|
63
59
|
|
64
60
|
NftId bundleNftId = policyInfo.bundleNftId;
|
65
61
|
// decision will likely depend on the decision what to check here and what in the service
|
66
|
-
NftId poolNftId =
|
62
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
67
63
|
|
68
64
|
// ensure bundle is registered with this instance
|
69
65
|
if (!_contains(poolNftId, bundleNftId)) {
|
@@ -78,7 +74,7 @@ contract BundleManager is
|
|
78
74
|
/// @dev add a new bundle to a riskpool registerd with this instance
|
79
75
|
// the corresponding pool is fetched via instance reader
|
80
76
|
function add(NftId bundleNftId) external restricted() {
|
81
|
-
NftId poolNftId =
|
77
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
82
78
|
|
83
79
|
// ensure pool is registered with instance
|
84
80
|
if(poolNftId.eqz()) {
|
@@ -91,14 +87,14 @@ contract BundleManager is
|
|
91
87
|
|
92
88
|
/// @dev unlocked (active) bundles are available to underwrite new policies
|
93
89
|
function unlock(NftId bundleNftId) external restricted() {
|
94
|
-
NftId poolNftId =
|
90
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
95
91
|
_activate(poolNftId, bundleNftId);
|
96
92
|
emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
|
97
93
|
}
|
98
94
|
|
99
95
|
/// @dev locked (deactivated) bundles may not underwrite any new policies
|
100
96
|
function lock(NftId bundleNftId) external restricted() {
|
101
|
-
NftId poolNftId =
|
97
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
102
98
|
_deactivate(poolNftId, bundleNftId);
|
103
99
|
emit LogBundleManagerBundleLocked(poolNftId, bundleNftId);
|
104
100
|
}
|
@@ -1,32 +1,41 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
4
|
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
6
5
|
|
6
|
+
import {NftId} from "../types/NftId.sol";
|
7
|
+
import {StateId} from "../types/StateId.sol";
|
8
|
+
import {RiskId} from "../types/RiskId.sol";
|
9
|
+
|
10
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
11
|
+
|
12
|
+
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
7
13
|
import {BundleManager} from "./BundleManager.sol";
|
8
14
|
import {InstanceReader} from "./InstanceReader.sol";
|
9
15
|
|
10
|
-
import {
|
11
|
-
import {
|
16
|
+
import {IBundle} from "./module/IBundle.sol";
|
17
|
+
import {IBundleService} from "./service/IBundleService.sol";
|
12
18
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
19
|
+
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
20
|
+
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
21
|
+
import {IPolicy} from "./module/IPolicy.sol";
|
22
|
+
import {IPolicyService} from "./service/IPolicyService.sol";
|
13
23
|
import {IPoolService} from "./service/IPoolService.sol";
|
14
24
|
import {IProductService} from "./service/IProductService.sol";
|
15
25
|
import {IPolicyService} from "./service/IPolicyService.sol";
|
16
26
|
import {IBundleService} from "./service/IBundleService.sol";
|
17
|
-
import {
|
27
|
+
import {IRisk} from "./module/IRisk.sol";
|
18
28
|
import {ISetup} from "./module/ISetup.sol";
|
19
29
|
import {NftId} from "../types/NftId.sol";
|
20
|
-
import {StateId} from "../types/StateId.sol";
|
21
30
|
import {RiskId} from "../types/RiskId.sol";
|
22
|
-
import {
|
23
|
-
import {
|
24
|
-
|
31
|
+
import {StateId} from "../types/StateId.sol";
|
32
|
+
import {VersionPart} from "../types/Version.sol";
|
33
|
+
|
34
|
+
|
25
35
|
|
26
36
|
|
27
|
-
interface IInstance is
|
37
|
+
interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
|
28
38
|
|
29
|
-
function getComponentOwnerService() external view returns (IComponentOwnerService);
|
30
39
|
function getDistributionService() external view returns (IDistributionService);
|
31
40
|
function getProductService() external view returns (IProductService);
|
32
41
|
function getPoolService() external view returns (IPoolService);
|
@@ -57,6 +66,7 @@ interface IInstance is IERC165, IKeyValueStore, IAccessManaged {
|
|
57
66
|
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
58
67
|
function updatePolicyState(NftId policyNftId, StateId newState) external;
|
59
68
|
|
69
|
+
function getMajorVersion() external pure returns (VersionPart majorVersion);
|
60
70
|
function getInstanceReader() external view returns (InstanceReader);
|
61
71
|
function getBundleManager() external view returns (BundleManager);
|
62
72
|
}
|
@@ -8,7 +8,7 @@ import {IService} from "../shared/IService.sol";
|
|
8
8
|
import {IRegistry} from "../registry/IRegistry.sol";
|
9
9
|
|
10
10
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
11
|
-
import {
|
11
|
+
import {IComponent} from "../components/IComponent.sol";
|
12
12
|
|
13
13
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
14
14
|
import {Instance} from "./Instance.sol";
|
@@ -1,22 +1,9 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
5
|
-
import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
|
6
|
-
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
|
7
4
|
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
8
5
|
|
9
|
-
import {IAccess} from "./module/IAccess.sol";
|
10
|
-
import {IBundle} from "./module/IBundle.sol";
|
11
|
-
import {IPolicy} from "./module/IPolicy.sol";
|
12
|
-
import {IRisk} from "./module/IRisk.sol";
|
13
|
-
import {ISetup} from "./module/ISetup.sol";
|
14
6
|
import {Key32, KeyId, Key32Lib} from "../types/Key32.sol";
|
15
|
-
import {KeyValueStore} from "./base/KeyValueStore.sol";
|
16
|
-
import {IInstance} from "./IInstance.sol";
|
17
|
-
import {InstanceReader} from "./InstanceReader.sol";
|
18
|
-
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
19
|
-
import {BundleManager} from "./BundleManager.sol";
|
20
7
|
import {NftId} from "../types/NftId.sol";
|
21
8
|
import {NumberId} from "../types/NumberId.sol";
|
22
9
|
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT} from "../types/ObjectType.sol";
|
@@ -24,25 +11,40 @@ import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
|
24
11
|
import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
25
12
|
import {StateId, ACTIVE} from "../types/StateId.sol";
|
26
13
|
import {TimestampLib} from "../types/Timestamp.sol";
|
14
|
+
import {VersionPart} from "../types/Version.sol";
|
15
|
+
|
27
16
|
import {ERC165} from "../shared/ERC165.sol";
|
28
17
|
import {Registerable} from "../shared/Registerable.sol";
|
29
|
-
|
30
|
-
import {
|
18
|
+
|
19
|
+
import {IInstance} from "./IInstance.sol";
|
20
|
+
import {InstanceReader} from "./InstanceReader.sol";
|
21
|
+
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
22
|
+
import {BundleManager} from "./BundleManager.sol";
|
23
|
+
|
24
|
+
import {KeyValueStore} from "./base/KeyValueStore.sol";
|
25
|
+
|
26
|
+
import {IAccess} from "./module/IAccess.sol";
|
27
|
+
import {IBundle} from "./module/IBundle.sol";
|
28
|
+
import {IPolicy} from "./module/IPolicy.sol";
|
29
|
+
import {IRisk} from "./module/IRisk.sol";
|
30
|
+
import {ISetup} from "./module/ISetup.sol";
|
31
|
+
|
31
32
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
32
33
|
import {IPoolService} from "./service/IPoolService.sol";
|
33
34
|
import {IProductService} from "./service/IProductService.sol";
|
34
35
|
import {IPolicyService} from "./service/IPolicyService.sol";
|
35
36
|
import {IBundleService} from "./service/IBundleService.sol";
|
36
|
-
import {VersionPart} from "../types/Version.sol";
|
37
|
-
import {InstanceBase} from "./InstanceBase.sol";
|
37
|
+
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
38
38
|
|
39
39
|
contract Instance is
|
40
|
-
AccessManagedUpgradeable,
|
41
40
|
IInstance,
|
42
|
-
|
43
|
-
|
41
|
+
AccessManagedUpgradeable,
|
42
|
+
Registerable,
|
43
|
+
KeyValueStore
|
44
44
|
{
|
45
45
|
|
46
|
+
uint256 public constant GIF_MAJOR_VERSION = 3;
|
47
|
+
|
46
48
|
uint64 public constant ADMIN_ROLE = type(uint64).min;
|
47
49
|
uint64 public constant PUBLIC_ROLE = type(uint64).max;
|
48
50
|
uint64 public constant CUSTOM_ROLE_ID_MIN = 10000;
|
@@ -59,16 +61,11 @@ contract Instance is
|
|
59
61
|
public
|
60
62
|
initializer
|
61
63
|
{
|
62
|
-
require(!_initialized, "Contract instance has already been initialized");
|
63
|
-
|
64
64
|
__AccessManaged_init(accessManagerAddress);
|
65
|
-
|
66
|
-
_accessManager = InstanceAccessManager(accessManagerAddress);
|
67
65
|
|
68
66
|
_initializeRegisterable(registryAddress, registryNftId, INSTANCE(), false, initialOwner, "");
|
69
67
|
|
70
68
|
_registerInterface(type(IInstance).interfaceId);
|
71
|
-
_initialized = true;
|
72
69
|
}
|
73
70
|
|
74
71
|
//--- ProductSetup ------------------------------------------------------//
|
@@ -227,10 +224,6 @@ contract Instance is
|
|
227
224
|
return policyNftId.toKey32(POLICY());
|
228
225
|
}
|
229
226
|
|
230
|
-
function getComponentOwnerService() external view returns (IComponentOwnerService) {
|
231
|
-
return ComponentOwnerService(_registry.getServiceAddress(COMPONENT(), VersionPart.wrap(3)));
|
232
|
-
}
|
233
|
-
|
234
227
|
function getDistributionService() external view returns (IDistributionService) {
|
235
228
|
return IDistributionService(_registry.getServiceAddress(DISTRIBUTION(), VersionPart.wrap(3)));
|
236
229
|
}
|
@@ -252,17 +245,21 @@ contract Instance is
|
|
252
245
|
}
|
253
246
|
|
254
247
|
function setInstanceReader(InstanceReader instanceReader) external restricted() {
|
255
|
-
require(instanceReader.
|
248
|
+
require(instanceReader.getInstance() == Instance(this), "InstanceReader instance mismatch");
|
256
249
|
_instanceReader = instanceReader;
|
257
250
|
}
|
258
251
|
|
252
|
+
function getMajorVersion() external pure returns (VersionPart majorVersion) {
|
253
|
+
return VersionPartLib.toVersionPart(GIF_MAJOR_VERSION);
|
254
|
+
}
|
255
|
+
|
259
256
|
function getInstanceReader() external view returns (InstanceReader) {
|
260
257
|
return _instanceReader;
|
261
258
|
}
|
262
259
|
|
263
260
|
function setBundleManager(BundleManager bundleManager) external restricted() {
|
264
261
|
require(address(_bundleManager) == address(0), "BundleManager is set");
|
265
|
-
require(bundleManager.
|
262
|
+
require(bundleManager.getInstance() == Instance(this), "BundleManager instance mismatch");
|
266
263
|
_bundleManager = bundleManager;
|
267
264
|
}
|
268
265
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {AccessManager} from "@openzeppelin/contracts/access/manager/AccessManager.sol";
|
5
|
+
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
4
6
|
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
5
7
|
import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
|
6
|
-
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
7
8
|
|
8
|
-
import {AccessManagerUpgradeableInitializeable} from "../../contracts/instance/AccessManagerUpgradeableInitializeable.sol";
|
9
9
|
import {RoleId, RoleIdLib } from "../types/RoleId.sol";
|
10
10
|
import {TimestampLib} from "../types/Timestamp.sol";
|
11
11
|
import {IAccess} from "./module/IAccess.sol";
|
@@ -32,14 +32,13 @@ contract InstanceAccessManager is
|
|
32
32
|
mapping(ShortString name => address target) internal _targetForName;
|
33
33
|
address [] internal _targets;
|
34
34
|
|
35
|
-
|
35
|
+
AccessManager internal _accessManager;
|
36
36
|
|
37
|
-
function
|
37
|
+
function initialize(address initialAdmin) external initializer
|
38
38
|
{
|
39
39
|
// if size of the contract gets too large, this can be externalized which will reduce the contract size considerably
|
40
|
-
_accessManager = new
|
41
|
-
// this service required
|
42
|
-
_accessManager.__AccessManagerUpgradeableInitializeable_init(address(this));
|
40
|
+
_accessManager = new AccessManager(address(this));
|
41
|
+
// this service required admin rights to access manager to be able to grant/revoke roles
|
43
42
|
_accessManager.grantRole(_accessManager.ADMIN_ROLE(), initialAdmin, 0);
|
44
43
|
|
45
44
|
__AccessManaged_init(address(_accessManager));
|
@@ -277,10 +276,6 @@ contract InstanceAccessManager is
|
|
277
276
|
_accessManager.setTargetFunctionRole(target, selectors, roleIdInt);
|
278
277
|
}
|
279
278
|
|
280
|
-
function getAccessManager() public restricted() returns (AccessManagerUpgradeableInitializeable) {
|
281
|
-
return _accessManager;
|
282
|
-
}
|
283
|
-
|
284
279
|
function setTargetClosed(string memory targetName, bool closed) public restricted() {
|
285
280
|
address target = _targetForName[ShortStrings.toShortString(targetName)];
|
286
281
|
if (target == address(0)) {
|
@@ -31,39 +31,21 @@ contract InstanceReader {
|
|
31
31
|
bool private _initialized;
|
32
32
|
|
33
33
|
IRegistry internal _registry;
|
34
|
-
NftId internal _instanceNftId;
|
35
34
|
IInstance internal _instance;
|
36
35
|
IKeyValueStore internal _store;
|
37
36
|
|
38
|
-
|
39
|
-
address registry,
|
40
|
-
NftId instanceNftId
|
41
|
-
)
|
42
|
-
{
|
43
|
-
initialize(registry, instanceNftId);
|
44
|
-
}
|
45
|
-
|
46
|
-
function initialize(address registry, NftId instanceNftId) public {
|
37
|
+
function initialize(address registry, address instance) public {
|
47
38
|
require(!_initialized, "ERROR:CRD-000:ALREADY_INITIALIZED");
|
48
39
|
|
49
40
|
require(
|
50
41
|
address(registry) != address(0),
|
51
42
|
"ERROR:CRD-001:REGISTRY_ZERO");
|
52
43
|
|
53
|
-
require(
|
54
|
-
instanceNftId.gtz(),
|
55
|
-
"ERROR:CRD-002:NFT_ID_ZERO");
|
56
44
|
|
57
45
|
_registry = IRegistry(registry);
|
58
|
-
_instanceNftId = instanceNftId;
|
59
|
-
IRegistry.ObjectInfo memory instanceInfo = _registry.getObjectInfo(_instanceNftId);
|
60
46
|
|
61
|
-
|
62
|
-
|
63
|
-
"ERROR:CRD-003:PARENT_NOT_INSTANCE");
|
64
|
-
|
65
|
-
_instance = IInstance(instanceInfo.objectAddress);
|
66
|
-
_store = IKeyValueStore(instanceInfo.objectAddress);
|
47
|
+
_instance = IInstance(instance);
|
48
|
+
_store = IKeyValueStore(instance);
|
67
49
|
|
68
50
|
_initialized = true;
|
69
51
|
}
|
@@ -301,10 +283,6 @@ contract InstanceReader {
|
|
301
283
|
return _store;
|
302
284
|
}
|
303
285
|
|
304
|
-
function getInstanceNftId() external view returns (NftId nftId) {
|
305
|
-
return _instanceNftId;
|
306
|
-
}
|
307
|
-
|
308
286
|
function toUFixed(uint256 value, int8 exp) public pure returns (UFixed) {
|
309
287
|
return UFixedLib.toUFixed(value, exp);
|
310
288
|
}
|