@etherisc/gif-next 0.0.2-2a0a7d0-893 → 0.0.2-2a59cd5-352
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 +73 -1
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +405 -6
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +883 -141
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +113 -6
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +798 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +662 -43
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +656 -0
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +583 -75
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +504 -5
- 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/Dummy.sol/LifeCycleModule.json +2 -2
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +450 -35
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +111 -7
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +589 -223
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +39 -89
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +58 -53
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +400 -96
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +175 -25
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +166 -7
- 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/KeyValueStore.sol/KeyValueStore.json +2 -2
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +13 -13
- 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/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +1117 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +290 -66
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +169 -19
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +439 -27
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +194 -16
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +638 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +118 -40
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +217 -7
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +33 -20
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +20 -7
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +20 -7
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +223 -64
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +182 -32
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +186 -27
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +166 -16
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +186 -27
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +166 -16
- 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 +15 -2
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +100 -26
- 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 +28 -15
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +260 -40
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +166 -16
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +11 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +160 -10
- 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 +41 -3
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +37 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +18 -5
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +69 -0
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +20 -7
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -2
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +156 -11
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +269 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +156 -6
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +152 -11
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +105 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +166 -7
- 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/shared/Versionable.sol/Versionable.json +2 -2
- 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 +152 -11
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +184 -25
- 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/TestVersionable.sol/TestVersionable.json +8 -8
- 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/DistributorType.sol/DistributorTypeLib.json +2 -2
- 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/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- 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/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Component.sol +121 -62
- package/contracts/components/Distribution.sol +207 -53
- package/contracts/components/IComponent.sol +16 -3
- package/contracts/components/IDistributionComponent.sol +59 -3
- package/contracts/components/IPoolComponent.sol +50 -29
- package/contracts/components/IProductComponent.sol +5 -1
- package/contracts/components/Pool.sol +133 -137
- package/contracts/components/Product.sol +90 -107
- package/contracts/instance/IInstance.sol +26 -6
- package/contracts/instance/IInstanceService.sol +19 -0
- package/contracts/instance/Instance.sol +58 -30
- package/contracts/instance/InstanceAccessManager.sol +12 -13
- package/contracts/instance/InstanceService.sol +119 -39
- package/contracts/instance/base/ComponentService.sol +3 -2
- package/contracts/instance/module/IAccess.sol +3 -4
- package/contracts/instance/module/ISetup.sol +5 -4
- package/contracts/instance/service/ApplicationService.sol +268 -0
- package/contracts/instance/service/BundleService.sol +11 -6
- package/contracts/instance/service/DistributionService.sol +197 -30
- package/contracts/instance/service/IApplicationService.sol +82 -0
- package/contracts/instance/service/IBundleService.sol +11 -1
- package/contracts/instance/service/IDistributionService.sol +53 -0
- package/contracts/instance/service/IPolicyService.sol +10 -16
- package/contracts/instance/service/PolicyService.sol +84 -98
- package/contracts/instance/service/PoolService.sol +9 -42
- package/contracts/instance/service/ProductService.sol +20 -28
- package/contracts/registry/IRegistry.sol +3 -2
- package/contracts/registry/IRegistryService.sol +16 -6
- package/contracts/registry/Registry.sol +20 -8
- package/contracts/registry/RegistryService.sol +50 -85
- package/contracts/registry/ReleaseManager.sol +19 -40
- package/contracts/registry/TokenRegistry.sol +4 -3
- package/contracts/shared/ERC165.sol +12 -11
- package/contracts/shared/INftOwnable.sol +12 -6
- package/contracts/shared/IPolicyHolder.sol +26 -0
- package/contracts/shared/IRegisterable.sol +4 -4
- package/contracts/shared/IRegistryLinked.sol +15 -0
- package/contracts/shared/IVersionable.sol +2 -2
- package/contracts/shared/NftOwnable.sol +113 -59
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +5 -4
- package/contracts/shared/Registerable.sol +15 -24
- package/contracts/shared/RegistryLinked.sol +64 -0
- package/contracts/shared/Service.sol +5 -5
- package/contracts/shared/Versionable.sol +3 -2
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/DistributorType.sol +2 -2
- package/contracts/types/ObjectType.sol +6 -2
- package/package.json +3 -3
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -100
- package/contracts/instance/base/IInstanceBase.sol +0 -21
|
@@ -60,11 +60,11 @@ contract ProductService is ComponentService, IProductService {
|
|
|
60
60
|
address initialOwner;
|
|
61
61
|
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
initializeService(registryAddress, owner);
|
|
64
64
|
|
|
65
|
-
_poolService = IPoolService(
|
|
65
|
+
_poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getMajorVersion()));
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
registerInterface(type(IProductService).interfaceId);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
|
|
@@ -73,7 +73,7 @@ contract ProductService is ComponentService, IProductService {
|
|
|
73
73
|
returns(NftId productNftId)
|
|
74
74
|
{
|
|
75
75
|
(
|
|
76
|
-
IComponent
|
|
76
|
+
IComponent component,
|
|
77
77
|
address owner,
|
|
78
78
|
IInstance instance,
|
|
79
79
|
NftId instanceNftId
|
|
@@ -82,37 +82,28 @@ contract ProductService is ComponentService, IProductService {
|
|
|
82
82
|
PRODUCT(),
|
|
83
83
|
PRODUCT_OWNER_ROLE());
|
|
84
84
|
|
|
85
|
-
(
|
|
86
|
-
|
|
87
|
-
bytes memory data
|
|
88
|
-
) = getRegistryService().registerProduct(product, owner);
|
|
89
|
-
|
|
85
|
+
IProductComponent product = IProductComponent(productAddress);
|
|
86
|
+
IRegistry.ObjectInfo memory productInfo = getRegistryService().registerProduct(product, owner);
|
|
90
87
|
productNftId = productInfo.nftId;
|
|
91
88
|
_createProductSetup(
|
|
92
89
|
instance,
|
|
93
90
|
product,
|
|
94
|
-
productNftId
|
|
95
|
-
data);
|
|
91
|
+
productNftId);
|
|
96
92
|
}
|
|
97
93
|
|
|
98
94
|
|
|
99
95
|
function _createProductSetup(
|
|
100
96
|
IInstance instance,
|
|
101
|
-
|
|
102
|
-
NftId productNftId
|
|
103
|
-
bytes memory data
|
|
97
|
+
IProductComponent product,
|
|
98
|
+
NftId productNftId
|
|
104
99
|
)
|
|
105
100
|
internal
|
|
106
101
|
returns (string memory name)
|
|
107
102
|
{
|
|
108
|
-
(
|
|
109
|
-
string memory name,
|
|
110
|
-
ISetup.ProductSetupInfo memory setup
|
|
111
|
-
) = _decodeAndVerifyProductData(data);
|
|
112
|
-
|
|
113
103
|
// wire distribution and pool components to product component
|
|
114
|
-
|
|
115
|
-
IComponent
|
|
104
|
+
ISetup.ProductSetupInfo memory setup = product.getSetupInfo();
|
|
105
|
+
IComponent distribution = IComponent(getRegistry().getObjectInfo(setup.distributionNftId).objectAddress);
|
|
106
|
+
IComponent pool = IComponent(getRegistry().getObjectInfo(setup.poolNftId).objectAddress);
|
|
116
107
|
|
|
117
108
|
distribution.setProductNftId(productNftId);
|
|
118
109
|
pool.setProductNftId(productNftId);
|
|
@@ -120,13 +111,14 @@ contract ProductService is ComponentService, IProductService {
|
|
|
120
111
|
product.linkToRegisteredNftId();
|
|
121
112
|
|
|
122
113
|
// create product setup in instance
|
|
123
|
-
instance.createProductSetup(productNftId,
|
|
114
|
+
instance.createProductSetup(productNftId, product.getSetupInfo());
|
|
124
115
|
|
|
125
116
|
// create target for instane access manager
|
|
126
|
-
getInstanceService().
|
|
127
|
-
|
|
117
|
+
getInstanceService().createGifTarget(
|
|
118
|
+
getRegistry().getNftId(address(instance)),
|
|
128
119
|
address(product),
|
|
129
|
-
|
|
120
|
+
product.getName());
|
|
121
|
+
getInstanceService().grantProductDefaultPermissions(instance.getNftId(), address(product), product.getName());
|
|
130
122
|
}
|
|
131
123
|
|
|
132
124
|
function getDomain() public pure override(IService, Service) returns(ObjectType) {
|
|
@@ -148,13 +140,13 @@ contract ProductService is ComponentService, IProductService {
|
|
|
148
140
|
// revert WalletIsZero();
|
|
149
141
|
// }
|
|
150
142
|
|
|
151
|
-
// IRegistry.ObjectInfo memory tokenInfo =
|
|
143
|
+
// IRegistry.ObjectInfo memory tokenInfo = getRegistry().getObjectInfo(address(info.token));
|
|
152
144
|
|
|
153
145
|
// if(tokenInfo.objectType != TOKEN()) {
|
|
154
146
|
// revert InvalidToken();
|
|
155
147
|
// }
|
|
156
148
|
|
|
157
|
-
// IRegistry.ObjectInfo memory poolInfo =
|
|
149
|
+
// IRegistry.ObjectInfo memory poolInfo = getRegistry().getObjectInfo(info.poolNftId);
|
|
158
150
|
|
|
159
151
|
// if(poolInfo.objectType != POOL()) {
|
|
160
152
|
// revert InvalidPool();
|
|
@@ -168,7 +160,7 @@ contract ProductService is ComponentService, IProductService {
|
|
|
168
160
|
// //require(tokenInfo.objectAddress == address(poolSetup.token), "ERROR:COS-018:PRODUCT_POOL_TOKEN_MISMATCH");
|
|
169
161
|
// // TODO pool is not linked
|
|
170
162
|
|
|
171
|
-
// IRegistry.ObjectInfo memory distributionInfo =
|
|
163
|
+
// IRegistry.ObjectInfo memory distributionInfo = getRegistry().getObjectInfo(info.distributionNftId);
|
|
172
164
|
|
|
173
165
|
// if(distributionInfo.objectType != DISTRIBUTION()) {
|
|
174
166
|
// revert InvalidDistribution();
|
|
@@ -3,7 +3,6 @@ pragma solidity ^0.8.20;
|
|
|
3
3
|
|
|
4
4
|
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
5
5
|
|
|
6
|
-
import {ChainNft} from "./ChainNft.sol";
|
|
7
6
|
import {NftId} from "../types/NftId.sol";
|
|
8
7
|
import {ObjectType} from "../types/ObjectType.sol";
|
|
9
8
|
import {VersionPart} from "../types/Version.sol";
|
|
@@ -92,7 +91,9 @@ interface IRegistry is IERC165 {
|
|
|
92
91
|
VersionPart releaseVersion
|
|
93
92
|
) external view returns (address serviceAddress);
|
|
94
93
|
|
|
95
|
-
function
|
|
94
|
+
function getReleaseManagerAddress() external view returns (address);
|
|
95
|
+
|
|
96
|
+
function getChainNftAddress() external view returns (address);
|
|
96
97
|
|
|
97
98
|
function getOwner() external view returns (address);
|
|
98
99
|
}
|
|
@@ -35,20 +35,30 @@ interface IRegistryService is
|
|
|
35
35
|
struct FunctionConfig
|
|
36
36
|
{
|
|
37
37
|
ObjectType serviceDomain;
|
|
38
|
-
bytes4
|
|
38
|
+
bytes4[] selectors;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
function getFunctionConfigs()
|
|
42
|
+
external
|
|
43
|
+
pure
|
|
44
|
+
returns(
|
|
45
|
+
FunctionConfig[] memory config
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// TODO used by service -> add owner arg
|
|
49
|
+
function registerInstance(IRegisterable instance, address owner)
|
|
50
|
+
external returns(IRegistry.ObjectInfo memory info);
|
|
43
51
|
|
|
44
52
|
function registerProduct(IComponent product, address owner)
|
|
45
|
-
external returns(IRegistry.ObjectInfo memory info
|
|
53
|
+
external returns(IRegistry.ObjectInfo memory info);
|
|
46
54
|
|
|
47
55
|
function registerPool(IComponent pool, address owner)
|
|
48
|
-
external returns(IRegistry.ObjectInfo memory info
|
|
56
|
+
external returns(IRegistry.ObjectInfo memory info);
|
|
49
57
|
|
|
50
58
|
function registerDistribution(IComponent distribution, address owner)
|
|
51
|
-
external returns(IRegistry.ObjectInfo memory info
|
|
59
|
+
external returns(IRegistry.ObjectInfo memory info);
|
|
60
|
+
|
|
61
|
+
function registerDistributor(IRegistry.ObjectInfo memory info) external returns(NftId nftId);
|
|
52
62
|
|
|
53
63
|
function registerPolicy(IRegistry.ObjectInfo memory info) external returns(NftId nftId);
|
|
54
64
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.20;
|
|
3
3
|
|
|
4
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
4
5
|
|
|
5
6
|
import {NftId, toNftId, zeroNftId} from "../types/NftId.sol";
|
|
6
7
|
import {VersionPart} from "../types/Version.sol";
|
|
7
|
-
import {ObjectType, PROTOCOL, REGISTRY, TOKEN, SERVICE, INSTANCE, STAKE, PRODUCT, DISTRIBUTION, ORACLE, POOL, POLICY, BUNDLE} from "../types/ObjectType.sol";
|
|
8
|
-
|
|
9
|
-
import {ERC165} from "../shared/ERC165.sol";
|
|
8
|
+
import {ObjectType, PROTOCOL, REGISTRY, TOKEN, SERVICE, INSTANCE, STAKE, PRODUCT, DISTRIBUTION, DISTRIBUTOR, ORACLE, POOL, POLICY, BUNDLE} from "../types/ObjectType.sol";
|
|
10
9
|
|
|
11
10
|
import {ChainNft} from "./ChainNft.sol";
|
|
12
11
|
import {IRegistry} from "./IRegistry.sol";
|
|
@@ -23,7 +22,6 @@ import {ReleaseManager} from "./ReleaseManager.sol";
|
|
|
23
22
|
// 4) state object by regular service (POLICY, BUNDLE, STAKE)
|
|
24
23
|
|
|
25
24
|
contract Registry is
|
|
26
|
-
ERC165,
|
|
27
25
|
IRegistry
|
|
28
26
|
{
|
|
29
27
|
address public constant NFT_LOCK_ADDRESS = address(0x1);
|
|
@@ -75,8 +73,6 @@ contract Registry is
|
|
|
75
73
|
|
|
76
74
|
// set object types and object parent relations
|
|
77
75
|
_setupValidCoreTypesAndCombinations();
|
|
78
|
-
|
|
79
|
-
_registerInterface(type(IRegistry).interfaceId);
|
|
80
76
|
}
|
|
81
77
|
|
|
82
78
|
function registerService(
|
|
@@ -194,6 +190,10 @@ contract Registry is
|
|
|
194
190
|
return _chainNft.totalSupply();
|
|
195
191
|
}
|
|
196
192
|
|
|
193
|
+
function getReleaseManagerAddress() external view returns (address) {
|
|
194
|
+
return address(_releaseManager);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
197
|
function getNftId() external view returns (NftId nftId) {
|
|
198
198
|
return _registryNftId;
|
|
199
199
|
}
|
|
@@ -246,14 +246,24 @@ contract Registry is
|
|
|
246
246
|
//}
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
function
|
|
250
|
-
return _chainNft;
|
|
249
|
+
function getChainNftAddress() external view override returns (address) {
|
|
250
|
+
return address(_chainNft);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
function getOwner() public view returns (address owner) {
|
|
254
254
|
return ownerOf(address(this));
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
+
// IERC165
|
|
258
|
+
|
|
259
|
+
function supportsInterface(bytes4 interfaceId) external pure returns (bool) {
|
|
260
|
+
if(interfaceId == type(IERC165).interfaceId || interfaceId == type(IRegistry).interfaceId) {
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
|
|
257
267
|
// Internals
|
|
258
268
|
|
|
259
269
|
/// @dev registry protects only against tampering existing records, registering with invalid types pairs and 0 parent address
|
|
@@ -442,6 +452,8 @@ contract Registry is
|
|
|
442
452
|
_coreContractCombinations[ORACLE()][INSTANCE()] = true;
|
|
443
453
|
_coreContractCombinations[POOL()][INSTANCE()] = true;
|
|
444
454
|
|
|
455
|
+
_coreObjectCombinations[DISTRIBUTOR()][DISTRIBUTION()] = true;
|
|
456
|
+
|
|
445
457
|
// product as parent, ONLY approved
|
|
446
458
|
_coreObjectCombinations[POLICY()][PRODUCT()] = true;
|
|
447
459
|
|
|
@@ -19,7 +19,7 @@ import {IRegisterable} from "../../contracts/shared/IRegisterable.sol";
|
|
|
19
19
|
import {Registerable} from "../../contracts/shared/Registerable.sol";
|
|
20
20
|
|
|
21
21
|
import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, ORACLE_OWNER_ROLE} from "../../contracts/types/RoleId.sol";
|
|
22
|
-
import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, POLICY, BUNDLE, STAKE} from "../../contracts/types/ObjectType.sol";
|
|
22
|
+
import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, DISTRIBUTOR, POLICY, BUNDLE, STAKE} from "../../contracts/types/ObjectType.sol";
|
|
23
23
|
import {StateId, ACTIVE, PAUSED} from "../../contracts/types/StateId.sol";
|
|
24
24
|
import {NftId, NftIdLib, zeroNftId} from "../../contracts/types/NftId.sol";
|
|
25
25
|
import {Fee, FeeLib} from "../../contracts/types/Fee.sol";
|
|
@@ -44,27 +44,24 @@ contract RegistryService is
|
|
|
44
44
|
external
|
|
45
45
|
restricted
|
|
46
46
|
returns(
|
|
47
|
-
IRegistry.ObjectInfo memory info
|
|
48
|
-
bytes memory data
|
|
47
|
+
IRegistry.ObjectInfo memory info
|
|
49
48
|
)
|
|
50
49
|
{
|
|
51
50
|
if(!instance.supportsInterface(type(IInstance).interfaceId)) {
|
|
52
51
|
revert NotInstance();
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
info = _getAndVerifyContractInfo(instance, INSTANCE(), owner);
|
|
55
|
+
info.nftId = getRegistry().register(info);
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return (info, data);
|
|
57
|
+
instance.linkToRegisteredNftId(); // asume safe
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
function registerProduct(IComponent product, address owner)
|
|
63
61
|
external
|
|
64
62
|
restricted
|
|
65
63
|
returns(
|
|
66
|
-
IRegistry.ObjectInfo memory info
|
|
67
|
-
bytes memory data
|
|
64
|
+
IRegistry.ObjectInfo memory info
|
|
68
65
|
)
|
|
69
66
|
{
|
|
70
67
|
// CAN revert if no ERC165 support -> will revert with empty message
|
|
@@ -72,49 +69,47 @@ contract RegistryService is
|
|
|
72
69
|
revert NotProduct();
|
|
73
70
|
}
|
|
74
71
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
info.nftId = _registry.register(info);
|
|
78
|
-
|
|
79
|
-
return (info, data);
|
|
72
|
+
info = _getAndVerifyContractInfo(product, PRODUCT(), owner);
|
|
73
|
+
info.nftId = getRegistry().register(info);
|
|
80
74
|
}
|
|
81
75
|
|
|
82
76
|
function registerPool(IComponent pool, address owner)
|
|
83
77
|
external
|
|
84
78
|
restricted
|
|
85
79
|
returns(
|
|
86
|
-
IRegistry.ObjectInfo memory info
|
|
87
|
-
bytes memory data
|
|
80
|
+
IRegistry.ObjectInfo memory info
|
|
88
81
|
)
|
|
89
82
|
{
|
|
90
83
|
if(!pool.supportsInterface(type(IPoolComponent).interfaceId)) {
|
|
91
84
|
revert NotPool();
|
|
92
85
|
}
|
|
93
86
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
info.nftId = _registry.register(info);
|
|
97
|
-
|
|
98
|
-
return (info, data);
|
|
87
|
+
info = _getAndVerifyContractInfo(pool, POOL(), owner);
|
|
88
|
+
info.nftId = getRegistry().register(info);
|
|
99
89
|
}
|
|
100
90
|
|
|
101
91
|
function registerDistribution(IComponent distribution, address owner)
|
|
102
92
|
external
|
|
103
93
|
restricted
|
|
104
94
|
returns(
|
|
105
|
-
IRegistry.ObjectInfo memory info
|
|
106
|
-
bytes memory data
|
|
95
|
+
IRegistry.ObjectInfo memory info
|
|
107
96
|
)
|
|
108
97
|
{
|
|
109
98
|
if(!distribution.supportsInterface(type(IDistributionComponent).interfaceId)) {
|
|
110
99
|
revert NotDistribution();
|
|
111
100
|
}
|
|
112
101
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
102
|
+
info = _getAndVerifyContractInfo(distribution, DISTRIBUTION(), owner);
|
|
103
|
+
info.nftId = getRegistry().register(info);
|
|
104
|
+
}
|
|
116
105
|
|
|
117
|
-
|
|
106
|
+
function registerDistributor(IRegistry.ObjectInfo memory info)
|
|
107
|
+
external
|
|
108
|
+
restricted
|
|
109
|
+
returns(NftId nftId)
|
|
110
|
+
{
|
|
111
|
+
_verifyObjectInfo(info, DISTRIBUTOR());
|
|
112
|
+
nftId = getRegistry().register(info);
|
|
118
113
|
}
|
|
119
114
|
|
|
120
115
|
function registerPolicy(IRegistry.ObjectInfo memory info)
|
|
@@ -124,7 +119,7 @@ contract RegistryService is
|
|
|
124
119
|
{
|
|
125
120
|
_verifyObjectInfo(info, POLICY());
|
|
126
121
|
|
|
127
|
-
nftId =
|
|
122
|
+
nftId = getRegistry().register(info);
|
|
128
123
|
}
|
|
129
124
|
|
|
130
125
|
function registerBundle(IRegistry.ObjectInfo memory info)
|
|
@@ -134,7 +129,7 @@ contract RegistryService is
|
|
|
134
129
|
{
|
|
135
130
|
_verifyObjectInfo(info, BUNDLE());
|
|
136
131
|
|
|
137
|
-
nftId =
|
|
132
|
+
nftId = getRegistry().register(info);
|
|
138
133
|
}
|
|
139
134
|
|
|
140
135
|
function registerStake(IRegistry.ObjectInfo memory info)
|
|
@@ -144,7 +139,7 @@ contract RegistryService is
|
|
|
144
139
|
{
|
|
145
140
|
_verifyObjectInfo(info, STAKE());
|
|
146
141
|
|
|
147
|
-
nftId =
|
|
142
|
+
nftId = getRegistry().register(info);
|
|
148
143
|
}
|
|
149
144
|
|
|
150
145
|
// From IService
|
|
@@ -170,47 +165,50 @@ contract RegistryService is
|
|
|
170
165
|
|
|
171
166
|
__AccessManaged_init(initialAuthority);
|
|
172
167
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
_registerInterface(type(IRegistryService).interfaceId);
|
|
168
|
+
initializeService(address(registry), owner);
|
|
169
|
+
registerInterface(type(IRegistryService).interfaceId);
|
|
176
170
|
}
|
|
177
171
|
|
|
178
172
|
// from IRegisterable
|
|
179
173
|
|
|
180
|
-
function
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
174
|
+
function getFunctionConfigs()
|
|
175
|
+
external
|
|
176
|
+
pure
|
|
177
|
+
returns(
|
|
178
|
+
FunctionConfig[] memory config
|
|
179
|
+
)
|
|
185
180
|
{
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
FunctionConfig[] memory config = new FunctionConfig[](6);
|
|
181
|
+
config = new FunctionConfig[](6);
|
|
189
182
|
|
|
190
183
|
// order of service registrations MUST be reverse to this array
|
|
191
184
|
/*config[-1].serviceDomain = STAKE();
|
|
192
185
|
config[-1].selector = RegistryService.registerStake.selector;*/
|
|
193
186
|
|
|
194
187
|
config[0].serviceDomain = POLICY();
|
|
195
|
-
config[0].
|
|
188
|
+
config[0].selectors = new bytes4[](1);
|
|
189
|
+
config[0].selectors[0] = RegistryService.registerPolicy.selector;
|
|
196
190
|
|
|
197
191
|
config[1].serviceDomain = BUNDLE();
|
|
198
|
-
config[1].
|
|
192
|
+
config[1].selectors = new bytes4[](1);
|
|
193
|
+
config[1].selectors[0] = RegistryService.registerBundle.selector;
|
|
199
194
|
|
|
200
195
|
config[2].serviceDomain = PRODUCT();
|
|
201
|
-
config[2].
|
|
196
|
+
config[2].selectors = new bytes4[](1);
|
|
197
|
+
config[2].selectors[0] = RegistryService.registerProduct.selector;
|
|
202
198
|
|
|
203
199
|
config[3].serviceDomain = POOL();
|
|
204
|
-
config[3].
|
|
200
|
+
config[3].selectors = new bytes4[](1);
|
|
201
|
+
config[3].selectors[0] = RegistryService.registerPool.selector;
|
|
205
202
|
|
|
206
203
|
config[4].serviceDomain = DISTRIBUTION();
|
|
207
|
-
config[4].
|
|
204
|
+
config[4].selectors = new bytes4[](2);
|
|
205
|
+
config[4].selectors[0] = RegistryService.registerDistribution.selector;
|
|
206
|
+
config[4].selectors[1] = RegistryService.registerDistributor.selector;
|
|
208
207
|
|
|
209
208
|
// registerInstance() have no restriction
|
|
210
209
|
config[5].serviceDomain = INSTANCE();
|
|
211
|
-
config[5].
|
|
212
|
-
|
|
213
|
-
data = abi.encode(config);
|
|
210
|
+
config[5].selectors = new bytes4[](1);
|
|
211
|
+
config[5].selectors[0] = RegistryService.registerInstance.selector;
|
|
214
212
|
}
|
|
215
213
|
|
|
216
214
|
// Internal
|
|
@@ -221,16 +219,12 @@ contract RegistryService is
|
|
|
221
219
|
address expectedOwner // assume can be 0 when given by other service
|
|
222
220
|
)
|
|
223
221
|
internal
|
|
224
|
-
view
|
|
222
|
+
// view
|
|
225
223
|
returns(
|
|
226
|
-
IRegistry.ObjectInfo memory info
|
|
227
|
-
bytes memory data
|
|
224
|
+
IRegistry.ObjectInfo memory info
|
|
228
225
|
)
|
|
229
226
|
{
|
|
230
|
-
(
|
|
231
|
-
info,
|
|
232
|
-
data
|
|
233
|
-
) = registerable.getInitialInfo();
|
|
227
|
+
info = registerable.getInitialInfo();
|
|
234
228
|
info.objectAddress = address(registerable);
|
|
235
229
|
|
|
236
230
|
if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
|
|
@@ -254,15 +248,6 @@ contract RegistryService is
|
|
|
254
248
|
if(getRegistry().isRegistered(owner)) {
|
|
255
249
|
revert RegisterableOwnerIsRegistered();
|
|
256
250
|
}
|
|
257
|
-
|
|
258
|
-
/*NftId parentNftId = info.parentNftId;
|
|
259
|
-
IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
|
|
260
|
-
|
|
261
|
-
if(parentInfo.objectType != parentType) { // parent registration + type
|
|
262
|
-
revert InvalidParent(parentNftId);
|
|
263
|
-
}*/
|
|
264
|
-
|
|
265
|
-
return(info, data);
|
|
266
251
|
}
|
|
267
252
|
|
|
268
253
|
function _verifyObjectInfo(
|
|
@@ -288,25 +273,5 @@ contract RegistryService is
|
|
|
288
273
|
if(getRegistry().isRegistered(owner)) {
|
|
289
274
|
revert RegisterableOwnerIsRegistered();
|
|
290
275
|
}
|
|
291
|
-
|
|
292
|
-
// can catch all 3 if check that initialOwner is not registered
|
|
293
|
-
/*if(info.initialOwner == msg.sender) {
|
|
294
|
-
revert InitialOwnerIsParent();
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if(info.initialOwner == address(this)) {
|
|
298
|
-
revert InitialOwnerIsService();
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if(info.initialOwner == address(getRegistry())) {
|
|
302
|
-
revert InitialOwnerIsRegistry();
|
|
303
|
-
}*/
|
|
304
|
-
|
|
305
|
-
/*NftId parentNftId = info.parentNftId;
|
|
306
|
-
IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
|
|
307
|
-
|
|
308
|
-
if(parentInfo.objectType != parentType) { // parent registration + type
|
|
309
|
-
revert InvalidParent(parentNftId);
|
|
310
|
-
}*/
|
|
311
276
|
}
|
|
312
277
|
}
|
|
@@ -61,7 +61,7 @@ contract ReleaseManager is AccessManaged
|
|
|
61
61
|
|
|
62
62
|
mapping(VersionPart version => IRegistry.ReleaseInfo info) _release;
|
|
63
63
|
|
|
64
|
-
mapping(VersionPart version => mapping(ObjectType serviceDomain => bytes4))
|
|
64
|
+
mapping(VersionPart version => mapping(ObjectType serviceDomain => bytes4[])) _selectors; // registry service function selector assigned to domain
|
|
65
65
|
|
|
66
66
|
uint _awaitingRegistration; // "services left to register" counter
|
|
67
67
|
|
|
@@ -135,6 +135,7 @@ contract ReleaseManager is AccessManaged
|
|
|
135
135
|
if(!service.supportsInterface(type(IRegistryService).interfaceId)) {
|
|
136
136
|
revert NotRegistryService();
|
|
137
137
|
}
|
|
138
|
+
|
|
138
139
|
// TODO unreliable! MUST guarantee the same authority -> how?
|
|
139
140
|
address serviceAuthority = service.authority();
|
|
140
141
|
if(serviceAuthority != authority()) {
|
|
@@ -143,16 +144,14 @@ contract ReleaseManager is AccessManaged
|
|
|
143
144
|
serviceAuthority);
|
|
144
145
|
}
|
|
145
146
|
|
|
146
|
-
(
|
|
147
|
-
IRegistry.ObjectInfo memory info,
|
|
148
|
-
bytes memory data
|
|
149
|
-
) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
|
147
|
+
IRegistry.ObjectInfo memory info = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
|
150
148
|
|
|
151
149
|
VersionPart version = _next;
|
|
152
150
|
ObjectType domain = REGISTRY();
|
|
153
151
|
_verifyServiceInfo(info, version, domain);
|
|
154
152
|
|
|
155
|
-
|
|
153
|
+
// data: config bytes
|
|
154
|
+
_createRelease(service.getFunctionConfigs());
|
|
156
155
|
|
|
157
156
|
//setTargetClosed(service, true);
|
|
158
157
|
|
|
@@ -173,24 +172,19 @@ contract ReleaseManager is AccessManaged
|
|
|
173
172
|
revert NotService();
|
|
174
173
|
}
|
|
175
174
|
|
|
176
|
-
(
|
|
177
|
-
|
|
178
|
-
//bytes memory data
|
|
179
|
-
) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
|
180
|
-
|
|
181
|
-
VersionPart version = _next;
|
|
175
|
+
IRegistry.ObjectInfo memory info = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
|
176
|
+
VersionPart version = getNextVersion();
|
|
182
177
|
ObjectType domain = _release[version].domains[_awaitingRegistration];// reversed registration order of services specified in RegistryService config
|
|
183
178
|
_verifyServiceInfo(info, version, domain);
|
|
184
179
|
|
|
185
180
|
// setup and grant unique role if service does registrations
|
|
186
|
-
bytes4[] memory
|
|
187
|
-
selector[0] = _selector[version][domain];
|
|
181
|
+
bytes4[] memory selectors = _selectors[version][domain];
|
|
188
182
|
address registryService = _registry.getServiceAddress(REGISTRY(), version);
|
|
189
|
-
if(
|
|
183
|
+
if(selectors.length > 0) {
|
|
190
184
|
_accessManager.setAndGrantUniqueRole(
|
|
191
185
|
address(service),
|
|
192
186
|
registryService,
|
|
193
|
-
|
|
187
|
+
selectors);
|
|
194
188
|
}
|
|
195
189
|
|
|
196
190
|
_awaitingRegistration--;
|
|
@@ -244,13 +238,12 @@ contract ReleaseManager is AccessManaged
|
|
|
244
238
|
address expectedOwner // assume always valid, can not be 0
|
|
245
239
|
)
|
|
246
240
|
internal
|
|
247
|
-
view
|
|
241
|
+
// view
|
|
248
242
|
returns(
|
|
249
|
-
IRegistry.ObjectInfo memory info
|
|
250
|
-
bytes memory data
|
|
243
|
+
IRegistry.ObjectInfo memory info
|
|
251
244
|
)
|
|
252
245
|
{
|
|
253
|
-
|
|
246
|
+
info = service.getInitialInfo();
|
|
254
247
|
info.objectAddress = address(service);
|
|
255
248
|
info.isInterceptor = false; // service is never interceptor, at least now
|
|
256
249
|
|
|
@@ -267,23 +260,10 @@ contract ReleaseManager is AccessManaged
|
|
|
267
260
|
if(owner == address(service)) {
|
|
268
261
|
revert SelfRegistration();
|
|
269
262
|
}
|
|
270
|
-
|
|
271
|
-
/*if(owner == address(0)) { // never 0
|
|
272
|
-
revert();// RegisterableOwnerIsZero();
|
|
273
|
-
}*/
|
|
274
263
|
|
|
275
264
|
if(_registry.isRegistered(owner)) {
|
|
276
265
|
revert RegisterableOwnerIsRegistered();
|
|
277
266
|
}
|
|
278
|
-
|
|
279
|
-
/*NftId parentNftId = info.parentNftId;
|
|
280
|
-
IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
|
|
281
|
-
|
|
282
|
-
if(parentInfo.objectType != parentType) { // parent registration + type
|
|
283
|
-
revert InvalidParent(parentNftId);
|
|
284
|
-
}*/
|
|
285
|
-
|
|
286
|
-
return(info, data);
|
|
287
267
|
}
|
|
288
268
|
|
|
289
269
|
function _verifyServiceInfo(
|
|
@@ -312,11 +292,10 @@ contract ReleaseManager is AccessManaged
|
|
|
312
292
|
}
|
|
313
293
|
|
|
314
294
|
// TODO check if registry supports types specified in the config array
|
|
315
|
-
function _createRelease(
|
|
295
|
+
function _createRelease(IRegistryService.FunctionConfig[] memory config)
|
|
316
296
|
internal
|
|
317
297
|
{
|
|
318
|
-
VersionPart version =
|
|
319
|
-
IRegistryService.FunctionConfig[] memory config = abi.decode(configBytes, (IRegistryService.FunctionConfig[]));
|
|
298
|
+
VersionPart version = getNextVersion();
|
|
320
299
|
|
|
321
300
|
if(config.length == 0) {
|
|
322
301
|
revert ConfigMissing();
|
|
@@ -326,21 +305,21 @@ contract ReleaseManager is AccessManaged
|
|
|
326
305
|
for(uint idx = 0; idx < config.length; idx++)
|
|
327
306
|
{
|
|
328
307
|
ObjectType domain = config[idx].serviceDomain;
|
|
329
|
-
bytes4 selector = config[idx].selector;
|
|
330
|
-
|
|
331
308
|
// not "registry service" / zero domain
|
|
332
309
|
if(
|
|
333
310
|
domain == REGISTRY() ||
|
|
334
311
|
domain.eqz()
|
|
335
312
|
) { revert ConfigServiceDomainInvalid(idx, domain); }
|
|
336
313
|
|
|
314
|
+
bytes4[] memory selectors = config[idx].selectors;
|
|
315
|
+
|
|
337
316
|
// TODO can be zero -> e.g. duplicate domain, first with zero selector, second with non zero selector -> need to check _release[version].domains.contains(domain) instead
|
|
338
317
|
// no overwrite
|
|
339
|
-
if(
|
|
318
|
+
if(_selectors[version][domain].length > 0) {
|
|
340
319
|
revert SelectorAlreadyExists(version, domain);
|
|
341
320
|
}
|
|
342
321
|
|
|
343
|
-
|
|
322
|
+
_selectors[version][domain] = selectors;
|
|
344
323
|
_release[version].domains.push(domain);
|
|
345
324
|
}
|
|
346
325
|
// TODO set when activated?
|
|
@@ -27,8 +27,9 @@ contract TokenRegistry is
|
|
|
27
27
|
mapping(address token => mapping(VersionPart majorVersion => bool isActive)) internal _active;
|
|
28
28
|
|
|
29
29
|
constructor()
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
{
|
|
31
|
+
initializeOwner(msg.sender);
|
|
32
|
+
}
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
/// @dev link ownership of token registry to nft owner of registry service
|
|
@@ -60,7 +61,7 @@ contract TokenRegistry is
|
|
|
60
61
|
// verify valid major version
|
|
61
62
|
// ensure major version increments is one
|
|
62
63
|
uint256 version = majorVersion.toInt();
|
|
63
|
-
if (!
|
|
64
|
+
if (!getRegistry().isValidRelease(majorVersion)) {
|
|
64
65
|
revert TokenMajorVersionInvalid(majorVersion);
|
|
65
66
|
}
|
|
66
67
|
|