@etherisc/gif-next 0.0.2-be8b468-276 → 0.0.2-bfb44e0-483
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +136 -2
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/Component.sol/Component.json +897 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +972 -209
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/{instance/base/ComponentServiceBase.sol/ComponentServiceBase.json → components/IComponent.sol/IComponent.json} +191 -152
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +752 -6
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +676 -31
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +661 -5
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +875 -299
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +695 -180
- 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 +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +764 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +2056 -113
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +214 -20
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +559 -752
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +211 -144
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +179 -76
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +550 -77
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +194 -32
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +261 -0
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/{shared/RegisterableUpgradable.sol/RegisterableUpgradable.json → instance/base/ComponentService.sol/ComponentService.json} +321 -9
- 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 +59 -16
- 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 +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1318 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +586 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +576 -41
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +198 -24
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/{IComponentOwnerService.sol/IComponentOwnerService.json → IApplicationService.sol/IApplicationService.json} +223 -51
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +798 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +229 -19
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +784 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +34 -83
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +44 -246
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1378 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +642 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +957 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +574 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +1007 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +574 -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 +208 -224
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +240 -94
- 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 +222 -330
- 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 +221 -107
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +181 -105
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +150 -29
- 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 +32 -19
- 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 +178 -19
- 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 +196 -37
- 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 +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/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 +236 -0
- package/contracts/components/Distribution.sol +198 -66
- package/contracts/components/IComponent.sol +50 -0
- package/contracts/components/IDistributionComponent.sol +58 -4
- package/contracts/components/IPoolComponent.sol +54 -29
- package/contracts/components/IProductComponent.sol +7 -3
- package/contracts/components/Pool.sol +153 -157
- package/contracts/components/Product.sol +109 -128
- package/contracts/instance/BundleManager.sol +125 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +63 -10
- package/contracts/instance/IInstanceService.sol +33 -4
- package/contracts/instance/Instance.sol +104 -266
- package/contracts/instance/InstanceAccessManager.sol +87 -78
- package/contracts/instance/InstanceReader.sol +29 -26
- package/contracts/instance/InstanceService.sol +361 -90
- package/contracts/instance/InstanceServiceManager.sol +10 -12
- package/contracts/instance/ObjectManager.sol +84 -0
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/module/IAccess.sol +27 -18
- package/contracts/instance/module/IBundle.sol +1 -0
- package/contracts/instance/module/ISetup.sol +7 -3
- package/contracts/instance/service/ApplicationService.sol +268 -0
- package/contracts/instance/service/BundleService.sol +298 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/DistributionService.sol +214 -36
- package/contracts/instance/service/DistributionServiceManager.sol +10 -12
- package/contracts/instance/service/IApplicationService.sol +82 -0
- package/contracts/instance/service/IBundleService.sol +54 -0
- package/contracts/instance/service/IDistributionService.sol +53 -0
- package/contracts/instance/service/IPolicyService.sol +88 -0
- package/contracts/instance/service/IPoolService.sol +6 -23
- package/contracts/instance/service/IProductService.sol +6 -73
- package/contracts/instance/service/PolicyService.sol +524 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +109 -0
- package/contracts/instance/service/PoolServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +233 -0
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +38 -33
- package/contracts/registry/IRegistryService.sol +45 -13
- package/contracts/registry/Registry.sol +223 -250
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +86 -224
- package/contracts/registry/RegistryServiceManager.sol +18 -36
- package/contracts/registry/ReleaseManager.sol +332 -0
- package/contracts/registry/TokenRegistry.sol +11 -9
- 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 -6
- package/contracts/shared/IRegistryLinked.sol +15 -0
- package/contracts/shared/IService.sol +2 -1
- package/contracts/shared/IVersionable.sol +2 -2
- package/contracts/shared/NftOwnable.sol +114 -60
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +6 -5
- package/contracts/shared/Registerable.sol +15 -24
- package/contracts/shared/RegistryLinked.sol +64 -0
- package/contracts/shared/Service.sol +19 -13
- package/contracts/shared/Versionable.sol +3 -2
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestService.sol +4 -3
- package/contracts/types/DistributorType.sol +2 -2
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/ObjectType.sol +6 -2
- package/contracts/types/RoleId.sol +10 -8
- package/package.json +3 -3
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +0 -327
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -280
- 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/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/contracts/components/BaseComponent.sol +0 -91
- package/contracts/components/IBaseComponent.sol +0 -25
- package/contracts/instance/AccessManagedSimple.sol +0 -115
- package/contracts/instance/AccessManagerSimple.sol +0 -692
- package/contracts/instance/IAccessManagerSimple.sol +0 -391
- package/contracts/instance/base/ComponentServiceBase.sol +0 -39
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/service/ComponentOwnerService.sol +0 -317
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -1,87 +1,130 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
// import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
5
|
+
|
6
|
+
import {ERC165} from "./ERC165.sol";
|
4
7
|
import {INftOwnable} from "./INftOwnable.sol";
|
5
8
|
import {IRegistry} from "../registry/IRegistry.sol";
|
6
9
|
import {NftId, zeroNftId} from "../types/NftId.sol";
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
import {RegistryLinked} from "./RegistryLinked.sol";
|
11
|
+
|
12
|
+
contract NftOwnable is
|
13
|
+
ERC165,
|
14
|
+
RegistryLinked,
|
15
|
+
INftOwnable
|
16
|
+
{
|
17
|
+
// keccak256(abi.encode(uint256(keccak256("etherisc.storage.NftOwnable")) - 1)) & ~bytes32(uint256(0xff));
|
18
|
+
bytes32 public constant NFT_OWNABLE_STORAGE_LOCATION_V1 = 0x07ebcf49758b6ed3af50fa146bec0abe157c0218fe65dc0874c286e9d5da4f00;
|
19
|
+
|
20
|
+
struct NftOwnableStorage {
|
21
|
+
// IRegistry _registry;
|
22
|
+
NftId _nftId;
|
23
|
+
address _initialOwner;
|
24
|
+
}
|
13
25
|
|
14
26
|
/// @dev enforces msg.sender is owner of nft (or initial owner of nft ownable)
|
15
27
|
modifier onlyOwner() {
|
16
|
-
|
17
|
-
|
18
|
-
// owner == address(0) is eg uninitialized upgradable contract
|
19
|
-
if (owner != address(0) && msg.sender != owner) {
|
28
|
+
if (msg.sender != getOwner()) {
|
20
29
|
revert ErrorNotOwner(msg.sender);
|
21
30
|
}
|
22
31
|
_;
|
23
32
|
}
|
24
33
|
|
25
|
-
|
26
|
-
|
34
|
+
|
35
|
+
/// @dev initialization for upgradable contracts
|
36
|
+
// used in _initializeRegisterable
|
37
|
+
function initializeNftOwnable(
|
38
|
+
address initialOwner,
|
39
|
+
address registryAddress
|
40
|
+
)
|
41
|
+
public
|
42
|
+
virtual
|
43
|
+
onlyInitializing()
|
44
|
+
{
|
45
|
+
_setInitialOwner(initialOwner);
|
46
|
+
|
47
|
+
initializeRegistryLinked(registryAddress);
|
48
|
+
initializeERC165();
|
49
|
+
registerInterface(type(INftOwnable).interfaceId);
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
function initializeOwner(address initialOwner)
|
54
|
+
public
|
55
|
+
initializer()
|
56
|
+
{
|
57
|
+
_setInitialOwner(initialOwner);
|
58
|
+
initializeERC165();
|
59
|
+
registerInterface(type(INftOwnable).interfaceId);
|
27
60
|
}
|
28
61
|
|
62
|
+
|
29
63
|
/// @dev links this contract to nft after registration
|
30
64
|
// needs to be done once per registered contract and
|
31
65
|
// reduces registry calls to check ownership
|
32
66
|
// does not need any protection as function can only do the "right thing"
|
33
|
-
function linkToRegisteredNftId()
|
34
|
-
|
35
|
-
|
67
|
+
function linkToRegisteredNftId()
|
68
|
+
public
|
69
|
+
virtual
|
70
|
+
{
|
71
|
+
NftOwnableStorage storage $ = _getNftOwnableStorage();
|
72
|
+
|
73
|
+
if ($._nftId.gtz()) {
|
74
|
+
revert ErrorAlreadyLinked(address(getRegistry()), $._nftId);
|
36
75
|
}
|
37
76
|
|
38
|
-
if (address(
|
77
|
+
if (address(getRegistry()) == address(0)) {
|
39
78
|
revert ErrorRegistryNotInitialized();
|
40
79
|
}
|
41
80
|
|
42
81
|
address contractAddress = address(this);
|
43
82
|
|
44
|
-
if (!
|
83
|
+
if (!getRegistry().isRegistered(contractAddress)) {
|
45
84
|
revert ErrorContractNotRegistered(contractAddress);
|
46
85
|
}
|
47
86
|
|
48
|
-
_nftId =
|
87
|
+
$._nftId = getRegistry().getNftId(contractAddress);
|
49
88
|
}
|
50
89
|
|
51
90
|
|
52
|
-
function getRegistry() public view virtual override returns (IRegistry) {
|
53
|
-
|
54
|
-
}
|
55
|
-
|
91
|
+
// function getRegistry() public view virtual override returns (IRegistry) {
|
92
|
+
// return _getNftOwnableStorage()._registry;
|
93
|
+
// }
|
56
94
|
|
57
95
|
function getNftId() public view virtual override returns (NftId) {
|
58
|
-
return _nftId;
|
96
|
+
return _getNftOwnableStorage()._nftId;
|
59
97
|
}
|
60
98
|
|
99
|
+
function getInitialOwner() public view returns (address) {
|
100
|
+
return _getNftOwnableStorage()._initialOwner;
|
101
|
+
}
|
61
102
|
|
62
103
|
function getOwner() public view virtual override returns (address) {
|
63
|
-
|
64
|
-
|
104
|
+
NftOwnableStorage storage $ = _getNftOwnableStorage();
|
105
|
+
|
106
|
+
if ($._nftId.gtz()) {
|
107
|
+
return getRegistry().ownerOf($._nftId);
|
65
108
|
}
|
66
109
|
|
67
|
-
return _initialOwner;
|
110
|
+
return $._initialOwner;
|
68
111
|
}
|
69
112
|
|
70
|
-
|
71
|
-
///
|
72
|
-
|
73
|
-
function _initializeNftOwnable(
|
74
|
-
address initialOwner,
|
75
|
-
address registryAddress
|
76
|
-
)
|
113
|
+
/// @dev set initialOwner
|
114
|
+
/// initial owner may only be set during initialization
|
115
|
+
function _setInitialOwner(address initialOwner)
|
77
116
|
internal
|
78
117
|
virtual
|
118
|
+
onlyInitializing()
|
79
119
|
{
|
80
|
-
|
81
|
-
|
82
|
-
|
120
|
+
if(initialOwner == address(0)) {
|
121
|
+
revert ErrorInitialOwnerZero();
|
122
|
+
}
|
83
123
|
|
124
|
+
_getNftOwnableStorage()._initialOwner = initialOwner;
|
125
|
+
}
|
84
126
|
|
127
|
+
// TODO check if function can be refactored to work with a registry address set in an initializer
|
85
128
|
/// @dev used in constructor of registry service manager
|
86
129
|
// links ownership of registry service manager ot nft owner of registry service
|
87
130
|
function _linkToNftOwnable(
|
@@ -92,45 +135,56 @@ contract NftOwnable is INftOwnable {
|
|
92
135
|
onlyOwner()
|
93
136
|
returns (NftId)
|
94
137
|
{
|
95
|
-
|
96
|
-
|
138
|
+
NftOwnableStorage storage $ = _getNftOwnableStorage();
|
139
|
+
|
140
|
+
if ($._nftId.gtz()) {
|
141
|
+
revert ErrorAlreadyLinked(address(getRegistry()), $._nftId);
|
97
142
|
}
|
98
143
|
|
99
144
|
_setRegistry(registryAddress);
|
100
145
|
|
101
|
-
if (!
|
146
|
+
if (!getRegistry().isRegistered(nftOwnableAddress)) {
|
102
147
|
revert ErrorContractNotRegistered(nftOwnableAddress);
|
103
148
|
}
|
104
149
|
|
105
|
-
_nftId =
|
150
|
+
$._nftId = getRegistry().getNftId(nftOwnableAddress);
|
106
151
|
|
107
|
-
return _nftId;
|
152
|
+
return $._nftId;
|
108
153
|
}
|
109
154
|
|
110
155
|
|
111
|
-
function _setRegistry(address registryAddress)
|
112
|
-
|
113
|
-
{
|
114
|
-
|
115
|
-
revert ErrorRegistryAlreadyInitialized(address(_registry));
|
116
|
-
}
|
156
|
+
// function _setRegistry(address registryAddress)
|
157
|
+
// private
|
158
|
+
// {
|
159
|
+
// NftOwnableStorage storage $ = _getNftOwnableStorage();
|
117
160
|
|
118
|
-
|
119
|
-
|
120
|
-
|
161
|
+
// if (address($._registry) != address(0)) {
|
162
|
+
// revert ErrorRegistryAlreadyInitialized(address($._registry));
|
163
|
+
// }
|
121
164
|
|
122
|
-
|
123
|
-
|
124
|
-
|
165
|
+
// if (registryAddress == address(0)) {
|
166
|
+
// revert ErrorRegistryAddressZero();
|
167
|
+
// }
|
168
|
+
|
169
|
+
// if (registryAddress.code.length == 0) {
|
170
|
+
// revert ErrorNotRegistry(registryAddress);
|
171
|
+
// }
|
172
|
+
|
173
|
+
// $._registry = IRegistry(registryAddress);
|
174
|
+
|
175
|
+
// try $._registry.supportsInterface(type(IRegistry).interfaceId) returns (bool isRegistry) {
|
176
|
+
// if (!isRegistry) {
|
177
|
+
// revert ErrorNotRegistry(registryAddress);
|
178
|
+
// }
|
179
|
+
// } catch {
|
180
|
+
// revert ErrorNotRegistry(registryAddress);
|
181
|
+
// }
|
182
|
+
// }
|
125
183
|
|
126
|
-
_registry = IRegistry(registryAddress);
|
127
184
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
}
|
132
|
-
} catch {
|
133
|
-
revert ErrorNotRegistry(registryAddress);
|
185
|
+
function _getNftOwnableStorage() private pure returns (NftOwnableStorage storage $) {
|
186
|
+
assembly {
|
187
|
+
$.slot := NFT_OWNABLE_STORAGE_LOCATION_V1
|
134
188
|
}
|
135
189
|
}
|
136
190
|
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
|
+
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
|
6
|
+
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
7
|
+
|
8
|
+
import {ERC165} from "./ERC165.sol";
|
9
|
+
import {IPolicyHolder} from "./IPolicyHolder.sol";
|
10
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
11
|
+
import {NftId} from "../types/NftId.sol";
|
12
|
+
import {NumberId} from "../types/NumberId.sol";
|
13
|
+
import {RegistryLinked} from "./RegistryLinked.sol";
|
14
|
+
|
15
|
+
/// @dev template implementation for IPolicyHolder
|
16
|
+
contract PolicyHolder is
|
17
|
+
ERC165,
|
18
|
+
RegistryLinked,
|
19
|
+
IPolicyHolder
|
20
|
+
{
|
21
|
+
// keccak256(abi.encode(uint256(keccak256("etherisc.storage.PolicyHolder")) - 1)) & ~bytes32(uint256(0xff));
|
22
|
+
// TODO fix address
|
23
|
+
bytes32 public constant POLICY_HOLDER_STORAGE_LOCATION_V1 = 0x07ebcf49758b6ed3af50fa146bec0abe157c0218fe65dc0874c286e9d5da4f00;
|
24
|
+
|
25
|
+
// TODO uncomment/fix/refactor
|
26
|
+
struct PolicyHolderStorage {
|
27
|
+
// mapping(NftId policyId => mapping(NumberId claimId => address beneficiary)) private _claimBeneficiary;
|
28
|
+
// mapping(NftId policyId => address beneficiary) private _beneficiary;
|
29
|
+
bool dummy;
|
30
|
+
}
|
31
|
+
|
32
|
+
function initializePolicyHolder(
|
33
|
+
address registryAddress
|
34
|
+
)
|
35
|
+
public
|
36
|
+
virtual
|
37
|
+
onlyInitializing()
|
38
|
+
{
|
39
|
+
initializeRegistryLinked(registryAddress);
|
40
|
+
}
|
41
|
+
|
42
|
+
/// @dev empty default implementation
|
43
|
+
function policyCreatedCallback(NftId policyNftId) external virtual { }
|
44
|
+
|
45
|
+
/// @dev empty default implementation
|
46
|
+
function payoutExecutedCallback(NftId policyNftId, NumberId payoutId, address beneficiary, uint256 amount) external virtual { }
|
47
|
+
|
48
|
+
/// @dev determines beneficiary address that will be used in payouts targeting this contract
|
49
|
+
/// returned address will override GIF default where the policy nft holder is treated as beneficiary
|
50
|
+
function getBeneficiary(NftId policyId, NumberId claimId) external virtual view returns (address beneficiary) {
|
51
|
+
// TODO add implementation
|
52
|
+
}
|
53
|
+
|
54
|
+
//--- IERC165 functions ---------------//
|
55
|
+
function onERC721Received(
|
56
|
+
address, // operator
|
57
|
+
address, // from
|
58
|
+
uint256, // tokenId
|
59
|
+
bytes calldata // data
|
60
|
+
)
|
61
|
+
external
|
62
|
+
virtual
|
63
|
+
returns (bytes4)
|
64
|
+
{
|
65
|
+
return IERC721Receiver.onERC721Received.selector;
|
66
|
+
}
|
67
|
+
|
68
|
+
function _setBeneficiary(address beneficiary) internal {
|
69
|
+
|
70
|
+
}
|
71
|
+
|
72
|
+
function _setBeneficiary(NftId policyId, address beneficiary) internal {
|
73
|
+
|
74
|
+
}
|
75
|
+
|
76
|
+
function _getPolicyHolderStorage() private pure returns (PolicyHolderStorage storage $) {
|
77
|
+
assembly {
|
78
|
+
$.slot := POLICY_HOLDER_STORAGE_LOCATION_V1
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
@@ -27,8 +27,9 @@ contract ProxyManager is
|
|
27
27
|
|
28
28
|
/// @dev only used to capture proxy owner
|
29
29
|
constructor()
|
30
|
-
|
31
|
-
|
30
|
+
{
|
31
|
+
initializeOwner(msg.sender);
|
32
|
+
}
|
32
33
|
|
33
34
|
/// @dev deploy initial contract
|
34
35
|
function deploy(address initialImplementation, bytes memory initializationData)
|
@@ -38,6 +39,7 @@ contract ProxyManager is
|
|
38
39
|
returns (IVersionable versionable)
|
39
40
|
{
|
40
41
|
if (_isDeployed) { revert ErrorAlreadyDeployed(); }
|
42
|
+
_isDeployed = true;
|
41
43
|
|
42
44
|
address currentProxyOwner = getOwner(); // used by implementation
|
43
45
|
address initialProxyAdminOwner = address(this); // used by proxy
|
@@ -49,7 +51,6 @@ contract ProxyManager is
|
|
49
51
|
data
|
50
52
|
);
|
51
53
|
|
52
|
-
_isDeployed = true;
|
53
54
|
versionable = IVersionable(address(_proxy));
|
54
55
|
|
55
56
|
emit LogProxyDeployed(address(_proxy), initialImplementation);
|
@@ -81,11 +82,11 @@ contract ProxyManager is
|
|
81
82
|
}
|
82
83
|
|
83
84
|
function getDeployData(address implementation, address proxyOwner, bytes memory deployData) public pure returns (bytes memory data) {
|
84
|
-
return abi.encodeWithSelector(IVersionable.
|
85
|
+
return abi.encodeWithSelector(IVersionable.initializeVersionable.selector, implementation, proxyOwner, deployData);
|
85
86
|
}
|
86
87
|
|
87
88
|
function getUpgradeData(address implementation, address proxyOwner, bytes memory upgradeData) public pure returns (bytes memory data) {
|
88
|
-
return abi.encodeWithSelector(IVersionable.
|
89
|
+
return abi.encodeWithSelector(IVersionable.upgradeVersionable.selector, implementation, proxyOwner, upgradeData);
|
89
90
|
}
|
90
91
|
|
91
92
|
function getProxy() public returns (UpgradableProxyWithAdmin) {
|
@@ -11,11 +11,7 @@ import {IRegistry} from "../registry/IRegistry.sol";
|
|
11
11
|
import {IRegisterable} from "./IRegisterable.sol";
|
12
12
|
import {Versionable} from "./Versionable.sol";
|
13
13
|
|
14
|
-
import {ERC165} from "./ERC165.sol";
|
15
|
-
|
16
14
|
contract Registerable is
|
17
|
-
ERC165,
|
18
|
-
Initializable,
|
19
15
|
NftOwnable,
|
20
16
|
IRegisterable
|
21
17
|
{
|
@@ -37,7 +33,7 @@ contract Registerable is
|
|
37
33
|
}
|
38
34
|
}
|
39
35
|
|
40
|
-
function
|
36
|
+
function initializeRegisterable(
|
41
37
|
address registryAddress,
|
42
38
|
NftId parentNftId,
|
43
39
|
ObjectType objectType,
|
@@ -45,12 +41,11 @@ contract Registerable is
|
|
45
41
|
address initialOwner,
|
46
42
|
bytes memory data
|
47
43
|
)
|
48
|
-
|
49
|
-
//onlyInitializing//TODO uncomment when "fully" upgradeable
|
44
|
+
public
|
50
45
|
virtual
|
46
|
+
onlyInitializing
|
51
47
|
{
|
52
|
-
|
53
|
-
_initializeNftOwnable(
|
48
|
+
initializeNftOwnable(
|
54
49
|
initialOwner,
|
55
50
|
registryAddress);
|
56
51
|
|
@@ -63,7 +58,7 @@ contract Registerable is
|
|
63
58
|
$._isInterceptor = isInterceptor;
|
64
59
|
$._data = data;
|
65
60
|
|
66
|
-
|
61
|
+
registerInterface(type(IRegisterable).interfaceId);
|
67
62
|
}
|
68
63
|
|
69
64
|
|
@@ -71,20 +66,16 @@ contract Registerable is
|
|
71
66
|
public
|
72
67
|
view
|
73
68
|
virtual
|
74
|
-
returns (IRegistry.ObjectInfo memory
|
69
|
+
returns (IRegistry.ObjectInfo memory info)
|
75
70
|
{
|
76
|
-
RegisterableStorage
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
$._data
|
86
|
-
),
|
87
|
-
bytes("")
|
88
|
-
);
|
71
|
+
RegisterableStorage memory $ = _getRegisterableStorage();
|
72
|
+
info = IRegistry.ObjectInfo(
|
73
|
+
zeroNftId(),
|
74
|
+
$._parentNftId,
|
75
|
+
$._objectType,
|
76
|
+
$._isInterceptor,
|
77
|
+
address(this),
|
78
|
+
getInitialOwner(),
|
79
|
+
$._data);
|
89
80
|
}
|
90
81
|
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
5
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
6
|
+
import {IRegistryLinked} from "./IRegistryLinked.sol";
|
7
|
+
|
8
|
+
contract RegistryLinked is
|
9
|
+
Initializable,
|
10
|
+
IRegistryLinked
|
11
|
+
{
|
12
|
+
|
13
|
+
IRegistry private _registry;
|
14
|
+
|
15
|
+
/// @dev initialization for upgradable contracts
|
16
|
+
// used in _initializeRegisterable
|
17
|
+
function initializeRegistryLinked(
|
18
|
+
address registryAddress
|
19
|
+
)
|
20
|
+
public
|
21
|
+
virtual
|
22
|
+
onlyInitializing()
|
23
|
+
{
|
24
|
+
_setRegistry(registryAddress);
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
function getRegistry() public view returns (IRegistry) {
|
29
|
+
return _registry;
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
function getRegistryAddress() public view returns (address) {
|
34
|
+
return address(_registry);
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
function _setRegistry(address registryAddress)
|
39
|
+
internal
|
40
|
+
{
|
41
|
+
|
42
|
+
if (address(_registry) != address(0)) {
|
43
|
+
revert ErrorRegistryAlreadyInitialized(address(_registry));
|
44
|
+
}
|
45
|
+
|
46
|
+
if (registryAddress == address(0)) {
|
47
|
+
revert ErrorRegistryAddressZero();
|
48
|
+
}
|
49
|
+
|
50
|
+
if (registryAddress.code.length == 0) {
|
51
|
+
revert ErrorNotRegistry(registryAddress);
|
52
|
+
}
|
53
|
+
|
54
|
+
_registry = IRegistry(registryAddress);
|
55
|
+
|
56
|
+
try _registry.supportsInterface(type(IRegistry).interfaceId) returns (bool isRegistry) {
|
57
|
+
if (!isRegistry) {
|
58
|
+
revert ErrorNotRegistry(registryAddress);
|
59
|
+
}
|
60
|
+
} catch {
|
61
|
+
revert ErrorNotRegistry(registryAddress);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
@@ -1,21 +1,26 @@
|
|
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
|
+
|
8
|
+
import {Versionable} from "./Versionable.sol";
|
9
|
+
import {IService} from "./IService.sol";
|
10
|
+
import {IVersionable} from "./IVersionable.sol";
|
11
11
|
import {Versionable} from "./Versionable.sol";
|
12
|
+
import {Registerable} from "./Registerable.sol";
|
13
|
+
|
14
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
15
|
+
|
12
16
|
|
13
17
|
/// @dev service base contract
|
14
18
|
abstract contract Service is
|
15
|
-
|
19
|
+
Registerable,
|
20
|
+
Versionable,
|
16
21
|
IService
|
17
22
|
{
|
18
|
-
function
|
23
|
+
function getDomain() public pure virtual override returns(ObjectType);
|
19
24
|
|
20
25
|
function getMajorVersion() public view virtual override returns(VersionPart majorVersion) {
|
21
26
|
return getVersion().toMajorPart();
|
@@ -31,20 +36,21 @@ abstract contract Service is
|
|
31
36
|
return VersionLib.toVersion(3,0,0);
|
32
37
|
}
|
33
38
|
|
34
|
-
function
|
39
|
+
function initializeService(
|
35
40
|
address registry,
|
36
41
|
address initialOwner
|
37
42
|
)
|
38
|
-
|
39
|
-
|
43
|
+
public
|
44
|
+
virtual
|
45
|
+
onlyInitializing()
|
40
46
|
{
|
41
47
|
// service must provide its name and version upon registration
|
42
|
-
bytes memory data = abi.encode(
|
48
|
+
bytes memory data = abi.encode(getDomain(), getMajorVersion());
|
43
49
|
NftId registryNftId = _getRegistryNftId(registry);
|
44
50
|
bool isInterceptor = false;
|
45
51
|
|
46
|
-
|
47
|
-
|
52
|
+
initializeRegisterable(registry, registryNftId, SERVICE(), isInterceptor, initialOwner, data);
|
53
|
+
registerInterface(type(IService).interfaceId);
|
48
54
|
}
|
49
55
|
|
50
56
|
// this is just a conveniene function, actual validation will be done upon registration
|
@@ -31,7 +31,8 @@ abstract contract Versionable is
|
|
31
31
|
_disableInitializers();
|
32
32
|
}
|
33
33
|
// TODO write test where new version of private _updateVersionHistory is added and used...
|
34
|
-
|
34
|
+
|
35
|
+
function initializeVersionable(
|
35
36
|
address implementation,
|
36
37
|
address activatedBy,
|
37
38
|
bytes memory data
|
@@ -44,7 +45,7 @@ abstract contract Versionable is
|
|
44
45
|
}
|
45
46
|
|
46
47
|
// TODO activatedBy MUST ALWAYS be an owner?
|
47
|
-
function
|
48
|
+
function upgradeVersionable(
|
48
49
|
address implementation,
|
49
50
|
address activatedBy,
|
50
51
|
bytes memory data
|
@@ -13,6 +13,6 @@ contract TestRegisterable is Registerable {
|
|
13
13
|
// solhint-disable-next-line no-empty-blocks
|
14
14
|
{
|
15
15
|
bytes memory data = "";
|
16
|
-
|
16
|
+
initializeRegisterable(registry, registryNftId, objectType, isInterceptor, initialOwner, data);
|
17
17
|
}
|
18
18
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
+
import {ObjectType, PRODUCT} from "../../contracts/types/ObjectType.sol";
|
4
5
|
import {NftId} from "../../contracts/types/NftId.sol";
|
5
6
|
import {Version, VersionLib} from "../../contracts/types/Version.sol";
|
6
7
|
import {Service} from "../../contracts/shared/Service.sol";
|
@@ -15,10 +16,10 @@ contract TestService is Service {
|
|
15
16
|
constructor(address registry, NftId registryNftId, address initialOwner)
|
16
17
|
// solhint-disable-next-line no-empty-blocks
|
17
18
|
{
|
18
|
-
|
19
|
+
initializeService(registry, initialOwner);
|
19
20
|
}
|
20
21
|
|
21
|
-
function
|
22
|
-
return
|
22
|
+
function getDomain() public pure override returns(ObjectType) {
|
23
|
+
return PRODUCT();
|
23
24
|
}
|
24
25
|
}
|
@@ -3,7 +3,7 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {Key32, KeyId, Key32Lib} from "./Key32.sol";
|
5
5
|
import {NftId} from "./NftId.sol";
|
6
|
-
import {
|
6
|
+
import {DISTRIBUTOR_TYPE} from "./ObjectType.sol";
|
7
7
|
|
8
8
|
type DistributorType is bytes8;
|
9
9
|
|
@@ -45,7 +45,7 @@ library DistributorTypeLib {
|
|
45
45
|
|
46
46
|
/// @dev Returns the key32 value for the specified nft id and object type.
|
47
47
|
function toKey32(DistributorType id) public pure returns (Key32 key) {
|
48
|
-
return Key32Lib.toKey32(
|
48
|
+
return Key32Lib.toKey32(DISTRIBUTOR_TYPE(), toKeyId(id));
|
49
49
|
}
|
50
50
|
|
51
51
|
/// @dev Returns the key id value for the specified nft id
|