@etherisc/gif-next 0.0.2-aad7ee0-660 → 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 +67 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +139 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +149 -15
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +101 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- 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 +181 -16
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +157 -56
- 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} +74 -3
- 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 +1373 -93
- 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 +195 -155
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +57 -47
- 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 +177 -38
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +378 -67
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +145 -17
- 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 +49 -9
- 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 +90 -36
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +20 -20
- 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 +4 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +705 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +428 -0
- 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 +197 -68
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +187 -83
- 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 +197 -182
- 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 +31 -97
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +38 -91
- 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 +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +397 -0
- 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/ERC165.sol/ERC165.json +2 -2
- 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 +4 -4
- 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/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- 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/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
- 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/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
- package/contracts/components/BaseComponent.sol +57 -11
- package/contracts/components/Distribution.sol +15 -18
- package/contracts/components/IBaseComponent.sol +7 -0
- package/contracts/components/IDistributionComponent.sol +1 -0
- package/contracts/components/IPoolComponent.sol +5 -1
- package/contracts/components/Pool.sol +43 -31
- package/contracts/components/Product.sol +42 -47
- 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 +34 -7
- package/contracts/instance/IInstanceBase.sol +26 -0
- package/contracts/instance/IInstanceService.sol +7 -3
- package/contracts/instance/Instance.sol +54 -32
- package/contracts/instance/InstanceAccessManager.sol +6 -6
- package/contracts/instance/InstanceBase.sol +41 -0
- package/contracts/instance/InstanceReader.sol +26 -1
- package/contracts/instance/InstanceService.sol +229 -68
- package/contracts/instance/InstanceServiceManager.sol +8 -6
- package/contracts/instance/ObjectManager.sol +101 -0
- package/contracts/instance/base/ComponentServiceBase.sol +45 -12
- package/contracts/instance/module/IBundle.sol +1 -0
- package/contracts/instance/module/ISetup.sol +3 -0
- 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 +53 -12
- 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 +122 -0
- package/contracts/instance/service/PoolServiceManager.sol +55 -0
- 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 +25 -6
- package/contracts/registry/IRegistryService.sol +36 -13
- package/contracts/registry/Registry.sol +165 -203
- package/contracts/registry/RegistryAccessManager.sol +207 -0
- package/contracts/registry/RegistryService.sol +83 -197
- package/contracts/registry/RegistryServiceManager.sol +20 -22
- package/contracts/registry/ReleaseManager.sol +382 -0
- package/contracts/registry/TokenRegistry.sol +110 -0
- package/contracts/shared/ERC165.sol +6 -2
- package/contracts/shared/IService.sol +2 -1
- package/contracts/shared/NftOwnable.sol +2 -4
- package/contracts/shared/ProxyManager.sol +1 -1
- package/contracts/shared/Registerable.sol +1 -0
- 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 +14 -5
- package/contracts/types/Version.sol +4 -1
- 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 -122
- package/contracts/instance/AccessManagerSimple.sol +0 -692
@@ -9,6 +9,7 @@ import {Registry} from "./Registry.sol";
|
|
9
9
|
import {IVersionable} from "../shared/IVersionable.sol";
|
10
10
|
import {ProxyManager} from "../shared/ProxyManager.sol";
|
11
11
|
import {RegistryService} from "./RegistryService.sol";
|
12
|
+
import {TokenRegistry} from "./TokenRegistry.sol";
|
12
13
|
|
13
14
|
|
14
15
|
contract RegistryServiceManager is
|
@@ -16,36 +17,41 @@ contract RegistryServiceManager is
|
|
16
17
|
{
|
17
18
|
bytes32 constant public ACCESS_MANAGER_CREATION_CODE_HASH = 0x0;
|
18
19
|
|
19
|
-
RegistryService private _registryService;
|
20
|
-
|
21
|
-
AccessManager private _accessManager;
|
20
|
+
RegistryService private immutable _registryService;
|
22
21
|
|
23
22
|
/// @dev initializes proxy manager with registry service implementation and deploys registry
|
24
23
|
constructor(
|
25
|
-
address
|
26
|
-
|
24
|
+
address initialAuthority, // used by implementation
|
25
|
+
address registry) // used by implementation
|
27
26
|
ProxyManager()
|
28
27
|
{
|
29
|
-
|
30
|
-
|
31
|
-
|
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);
|
32
35
|
|
33
36
|
IVersionable versionable = deploy(
|
34
37
|
address(new RegistryService()),
|
35
38
|
initializationData);
|
36
39
|
|
37
40
|
_registryService = RegistryService(address(versionable));
|
41
|
+
}
|
38
42
|
|
39
|
-
|
40
|
-
_linkToNftOwnable(
|
41
|
-
address(_registryService.getRegistry()),
|
42
|
-
address(_registryService));
|
43
|
+
// from IRegisterable
|
43
44
|
|
44
|
-
|
45
|
-
|
45
|
+
// IMPORTANT: registry here and in constructor MUST be the same
|
46
|
+
function linkToNftOwnable(address registry)
|
47
|
+
public
|
48
|
+
onlyOwner
|
49
|
+
{
|
50
|
+
_linkToNftOwnable(registry, address(_registryService));
|
46
51
|
}
|
47
52
|
|
48
53
|
//--- view functions ----------------------------------------------------//
|
54
|
+
|
49
55
|
function getRegistryService()
|
50
56
|
external
|
51
57
|
view
|
@@ -53,12 +59,4 @@ contract RegistryServiceManager is
|
|
53
59
|
{
|
54
60
|
return _registryService;
|
55
61
|
}
|
56
|
-
|
57
|
-
function getAccessManager()
|
58
|
-
external
|
59
|
-
view
|
60
|
-
returns (AccessManager)
|
61
|
-
{
|
62
|
-
return _accessManager;
|
63
|
-
}
|
64
62
|
}
|
@@ -0,0 +1,382 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {AccessManaged} from "@openzeppelin/contracts/access/manager/AccessManaged.sol";
|
5
|
+
import {AccessManager} from "@openzeppelin/contracts/access/manager/AccessManager.sol";
|
6
|
+
|
7
|
+
import {NftId} from "../types/NftId.sol";
|
8
|
+
import {RoleId} from "../types/RoleId.sol";
|
9
|
+
import {ObjectType, zeroObjectType, SERVICE} from "../types/ObjectType.sol";
|
10
|
+
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
11
|
+
|
12
|
+
import {IVersionable} from "../shared/IVersionable.sol";
|
13
|
+
import {IService} from "../shared/IService.sol";
|
14
|
+
import {ProxyManager} from "../shared/ProxyManager.sol";
|
15
|
+
|
16
|
+
import {IRegistry} from "./IRegistry.sol";
|
17
|
+
import {Registry} from "./Registry.sol";
|
18
|
+
import {IRegistryService} from "./IRegistryService.sol";
|
19
|
+
import {RegistryService} from "./RegistryService.sol";
|
20
|
+
import {RegistryServiceManager} from "./RegistryServiceManager.sol";
|
21
|
+
import {RegistryAccessManager} from "./RegistryAccessManager.sol";
|
22
|
+
|
23
|
+
|
24
|
+
contract ReleaseManager is AccessManaged
|
25
|
+
{
|
26
|
+
event LogReleaseCreation(VersionPart version, IService registryService);
|
27
|
+
event LogServiceRegistration(VersionPart majorVersion, ObjectType serviceDomain);
|
28
|
+
event LogReleaseActivation(VersionPart version);
|
29
|
+
|
30
|
+
// createNextRelease
|
31
|
+
error NotRegistryService();
|
32
|
+
error UnexpectedServiceAuthority(address expected, address found);
|
33
|
+
|
34
|
+
// registerService
|
35
|
+
error NotService();
|
36
|
+
error ServiceNotInRelease(IService service, ObjectType serviceDomain);
|
37
|
+
error ServiceAlreadyRegistered(address service);
|
38
|
+
|
39
|
+
// activateNextRelease
|
40
|
+
//error ReleaseNotCreated();
|
41
|
+
//error ReleaseRegistrationNotFinished();
|
42
|
+
|
43
|
+
// _getAndVerifyContractInfo
|
44
|
+
error UnexpectedRegisterableType(ObjectType expected, ObjectType found);
|
45
|
+
error NotRegisterableOwner(address expectedOwner);
|
46
|
+
error SelfRegistration();
|
47
|
+
error RegisterableOwnerIsRegistered();
|
48
|
+
|
49
|
+
// _verifyServiceInfo
|
50
|
+
error UnexpectedServiceVersion(VersionPart expected, VersionPart found);
|
51
|
+
error UnexpectedServiceDomain(ObjectType expected, ObjectType found);
|
52
|
+
|
53
|
+
// _verifyAndStoreConfig
|
54
|
+
error ConfigMissing();
|
55
|
+
error ConfigServiceDomainInvalid();
|
56
|
+
error ConfigSelectorMissing();
|
57
|
+
error ConfigSelectorZero();
|
58
|
+
error ConfigSelectorAlreadyExists(VersionPart serviceVersion, ObjectType serviceDomain);
|
59
|
+
|
60
|
+
struct ReleaseInfo {
|
61
|
+
ObjectType[] types; // service types in release
|
62
|
+
}
|
63
|
+
|
64
|
+
// unique role for some service function
|
65
|
+
struct ConfigInfo {
|
66
|
+
bytes4[] selector; // selector used by service
|
67
|
+
RoleId roleId; // roleId granted to service
|
68
|
+
}
|
69
|
+
|
70
|
+
RegistryAccessManager private immutable _accessManager;
|
71
|
+
IRegistry private immutable _registry;
|
72
|
+
|
73
|
+
VersionPart _latest;// latest active version
|
74
|
+
VersionPart immutable _initial;// first active version
|
75
|
+
|
76
|
+
mapping(VersionPart version => ReleaseInfo info) _release;
|
77
|
+
|
78
|
+
mapping(VersionPart version => mapping(ObjectType serviceDomain => ConfigInfo)) _config;
|
79
|
+
|
80
|
+
mapping(VersionPart version => mapping(ObjectType serviceDomain => address)) _service;
|
81
|
+
|
82
|
+
uint _awaitingRegistration; // "services left to register" counter
|
83
|
+
|
84
|
+
mapping(address registryService => bool isActive) _active;
|
85
|
+
|
86
|
+
constructor(
|
87
|
+
RegistryAccessManager accessManager,
|
88
|
+
VersionPart initialVersion)
|
89
|
+
AccessManaged(accessManager.authority())
|
90
|
+
{
|
91
|
+
require(address(accessManager) > address(0));
|
92
|
+
require(initialVersion.toInt() > 0);
|
93
|
+
|
94
|
+
_accessManager = accessManager;
|
95
|
+
|
96
|
+
_initial = initialVersion;
|
97
|
+
|
98
|
+
_registry = new Registry(address(this), initialVersion);
|
99
|
+
}
|
100
|
+
|
101
|
+
// TODO deploy proxy and initialize with given implementation instead of using given proxy?
|
102
|
+
// IMPORTANT: MUST never be possible to create with access/release manager, token registry
|
103
|
+
function createNextRelease(IRegistryService registryService)
|
104
|
+
external
|
105
|
+
restricted // GIF_ADMIN_ROLE
|
106
|
+
returns(NftId nftId)
|
107
|
+
{
|
108
|
+
if(!registryService.supportsInterface(type(IRegistryService).interfaceId)) {
|
109
|
+
revert NotRegistryService();
|
110
|
+
}
|
111
|
+
// TODO unreliable! MUST guarantee the same authority -> how?
|
112
|
+
if(registryService.authority() != authority()) {
|
113
|
+
revert UnexpectedServiceAuthority(
|
114
|
+
authority(),
|
115
|
+
registryService.authority());
|
116
|
+
}
|
117
|
+
|
118
|
+
(
|
119
|
+
IRegistry.ObjectInfo memory info,
|
120
|
+
bytes memory data
|
121
|
+
) = _getAndVerifyContractInfo(registryService, SERVICE(), msg.sender);
|
122
|
+
|
123
|
+
VersionPart nextVersion = getNextVersion();
|
124
|
+
_verifyServiceInfo(info, nextVersion, SERVICE());
|
125
|
+
|
126
|
+
_verifyAndStoreConfig(data);
|
127
|
+
|
128
|
+
//setTargetClosed(newRegistryService, true);
|
129
|
+
|
130
|
+
_registerService(address(registryService), nextVersion, SERVICE());
|
131
|
+
|
132
|
+
nftId = _registry.registerService(info);
|
133
|
+
|
134
|
+
// external call
|
135
|
+
registryService.linkToRegisteredNftId();
|
136
|
+
|
137
|
+
emit LogReleaseCreation(nextVersion, registryService);
|
138
|
+
}
|
139
|
+
|
140
|
+
function registerService(IService service)
|
141
|
+
external
|
142
|
+
restricted // GIF_MANAGER_ROLE
|
143
|
+
returns(NftId nftId)
|
144
|
+
{
|
145
|
+
if(!service.supportsInterface(type(IService).interfaceId)) {
|
146
|
+
revert NotService();
|
147
|
+
}
|
148
|
+
|
149
|
+
(
|
150
|
+
IRegistry.ObjectInfo memory info,
|
151
|
+
//bytes memory data
|
152
|
+
) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
153
|
+
|
154
|
+
VersionPart nextVersion = getNextVersion();
|
155
|
+
ObjectType serviceDomain = _verifyServiceInfo(info, nextVersion, zeroObjectType());
|
156
|
+
|
157
|
+
bytes4[] memory selector = _config[nextVersion][serviceDomain].selector;
|
158
|
+
|
159
|
+
// service type is in release
|
160
|
+
if(selector.length == 0) {
|
161
|
+
revert ServiceNotInRelease(service, serviceDomain);
|
162
|
+
}
|
163
|
+
|
164
|
+
// setup and grant unique role
|
165
|
+
address registryService = getService(nextVersion, SERVICE());
|
166
|
+
RoleId roleId = _accessManager.setAndGrantUniqueRole(
|
167
|
+
address(service),
|
168
|
+
registryService,
|
169
|
+
selector);
|
170
|
+
|
171
|
+
_config[nextVersion][serviceDomain].roleId = roleId;
|
172
|
+
_awaitingRegistration--;
|
173
|
+
|
174
|
+
// activate release
|
175
|
+
if(_awaitingRegistration == 0) {
|
176
|
+
_latest = nextVersion;
|
177
|
+
_active[registryService] = true;
|
178
|
+
|
179
|
+
emit LogReleaseActivation(nextVersion);
|
180
|
+
}
|
181
|
+
|
182
|
+
_registerService(address(service), nextVersion, serviceDomain);
|
183
|
+
|
184
|
+
nftId = _registry.registerService(info);
|
185
|
+
|
186
|
+
// external call
|
187
|
+
service.linkToRegisteredNftId();
|
188
|
+
}
|
189
|
+
|
190
|
+
/*function activateNextRelease()
|
191
|
+
external
|
192
|
+
restricted // GIF_ADMIN_ROLE
|
193
|
+
{
|
194
|
+
VersionPart nextVersion = getNextVersion();
|
195
|
+
address service = _service[nextVersion][SERVICE()];
|
196
|
+
|
197
|
+
// release was created
|
198
|
+
if(service == address(0)) {
|
199
|
+
revert ReleaseNotCreated();
|
200
|
+
}
|
201
|
+
|
202
|
+
// release fully deployed
|
203
|
+
if(_awaitingRegistration > 0) {
|
204
|
+
revert ReleaseRegistrationNotFinished();
|
205
|
+
}
|
206
|
+
|
207
|
+
//setTargetClosed(newRegistryService, false);
|
208
|
+
|
209
|
+
_latest = nextVersion;
|
210
|
+
_active[service] = true;
|
211
|
+
|
212
|
+
LogReleaseActivation(nextVersion);
|
213
|
+
}*/
|
214
|
+
|
215
|
+
//--- view functions ----------------------------------------------------//
|
216
|
+
|
217
|
+
function isActiveRegistryService(address service) external view returns(bool)
|
218
|
+
{
|
219
|
+
return _active[service];
|
220
|
+
}
|
221
|
+
|
222
|
+
function getRegistry() external view returns(address)
|
223
|
+
{
|
224
|
+
return (address(_registry));
|
225
|
+
}
|
226
|
+
|
227
|
+
function getService(VersionPart serviceVersion, ObjectType serviceDomain) public view returns(address)
|
228
|
+
{
|
229
|
+
return _service[serviceVersion][serviceDomain];
|
230
|
+
}
|
231
|
+
|
232
|
+
function getReleaseInfo(VersionPart releaseVersion) external view returns(ReleaseInfo memory)
|
233
|
+
{
|
234
|
+
return _release[releaseVersion];
|
235
|
+
}
|
236
|
+
|
237
|
+
function getNextVersion() public view returns(VersionPart)
|
238
|
+
{
|
239
|
+
uint256 latest = _latest.toInt();
|
240
|
+
|
241
|
+
return latest == 0 ?
|
242
|
+
_initial : // no active releases yet
|
243
|
+
VersionPartLib.toVersionPart(latest + 1);
|
244
|
+
}
|
245
|
+
|
246
|
+
function getLatestVersion() external view returns(VersionPart) {
|
247
|
+
return _latest;
|
248
|
+
}
|
249
|
+
|
250
|
+
function getInitialVersion() external view returns(VersionPart) {
|
251
|
+
return _initial;
|
252
|
+
}
|
253
|
+
|
254
|
+
//--- private functions ----------------------------------------------------//
|
255
|
+
|
256
|
+
function _registerService(address service, VersionPart version, ObjectType serviceDomain)
|
257
|
+
internal
|
258
|
+
{
|
259
|
+
if(_service[version][serviceDomain] > address(0)) {
|
260
|
+
revert ServiceAlreadyRegistered(service);
|
261
|
+
}
|
262
|
+
|
263
|
+
_service[version][serviceDomain] = service;
|
264
|
+
|
265
|
+
emit LogServiceRegistration(version, serviceDomain);
|
266
|
+
}
|
267
|
+
|
268
|
+
function _getAndVerifyContractInfo(
|
269
|
+
IService service,
|
270
|
+
ObjectType expectedType,
|
271
|
+
address expectedOwner // assume always valid, can not be 0
|
272
|
+
)
|
273
|
+
internal
|
274
|
+
view
|
275
|
+
returns(
|
276
|
+
IRegistry.ObjectInfo memory info,
|
277
|
+
bytes memory data
|
278
|
+
)
|
279
|
+
{
|
280
|
+
(info, data) = service.getInitialInfo();
|
281
|
+
info.objectAddress = address(service);
|
282
|
+
info.isInterceptor = false; // service is never interceptor, at least now
|
283
|
+
|
284
|
+
if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
|
285
|
+
revert UnexpectedRegisterableType(expectedType, info.objectType);
|
286
|
+
}
|
287
|
+
|
288
|
+
address owner = info.initialOwner;
|
289
|
+
|
290
|
+
if(owner != expectedOwner) { // registerable owner protection
|
291
|
+
revert NotRegisterableOwner(expectedOwner);
|
292
|
+
}
|
293
|
+
|
294
|
+
if(owner == address(service)) {
|
295
|
+
revert SelfRegistration();
|
296
|
+
}
|
297
|
+
|
298
|
+
/*if(owner == address(0)) { // never 0
|
299
|
+
revert();// RegisterableOwnerIsZero();
|
300
|
+
}*/
|
301
|
+
|
302
|
+
if(_registry.isRegistered(owner)) {
|
303
|
+
revert RegisterableOwnerIsRegistered();
|
304
|
+
}
|
305
|
+
|
306
|
+
/*NftId parentNftId = info.parentNftId;
|
307
|
+
IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
|
308
|
+
|
309
|
+
if(parentInfo.objectType != parentType) { // parent registration + type
|
310
|
+
revert InvalidParent(parentNftId);
|
311
|
+
}*/
|
312
|
+
|
313
|
+
return(info, data);
|
314
|
+
}
|
315
|
+
|
316
|
+
function _verifyServiceInfo(
|
317
|
+
IRegistry.ObjectInfo memory info,
|
318
|
+
VersionPart expectedVersion,
|
319
|
+
ObjectType expectedType
|
320
|
+
)
|
321
|
+
internal
|
322
|
+
view
|
323
|
+
returns(ObjectType)
|
324
|
+
{
|
325
|
+
(
|
326
|
+
ObjectType serviceDomain,
|
327
|
+
VersionPart serviceVersion
|
328
|
+
) = abi.decode(info.data, (ObjectType, VersionPart));
|
329
|
+
|
330
|
+
if(serviceVersion != expectedVersion) {
|
331
|
+
revert UnexpectedServiceVersion(expectedVersion, serviceVersion);
|
332
|
+
}
|
333
|
+
|
334
|
+
if(expectedType != zeroObjectType()) {
|
335
|
+
if(serviceDomain != expectedType) {
|
336
|
+
revert UnexpectedServiceDomain(expectedType, serviceDomain);
|
337
|
+
}
|
338
|
+
}
|
339
|
+
|
340
|
+
return serviceDomain;
|
341
|
+
}
|
342
|
+
|
343
|
+
function _verifyAndStoreConfig(bytes memory configBytes)
|
344
|
+
internal
|
345
|
+
{
|
346
|
+
VersionPart nextVersion = getNextVersion();
|
347
|
+
IRegistryService.FunctionConfig[] memory config = abi.decode(configBytes, (IRegistryService.FunctionConfig[]));
|
348
|
+
|
349
|
+
if(config.length == 0) {
|
350
|
+
revert ConfigMissing();
|
351
|
+
}
|
352
|
+
// always in release
|
353
|
+
_release[nextVersion].types.push(SERVICE());
|
354
|
+
|
355
|
+
for(uint idx = 0; idx < config.length; idx++)
|
356
|
+
{
|
357
|
+
ObjectType serviceDomain = config[idx].serviceDomain;
|
358
|
+
bytes4[] memory selector = config[idx].selector;
|
359
|
+
|
360
|
+
// not "registry service" type
|
361
|
+
if(serviceDomain == SERVICE()) { revert ConfigServiceDomainInvalid(); }
|
362
|
+
|
363
|
+
// at least one selector exists
|
364
|
+
if(selector.length == 0) { revert ConfigSelectorMissing(); }
|
365
|
+
|
366
|
+
// no zero selectors
|
367
|
+
for(uint jdx = 0; jdx < selector.length; jdx++) {
|
368
|
+
if(selector[jdx] == 0) { revert ConfigSelectorZero(); }
|
369
|
+
}
|
370
|
+
|
371
|
+
// no overwrite
|
372
|
+
if(_config[nextVersion][serviceDomain].selector.length > 0) {
|
373
|
+
revert ConfigSelectorAlreadyExists(nextVersion, serviceDomain);
|
374
|
+
}
|
375
|
+
|
376
|
+
_config[nextVersion][serviceDomain].selector = selector;
|
377
|
+
_release[nextVersion].types.push(serviceDomain);
|
378
|
+
}
|
379
|
+
|
380
|
+
_awaitingRegistration = config.length;
|
381
|
+
}
|
382
|
+
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
|
6
|
+
|
7
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
8
|
+
import {IRegistry} from "./IRegistry.sol";
|
9
|
+
import {VersionPart} from "../types/Version.sol";
|
10
|
+
import {SERVICE} from "../types/ObjectType.sol";
|
11
|
+
import {NftOwnable} from "../shared/NftOwnable.sol";
|
12
|
+
|
13
|
+
/// @title contract to register token per GIF major release.
|
14
|
+
contract TokenRegistry is
|
15
|
+
NftOwnable
|
16
|
+
{
|
17
|
+
event LogRegistered(address token, string symbol, uint256 decimals);
|
18
|
+
event LogTokenStateSet(address token, VersionPart majorVersion, bool active);
|
19
|
+
|
20
|
+
error NotContract(address account);
|
21
|
+
error NotToken(address account);
|
22
|
+
error TokenDecimalsZero();
|
23
|
+
error TokenMajorVersionInvalid(VersionPart majorVersion);
|
24
|
+
|
25
|
+
address [] internal _token;
|
26
|
+
mapping(address token => bool registered) internal _registered;
|
27
|
+
mapping(address token => mapping(VersionPart majorVersion => bool isActive)) internal _active;
|
28
|
+
|
29
|
+
constructor()
|
30
|
+
NftOwnable()
|
31
|
+
{ }
|
32
|
+
|
33
|
+
|
34
|
+
/// @dev link ownership of token registry to nft owner of registry service
|
35
|
+
function linkToNftOwnable(address registryAddress)
|
36
|
+
external
|
37
|
+
onlyOwner
|
38
|
+
{
|
39
|
+
IRegistry registry = IRegistry(registryAddress);
|
40
|
+
// TODO use _latest instead of `next version` -> but _latest is 0 before first release activation
|
41
|
+
address registryServiceAddress = registry.getServiceAddress(SERVICE(), registry.getMajorVersionMax());
|
42
|
+
|
43
|
+
_linkToNftOwnable(registryAddress, registryServiceAddress);
|
44
|
+
}
|
45
|
+
|
46
|
+
/// @dev token state is informative, registry have no clue about used tokens
|
47
|
+
// component owner is responsible for token selection and operations
|
48
|
+
// service MUST deny registration of component with inactive token
|
49
|
+
function setActive(address token, VersionPart majorVersion, bool active)
|
50
|
+
external
|
51
|
+
onlyOwner
|
52
|
+
{
|
53
|
+
// verify that token is registered
|
54
|
+
if (!_registered[token]) {
|
55
|
+
_registerToken(token);
|
56
|
+
}
|
57
|
+
|
58
|
+
// verify valid major version
|
59
|
+
// ensure major version increments is one
|
60
|
+
uint256 version = majorVersion.toInt();
|
61
|
+
if (version < _registry.getMajorVersionMin().toInt() || version > _registry.getMajorVersionMax().toInt()) {
|
62
|
+
revert TokenMajorVersionInvalid(majorVersion);
|
63
|
+
}
|
64
|
+
|
65
|
+
_active[token][majorVersion] = active;
|
66
|
+
|
67
|
+
emit LogTokenStateSet(token, majorVersion, active);
|
68
|
+
}
|
69
|
+
|
70
|
+
function tokens() external view returns (uint256) {
|
71
|
+
return _token.length;
|
72
|
+
}
|
73
|
+
|
74
|
+
function getToken(uint256 idx) external view returns (IERC20Metadata token) {
|
75
|
+
return IERC20Metadata(_token[idx]);
|
76
|
+
}
|
77
|
+
|
78
|
+
function isRegistered(address token) external view returns (bool) {
|
79
|
+
return _registered[token];
|
80
|
+
}
|
81
|
+
|
82
|
+
function isActive(address token, VersionPart majorVersion) external view returns (bool) {
|
83
|
+
return _active[token][majorVersion];
|
84
|
+
}
|
85
|
+
|
86
|
+
/// @dev some sanity checks to prevent unintended registration
|
87
|
+
function _registerToken(address token) internal {
|
88
|
+
|
89
|
+
// MUST be contract
|
90
|
+
if(token.code.length == 0) {
|
91
|
+
revert NotContract(token);
|
92
|
+
}
|
93
|
+
|
94
|
+
// MUST not be GIF registerable
|
95
|
+
if(ERC165Checker.supportsInterface(token, type(IRegisterable).interfaceId)) {
|
96
|
+
revert NotToken(token);
|
97
|
+
}
|
98
|
+
|
99
|
+
// MUST have decimals > 0
|
100
|
+
IERC20Metadata erc20 = IERC20Metadata(token);
|
101
|
+
if(erc20.decimals() == 0) {
|
102
|
+
revert TokenDecimalsZero();
|
103
|
+
}
|
104
|
+
|
105
|
+
_registered[token] = true;
|
106
|
+
_token.push(token);
|
107
|
+
|
108
|
+
emit LogRegistered(token, erc20.symbol(), erc20.decimals());
|
109
|
+
}
|
110
|
+
}
|
@@ -7,14 +7,18 @@ contract ERC165 is IERC165 {
|
|
7
7
|
mapping(bytes4 => bool) private _isSupported;
|
8
8
|
|
9
9
|
constructor() {
|
10
|
-
|
11
|
-
_registerInterface(type(IERC165).interfaceId);
|
10
|
+
_initializeERC165();
|
12
11
|
}
|
13
12
|
|
14
13
|
function supportsInterface(bytes4 interfaceId) external view override returns (bool) {
|
15
14
|
return _isSupported[interfaceId];
|
16
15
|
}
|
17
16
|
|
17
|
+
// @dev register support for ERC165 itself
|
18
|
+
function _initializeERC165() internal {
|
19
|
+
_isSupported[type(IERC165).interfaceId] = true;
|
20
|
+
}
|
21
|
+
|
18
22
|
function _registerInterface(bytes4 interfaceId) internal {
|
19
23
|
_isSupported[interfaceId] = true;
|
20
24
|
}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {VersionPart} from "../types/Version.sol";
|
5
|
+
import {ObjectType} from "../types/ObjectType.sol";
|
5
6
|
|
6
7
|
import {IRegisterable} from "./IRegisterable.sol";
|
7
8
|
import {IVersionable} from "./IVersionable.sol";
|
@@ -10,6 +11,6 @@ interface IService is
|
|
10
11
|
IRegisterable,
|
11
12
|
IVersionable
|
12
13
|
{
|
13
|
-
function
|
14
|
+
function getDomain() external pure returns(ObjectType serviceDomain);
|
14
15
|
function getMajorVersion() external view returns(VersionPart majorVersion);
|
15
16
|
}
|
@@ -13,10 +13,7 @@ contract NftOwnable is INftOwnable {
|
|
13
13
|
|
14
14
|
/// @dev enforces msg.sender is owner of nft (or initial owner of nft ownable)
|
15
15
|
modifier onlyOwner() {
|
16
|
-
|
17
|
-
|
18
|
-
// owner == address(0) is eg uninitialized upgradable contract
|
19
|
-
if (owner != address(0) && msg.sender != owner) {
|
16
|
+
if (msg.sender != getOwner()) {
|
20
17
|
revert ErrorNotOwner(msg.sender);
|
21
18
|
}
|
22
19
|
_;
|
@@ -77,6 +74,7 @@ contract NftOwnable is INftOwnable {
|
|
77
74
|
internal
|
78
75
|
virtual
|
79
76
|
{
|
77
|
+
require(initialOwner > address(0), "NftOwnable: initial owner is 0");
|
80
78
|
_initialOwner = initialOwner;
|
81
79
|
_setRegistry(registryAddress);
|
82
80
|
}
|
@@ -38,6 +38,7 @@ contract ProxyManager is
|
|
38
38
|
returns (IVersionable versionable)
|
39
39
|
{
|
40
40
|
if (_isDeployed) { revert ErrorAlreadyDeployed(); }
|
41
|
+
_isDeployed = true;
|
41
42
|
|
42
43
|
address currentProxyOwner = getOwner(); // used by implementation
|
43
44
|
address initialProxyAdminOwner = address(this); // used by proxy
|
@@ -49,7 +50,6 @@ contract ProxyManager is
|
|
49
50
|
data
|
50
51
|
);
|
51
52
|
|
52
|
-
_isDeployed = true;
|
53
53
|
versionable = IVersionable(address(_proxy));
|
54
54
|
|
55
55
|
emit LogProxyDeployed(address(_proxy), initialImplementation);
|
@@ -1,21 +1,24 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {
|
5
|
-
import {IService} from "./IService.sol";
|
6
|
-
import {IVersionable} from "./IVersionable.sol";
|
4
|
+
import {ObjectType, SERVICE} from "../types/ObjectType.sol";
|
7
5
|
import {NftId, zeroNftId} from "../types/NftId.sol";
|
8
|
-
import {RegisterableUpgradable} from "./RegisterableUpgradable.sol";
|
9
|
-
import {SERVICE} from "../types/ObjectType.sol";
|
10
6
|
import {Version, VersionPart, VersionLib} from "../types/Version.sol";
|
7
|
+
|
11
8
|
import {Versionable} from "./Versionable.sol";
|
9
|
+
import {IService} from "./IService.sol";
|
10
|
+
import {IVersionable} from "./IVersionable.sol";
|
11
|
+
import {RegisterableUpgradable} from "./RegisterableUpgradable.sol";
|
12
|
+
|
13
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
14
|
+
|
12
15
|
|
13
16
|
/// @dev service base contract
|
14
17
|
abstract contract Service is
|
15
18
|
RegisterableUpgradable,
|
16
19
|
IService
|
17
20
|
{
|
18
|
-
function
|
21
|
+
function getDomain() public pure virtual override returns(ObjectType);
|
19
22
|
|
20
23
|
function getMajorVersion() public view virtual override returns(VersionPart majorVersion) {
|
21
24
|
return getVersion().toMajorPart();
|
@@ -36,10 +39,11 @@ abstract contract Service is
|
|
36
39
|
address initialOwner
|
37
40
|
)
|
38
41
|
internal
|
42
|
+
virtual
|
39
43
|
//onlyInitializing //TODO uncomment when "fully" upgradeable
|
40
44
|
{
|
41
45
|
// service must provide its name and version upon registration
|
42
|
-
bytes memory data = abi.encode(
|
46
|
+
bytes memory data = abi.encode(getDomain(), getMajorVersion());
|
43
47
|
NftId registryNftId = _getRegistryNftId(registry);
|
44
48
|
bool isInterceptor = false;
|
45
49
|
|