@etherisc/gif-next 0.0.2-ef2f083-203 → 0.0.2-ef935e0-790
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +10 -62
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +0 -52
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +8 -16
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +18 -18
- 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 +310 -1
- 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 +107 -84
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +2 -2
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +143 -38
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +113 -49
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +46 -26
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +59 -0
- 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 +100 -25
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +30 -14
- 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/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +839 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +448 -0
- package/artifacts/contracts/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 +7 -13
- package/contracts/components/IDistributionComponent.sol +0 -2
- package/contracts/components/Pool.sol +3 -18
- package/contracts/instance/IInstance.sol +9 -3
- package/contracts/instance/Instance.sol +11 -11
- package/contracts/instance/InstanceReader.sol +17 -1
- package/contracts/instance/InstanceService.sol +34 -9
- package/contracts/instance/InstanceServiceManager.sol +6 -5
- package/contracts/instance/base/ComponentServiceBase.sol +86 -1
- package/contracts/instance/module/IBundle.sol +1 -0
- package/contracts/instance/module/ISetup.sol +1 -0
- package/contracts/instance/service/DistributionService.sol +12 -20
- package/contracts/instance/service/DistributionServiceManager.sol +6 -5
- package/contracts/instance/service/PoolService.sol +194 -0
- package/contracts/instance/service/PoolServiceManager.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
@@ -7,7 +7,7 @@ import {DistributorType} from "../types/DistributorType.sol";
|
|
7
7
|
import {Fee, FeeLib} from "../types/Fee.sol";
|
8
8
|
import {Key32} from "../types/Key32.sol";
|
9
9
|
import {NftId} from "../types/NftId.sol";
|
10
|
-
import {ObjectType, DISTRIBUTOR, DISTRIBUTION, INSTANCE, PRODUCT, POLICY, POOL, TREASURY} from "../types/ObjectType.sol";
|
10
|
+
import {ObjectType, DISTRIBUTOR, DISTRIBUTION, INSTANCE, PRODUCT, POLICY, POOL, TREASURY, BUNDLE} from "../types/ObjectType.sol";
|
11
11
|
import {ReferralId, ReferralStatus, ReferralLib, REFERRAL_OK, REFERRAL_ERROR_UNKNOWN, REFERRAL_ERROR_EXPIRED, REFERRAL_ERROR_EXHAUSTED} from "../types/Referral.sol";
|
12
12
|
import {Registerable} from "../shared/Registerable.sol";
|
13
13
|
import {RiskId} from "../types/RiskId.sol";
|
@@ -15,6 +15,7 @@ import {UFixed, MathLib, UFixedLib} from "../types/UFixed.sol";
|
|
15
15
|
import {Version} from "../types/Version.sol";
|
16
16
|
|
17
17
|
import {IRegistry} from "../registry/IRegistry.sol";
|
18
|
+
import {IBundle} from "../instance/module/IBundle.sol";
|
18
19
|
import {IDistribution} from "../instance/module/IDistribution.sol";
|
19
20
|
import {IInstance} from "./IInstance.sol";
|
20
21
|
import {IKeyValueStore} from "../instance/base/IKeyValueStore.sol";
|
@@ -114,6 +115,17 @@ contract InstanceReader {
|
|
114
115
|
return abi.decode(data, (ITreasury.TreasuryInfo));
|
115
116
|
}
|
116
117
|
}
|
118
|
+
|
119
|
+
function getBundleInfo(NftId bundleNftId)
|
120
|
+
public
|
121
|
+
view
|
122
|
+
returns (IBundle.BundleInfo memory info)
|
123
|
+
{
|
124
|
+
bytes memory data = _store.getData(toBundleKey(bundleNftId));
|
125
|
+
if (data.length > 0) {
|
126
|
+
return abi.decode(data, (IBundle.BundleInfo));
|
127
|
+
}
|
128
|
+
}
|
117
129
|
|
118
130
|
function getDistributorTypeInfo(DistributorType distributorType)
|
119
131
|
public
|
@@ -259,6 +271,10 @@ contract InstanceReader {
|
|
259
271
|
return distributionNftId.toKey32(DISTRIBUTION());
|
260
272
|
}
|
261
273
|
|
274
|
+
function toBundleKey(NftId poolNftId) public pure returns (Key32) {
|
275
|
+
return poolNftId.toKey32(BUNDLE());
|
276
|
+
}
|
277
|
+
|
262
278
|
function toPoolKey(NftId poolNftId) public pure returns (Key32) {
|
263
279
|
return poolNftId.toKey32(POOL());
|
264
280
|
}
|
@@ -15,8 +15,9 @@ import {Service} from "../../contracts/shared/Service.sol";
|
|
15
15
|
import {IService} from "../shared/IService.sol";
|
16
16
|
import {ContractDeployerLib} from "../shared/ContractDeployerLib.sol";
|
17
17
|
import {NftId, NftIdLib, zeroNftId} from "../../contracts/types/NftId.sol";
|
18
|
+
import {RoleId} from "../types/RoleId.sol";
|
18
19
|
import {VersionLib} from "../types/Version.sol";
|
19
|
-
import {ADMIN_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE} from "../types/RoleId.sol";
|
20
|
+
import {ADMIN_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE} from "../types/RoleId.sol";
|
20
21
|
|
21
22
|
contract InstanceService is Service, IInstanceService {
|
22
23
|
|
@@ -44,8 +45,10 @@ contract InstanceService is Service, IInstanceService {
|
|
44
45
|
address registryServiceAddress = registry.getServiceAddress("RegistryService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
45
46
|
RegistryService registryService = RegistryService(registryServiceAddress);
|
46
47
|
|
48
|
+
// initially set the authority of the access managar to this (being the instance service).
|
49
|
+
// This will allow the instance service to bootstrap the authorizations of the instance
|
50
|
+
// and then transfer the ownership of the access manager to the instance owner once everything is setup
|
47
51
|
clonedAccessManager = AccessManagerSimple(Clones.clone(_accessManagerMaster));
|
48
|
-
// initial as this
|
49
52
|
clonedAccessManager.initialize(address(this));
|
50
53
|
|
51
54
|
clonedInstance = Instance(Clones.clone(_instanceMaster));
|
@@ -59,8 +62,9 @@ contract InstanceService is Service, IInstanceService {
|
|
59
62
|
_grantInitialAuthorizations(clonedAccessManager, clonedInstance);
|
60
63
|
|
61
64
|
clonedInstance.setInstanceReader(clonedInstanceReader);
|
62
|
-
|
63
|
-
// switch instance ownership to instance owner
|
65
|
+
|
66
|
+
// to complete setup switch instance ownership to the instance owner
|
67
|
+
// TODO: use a role less powerful than admin, maybe INSTANCE_ADMIN (does not exist yet)
|
64
68
|
clonedAccessManager.grantRole(ADMIN_ROLE().toInt(), instanceOwner, 0);
|
65
69
|
clonedAccessManager.revokeRole(ADMIN_ROLE().toInt(), address(this));
|
66
70
|
|
@@ -69,7 +73,6 @@ contract InstanceService is Service, IInstanceService {
|
|
69
73
|
|
70
74
|
function _grantInitialAuthorizations(AccessManagerSimple clonedAccessManager, Instance clonedInstance) internal {
|
71
75
|
address distributionServiceAddress = _registry.getServiceAddress("DistributionService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
72
|
-
|
73
76
|
clonedAccessManager.grantRole(DISTRIBUTION_SERVICE_ROLE().toInt(), distributionServiceAddress, 0);
|
74
77
|
bytes4[] memory instanceDistributionServiceSelectors = new bytes4[](2);
|
75
78
|
instanceDistributionServiceSelectors[0] = clonedInstance.createDistributionSetup.selector;
|
@@ -78,6 +81,19 @@ contract InstanceService is Service, IInstanceService {
|
|
78
81
|
address(clonedInstance),
|
79
82
|
instanceDistributionServiceSelectors,
|
80
83
|
DISTRIBUTION_SERVICE_ROLE().toInt());
|
84
|
+
|
85
|
+
address poolServiceAddress = _registry.getServiceAddress("PoolService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
86
|
+
clonedAccessManager.grantRole(POOL_SERVICE_ROLE().toInt(), address(poolServiceAddress), 0);
|
87
|
+
bytes4[] memory instancePoolServiceSelectors = new bytes4[](4);
|
88
|
+
instancePoolServiceSelectors[0] = clonedInstance.createPoolSetup.selector;
|
89
|
+
instancePoolServiceSelectors[1] = clonedInstance.updatePoolSetup.selector;
|
90
|
+
instancePoolServiceSelectors[2] = clonedInstance.createBundle.selector;
|
91
|
+
instancePoolServiceSelectors[3] = clonedInstance.updateBundle.selector;
|
92
|
+
clonedAccessManager.setTargetFunctionRole(
|
93
|
+
address(clonedInstance),
|
94
|
+
instancePoolServiceSelectors,
|
95
|
+
POOL_SERVICE_ROLE().toInt());
|
96
|
+
|
81
97
|
}
|
82
98
|
|
83
99
|
function setAccessManagerMaster(address accessManagerMaster) external {
|
@@ -144,15 +160,24 @@ contract InstanceService is Service, IInstanceService {
|
|
144
160
|
|
145
161
|
address initialOwner = address(0);
|
146
162
|
(_registryAddress, initialOwner) = abi.decode(data, (address, address));
|
147
|
-
|
148
|
-
|
163
|
+
// TODO while InstanceService is not deployed in InstanceServiceManager constructor
|
164
|
+
// owner is InstanceServiceManager deployer
|
165
|
+
_initializeService(_registryAddress, owner);
|
149
166
|
|
150
167
|
_registerInterface(type(IService).interfaceId);
|
151
168
|
_registerInterface(type(IInstanceService).interfaceId);
|
152
169
|
}
|
153
170
|
|
154
|
-
function
|
155
|
-
|
171
|
+
function hasRole(address account, RoleId role, NftId instanceNftId) external view returns (bool) {
|
172
|
+
IRegistry.ObjectInfo memory instanceObjectInfo = getRegistry().getObjectInfo(instanceNftId);
|
173
|
+
address instanceAddress = instanceObjectInfo.objectAddress;
|
174
|
+
Instance instance = Instance(instanceAddress);
|
175
|
+
AccessManagerSimple accessManager = AccessManagerSimple(instance.authority());
|
176
|
+
(bool isMember, uint32 executionDelay) = accessManager.hasRole(role.toInt(), account);
|
177
|
+
if (executionDelay > 0) {
|
178
|
+
return false;
|
179
|
+
}
|
180
|
+
return isMember;
|
156
181
|
}
|
157
182
|
}
|
158
183
|
|
@@ -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,14 +4,99 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
5
|
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
6
6
|
import {IInstance} from "../../instance/IInstance.sol";
|
7
|
-
import {ObjectType, INSTANCE, PRODUCT, POOL} from "../../types/ObjectType.sol";
|
7
|
+
import {ObjectType, INSTANCE, PRODUCT, POOL, DISTRIBUTION, ORACLE} from "../../types/ObjectType.sol";
|
8
8
|
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
9
|
+
import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, DISTRIBUTION_OWNER_ROLE, ORACLE_OWNER_ROLE} from "../../types/RoleId.sol";
|
9
10
|
|
11
|
+
import {BaseComponent} from "../../components/BaseComponent.sol";
|
12
|
+
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
10
13
|
import {Service} from "../../shared/Service.sol";
|
14
|
+
import {InstanceService} from "../InstanceService.sol";
|
11
15
|
import {Version, VersionPart, VersionLib} from "../../types/Version.sol";
|
12
16
|
|
13
17
|
abstract contract ComponentServiceBase is Service {
|
14
18
|
|
19
|
+
error ExpectedRoleMissing(RoleId expected, address caller);
|
20
|
+
error ComponentTypeInvalid(ObjectType componentType);
|
21
|
+
|
22
|
+
mapping (ObjectType => RoleId) internal _objectTypeToExpectedRole;
|
23
|
+
|
24
|
+
/// @dev modifier to check if caller has a role on the instance the component is registered in
|
25
|
+
modifier onlyComponentOwnerRole(address componentAddress) {
|
26
|
+
BaseComponent component = BaseComponent(componentAddress);
|
27
|
+
ObjectType objectType = _getObjectType(component);
|
28
|
+
RoleId expectedRole = _objectTypeToExpectedRole[objectType];
|
29
|
+
|
30
|
+
address componentOwner = msg.sender;
|
31
|
+
INftOwnable nftOwnable = INftOwnable(address(component.getInstance()));
|
32
|
+
if(! getInstanceService().hasRole(componentOwner, expectedRole, nftOwnable.getNftId())) {
|
33
|
+
revert ExpectedRoleMissing(expectedRole, componentOwner);
|
34
|
+
}
|
35
|
+
_;
|
36
|
+
}
|
37
|
+
|
38
|
+
function _initializeService(
|
39
|
+
address registry,
|
40
|
+
address initialOwner
|
41
|
+
)
|
42
|
+
internal
|
43
|
+
override
|
44
|
+
{
|
45
|
+
super._initializeService(registry, initialOwner);
|
46
|
+
_objectTypeToExpectedRole[PRODUCT()] = PRODUCT_OWNER_ROLE();
|
47
|
+
_objectTypeToExpectedRole[POOL()] = POOL_OWNER_ROLE();
|
48
|
+
_objectTypeToExpectedRole[DISTRIBUTION()] = DISTRIBUTION_OWNER_ROLE();
|
49
|
+
_objectTypeToExpectedRole[ORACLE()] = ORACLE_OWNER_ROLE();
|
50
|
+
}
|
51
|
+
|
52
|
+
function getInstanceService() public view returns (InstanceService) {
|
53
|
+
return InstanceService(getRegistry().getServiceAddress("InstanceService", getMajorVersion()));
|
54
|
+
}
|
55
|
+
|
56
|
+
function register(address componentAddress)
|
57
|
+
external
|
58
|
+
onlyComponentOwnerRole(componentAddress)
|
59
|
+
returns (NftId componentNftId)
|
60
|
+
{
|
61
|
+
address componentOwner = msg.sender;
|
62
|
+
BaseComponent component = BaseComponent(componentAddress);
|
63
|
+
ObjectType objectType = _getObjectType(component);
|
64
|
+
IRegistryService registryService = getRegistryService();
|
65
|
+
|
66
|
+
IRegistry.ObjectInfo memory objInfo;
|
67
|
+
bytes memory initialObjData;
|
68
|
+
|
69
|
+
if (objectType == DISTRIBUTION()) {
|
70
|
+
(objInfo, initialObjData) = registryService.registerDistribution(component, componentOwner);
|
71
|
+
} else if (objectType == PRODUCT()) {
|
72
|
+
(objInfo, initialObjData) = registryService.registerProduct(component, componentOwner);
|
73
|
+
} else if (objectType == POOL()) {
|
74
|
+
(objInfo, initialObjData) = registryService.registerPool(component, componentOwner);
|
75
|
+
// TODO: implement this for oracle - currently missing in registry
|
76
|
+
// } else if (objectType == ORACLE()) {
|
77
|
+
// (objInfo, initialObjData) = registryService.registerOracle(component, componentOwner);
|
78
|
+
} else {
|
79
|
+
revert ComponentTypeInvalid(objectType);
|
80
|
+
}
|
81
|
+
|
82
|
+
componentNftId = objInfo.nftId;
|
83
|
+
IInstance instance = _getInstance(objInfo);
|
84
|
+
_finalizeComponentRegistration(componentNftId, initialObjData, instance);
|
85
|
+
}
|
86
|
+
|
87
|
+
function _finalizeComponentRegistration(NftId componentNftId, bytes memory initialObjData, IInstance instance) internal virtual;
|
88
|
+
|
89
|
+
function _getObjectType(BaseComponent component) internal view returns (ObjectType) {
|
90
|
+
(IRegistry.ObjectInfo memory compInitialInfo, ) = component.getInitialInfo();
|
91
|
+
return compInitialInfo.objectType;
|
92
|
+
}
|
93
|
+
|
94
|
+
function _getInstance(IRegistry.ObjectInfo memory compObjInfo) internal view returns (IInstance) {
|
95
|
+
IRegistry registry = getRegistry();
|
96
|
+
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(compObjInfo.parentNftId);
|
97
|
+
return IInstance(instanceInfo.objectAddress);
|
98
|
+
}
|
99
|
+
|
15
100
|
function _getAndVerifyComponentInfoAndInstance(
|
16
101
|
ObjectType objectType
|
17
102
|
)
|
@@ -13,6 +13,7 @@ interface IBundle {
|
|
13
13
|
uint256 capitalAmount; // net investment capital + net premiums - payouts
|
14
14
|
uint256 lockedAmount; // capital amount linked to collateralizaion of non-closed policies (<= balance)
|
15
15
|
uint256 balanceAmount; // total amount of funds: capitalAmount + fees (balance >= captial)
|
16
|
+
uint256 lifetime;
|
16
17
|
Timestamp expiredAt; // no new policies
|
17
18
|
Timestamp closedAt; // no open policies, locked amount = 0
|
18
19
|
}
|
@@ -5,6 +5,7 @@ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IER
|
|
5
5
|
|
6
6
|
import {Fee} from "../../types/Fee.sol";
|
7
7
|
import {NftId} from "../../types/NftId.sol";
|
8
|
+
import {LibNftIdSet} from "../../types/NftIdSet.sol";
|
8
9
|
import {UFixed} from "../../types/UFixed.sol";
|
9
10
|
import {TokenHandler} from "../../shared/TokenHandler.sol";
|
10
11
|
|
@@ -10,6 +10,7 @@ import {ITreasury} from "../../instance/module/ITreasury.sol";
|
|
10
10
|
|
11
11
|
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
12
12
|
import {Fee} from "../../types/Fee.sol";
|
13
|
+
import {DISTRIBUTION_OWNER_ROLE} from "../../types/RoleId.sol";
|
13
14
|
import {KEEP_STATE} from "../../types/StateId.sol";
|
14
15
|
import {DISTRIBUTION} from "../../types/ObjectType.sol";
|
15
16
|
import {Version, VersionLib} from "../../types/Version.sol";
|
@@ -22,6 +23,9 @@ import {Service} from "../../shared/Service.sol";
|
|
22
23
|
import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
|
23
24
|
import {IDistributionService} from "./IDistributionService.sol";
|
24
25
|
import {Distribution} from "../../components/Distribution.sol";
|
26
|
+
import {InstanceService} from "../InstanceService.sol";
|
27
|
+
import {Instance} from "../Instance.sol";
|
28
|
+
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
25
29
|
|
26
30
|
string constant DISTRIBUTION_SERVICE_NAME = "DistributionService";
|
27
31
|
|
@@ -45,10 +49,9 @@ contract DistributionService is
|
|
45
49
|
{
|
46
50
|
address initialOwner = address(0);
|
47
51
|
(_registryAddress, initialOwner) = abi.decode(data, (address, address));
|
48
|
-
|
49
|
-
//
|
50
|
-
|
51
|
-
_initializeService(_registryAddress, initialOwner);
|
52
|
+
// TODO while DistributionService is not deployed in DistributionServiceManager constructor
|
53
|
+
// owner is DistributionServiceManager deployer
|
54
|
+
_initializeService(_registryAddress, owner);
|
52
55
|
|
53
56
|
_registerInterface(type(IService).interfaceId);
|
54
57
|
_registerInterface(type(IDistributionService).interfaceId);
|
@@ -59,23 +62,12 @@ contract DistributionService is
|
|
59
62
|
return NAME;
|
60
63
|
}
|
61
64
|
|
62
|
-
function
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
{
|
67
|
-
// TODO validate permission of componentOwner
|
68
|
-
Distribution distribution = Distribution(distributionComponentAddress);
|
69
|
-
IRegistryService registryService = getRegistryService();
|
70
|
-
(IRegistry.ObjectInfo memory distributionObjInfo, ) = registryService.registerDistribution(
|
71
|
-
distribution,
|
72
|
-
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)
|
73
69
|
);
|
74
|
-
|
75
|
-
|
76
|
-
ISetup.DistributionSetupInfo memory initialSetup = distribution.getInitialSetupInfo();
|
77
|
-
IInstance instance = distribution.getInstance();
|
78
|
-
instance.createDistributionSetup(distributionNftId, initialSetup);
|
70
|
+
instance.createDistributionSetup(componentNftId, initialSetup);
|
79
71
|
}
|
80
72
|
|
81
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;
|
@@ -0,0 +1,194 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {Pool} from "../../components/Pool.sol";
|
5
|
+
import {IRegistry} from "../../registry/IRegistry.sol";
|
6
|
+
import {IInstance} from "../../instance/IInstance.sol";
|
7
|
+
import {IBundle} from "../../instance/module/IBundle.sol";
|
8
|
+
import {TokenHandler} from "../../instance/module/ITreasury.sol";
|
9
|
+
import {ISetup} from "../module/ISetup.sol";
|
10
|
+
|
11
|
+
import {IVersionable} from "../../shared/IVersionable.sol";
|
12
|
+
import {Versionable} from "../../shared/Versionable.sol";
|
13
|
+
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
14
|
+
|
15
|
+
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
16
|
+
import {POOL, BUNDLE} from "../../types/ObjectType.sol";
|
17
|
+
import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
|
18
|
+
import {Fee, FeeLib} from "../../types/Fee.sol";
|
19
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
20
|
+
import {KEEP_STATE} from "../../types/StateId.sol";
|
21
|
+
import {zeroTimestamp} from "../../types/Timestamp.sol";
|
22
|
+
|
23
|
+
import {IService} from "../../shared/IService.sol";
|
24
|
+
import {Service} from "../../shared/Service.sol";
|
25
|
+
import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
|
26
|
+
import {IPoolService} from "./IPoolService.sol";
|
27
|
+
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
28
|
+
import {InstanceService} from "../InstanceService.sol";
|
29
|
+
import {InstanceReader} from "../InstanceReader.sol";
|
30
|
+
|
31
|
+
|
32
|
+
string constant POOL_SERVICE_NAME = "PoolService";
|
33
|
+
|
34
|
+
contract PoolService is
|
35
|
+
ComponentServiceBase,
|
36
|
+
IPoolService
|
37
|
+
{
|
38
|
+
using NftIdLib for NftId;
|
39
|
+
|
40
|
+
string public constant NAME = "PoolService";
|
41
|
+
|
42
|
+
address internal _registryAddress;
|
43
|
+
|
44
|
+
function _initialize(
|
45
|
+
address owner,
|
46
|
+
bytes memory data
|
47
|
+
)
|
48
|
+
internal
|
49
|
+
initializer
|
50
|
+
virtual override
|
51
|
+
{
|
52
|
+
address initialOwner = address(0);
|
53
|
+
(_registryAddress, initialOwner) = abi.decode(data, (address, address));
|
54
|
+
// TODO while PoolService is not deployed in PoolServiceManager constructor
|
55
|
+
// owner is PoolServiceManager deployer
|
56
|
+
_initializeService(_registryAddress, owner);
|
57
|
+
|
58
|
+
_registerInterface(type(IService).interfaceId);
|
59
|
+
_registerInterface(type(IPoolService).interfaceId);
|
60
|
+
}
|
61
|
+
|
62
|
+
function getName() public pure override(Service, IService) returns(string memory name) {
|
63
|
+
return NAME;
|
64
|
+
}
|
65
|
+
|
66
|
+
function _finalizeComponentRegistration(NftId componentNftId, bytes memory initialObjData, IInstance instance) internal override {
|
67
|
+
ISetup.PoolSetupInfo memory initialSetup = abi.decode(
|
68
|
+
initialObjData,
|
69
|
+
(ISetup.PoolSetupInfo)
|
70
|
+
);
|
71
|
+
instance.createPoolSetup(componentNftId, initialSetup);
|
72
|
+
}
|
73
|
+
|
74
|
+
function setFees(
|
75
|
+
Fee memory poolFee,
|
76
|
+
Fee memory stakingFee,
|
77
|
+
Fee memory performanceFee
|
78
|
+
)
|
79
|
+
external
|
80
|
+
override
|
81
|
+
{
|
82
|
+
(IRegistry.ObjectInfo memory poolInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
83
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
84
|
+
NftId poolNftId = poolInfo.nftId;
|
85
|
+
|
86
|
+
ISetup.PoolSetupInfo memory poolSetupInfo = instanceReader.getPoolSetupInfo(poolNftId);
|
87
|
+
poolSetupInfo.poolFee = poolFee;
|
88
|
+
poolSetupInfo.stakingFee = stakingFee;
|
89
|
+
poolSetupInfo.performanceFee = performanceFee;
|
90
|
+
|
91
|
+
instance.updatePoolSetup(poolNftId, poolSetupInfo, KEEP_STATE());
|
92
|
+
}
|
93
|
+
|
94
|
+
function createBundle(
|
95
|
+
address owner,
|
96
|
+
Fee memory fee,
|
97
|
+
uint256 stakingAmount,
|
98
|
+
uint256 lifetime,
|
99
|
+
bytes calldata filter
|
100
|
+
)
|
101
|
+
external
|
102
|
+
override
|
103
|
+
returns(NftId bundleNftId)
|
104
|
+
{
|
105
|
+
(IRegistry.ObjectInfo memory info, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
106
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
107
|
+
NftId poolNftId = info.nftId;
|
108
|
+
|
109
|
+
IBundle.BundleInfo memory bundleInfo = IBundle.BundleInfo(
|
110
|
+
poolNftId,
|
111
|
+
fee,
|
112
|
+
filter,
|
113
|
+
stakingAmount,
|
114
|
+
0,
|
115
|
+
stakingAmount,
|
116
|
+
lifetime,
|
117
|
+
zeroTimestamp(),
|
118
|
+
zeroTimestamp()
|
119
|
+
);
|
120
|
+
|
121
|
+
// register bundle with registry
|
122
|
+
bundleNftId = getRegistryService().registerBundle(
|
123
|
+
IRegistry.ObjectInfo(
|
124
|
+
zeroNftId(),
|
125
|
+
poolNftId,
|
126
|
+
BUNDLE(),
|
127
|
+
false, // intercepting property for bundles is defined on pool
|
128
|
+
address(0),
|
129
|
+
owner,
|
130
|
+
abi.encode(bundleInfo)
|
131
|
+
)
|
132
|
+
);
|
133
|
+
|
134
|
+
// create bundle info in instance
|
135
|
+
instance.createBundle(bundleNftId, bundleInfo);
|
136
|
+
|
137
|
+
// TODO add bundle to pool in instance
|
138
|
+
|
139
|
+
// TODO collect capital
|
140
|
+
// _processStakingByTreasury(
|
141
|
+
// instanceReader,
|
142
|
+
// zeroNftId(),
|
143
|
+
// poolNftId,
|
144
|
+
// bundleNftId,
|
145
|
+
// stakingAmount);
|
146
|
+
|
147
|
+
// TODO add logging
|
148
|
+
}
|
149
|
+
|
150
|
+
function setBundleFee(
|
151
|
+
NftId bundleNftId,
|
152
|
+
Fee memory fee
|
153
|
+
)
|
154
|
+
external
|
155
|
+
override
|
156
|
+
{
|
157
|
+
(IRegistry.ObjectInfo memory info , IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
158
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
159
|
+
NftId poolNftId = info.nftId;
|
160
|
+
|
161
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
162
|
+
require(bundleInfo.poolNftId.gtz(), "ERROR:PLS-010:BUNDLE_UNKNOWN");
|
163
|
+
require(poolNftId == bundleInfo.poolNftId, "ERROR:PLS-011:BUNDLE_POOL_MISMATCH");
|
164
|
+
|
165
|
+
bundleInfo.fee = fee;
|
166
|
+
|
167
|
+
instance.updateBundle(bundleNftId, bundleInfo, KEEP_STATE());
|
168
|
+
}
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
function _processStakingByTreasury(
|
173
|
+
InstanceReader instanceReader,
|
174
|
+
NftId productNftId,
|
175
|
+
NftId poolNftId,
|
176
|
+
NftId bundleNftId,
|
177
|
+
uint256 stakingAmount
|
178
|
+
)
|
179
|
+
internal
|
180
|
+
{
|
181
|
+
// process token transfer(s)
|
182
|
+
if(stakingAmount > 0) {
|
183
|
+
TokenHandler tokenHandler = TokenHandler(instanceReader.getTokenHandler(productNftId));
|
184
|
+
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
185
|
+
ISetup.PoolSetupInfo memory poolInfo = instanceReader.getPoolSetupInfo(poolNftId);
|
186
|
+
|
187
|
+
tokenHandler.transfer(
|
188
|
+
bundleOwner,
|
189
|
+
poolInfo.wallet,
|
190
|
+
stakingAmount
|
191
|
+
);
|
192
|
+
}
|
193
|
+
}
|
194
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IVersionable} from "../../shared/IVersionable.sol";
|
5
|
+
import {ProxyManager} from "../../shared/ProxyManager.sol";
|
6
|
+
import {PoolService} from "./PoolService.sol";
|
7
|
+
import {Registry} from "../../registry/Registry.sol";
|
8
|
+
import {RegistryService} from "../../registry/RegistryService.sol";
|
9
|
+
import {VersionLib} from "../../types/Version.sol";
|
10
|
+
|
11
|
+
contract PoolServiceManager is ProxyManager {
|
12
|
+
|
13
|
+
PoolService private _poolService;
|
14
|
+
|
15
|
+
/// @dev initializes proxy manager with pool service implementation
|
16
|
+
constructor(
|
17
|
+
address registryAddress
|
18
|
+
)
|
19
|
+
ProxyManager()
|
20
|
+
{
|
21
|
+
PoolService poolSrv = new PoolService();
|
22
|
+
bytes memory data = abi.encode(registryAddress, address(this));
|
23
|
+
IVersionable versionable = deploy(
|
24
|
+
address(poolSrv),
|
25
|
+
data);
|
26
|
+
|
27
|
+
_poolService = PoolService(address(versionable));
|
28
|
+
|
29
|
+
Registry registry = Registry(registryAddress);
|
30
|
+
address registryServiceAddress = registry.getServiceAddress("RegistryService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
31
|
+
RegistryService registryService = RegistryService(registryServiceAddress);
|
32
|
+
// TODO this must have a role or own nft to register service
|
33
|
+
//registryService.registerService(_poolService);
|
34
|
+
|
35
|
+
// TODO no nft to link yet
|
36
|
+
// link ownership of instance service manager ot nft owner of instance service
|
37
|
+
//_linkToNftOwnable(
|
38
|
+
// address(registryAddress),
|
39
|
+
// address(_poolService));
|
40
|
+
|
41
|
+
// implies that after this constructor call only upgrade functionality is available
|
42
|
+
_isDeployed = true;
|
43
|
+
}
|
44
|
+
|
45
|
+
//--- view functions ----------------------------------------------------//
|
46
|
+
function getPoolService()
|
47
|
+
external
|
48
|
+
view
|
49
|
+
returns (PoolService poolService)
|
50
|
+
{
|
51
|
+
return _poolService;
|
52
|
+
}
|
53
|
+
|
54
|
+
}
|
@@ -13,30 +13,19 @@ interface IRegistry is IERC165 {
|
|
13
13
|
event LogInitialMajorVersionSet(VersionPart majorVersion);
|
14
14
|
event LogMajorVersionSet(VersionPart majorVersionMax);
|
15
15
|
event LogRegistration(ObjectInfo info);
|
16
|
-
event LogTokenStateSet(address token, VersionPart majorVersion, bool active);
|
17
16
|
event LogServiceNameRegistration(string serviceName, VersionPart majorVersion);
|
18
17
|
|
19
|
-
//
|
18
|
+
// setMajorVersion()
|
19
|
+
error NotOwner(address account);
|
20
20
|
error MajorVersionMaxIncreaseInvalid(VersionPart newMajorVersionMax, VersionPart existingMaxMajorVersion);
|
21
21
|
|
22
|
-
//
|
23
|
-
error TokenNotRegistered(address token);
|
24
|
-
error NotToken(address token);
|
25
|
-
error TokenMajorVersionInvalid(VersionPart majorVersion);
|
26
|
-
|
27
|
-
// register
|
22
|
+
// register()
|
28
23
|
error NotRegistryService();
|
29
24
|
error ZeroParentAddress();
|
25
|
+
error InvalidTypesCombination(ObjectType objectType, ObjectType parentType);
|
30
26
|
error ContractAlreadyRegistered(address objectAddress);
|
31
27
|
error InvalidServiceVersion(VersionPart majorVersion);
|
32
28
|
error ServiceNameAlreadyRegistered(string name, VersionPart majorVersion);
|
33
|
-
|
34
|
-
// approve
|
35
|
-
error NotOwner(address account);
|
36
|
-
error NotRegisteredContract(NftId registrarNftId);
|
37
|
-
error NotService(NftId registrarNftId);
|
38
|
-
error InvalidTypesCombination(ObjectType objectType, ObjectType parentType);
|
39
|
-
|
40
29
|
|
41
30
|
struct ObjectInfo {
|
42
31
|
NftId nftId;
|
@@ -53,8 +42,6 @@ interface IRegistry is IERC165 {
|
|
53
42
|
|
54
43
|
function register(ObjectInfo memory info) external returns (NftId nftId);
|
55
44
|
|
56
|
-
function setTokenActive(address token, VersionPart majorVersion, bool active) external;
|
57
|
-
|
58
45
|
function getMajorVersionMin() external view returns (VersionPart);
|
59
46
|
|
60
47
|
function getMajorVersionMax() external view returns (VersionPart);
|
@@ -79,8 +66,6 @@ interface IRegistry is IERC165 {
|
|
79
66
|
|
80
67
|
function isRegistered(address contractAddress) external view returns (bool);
|
81
68
|
|
82
|
-
function isTokenActive(address token, VersionPart majorVersion) external view returns (bool);
|
83
|
-
|
84
69
|
function getServiceName(NftId nftId) external view returns (string memory name);
|
85
70
|
|
86
71
|
function getServiceAddress(
|