@etherisc/gif-next 0.0.2-b9e43cf-870 → 0.0.2-bb1081a-994
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +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
@@ -10,7 +10,7 @@ import {IInstanceService} from "./IInstanceService.sol";
|
|
10
10
|
import {InstanceReader} from "./InstanceReader.sol";
|
11
11
|
import {BundleManager} from "./BundleManager.sol";
|
12
12
|
import {IRegistry} from "../registry/IRegistry.sol";
|
13
|
-
import {
|
13
|
+
import {IRegistryService} from "../registry/IRegistryService.sol";
|
14
14
|
import {ChainNft} from "../registry/ChainNft.sol";
|
15
15
|
import {Service} from "../../contracts/shared/Service.sol";
|
16
16
|
import {IService} from "../shared/IService.sol";
|
@@ -28,7 +28,6 @@ contract InstanceService is Service, IInstanceService {
|
|
28
28
|
|
29
29
|
// TODO update to real hash when instance is stable
|
30
30
|
bytes32 public constant INSTANCE_CREATION_CODE_HASH = bytes32(0);
|
31
|
-
string public constant NAME = "InstanceService";
|
32
31
|
|
33
32
|
modifier onlyInstanceOwner(NftId instanceNftId) {
|
34
33
|
IRegistry registry = getRegistry();
|
@@ -63,25 +62,23 @@ contract InstanceService is Service, IInstanceService {
|
|
63
62
|
address registryAddress = address(registry);
|
64
63
|
NftId registryNftId = registry.getNftId(registryAddress);
|
65
64
|
address registryServiceAddress = registry.getServiceAddress(REGISTRY(), getMajorVersion());
|
66
|
-
|
65
|
+
IRegistryService registryService = IRegistryService(registryServiceAddress);
|
67
66
|
|
68
67
|
// initially set the authority of the access managar to this (being the instance service).
|
69
68
|
// This will allow the instance service to bootstrap the authorizations of the instance
|
70
69
|
// and then transfer the ownership of the access manager to the instance owner once everything is setup
|
71
70
|
clonedAccessManager = InstanceAccessManager(Clones.clone(_masterInstanceAccessManager));
|
72
|
-
clonedAccessManager.
|
71
|
+
clonedAccessManager.initialize(address(this));
|
73
72
|
|
74
73
|
clonedInstance = Instance(Clones.clone(_masterInstance));
|
75
74
|
clonedInstance.initialize(address(clonedAccessManager), registryAddress, registryNftId, msg.sender);
|
76
|
-
( IRegistry.ObjectInfo memory info, ) = registryService.registerInstance(clonedInstance);
|
77
|
-
clonedInstanceNftId = info.nftId;
|
78
75
|
|
79
76
|
clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
80
|
-
clonedInstanceReader.initialize(registryAddress,
|
77
|
+
clonedInstanceReader.initialize(registryAddress, address(clonedInstance));
|
81
78
|
clonedInstance.setInstanceReader(clonedInstanceReader);
|
82
79
|
|
83
80
|
clonedBundleManager = BundleManager(Clones.clone(_masterInstanceBundleManager));
|
84
|
-
clonedBundleManager.initialize(address(clonedAccessManager), registryAddress,
|
81
|
+
clonedBundleManager.initialize(address(clonedAccessManager), registryAddress, address(clonedInstance));
|
85
82
|
clonedInstance.setBundleManager(clonedBundleManager);
|
86
83
|
|
87
84
|
// TODO amend setters with instance specific , policy manager ...
|
@@ -93,6 +90,10 @@ contract InstanceService is Service, IInstanceService {
|
|
93
90
|
clonedAccessManager.grantRole(ADMIN_ROLE(), instanceOwner);
|
94
91
|
clonedAccessManager.revokeRole(ADMIN_ROLE(), address(this));
|
95
92
|
|
93
|
+
IRegistry.ObjectInfo memory info = registryService.registerInstance(clonedInstance, instanceOwner);
|
94
|
+
clonedInstanceNftId = info.nftId;
|
95
|
+
// clonedInstance.linkToRegisteredNftId();
|
96
|
+
|
96
97
|
emit LogInstanceCloned(address(clonedAccessManager), address(clonedInstance), address(clonedInstanceReader), clonedInstanceNftId);
|
97
98
|
}
|
98
99
|
|
@@ -219,7 +220,15 @@ contract InstanceService is Service, IInstanceService {
|
|
219
220
|
INSTANCE_SERVICE_ROLE());
|
220
221
|
}
|
221
222
|
|
222
|
-
function
|
223
|
+
function setAndRegisterMasterInstance(
|
224
|
+
address accessManagerAddress,
|
225
|
+
address instanceAddress,
|
226
|
+
address instanceReaderAddress,
|
227
|
+
address bundleManagerAddress)
|
228
|
+
external
|
229
|
+
onlyOwner
|
230
|
+
returns(NftId masterInstanceNftId)
|
231
|
+
{
|
223
232
|
require(_masterInstanceAccessManager == address(0), "ERROR:CRD-001:ACCESS_MANAGER_MASTER_ALREADY_SET");
|
224
233
|
require(_masterInstance == address(0), "ERROR:CRD-002:INSTANCE_MASTER_ALREADY_SET");
|
225
234
|
require(_masterInstanceBundleManager == address(0), "ERROR:CRD-004:BUNDLE_MANAGER_MASTER_ALREADY_SET");
|
@@ -229,18 +238,25 @@ contract InstanceService is Service, IInstanceService {
|
|
229
238
|
require (instanceReaderAddress != address(0), "ERROR:CRD-007:INSTANCE_READER_ZERO");
|
230
239
|
require (bundleManagerAddress != address(0), "ERROR:CRD-008:BUNDLE_MANAGER_ZERO");
|
231
240
|
|
232
|
-
|
241
|
+
IInstance instance = IInstance(instanceAddress);
|
233
242
|
InstanceReader instanceReader = InstanceReader(instanceReaderAddress);
|
234
243
|
BundleManager bundleManager = BundleManager(bundleManagerAddress);
|
235
244
|
|
236
245
|
require(instance.authority() == accessManagerAddress, "ERROR:CRD-009:INSTANCE_AUTHORITY_MISMATCH");
|
237
|
-
require(instanceReader.
|
238
|
-
require(bundleManager.
|
246
|
+
require(instanceReader.getInstance() == instance, "ERROR:CRD-010:INSTANCE_READER_INSTANCE_MISMATCH");
|
247
|
+
require(bundleManager.getInstance() == instance, "ERROR:CRD-011:BUNDLE_MANAGER_INSTANCE_MISMATCH");
|
239
248
|
|
240
249
|
_masterInstanceAccessManager = accessManagerAddress;
|
241
250
|
_masterInstance = instanceAddress;
|
242
251
|
_masterInstanceReader = instanceReaderAddress;
|
243
252
|
_masterInstanceBundleManager = bundleManagerAddress;
|
253
|
+
|
254
|
+
IRegistryService registryService = IRegistryService(getRegistry().getServiceAddress(REGISTRY(), getMajorVersion()));
|
255
|
+
IInstance masterInstance = IInstance(_masterInstance);
|
256
|
+
IRegistry.ObjectInfo memory info = registryService.registerInstance(masterInstance, getOwner());
|
257
|
+
masterInstanceNftId = info.nftId;
|
258
|
+
|
259
|
+
// masterInstance.linkToRegisteredNftId();
|
244
260
|
}
|
245
261
|
|
246
262
|
function setMasterInstanceReader(address instanceReaderAddress) external onlyOwner {
|
@@ -249,11 +265,12 @@ contract InstanceService is Service, IInstanceService {
|
|
249
265
|
require(instanceReaderAddress != _masterInstanceReader, "ERROR:CRD-014:INSTANCE_READER_MASTER_SAME_AS_NEW");
|
250
266
|
|
251
267
|
InstanceReader instanceReader = InstanceReader(instanceReaderAddress);
|
252
|
-
require(instanceReader.
|
268
|
+
require(instanceReader.getInstance() == IInstance(_masterInstance), "ERROR:CRD-015:INSTANCE_READER_INSTANCE_MISMATCH");
|
253
269
|
|
254
270
|
_masterInstanceReader = instanceReaderAddress;
|
255
271
|
}
|
256
272
|
|
273
|
+
// TODO access restriction
|
257
274
|
function upgradeInstanceReader(NftId instanceNftId) external {
|
258
275
|
IRegistry registry = getRegistry();
|
259
276
|
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
@@ -265,7 +282,7 @@ contract InstanceService is Service, IInstanceService {
|
|
265
282
|
}
|
266
283
|
|
267
284
|
InstanceReader upgradedInstanceReaderClone = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
268
|
-
upgradedInstanceReaderClone.initialize(address(registry),
|
285
|
+
upgradedInstanceReaderClone.initialize(address(registry), address(instance));
|
269
286
|
instance.setInstanceReader(upgradedInstanceReaderClone);
|
270
287
|
}
|
271
288
|
|
@@ -14,49 +14,32 @@ contract ObjectManager is
|
|
14
14
|
Cloneable
|
15
15
|
{
|
16
16
|
|
17
|
-
event LogObjectManagerInitialized(
|
17
|
+
event LogObjectManagerInitialized(address instance);
|
18
18
|
|
19
19
|
error ErrorObjectManagerNftIdInvalid(NftId instanceNftId);
|
20
20
|
error ErrorObjectManagerAlreadyAdded(NftId componentNftId, NftId objectNftId);
|
21
21
|
|
22
22
|
mapping(NftId compnentNftId => LibNftIdSet.Set objects) internal _activeObjects;
|
23
23
|
mapping(NftId compnentNftId => LibNftIdSet.Set objects) internal _allObjects;
|
24
|
-
|
25
|
-
InstanceReader internal _instanceReader;
|
26
|
-
|
27
|
-
constructor() Cloneable() {
|
28
|
-
_instanceReader = InstanceReader(address(0));
|
29
|
-
}
|
24
|
+
IInstance internal _instance; // store instance address -> more flexible, instance may not be registered during ObjectManager initialization
|
30
25
|
|
31
26
|
/// @dev call to initialize MUST be made in the same transaction as cloning of the contract
|
32
27
|
function initialize(
|
33
28
|
address authority,
|
34
29
|
address registry,
|
35
|
-
|
30
|
+
address instance
|
36
31
|
)
|
37
32
|
external
|
38
33
|
{
|
39
34
|
initialize(authority, registry);
|
40
35
|
|
41
|
-
|
42
|
-
IRegistry.ObjectInfo memory instanceInfo = _registry.getObjectInfo(instanceNftId);
|
43
|
-
if (instanceInfo.objectType != INSTANCE()) {
|
44
|
-
revert ErrorObjectManagerNftIdInvalid(instanceNftId);
|
45
|
-
}
|
46
|
-
|
47
|
-
IInstance instance = IInstance(instanceInfo.objectAddress);
|
48
|
-
_instanceReader = instance.getInstanceReader();
|
49
|
-
_instanceNftId = instanceNftId;
|
36
|
+
_instance = IInstance(instance);
|
50
37
|
|
51
|
-
emit LogObjectManagerInitialized(
|
52
|
-
}
|
53
|
-
|
54
|
-
function getInstanceReader() external view returns (InstanceReader) {
|
55
|
-
return _instanceReader;
|
38
|
+
emit LogObjectManagerInitialized(instance);
|
56
39
|
}
|
57
40
|
|
58
|
-
function
|
59
|
-
return
|
41
|
+
function getInstance() external view returns (IInstance) {
|
42
|
+
return _instance;
|
60
43
|
}
|
61
44
|
|
62
45
|
function _add(NftId componentNftId, NftId objectNftId) internal {
|
@@ -0,0 +1,134 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {IComponent} from "../../components/IComponent.sol";
|
5
|
+
import {IRegistry} from "../../registry/IRegistry.sol";
|
6
|
+
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
7
|
+
import {IInstance} from "../../instance/IInstance.sol";
|
8
|
+
import {IAccess} from "../module/IAccess.sol";
|
9
|
+
import {ObjectType, INSTANCE, REGISTRY} from "../../types/ObjectType.sol";
|
10
|
+
import {NftId} from "../../types/NftId.sol";
|
11
|
+
import {RoleId} from "../../types/RoleId.sol";
|
12
|
+
|
13
|
+
import {Service} from "../../shared/Service.sol";
|
14
|
+
import {InstanceService} from "../InstanceService.sol";
|
15
|
+
import {InstanceAccessManager} from "../InstanceAccessManager.sol";
|
16
|
+
|
17
|
+
abstract contract ComponentService is Service {
|
18
|
+
|
19
|
+
error ErrorComponentServiceAlreadyRegistered(address component, NftId nftId);
|
20
|
+
error ErrorComponentServiceNotComponent(address component);
|
21
|
+
error ErrorComponentServiceInvalidType(address component, ObjectType requiredType, ObjectType componentType);
|
22
|
+
error ErrorComponentServiceSenderNotOwner(address component, address initialOwner, address sender);
|
23
|
+
error ErrorComponentServiceExpectedRoleMissing(NftId instanceNftId, RoleId requiredRole, address sender);
|
24
|
+
error ErrorComponentServiceComponentLocked(address component);
|
25
|
+
|
26
|
+
/// @dev modifier to check if caller is a registered service
|
27
|
+
modifier onlyService() {
|
28
|
+
address caller = msg.sender;
|
29
|
+
require(getRegistry().isRegisteredService(caller), "ERROR_NOT_SERVICE");
|
30
|
+
_;
|
31
|
+
}
|
32
|
+
|
33
|
+
// view functions
|
34
|
+
|
35
|
+
function getRegistryService() public view virtual returns (IRegistryService) {
|
36
|
+
address service = getRegistry().getServiceAddress(REGISTRY(), getMajorVersion());
|
37
|
+
return IRegistryService(service);
|
38
|
+
}
|
39
|
+
|
40
|
+
function getInstanceService() public view returns (InstanceService) {
|
41
|
+
address service = getRegistry().getServiceAddress(INSTANCE(), getMajorVersion());
|
42
|
+
return InstanceService(service);
|
43
|
+
}
|
44
|
+
|
45
|
+
// internal functions
|
46
|
+
function _checkComponentForRegistration(
|
47
|
+
address componentAddress,
|
48
|
+
ObjectType requiredType,
|
49
|
+
RoleId requiredRole
|
50
|
+
)
|
51
|
+
internal
|
52
|
+
view
|
53
|
+
returns (
|
54
|
+
IComponent component,
|
55
|
+
address owner,
|
56
|
+
IInstance instance,
|
57
|
+
NftId instanceNftId
|
58
|
+
)
|
59
|
+
{
|
60
|
+
// component may only be registerd by initial owner of component
|
61
|
+
owner = msg.sender;
|
62
|
+
|
63
|
+
// check component has not already been registerd
|
64
|
+
NftId compoentNftId = _registry.getNftId(componentAddress);
|
65
|
+
if(compoentNftId.gtz()) {
|
66
|
+
revert ErrorComponentServiceAlreadyRegistered(componentAddress, compoentNftId);
|
67
|
+
}
|
68
|
+
|
69
|
+
// check this is a component
|
70
|
+
component = IComponent(componentAddress);
|
71
|
+
if(!component.supportsInterface(type(IComponent).interfaceId)) {
|
72
|
+
revert ErrorComponentServiceNotComponent(componentAddress);
|
73
|
+
}
|
74
|
+
|
75
|
+
// check component is of required type
|
76
|
+
IRegistry.ObjectInfo memory componentInfo = component.getInitialInfo();
|
77
|
+
if(componentInfo.objectType != requiredType) {
|
78
|
+
revert ErrorComponentServiceInvalidType(componentAddress, requiredType, componentInfo.objectType);
|
79
|
+
}
|
80
|
+
|
81
|
+
// check msg.sender is component owner
|
82
|
+
address initialOwner = componentInfo.initialOwner;
|
83
|
+
if(owner != initialOwner) {
|
84
|
+
revert ErrorComponentServiceSenderNotOwner(componentAddress, componentInfo.initialOwner, owner);
|
85
|
+
}
|
86
|
+
|
87
|
+
// check instance has assigned required role to owner
|
88
|
+
instanceNftId = componentInfo.parentNftId;
|
89
|
+
instance = _getInstance(instanceNftId);
|
90
|
+
bool hasRole = getInstanceService().hasRole(
|
91
|
+
owner,
|
92
|
+
requiredRole,
|
93
|
+
address(instance));
|
94
|
+
|
95
|
+
if(!hasRole) {
|
96
|
+
revert ErrorComponentServiceExpectedRoleMissing(instanceNftId, requiredRole, owner);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
// internal view functions
|
101
|
+
|
102
|
+
function _getInstance(NftId instanceNftId) internal view returns (IInstance) {
|
103
|
+
IRegistry.ObjectInfo memory instanceInfo = getRegistry().getObjectInfo(instanceNftId);
|
104
|
+
return IInstance(instanceInfo.objectAddress);
|
105
|
+
}
|
106
|
+
|
107
|
+
function _getAndVerifyComponentInfoAndInstance(
|
108
|
+
//address component,
|
109
|
+
ObjectType expectedType
|
110
|
+
)
|
111
|
+
internal
|
112
|
+
view
|
113
|
+
returns(
|
114
|
+
IRegistry.ObjectInfo memory info,
|
115
|
+
IInstance instance
|
116
|
+
)
|
117
|
+
{
|
118
|
+
IRegistry registry = getRegistry();
|
119
|
+
//TODO redundant check -> just check type
|
120
|
+
//NftId componentNftId = registry.getNftId(component);
|
121
|
+
//require(componentNftId.gtz(), "ERROR_COMPONENT_UNKNOWN");
|
122
|
+
|
123
|
+
info = registry.getObjectInfo(msg.sender);
|
124
|
+
require(info.objectType == expectedType, "OBJECT_TYPE_INVALID");
|
125
|
+
|
126
|
+
address instanceAddress = registry.getObjectInfo(info.parentNftId).objectAddress;
|
127
|
+
instance = IInstance(instanceAddress);
|
128
|
+
|
129
|
+
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
130
|
+
if (accessManager.isTargetLocked(info.objectAddress)) {
|
131
|
+
revert IAccess.ErrorIAccessTargetLocked(info.objectAddress);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
@@ -39,8 +39,8 @@ interface ISetup {
|
|
39
39
|
Fee poolFee; // pool fee on net premium
|
40
40
|
Fee stakingFee; // pool fee on staked capital from investor
|
41
41
|
Fee performanceFee; // pool fee on profits from capital investors
|
42
|
-
bool isIntercepting; // intercepts nft transfers
|
43
|
-
bool
|
42
|
+
bool isIntercepting; // intercepts nft transfers for bundles
|
43
|
+
bool isVerifyingApplications; // confirms applications before they are underwritten
|
44
44
|
address wallet;
|
45
45
|
}
|
46
46
|
}
|
@@ -24,17 +24,16 @@ import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
|
24
24
|
import {IService} from "../../shared/IService.sol";
|
25
25
|
import {Service} from "../../shared/Service.sol";
|
26
26
|
import {BundleManager} from "../BundleManager.sol";
|
27
|
-
import {
|
27
|
+
import {ComponentService} from "../base/ComponentService.sol";
|
28
28
|
import {IBundleService} from "./IBundleService.sol";
|
29
29
|
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
30
30
|
import {InstanceService} from "../InstanceService.sol";
|
31
31
|
import {InstanceReader} from "../InstanceReader.sol";
|
32
|
-
import {IBaseComponent} from "../../components/IBaseComponent.sol";
|
33
32
|
|
34
33
|
string constant BUNDLE_SERVICE_NAME = "BundleService";
|
35
34
|
|
36
35
|
contract BundleService is
|
37
|
-
|
36
|
+
ComponentService,
|
38
37
|
IBundleService
|
39
38
|
{
|
40
39
|
using NftIdLib for NftId;
|
@@ -165,17 +164,23 @@ contract BundleService is
|
|
165
164
|
bundleManager.unlock(bundleNftId);
|
166
165
|
}
|
167
166
|
|
168
|
-
function
|
167
|
+
function lockCollateral(
|
168
|
+
IInstance instance,
|
169
169
|
NftId policyNftId,
|
170
170
|
NftId bundleNftId,
|
171
171
|
uint256 collateralAmount,
|
172
172
|
uint256 netPremiumAmount
|
173
173
|
)
|
174
174
|
external
|
175
|
-
onlyService
|
175
|
+
onlyService
|
176
|
+
returns (
|
177
|
+
IBundle.BundleInfo memory bundleInfo
|
178
|
+
)
|
176
179
|
{
|
177
180
|
InstanceReader instanceReader = instance.getInstanceReader();
|
178
|
-
|
181
|
+
bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
182
|
+
|
183
|
+
// TODO add validation
|
179
184
|
|
180
185
|
// lock collateral
|
181
186
|
bundleInfo.lockedAmount += collateralAmount;
|
@@ -19,14 +19,15 @@ import {Versionable} from "../../shared/Versionable.sol";
|
|
19
19
|
|
20
20
|
import {IService} from "../../shared/IService.sol";
|
21
21
|
import {Service} from "../../shared/Service.sol";
|
22
|
-
import {
|
22
|
+
import {ComponentService} from "../base/ComponentService.sol";
|
23
23
|
import {InstanceService} from "../InstanceService.sol";
|
24
|
+
import {IComponent} from "../../components/IComponent.sol";
|
25
|
+
import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
|
24
26
|
import {IDistributionService} from "./IDistributionService.sol";
|
25
|
-
import {IBaseComponent} from "../../components/IBaseComponent.sol";
|
26
27
|
|
27
28
|
|
28
29
|
contract DistributionService is
|
29
|
-
|
30
|
+
ComponentService,
|
30
31
|
IDistributionService
|
31
32
|
{
|
32
33
|
using NftIdLib for NftId;
|
@@ -59,45 +60,30 @@ contract DistributionService is
|
|
59
60
|
external
|
60
61
|
returns(NftId distributionNftId)
|
61
62
|
{
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
distributionOwner,
|
75
|
-
DISTRIBUTION_OWNER_ROLE(),
|
76
|
-
address(instance));
|
77
|
-
|
78
|
-
if(!hasRole) {
|
79
|
-
revert ExpectedRoleMissing(DISTRIBUTION_OWNER_ROLE(), distributionOwner);
|
80
|
-
}
|
81
|
-
|
82
|
-
distributionNftId = info.nftId;
|
83
|
-
string memory distributionName;
|
84
|
-
ISetup.DistributionSetupInfo memory initialSetup;
|
85
|
-
(distributionName, initialSetup) = _decodeAndVerifyDistributionData(data);
|
86
|
-
instance.createDistributionSetup(distributionNftId, initialSetup);
|
87
|
-
|
88
|
-
instanceService.createTarget(instanceNftId, distributionAddress, distributionName);
|
89
|
-
|
63
|
+
(
|
64
|
+
IComponent component,
|
65
|
+
address owner,
|
66
|
+
IInstance instance,
|
67
|
+
NftId instanceNftId
|
68
|
+
) = _checkComponentForRegistration(
|
69
|
+
distributionAddress,
|
70
|
+
DISTRIBUTION(),
|
71
|
+
DISTRIBUTION_OWNER_ROLE());
|
72
|
+
|
73
|
+
IRegistry.ObjectInfo memory distributionInfo = getRegistryService().registerDistribution(component, owner);
|
74
|
+
IDistributionComponent distribution = IDistributionComponent(distributionAddress);
|
90
75
|
distribution.linkToRegisteredNftId();
|
76
|
+
distributionNftId = distributionInfo.nftId;
|
77
|
+
|
78
|
+
instance.createDistributionSetup(distributionNftId, distribution.getSetupInfo());
|
79
|
+
getInstanceService().createTarget(instanceNftId, distributionAddress, distribution.getName());
|
91
80
|
}
|
92
81
|
|
93
82
|
function _decodeAndVerifyDistributionData(bytes memory data)
|
94
83
|
internal
|
95
|
-
returns(string memory name
|
84
|
+
returns(string memory name)
|
96
85
|
{
|
97
|
-
(name
|
98
|
-
data,
|
99
|
-
(string, ISetup.DistributionSetupInfo)
|
100
|
-
);
|
86
|
+
(name) = abi.decode(data, (string));
|
101
87
|
|
102
88
|
// TODO add checks if applicable
|
103
89
|
}
|
@@ -26,7 +26,17 @@ interface IBundleService is IService {
|
|
26
26
|
|
27
27
|
function updateBundle(NftId instanceNftId, NftId bundleNftId, IBundle.BundleInfo memory bundleInfo, StateId state) external;
|
28
28
|
|
29
|
-
function
|
29
|
+
function lockCollateral(
|
30
|
+
IInstance instanceNftId,
|
31
|
+
NftId policyNftId,
|
32
|
+
NftId bundleNftId,
|
33
|
+
uint256 collateralAmount,
|
34
|
+
uint256 netPremium
|
35
|
+
)
|
36
|
+
external
|
37
|
+
returns (
|
38
|
+
IBundle.BundleInfo memory bundleInfo
|
39
|
+
);
|
30
40
|
|
31
41
|
function increaseBalance(IInstance instance, NftId bundleNftId, uint256 amount) external;
|
32
42
|
|