@etherisc/gif-next 0.0.2-bf75dbb-287 → 0.0.2-bfb44e0-483
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 +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 +907 -218
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → IComponent.sol/IComponent.json} +151 -84
- 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 +661 -5
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +620 -193
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +550 -115
- 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 +38 -62
- 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 +725 -36
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +198 -20
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +490 -710
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +188 -144
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +61 -97
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +501 -264
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +178 -100
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
- 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 +544 -84
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +191 -33
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/{base/ComponentServiceBase.sol/ComponentServiceBase.json → service/IApplicationService.sol/IApplicationService.json} +207 -109
- 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/{IComponentOwnerService.sol/IComponentOwnerService.json → IPolicyService.sol/IPolicyService.json} +369 -51
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +28 -244
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +33 -244
- 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 +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +259 -351
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +166 -56
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +270 -410
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +166 -80
- 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 +225 -133
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +146 -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 +238 -235
- 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 +214 -156
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +181 -97
- 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 +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 +236 -0
- package/contracts/components/Distribution.sol +199 -64
- package/contracts/components/IComponent.sol +50 -0
- package/contracts/components/IDistributionComponent.sol +59 -3
- package/contracts/components/IPoolComponent.sol +50 -29
- package/contracts/components/IProductComponent.sol +7 -3
- package/contracts/components/Pool.sol +136 -149
- package/contracts/components/Product.sol +104 -115
- package/contracts/instance/BundleManager.sol +7 -11
- package/contracts/instance/IInstance.sol +39 -9
- package/contracts/instance/IInstanceService.sol +29 -4
- package/contracts/instance/Instance.sol +78 -251
- package/contracts/instance/InstanceAccessManager.sol +87 -78
- package/contracts/instance/InstanceReader.sol +3 -25
- package/contracts/instance/InstanceService.sol +306 -137
- package/contracts/instance/InstanceServiceManager.sol +5 -8
- package/contracts/instance/ObjectManager.sol +7 -24
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/module/IAccess.sol +27 -18
- package/contracts/instance/module/ISetup.sol +5 -4
- 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 +212 -26
- package/contracts/instance/service/DistributionServiceManager.sol +6 -9
- 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 +2 -33
- package/contracts/instance/service/IProductService.sol +2 -72
- package/contracts/instance/service/PolicyService.sol +524 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +34 -212
- package/contracts/instance/service/PoolServiceManager.sol +5 -8
- package/contracts/instance/service/ProductService.sol +123 -460
- package/contracts/registry/ChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +37 -19
- package/contracts/registry/IRegistryService.sol +28 -13
- package/contracts/registry/Registry.sol +231 -217
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +65 -162
- 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 +113 -57
- 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 +18 -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/ObjectType.sol +6 -2
- package/contracts/types/RoleId.sol +10 -10
- package/package.json +3 -3
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -368
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
- 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/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
- 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 -132
- package/contracts/components/IBaseComponent.sol +0 -31
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +0 -23
- package/contracts/instance/IAccessManagerSimple.sol +0 -391
- package/contracts/instance/IInstanceBase.sol +0 -26
- package/contracts/instance/InstanceBase.sol +0 -41
- package/contracts/instance/base/ComponentServiceBase.sol +0 -134
- 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,15 +1,27 @@
|
|
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() {
|
@@ -19,67 +31,100 @@ contract NftOwnable is INftOwnable {
|
|
19
31
|
_;
|
20
32
|
}
|
21
33
|
|
22
|
-
|
23
|
-
|
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);
|
24
60
|
}
|
25
61
|
|
62
|
+
|
26
63
|
/// @dev links this contract to nft after registration
|
27
64
|
// needs to be done once per registered contract and
|
28
65
|
// reduces registry calls to check ownership
|
29
66
|
// does not need any protection as function can only do the "right thing"
|
30
|
-
function linkToRegisteredNftId()
|
31
|
-
|
32
|
-
|
67
|
+
function linkToRegisteredNftId()
|
68
|
+
public
|
69
|
+
virtual
|
70
|
+
{
|
71
|
+
NftOwnableStorage storage $ = _getNftOwnableStorage();
|
72
|
+
|
73
|
+
if ($._nftId.gtz()) {
|
74
|
+
revert ErrorAlreadyLinked(address(getRegistry()), $._nftId);
|
33
75
|
}
|
34
76
|
|
35
|
-
if (address(
|
77
|
+
if (address(getRegistry()) == address(0)) {
|
36
78
|
revert ErrorRegistryNotInitialized();
|
37
79
|
}
|
38
80
|
|
39
81
|
address contractAddress = address(this);
|
40
82
|
|
41
|
-
if (!
|
83
|
+
if (!getRegistry().isRegistered(contractAddress)) {
|
42
84
|
revert ErrorContractNotRegistered(contractAddress);
|
43
85
|
}
|
44
86
|
|
45
|
-
_nftId =
|
87
|
+
$._nftId = getRegistry().getNftId(contractAddress);
|
46
88
|
}
|
47
89
|
|
48
90
|
|
49
|
-
function getRegistry() public view virtual override returns (IRegistry) {
|
50
|
-
|
51
|
-
}
|
52
|
-
|
91
|
+
// function getRegistry() public view virtual override returns (IRegistry) {
|
92
|
+
// return _getNftOwnableStorage()._registry;
|
93
|
+
// }
|
53
94
|
|
54
95
|
function getNftId() public view virtual override returns (NftId) {
|
55
|
-
return _nftId;
|
96
|
+
return _getNftOwnableStorage()._nftId;
|
56
97
|
}
|
57
98
|
|
99
|
+
function getInitialOwner() public view returns (address) {
|
100
|
+
return _getNftOwnableStorage()._initialOwner;
|
101
|
+
}
|
58
102
|
|
59
103
|
function getOwner() public view virtual override returns (address) {
|
60
|
-
|
61
|
-
|
104
|
+
NftOwnableStorage storage $ = _getNftOwnableStorage();
|
105
|
+
|
106
|
+
if ($._nftId.gtz()) {
|
107
|
+
return getRegistry().ownerOf($._nftId);
|
62
108
|
}
|
63
109
|
|
64
|
-
return _initialOwner;
|
110
|
+
return $._initialOwner;
|
65
111
|
}
|
66
112
|
|
67
|
-
|
68
|
-
///
|
69
|
-
|
70
|
-
function _initializeNftOwnable(
|
71
|
-
address initialOwner,
|
72
|
-
address registryAddress
|
73
|
-
)
|
113
|
+
/// @dev set initialOwner
|
114
|
+
/// initial owner may only be set during initialization
|
115
|
+
function _setInitialOwner(address initialOwner)
|
74
116
|
internal
|
75
117
|
virtual
|
118
|
+
onlyInitializing()
|
76
119
|
{
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
}
|
120
|
+
if(initialOwner == address(0)) {
|
121
|
+
revert ErrorInitialOwnerZero();
|
122
|
+
}
|
81
123
|
|
124
|
+
_getNftOwnableStorage()._initialOwner = initialOwner;
|
125
|
+
}
|
82
126
|
|
127
|
+
// TODO check if function can be refactored to work with a registry address set in an initializer
|
83
128
|
/// @dev used in constructor of registry service manager
|
84
129
|
// links ownership of registry service manager ot nft owner of registry service
|
85
130
|
function _linkToNftOwnable(
|
@@ -90,45 +135,56 @@ contract NftOwnable is INftOwnable {
|
|
90
135
|
onlyOwner()
|
91
136
|
returns (NftId)
|
92
137
|
{
|
93
|
-
|
94
|
-
|
138
|
+
NftOwnableStorage storage $ = _getNftOwnableStorage();
|
139
|
+
|
140
|
+
if ($._nftId.gtz()) {
|
141
|
+
revert ErrorAlreadyLinked(address(getRegistry()), $._nftId);
|
95
142
|
}
|
96
143
|
|
97
144
|
_setRegistry(registryAddress);
|
98
145
|
|
99
|
-
if (!
|
146
|
+
if (!getRegistry().isRegistered(nftOwnableAddress)) {
|
100
147
|
revert ErrorContractNotRegistered(nftOwnableAddress);
|
101
148
|
}
|
102
149
|
|
103
|
-
_nftId =
|
150
|
+
$._nftId = getRegistry().getNftId(nftOwnableAddress);
|
104
151
|
|
105
|
-
return _nftId;
|
152
|
+
return $._nftId;
|
106
153
|
}
|
107
154
|
|
108
155
|
|
109
|
-
function _setRegistry(address registryAddress)
|
110
|
-
|
111
|
-
{
|
112
|
-
|
113
|
-
revert ErrorRegistryAlreadyInitialized(address(_registry));
|
114
|
-
}
|
156
|
+
// function _setRegistry(address registryAddress)
|
157
|
+
// private
|
158
|
+
// {
|
159
|
+
// NftOwnableStorage storage $ = _getNftOwnableStorage();
|
115
160
|
|
116
|
-
|
117
|
-
|
118
|
-
|
161
|
+
// if (address($._registry) != address(0)) {
|
162
|
+
// revert ErrorRegistryAlreadyInitialized(address($._registry));
|
163
|
+
// }
|
119
164
|
|
120
|
-
|
121
|
-
|
122
|
-
|
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
|
+
// }
|
123
183
|
|
124
|
-
_registry = IRegistry(registryAddress);
|
125
184
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
}
|
130
|
-
} catch {
|
131
|
-
revert ErrorNotRegistry(registryAddress);
|
185
|
+
function _getNftOwnableStorage() private pure returns (NftOwnableStorage storage $) {
|
186
|
+
assembly {
|
187
|
+
$.slot := NFT_OWNABLE_STORAGE_LOCATION_V1
|
132
188
|
}
|
133
189
|
}
|
134
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,21 +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
|
-
|
43
|
+
public
|
39
44
|
virtual
|
40
|
-
|
45
|
+
onlyInitializing()
|
41
46
|
{
|
42
47
|
// service must provide its name and version upon registration
|
43
|
-
bytes memory data = abi.encode(
|
48
|
+
bytes memory data = abi.encode(getDomain(), getMajorVersion());
|
44
49
|
NftId registryNftId = _getRegistryNftId(registry);
|
45
50
|
bool isInterceptor = false;
|
46
51
|
|
47
|
-
|
48
|
-
|
52
|
+
initializeRegisterable(registry, registryNftId, SERVICE(), isInterceptor, initialOwner, data);
|
53
|
+
registerInterface(type(IService).interfaceId);
|
49
54
|
}
|
50
55
|
|
51
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
|
@@ -66,7 +66,7 @@ function DISTRIBUTION() pure returns (ObjectType) {
|
|
66
66
|
return toObjectType(120);
|
67
67
|
}
|
68
68
|
|
69
|
-
function
|
69
|
+
function DISTRIBUTOR_TYPE() pure returns (ObjectType) {
|
70
70
|
return toObjectType(121);
|
71
71
|
}
|
72
72
|
|
@@ -90,10 +90,14 @@ function RISK() pure returns (ObjectType) {
|
|
90
90
|
return toObjectType(200);
|
91
91
|
}
|
92
92
|
|
93
|
-
function
|
93
|
+
function APPLICATION() pure returns (ObjectType) {
|
94
94
|
return toObjectType(210);
|
95
95
|
}
|
96
96
|
|
97
|
+
function POLICY() pure returns (ObjectType) {
|
98
|
+
return toObjectType(211);
|
99
|
+
}
|
100
|
+
|
97
101
|
function BUNDLE() pure returns (ObjectType) {
|
98
102
|
return toObjectType(220);
|
99
103
|
}
|