@etherisc/gif-next 0.0.2-aa8d0c4-506 → 0.0.2-ab4c2da-820
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/README.md +63 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +126 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +136 -62
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +88 -0
- 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/IPoolComponent.sol/IPoolComponent.json +28 -2
- 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 +168 -102
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +144 -64
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +788 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
- 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 +981 -10
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +448 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +30 -14
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +169 -139
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +55 -32
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +763 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +74 -40
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +269 -94
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +102 -34
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +285 -0
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +30 -19
- 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/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +923 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +440 -0
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +39 -52
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +43 -53
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +15 -23
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +669 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +13 -13
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -13
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +664 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +15 -77
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +25 -240
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +971 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +464 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +42 -157
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +15 -35
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +755 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +420 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +82 -262
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +188 -65
- 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 +112 -331
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +37 -79
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +38 -112
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +551 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +14 -27
- 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/IService.sol/IService.json +13 -13
- 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/Service.sol/Service.json +13 -13
- 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 +31 -31
- 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/NftIdSet.sol/LibNftIdSet.json +26 -3
- 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/BaseComponent.sol +49 -8
- package/contracts/components/Distribution.sol +12 -15
- package/contracts/components/IBaseComponent.sol +6 -0
- package/contracts/components/IDistributionComponent.sol +0 -2
- package/contracts/components/IPoolComponent.sol +5 -1
- package/contracts/components/Pool.sol +49 -25
- package/contracts/components/Product.sol +41 -46
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +23 -0
- package/contracts/instance/BundleManager.sol +129 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +25 -4
- package/contracts/instance/IInstanceBase.sol +26 -0
- package/contracts/instance/IInstanceService.sol +7 -3
- package/contracts/instance/Instance.sol +44 -23
- package/contracts/instance/InstanceAccessManager.sol +6 -6
- package/contracts/instance/InstanceBase.sol +41 -0
- package/contracts/instance/InstanceReader.sol +9 -0
- package/contracts/instance/InstanceService.sol +190 -73
- package/contracts/instance/InstanceServiceManager.sol +8 -6
- package/contracts/instance/ObjectManager.sol +101 -0
- package/contracts/instance/base/ComponentServiceBase.sol +36 -24
- package/contracts/instance/module/ISetup.sol +3 -1
- package/contracts/instance/service/BundleService.sol +260 -0
- package/contracts/instance/service/BundleServiceManager.sol +55 -0
- package/contracts/instance/service/ComponentOwnerService.sol +4 -6
- package/contracts/instance/service/DistributionService.sol +41 -26
- package/contracts/instance/service/DistributionServiceManager.sol +8 -6
- package/contracts/instance/service/IBundleService.sol +45 -0
- package/contracts/instance/service/IPolicyService.sol +87 -0
- package/contracts/instance/service/IPoolService.sol +6 -23
- package/contracts/instance/service/IProductService.sol +6 -73
- package/contracts/instance/service/PolicyService.sol +503 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +46 -129
- package/contracts/instance/service/PoolServiceManager.sol +8 -6
- package/contracts/instance/service/ProductService.sol +168 -0
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +16 -33
- package/contracts/registry/IRegistryService.sol +37 -12
- package/contracts/registry/Registry.sol +138 -242
- package/contracts/registry/RegistryAccessManager.sol +207 -0
- package/contracts/registry/RegistryService.sol +83 -152
- package/contracts/registry/RegistryServiceManager.sol +18 -36
- package/contracts/registry/ReleaseManager.sol +382 -0
- package/contracts/registry/TokenRegistry.sol +5 -6
- package/contracts/shared/IService.sol +2 -1
- package/contracts/shared/NftOwnable.sol +2 -4
- package/contracts/shared/ProxyManager.sol +1 -1
- package/contracts/shared/Service.sol +11 -7
- package/contracts/test/TestService.sol +3 -2
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/RoleId.sol +7 -5
- package/package.json +1 -1
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1132
- package/contracts/instance/AccessManagedSimple.sol +0 -115
- package/contracts/instance/AccessManagerSimple.sol +0 -692
@@ -0,0 +1,207 @@
|
|
1
|
+
// SPDX-License-Identifier: UNLICENSED
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {AccessManager} from "@openzeppelin/contracts/access/manager/AccessManager.sol";
|
5
|
+
import {AccessManaged} from "@openzeppelin/contracts/access/manager/AccessManaged.sol";
|
6
|
+
|
7
|
+
import {RoleId, RoleIdLib,
|
8
|
+
REGISTRY_SERVICE_MANAGER_ROLE,
|
9
|
+
REGISTRY_SERVICE_ADMIN_ROLE,
|
10
|
+
RELEASE_MANAGER_ROLE} from "../types/RoleId.sol";
|
11
|
+
|
12
|
+
import {TokenRegistry} from "./TokenRegistry.sol";
|
13
|
+
import {ReleaseManager} from "./ReleaseManager.sol";
|
14
|
+
|
15
|
+
/*
|
16
|
+
3 types of roles:
|
17
|
+
1) REGISTRAR roles
|
18
|
+
- each one is unique
|
19
|
+
- always have 1 member
|
20
|
+
- one role is set for each function of each version of registry service
|
21
|
+
2) REGISTRY_SERVICE_MANAGER_ROLE aka GIF_MANAGER_ROLE
|
22
|
+
- can have arbitrary number of members
|
23
|
+
- responsible for services registrations
|
24
|
+
- responsible for token registration and activation
|
25
|
+
3) REGISTRY_SERVICE_ADMIN_ROLE aka GIF_ADMIN_ROLE
|
26
|
+
- admin of REGISTRY_SERVICE_MANAGER_ROLE
|
27
|
+
- MUST have 1 member at any time
|
28
|
+
- granted/revoked ONLY in transferAdminRole() -> consider lock out situations!!!
|
29
|
+
- responsible for release manager initialization
|
30
|
+
- responsible for creation and activation of each release
|
31
|
+
|
32
|
+
*/
|
33
|
+
|
34
|
+
contract RegistryAccessManager is AccessManaged
|
35
|
+
{
|
36
|
+
error NotInitialized();
|
37
|
+
error AlreadyInitialized();
|
38
|
+
|
39
|
+
uint64 public constant UNIQUE_ROLE_ID_MIN = 1000000;
|
40
|
+
|
41
|
+
AccessManager private immutable _accessManager;
|
42
|
+
address private _releaseManager;
|
43
|
+
address private _tokenRegistry;
|
44
|
+
|
45
|
+
uint64 private _idNext; // role id
|
46
|
+
bool private _isInitialized;
|
47
|
+
|
48
|
+
modifier onlyOnce() {
|
49
|
+
if(_isInitialized) {
|
50
|
+
revert AlreadyInitialized();
|
51
|
+
}
|
52
|
+
_;
|
53
|
+
_isInitialized = true;
|
54
|
+
}
|
55
|
+
|
56
|
+
modifier onlyInitialized() {
|
57
|
+
if(!_isInitialized) {
|
58
|
+
revert NotInitialized();
|
59
|
+
}
|
60
|
+
_;
|
61
|
+
}
|
62
|
+
|
63
|
+
constructor(address manager)
|
64
|
+
AccessManaged(msg.sender)
|
65
|
+
{
|
66
|
+
_accessManager = new AccessManager(address(this));
|
67
|
+
setAuthority(address(_accessManager));
|
68
|
+
|
69
|
+
_idNext = UNIQUE_ROLE_ID_MIN;
|
70
|
+
|
71
|
+
_configureAdminRoleInitial();
|
72
|
+
|
73
|
+
address admin = msg.sender;
|
74
|
+
_grantRole(REGISTRY_SERVICE_ADMIN_ROLE(), admin, 0);
|
75
|
+
_grantRole(REGISTRY_SERVICE_MANAGER_ROLE(), manager, 0);
|
76
|
+
}
|
77
|
+
|
78
|
+
function initialize(address releaseManager, address tokenRegistry)
|
79
|
+
external
|
80
|
+
restricted // GIF_ADMIN_ROLE
|
81
|
+
onlyOnce
|
82
|
+
{
|
83
|
+
require(ReleaseManager(releaseManager).authority() == address(_accessManager));
|
84
|
+
//require(tokenRegistry.authority() == address(_accessManager));
|
85
|
+
|
86
|
+
_releaseManager = releaseManager;
|
87
|
+
_tokenRegistry = tokenRegistry;
|
88
|
+
|
89
|
+
_configureAdminRole();
|
90
|
+
_configureManagerRole();
|
91
|
+
_configureReleaseManagerRole();
|
92
|
+
|
93
|
+
_grantRole(RELEASE_MANAGER_ROLE(), releaseManager, 0);
|
94
|
+
}
|
95
|
+
|
96
|
+
// set unique role for target, role forever have 1 member and never revoked
|
97
|
+
function setAndGrantUniqueRole(
|
98
|
+
address account,
|
99
|
+
address target,
|
100
|
+
bytes4[] memory selector
|
101
|
+
)
|
102
|
+
external
|
103
|
+
restricted // RELEASE_MANAGER_ROLE
|
104
|
+
onlyInitialized
|
105
|
+
returns(RoleId)
|
106
|
+
{
|
107
|
+
// TODO questionable check...
|
108
|
+
// target is not part of `runtime`
|
109
|
+
//if(
|
110
|
+
// target == address(this) ||
|
111
|
+
// target == address(_accessManager) ||
|
112
|
+
// target == _releaseManager ||
|
113
|
+
// target == _tokenRegistry)
|
114
|
+
//{ return TargetInvalid(); }
|
115
|
+
|
116
|
+
RoleId roleId = _getNextRoleId();
|
117
|
+
|
118
|
+
_setTargetFunctionRole(target, selector, roleId);
|
119
|
+
_grantRole(roleId, account, 0);
|
120
|
+
}
|
121
|
+
|
122
|
+
/*function transferAdmin(address to)
|
123
|
+
external
|
124
|
+
restricted // only with REGISTRY_SERVICE_ADMIN_ROLE or nft owner
|
125
|
+
{
|
126
|
+
_accessManager.revoke(REGISTRY_SERVICE_ADMIN_ROLE, );
|
127
|
+
_accesssManager.grant(REGISTRY_SERVICE_ADMIN_ROLE, to, 0);
|
128
|
+
}*/
|
129
|
+
|
130
|
+
//--- view functions ----------------------------------------------------//
|
131
|
+
|
132
|
+
function getAccessManager()
|
133
|
+
external
|
134
|
+
view
|
135
|
+
returns (AccessManager)
|
136
|
+
{
|
137
|
+
return _accessManager;
|
138
|
+
}
|
139
|
+
|
140
|
+
//--- private functions -------------------------------------------------//
|
141
|
+
|
142
|
+
function _configureAdminRoleInitial() private
|
143
|
+
{
|
144
|
+
bytes4[] memory functionSelector = new bytes4[](1);
|
145
|
+
|
146
|
+
functionSelector[0] = RegistryAccessManager.initialize.selector;
|
147
|
+
_setTargetFunctionRole(address(this), functionSelector, REGISTRY_SERVICE_ADMIN_ROLE());
|
148
|
+
}
|
149
|
+
|
150
|
+
function _configureAdminRole() private
|
151
|
+
{
|
152
|
+
bytes4[] memory functionSelector = new bytes4[](1);
|
153
|
+
|
154
|
+
// for RegistryServiceProxyManager
|
155
|
+
// TODO upgrading with releaseManager.upgrade()->proxy.upgrade()???
|
156
|
+
//functionSelector[0] = RegistryServiceManager.upgrade.selector;
|
157
|
+
//_setTargetFunctionRole(address(this), functionSelector, REGISTRY_SERVICE_ADMIN_ROLE());
|
158
|
+
|
159
|
+
// for TokenRegistry
|
160
|
+
|
161
|
+
// for ReleaseManager
|
162
|
+
functionSelector[0] = ReleaseManager.createNextRelease.selector;
|
163
|
+
_setTargetFunctionRole(_releaseManager, functionSelector, REGISTRY_SERVICE_ADMIN_ROLE());
|
164
|
+
//functionSelector[0] = ReleaseManager.activateNextRelease.selector;
|
165
|
+
//_setTargetFunctionRole(_releaseManager, functionSelector, REGISTRY_SERVICE_ADMIN_ROLE());
|
166
|
+
}
|
167
|
+
|
168
|
+
function _configureManagerRole() private
|
169
|
+
{
|
170
|
+
bytes4[] memory functionSelector = new bytes4[](1);
|
171
|
+
|
172
|
+
// for TokenRegistry
|
173
|
+
functionSelector[0] = TokenRegistry.setActive.selector;
|
174
|
+
_setTargetFunctionRole(address(_tokenRegistry), functionSelector, REGISTRY_SERVICE_MANAGER_ROLE());
|
175
|
+
|
176
|
+
// for ReleaseManager
|
177
|
+
functionSelector[0] = ReleaseManager.registerService.selector;
|
178
|
+
_setTargetFunctionRole(_releaseManager, functionSelector, REGISTRY_SERVICE_MANAGER_ROLE());
|
179
|
+
|
180
|
+
// set admin
|
181
|
+
_setRoleAdmin(REGISTRY_SERVICE_MANAGER_ROLE(), REGISTRY_SERVICE_ADMIN_ROLE());
|
182
|
+
}
|
183
|
+
|
184
|
+
function _configureReleaseManagerRole() private
|
185
|
+
{
|
186
|
+
bytes4[] memory functionSelector = new bytes4[](1);
|
187
|
+
|
188
|
+
functionSelector[0] = RegistryAccessManager.setAndGrantUniqueRole.selector;
|
189
|
+
_setTargetFunctionRole(address(this), functionSelector, RELEASE_MANAGER_ROLE());
|
190
|
+
}
|
191
|
+
|
192
|
+
function _setTargetFunctionRole(address target, bytes4[] memory selectors, RoleId roleId) private {
|
193
|
+
_accessManager.setTargetFunctionRole(target, selectors, roleId.toInt());
|
194
|
+
}
|
195
|
+
|
196
|
+
function _setRoleAdmin(RoleId roleId, RoleId adminRoleId) private {
|
197
|
+
_accessManager.setRoleAdmin(roleId.toInt(), adminRoleId.toInt());
|
198
|
+
}
|
199
|
+
|
200
|
+
function _grantRole(RoleId roleId, address account, uint32 executionDelay) private {
|
201
|
+
_accessManager.grantRole(roleId.toInt(), account, executionDelay);
|
202
|
+
}
|
203
|
+
|
204
|
+
function _getNextRoleId() private returns(RoleId roleId) {
|
205
|
+
roleId = RoleIdLib.toRoleId(_idNext++);
|
206
|
+
}
|
207
|
+
}
|
@@ -8,8 +8,6 @@ import {IRegistry} from "./IRegistry.sol";
|
|
8
8
|
import {IInstance} from "../instance/IInstance.sol";
|
9
9
|
|
10
10
|
import {ContractDeployerLib} from "../shared/ContractDeployerLib.sol";
|
11
|
-
// import {IComponent, IComponentModule} from "../../contracts/instance/module/component/IComponent.sol";
|
12
|
-
// import {IPool} from "../../contracts/instance/module/pool/IPoolModule.sol";
|
13
11
|
import {IBaseComponent} from "../../contracts/components/IBaseComponent.sol";
|
14
12
|
import {IPoolComponent} from "../../contracts/components/IPoolComponent.sol";
|
15
13
|
import {IProductComponent} from "../../contracts/components/IProductComponent.sol";
|
@@ -18,9 +16,10 @@ import {IDistributionComponent} from "../../contracts/components/IDistributionCo
|
|
18
16
|
import {IVersionable} from "../../contracts/shared/IVersionable.sol";
|
19
17
|
import {Versionable} from "../../contracts/shared/Versionable.sol";
|
20
18
|
import {IRegisterable} from "../../contracts/shared/IRegisterable.sol";
|
19
|
+
import {Registerable} from "../../contracts/shared/Registerable.sol";
|
21
20
|
|
22
21
|
import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, ORACLE_OWNER_ROLE} from "../../contracts/types/RoleId.sol";
|
23
|
-
import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, POLICY, BUNDLE} from "../../contracts/types/ObjectType.sol";
|
22
|
+
import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, POLICY, BUNDLE, STAKE} from "../../contracts/types/ObjectType.sol";
|
24
23
|
import {StateId, ACTIVE, PAUSED} from "../../contracts/types/StateId.sol";
|
25
24
|
import {NftId, NftIdLib, zeroNftId} from "../../contracts/types/NftId.sol";
|
26
25
|
import {Fee, FeeLib} from "../../contracts/types/Fee.sol";
|
@@ -30,7 +29,6 @@ import {Service} from "../shared/Service.sol";
|
|
30
29
|
import {IService} from "../shared/IService.sol";
|
31
30
|
import {IRegistryService} from "./IRegistryService.sol";
|
32
31
|
import {Registry} from "./Registry.sol";
|
33
|
-
import {ChainNft} from "./ChainNft.sol";
|
34
32
|
|
35
33
|
contract RegistryService is
|
36
34
|
AccessManagedUpgradeable,
|
@@ -39,73 +37,12 @@ contract RegistryService is
|
|
39
37
|
{
|
40
38
|
using NftIdLib for NftId;
|
41
39
|
|
42
|
-
// TODO move errors to interface contract
|
43
|
-
error SelfRegistration();
|
44
|
-
error NotRegistryOwner();
|
45
|
-
|
46
|
-
error NotService();
|
47
|
-
error NotInstance();
|
48
|
-
error NotProduct();
|
49
|
-
error NotPool();
|
50
|
-
error NotDistribution();
|
51
|
-
|
52
|
-
error UnexpectedRegisterableType(ObjectType expected, ObjectType found);
|
53
|
-
error NotRegisterableOwner(address expectedOwner);
|
54
|
-
error RegisterableOwnerIsZero();
|
55
|
-
error RegisterableOwnerIsRegistered();
|
56
|
-
error InvalidInitialOwner(address initialOwner);
|
57
|
-
error InvalidAddress(address registerableAddress);
|
58
|
-
|
59
|
-
// Initial value for constant variable has to be compile-time constant
|
60
|
-
// TODO define types as constants?
|
61
|
-
//ObjectType public constant SERVICE_TYPE = REGISTRY();
|
62
|
-
string public constant NAME = "RegistryService";
|
63
|
-
|
64
40
|
// TODO update to real hash when registry is stable
|
65
41
|
bytes32 public constant REGISTRY_CREATION_CODE_HASH = bytes32(0);
|
66
42
|
|
67
43
|
address public constant NFT_LOCK_ADDRESS = address(0x1);
|
68
44
|
|
69
|
-
/// @dev
|
70
|
-
// msg.sender - ONLY registry owner
|
71
|
-
// CAN NOT register itself
|
72
|
-
// CAN register ONLY valid object-parent types combinations for SERVICE
|
73
|
-
// CAN register ONLY IRegisterable address he owns
|
74
|
-
// IMPORTANT: MUST NOT check owner before calling external contract
|
75
|
-
function registerService(IService service)
|
76
|
-
external
|
77
|
-
// TODO restrict access - registryService.registerService must use accessmanager for checking permissions as
|
78
|
-
// services are not always owned by registry owner - actually only registry service is owned by registry owner
|
79
|
-
|
80
|
-
returns(
|
81
|
-
IRegistry.ObjectInfo memory info,
|
82
|
-
bytes memory data
|
83
|
-
)
|
84
|
-
{
|
85
|
-
|
86
|
-
// CAN revert if no ERC165 support -> will revert with empty message
|
87
|
-
if(!service.supportsInterface(type(IService).interfaceId)) {
|
88
|
-
revert NotService();
|
89
|
-
}
|
90
|
-
|
91
|
-
(
|
92
|
-
info,
|
93
|
-
data
|
94
|
-
) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
95
45
|
|
96
|
-
info.nftId = _registry.register(info);
|
97
|
-
service.linkToRegisteredNftId();
|
98
|
-
return (
|
99
|
-
info,
|
100
|
-
data
|
101
|
-
);
|
102
|
-
}
|
103
|
-
|
104
|
-
// If msg.sender is approved service:
|
105
|
-
// 1) add owner arg (service MUST pass it's msg.sender as owner)
|
106
|
-
// 2) check service allowance
|
107
|
-
// 3) comment self registrstion check
|
108
|
-
//function registerInstance(IRegisterable instance, address owner)
|
109
46
|
function registerInstance(IRegisterable instance)
|
110
47
|
external
|
111
48
|
returns(
|
@@ -117,18 +54,12 @@ contract RegistryService is
|
|
117
54
|
revert NotInstance();
|
118
55
|
}
|
119
56
|
|
120
|
-
(
|
121
|
-
info,
|
122
|
-
data
|
123
|
-
) = _getAndVerifyContractInfo(instance, INSTANCE(), msg.sender);
|
57
|
+
(info, data) = _getAndVerifyContractInfo(instance, INSTANCE(), msg.sender);
|
124
58
|
|
125
59
|
info.nftId = _registry.register(info);
|
126
60
|
instance.linkToRegisteredNftId(); // asume safe
|
127
61
|
|
128
|
-
return (
|
129
|
-
info,
|
130
|
-
data
|
131
|
-
);
|
62
|
+
return (info, data);
|
132
63
|
}
|
133
64
|
|
134
65
|
function registerProduct(IBaseComponent product, address owner)
|
@@ -144,21 +75,13 @@ contract RegistryService is
|
|
144
75
|
revert NotProduct();
|
145
76
|
}
|
146
77
|
|
147
|
-
(
|
148
|
-
info,
|
149
|
-
data
|
150
|
-
) = _getAndVerifyContractInfo(product, PRODUCT(), owner);
|
151
|
-
|
152
|
-
NftId serviceNftId = _registry.getNftId(msg.sender);
|
78
|
+
(info, data) = _getAndVerifyContractInfo(product, PRODUCT(), owner);
|
153
79
|
|
154
80
|
info.nftId = _registry.register(info);
|
155
81
|
// TODO unsafe, let component or its owner derive nftId latter, when state assumptions and modifications of GIF contracts are finished
|
156
82
|
product.linkToRegisteredNftId();
|
157
83
|
|
158
|
-
return (
|
159
|
-
info,
|
160
|
-
data
|
161
|
-
);
|
84
|
+
return (info, data);
|
162
85
|
}
|
163
86
|
|
164
87
|
function registerPool(IBaseComponent pool, address owner)
|
@@ -173,20 +96,12 @@ contract RegistryService is
|
|
173
96
|
revert NotPool();
|
174
97
|
}
|
175
98
|
|
176
|
-
(
|
177
|
-
info,
|
178
|
-
data
|
179
|
-
) = _getAndVerifyContractInfo(pool, POOL(), owner);
|
180
|
-
|
181
|
-
NftId serviceNftId = _registry.getNftId(msg.sender);
|
99
|
+
(info, data) = _getAndVerifyContractInfo(pool, POOL(), owner);
|
182
100
|
|
183
101
|
info.nftId = _registry.register(info);
|
184
102
|
pool.linkToRegisteredNftId();
|
185
103
|
|
186
|
-
return (
|
187
|
-
info,
|
188
|
-
data
|
189
|
-
);
|
104
|
+
return (info, data);
|
190
105
|
}
|
191
106
|
|
192
107
|
function registerDistribution(IBaseComponent distribution, address owner)
|
@@ -201,20 +116,12 @@ contract RegistryService is
|
|
201
116
|
revert NotDistribution();
|
202
117
|
}
|
203
118
|
|
204
|
-
(
|
205
|
-
info,
|
206
|
-
data
|
207
|
-
) = _getAndVerifyContractInfo(distribution, DISTRIBUTION(), owner);
|
208
|
-
|
209
|
-
NftId serviceNftId = _registry.getNftId(msg.sender);
|
119
|
+
(info, data) = _getAndVerifyContractInfo(distribution, DISTRIBUTION(), owner);
|
210
120
|
|
211
121
|
info.nftId = _registry.register(info);
|
212
122
|
distribution.linkToRegisteredNftId();
|
213
123
|
|
214
|
-
return (
|
215
|
-
info,
|
216
|
-
data
|
217
|
-
);
|
124
|
+
return (info, data);
|
218
125
|
}
|
219
126
|
|
220
127
|
function registerPolicy(IRegistry.ObjectInfo memory info)
|
@@ -222,8 +129,6 @@ contract RegistryService is
|
|
222
129
|
restricted
|
223
130
|
returns(NftId nftId)
|
224
131
|
{
|
225
|
-
NftId senderNftId = _registry.getNftId(msg.sender);
|
226
|
-
|
227
132
|
_verifyObjectInfo(info, POLICY());
|
228
133
|
|
229
134
|
nftId = _registry.register(info);
|
@@ -234,31 +139,29 @@ contract RegistryService is
|
|
234
139
|
restricted
|
235
140
|
returns(NftId nftId)
|
236
141
|
{
|
237
|
-
|
238
|
-
NftId senderNftId = _registry.getNftId(msg.sender);
|
239
|
-
|
240
142
|
_verifyObjectInfo(info, BUNDLE());
|
241
143
|
|
242
144
|
nftId = _registry.register(info);
|
243
145
|
}
|
244
146
|
|
147
|
+
function registerStake(IRegistry.ObjectInfo memory info)
|
148
|
+
external
|
149
|
+
restricted
|
150
|
+
returns(NftId nftId)
|
151
|
+
{
|
152
|
+
_verifyObjectInfo(info, STAKE());
|
245
153
|
|
246
|
-
|
247
|
-
function getName() public pure override(IService, Service) returns(string memory) {
|
248
|
-
return NAME;
|
154
|
+
nftId = _registry.register(info);
|
249
155
|
}
|
250
|
-
//function getType() public pure override(IService, ServiceBase) returns(ObjectType serviceType) {
|
251
|
-
// return SERVICE_TYPE;
|
252
|
-
//}
|
253
156
|
|
157
|
+
// From IService
|
158
|
+
function getDomain() public pure override(IService, Service) returns(ObjectType serviceDomain) {
|
159
|
+
return SERVICE();
|
160
|
+
}
|
254
161
|
|
255
162
|
// from Versionable
|
256
163
|
|
257
164
|
/// @dev top level initializer
|
258
|
-
// 1) registry is non upgradeable -> don't need a proxy and uses constructor !
|
259
|
-
// 2) deploy registry service first -> from its initialization func it is easier to deploy registry then vice versa
|
260
|
-
// 3) deploy registry -> pass registry service address as constructor argument
|
261
|
-
// registry is getting instantiated and locked to registry service address forever
|
262
165
|
function _initialize(
|
263
166
|
address owner,
|
264
167
|
bytes memory data
|
@@ -269,38 +172,66 @@ contract RegistryService is
|
|
269
172
|
{
|
270
173
|
(
|
271
174
|
address initialAuthority,
|
272
|
-
|
273
|
-
) = abi.decode(data, (address,
|
175
|
+
address registry
|
176
|
+
) = abi.decode(data, (address, address));
|
274
177
|
|
275
178
|
__AccessManaged_init(initialAuthority);
|
276
179
|
|
277
|
-
|
278
|
-
|
279
|
-
|
180
|
+
_initializeService(address(registry), owner);
|
181
|
+
|
182
|
+
_registerInterface(type(IRegistryService).interfaceId);
|
183
|
+
}
|
280
184
|
|
281
|
-
|
282
|
-
registryByteCodeWithInitCode,
|
283
|
-
encodedConstructorArguments);
|
185
|
+
// from IRegisterable
|
284
186
|
|
285
|
-
|
286
|
-
|
287
|
-
|
187
|
+
function getInitialInfo()
|
188
|
+
public
|
189
|
+
view
|
190
|
+
override(IRegisterable, Registerable)
|
191
|
+
returns (IRegistry.ObjectInfo memory info, bytes memory data)
|
192
|
+
{
|
193
|
+
(info , data) = super.getInitialInfo();
|
288
194
|
|
289
|
-
|
195
|
+
FunctionConfig[] memory config = new FunctionConfig[](6);
|
290
196
|
|
291
|
-
|
197
|
+
// registerInstance() have no restriction
|
198
|
+
config[0].serviceDomain = INSTANCE();
|
199
|
+
config[0].selector = new bytes4[](1);
|
200
|
+
config[0].selector[0] = RegistryService.registerInstance.selector;
|
292
201
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
202
|
+
config[1].serviceDomain = POOL();
|
203
|
+
config[1].selector = new bytes4[](1);
|
204
|
+
config[1].selector[0] = RegistryService.registerPool.selector;
|
205
|
+
|
206
|
+
config[2].serviceDomain = DISTRIBUTION();
|
207
|
+
config[2].selector = new bytes4[](1);
|
208
|
+
config[2].selector[0] = RegistryService.registerDistribution.selector;
|
209
|
+
|
210
|
+
config[3].serviceDomain = PRODUCT();
|
211
|
+
config[3].selector = new bytes4[](1);
|
212
|
+
config[3].selector[0] = RegistryService.registerProduct.selector;
|
213
|
+
|
214
|
+
config[4].serviceDomain = POLICY();
|
215
|
+
config[4].selector = new bytes4[](1);
|
216
|
+
config[4].selector[0] = RegistryService.registerPolicy.selector;
|
217
|
+
|
218
|
+
config[5].serviceDomain = BUNDLE();
|
219
|
+
config[5].selector = new bytes4[](1);
|
220
|
+
config[5].selector[0] = RegistryService.registerBundle.selector;
|
221
|
+
|
222
|
+
/*config[6].serviceDomain = STAKE();
|
223
|
+
config[6].selector = new bytes4[](1);
|
224
|
+
config[6].selector[0] = RegistryService.registerStake.selector;*/
|
225
|
+
|
226
|
+
data = abi.encode(config);
|
297
227
|
}
|
298
228
|
|
299
|
-
//
|
229
|
+
// Internal
|
230
|
+
|
300
231
|
function _getAndVerifyContractInfo(
|
301
232
|
IRegisterable registerable,
|
302
233
|
ObjectType expectedType, // assume can be valid only
|
303
|
-
address expectedOwner // assume can be 0
|
234
|
+
address expectedOwner // assume can be 0 when given by other service
|
304
235
|
)
|
305
236
|
internal
|
306
237
|
view
|
@@ -349,31 +280,31 @@ contract RegistryService is
|
|
349
280
|
revert InvalidParent(parentNftId);
|
350
281
|
}*/
|
351
282
|
|
352
|
-
return(
|
353
|
-
info,
|
354
|
-
data
|
355
|
-
);
|
283
|
+
return(info, data);
|
356
284
|
}
|
357
285
|
|
358
|
-
// parent checks done in registry because of approve()
|
359
286
|
function _verifyObjectInfo(
|
360
287
|
IRegistry.ObjectInfo memory info,
|
361
|
-
ObjectType
|
288
|
+
ObjectType expectedType
|
362
289
|
)
|
363
290
|
internal
|
364
291
|
view
|
365
292
|
{
|
366
|
-
|
367
|
-
|
293
|
+
// enforce instead of check
|
294
|
+
info.objectAddress = address(0);
|
295
|
+
|
296
|
+
if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
|
297
|
+
revert UnexpectedRegisterableType(expectedType, info.objectType);
|
368
298
|
}
|
369
299
|
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
300
|
+
address owner = info.initialOwner;
|
301
|
+
|
302
|
+
if(owner == address(0)) {
|
303
|
+
revert RegisterableOwnerIsZero();
|
304
|
+
}
|
305
|
+
|
306
|
+
if(getRegistry().isRegistered(owner)) {
|
307
|
+
revert RegisterableOwnerIsRegistered();
|
377
308
|
}
|
378
309
|
|
379
310
|
// can catch all 3 if check that initialOwner is not registered
|
@@ -17,51 +17,41 @@ contract RegistryServiceManager is
|
|
17
17
|
{
|
18
18
|
bytes32 constant public ACCESS_MANAGER_CREATION_CODE_HASH = 0x0;
|
19
19
|
|
20
|
-
|
21
|
-
RegistryService private _registryService;
|
22
|
-
TokenRegistry private _tokenRegistry;
|
20
|
+
RegistryService private immutable _registryService;
|
23
21
|
|
24
22
|
/// @dev initializes proxy manager with registry service implementation and deploys registry
|
25
23
|
constructor(
|
26
|
-
address
|
27
|
-
|
24
|
+
address initialAuthority, // used by implementation
|
25
|
+
address registry) // used by implementation
|
28
26
|
ProxyManager()
|
29
27
|
{
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
require(initialAuthority > address(0));
|
29
|
+
require(registry > address(0));
|
30
|
+
|
31
|
+
// implementation's initializer func `data` argument
|
32
|
+
bytes memory initializationData = abi.encode(
|
33
|
+
initialAuthority,
|
34
|
+
registry);
|
33
35
|
|
34
36
|
IVersionable versionable = deploy(
|
35
37
|
address(new RegistryService()),
|
36
38
|
initializationData);
|
37
39
|
|
38
40
|
_registryService = RegistryService(address(versionable));
|
39
|
-
|
40
|
-
// link ownership of registry service manager ot nft owner of registry service
|
41
|
-
_linkToNftOwnable(
|
42
|
-
address(_registryService.getRegistry()),
|
43
|
-
address(_registryService));
|
44
|
-
|
45
|
-
// deploy token registry
|
46
|
-
|
47
|
-
// _tokenRegistry = new TokenRegistry(
|
48
|
-
// address(_registryService.getRegistry()),
|
49
|
-
// address(_registryService));
|
50
|
-
|
51
|
-
// implies that after this constructor call only upgrade functionality is available
|
52
|
-
_isDeployed = true;
|
53
41
|
}
|
54
42
|
|
55
|
-
|
43
|
+
// from IRegisterable
|
56
44
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
45
|
+
// IMPORTANT: registry here and in constructor MUST be the same
|
46
|
+
function linkToNftOwnable(address registry)
|
47
|
+
public
|
48
|
+
onlyOwner
|
61
49
|
{
|
62
|
-
|
50
|
+
_linkToNftOwnable(registry, address(_registryService));
|
63
51
|
}
|
64
52
|
|
53
|
+
//--- view functions ----------------------------------------------------//
|
54
|
+
|
65
55
|
function getRegistryService()
|
66
56
|
external
|
67
57
|
view
|
@@ -69,12 +59,4 @@ contract RegistryServiceManager is
|
|
69
59
|
{
|
70
60
|
return _registryService;
|
71
61
|
}
|
72
|
-
|
73
|
-
function getTokenRegistry()
|
74
|
-
external
|
75
|
-
view
|
76
|
-
returns (TokenRegistry)
|
77
|
-
{
|
78
|
-
return _tokenRegistry;
|
79
|
-
}
|
80
62
|
}
|