@etherisc/gif-next 0.0.2-743affe-003 → 0.0.2-771d9e9-515
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 +108 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +116 -2
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +204 -31
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +106 -3
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +0 -191
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +0 -225
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +0 -216
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +245 -65
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +314 -41
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +66 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +24 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +42 -0
- 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/SM.sol/SM.json +2 -2
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
- 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/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.json +101 -0
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +1132 -0
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +4 -0
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +1082 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +325 -1744
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +480 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +2300 -1340
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +917 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1388 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +891 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +492 -0
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +149 -2
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +27 -158
- 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 +37 -245
- 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 +4 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +211 -0
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{bundle/IBundle.sol → IBundle.sol}/IBundle.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{distribution/IDistribution.sol → IDistribution.sol}/IDistribution.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{policy/IPolicy.sol → IPolicy.sol}/IPolicy.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{risk/IRisk.sol → IRisk.sol}/IRisk.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +4 -0
- package/artifacts/contracts/instance/{base/ModuleBase.sol/ModuleBase.json → module/ISetup.sol/ISetup.json} +2 -2
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{treasury/ITreasury.sol → ITreasury.sol}/ITreasury.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +178 -41
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +212 -22
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +448 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +81 -4
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +80 -3
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +80 -3
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +80 -3
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +230 -24
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +460 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +47 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +293 -111
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +203 -18
- 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 +262 -150
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +416 -40
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +525 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +410 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.json +107 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
- package/artifacts/contracts/{instance/module/component/ComponentModule.sol/ComponentModule.json → shared/INftOwnable.sol/INftOwnable.json} +67 -57
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +80 -3
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/{instance/base/ServiceBase.sol/ServiceBase.json → shared/IService.sol/IService.json} +76 -35
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +158 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +121 -82
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +120 -6
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +4 -0
- package/artifacts/contracts/{instance/base/IService.sol/IService.json → shared/RegisterableUpgradable.sol/RegisterableUpgradable.json} +137 -39
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
- package/artifacts/contracts/{instance/base/InstanceBase.sol/InstanceBase.json → shared/Service.sol/Service.json} +106 -94
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +96 -0
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +4 -4
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +120 -6
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +14 -14
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +142 -14
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +91 -53
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +18 -2
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.json +91 -53
- 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 +4 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +4 -4
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +31 -17
- 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 +4 -0
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +100 -0
- 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 +4 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +123 -0
- 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 +134 -8
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +15 -2
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/{UFixedMathLib.json → UFixedLib.json} +3 -3
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
- package/contracts/components/BaseComponent.sol +16 -4
- package/contracts/components/Distribution.sol +21 -16
- package/contracts/components/IBaseComponent.sol +9 -3
- package/contracts/components/IDistributionComponent.sol +3 -6
- package/contracts/components/IPoolComponent.sol +1 -4
- package/contracts/components/IProductComponent.sol +3 -7
- package/contracts/components/Pool.sol +24 -27
- package/contracts/components/Product.sol +44 -46
- package/contracts/experiment/cloning/Cloner.sol +47 -0
- package/contracts/instance/AccessManagedSimple.sol +115 -0
- package/contracts/instance/AccessManagerSimple.sol +692 -0
- package/contracts/instance/IAccessManagerSimple.sol +391 -0
- package/contracts/instance/IInstance.sol +32 -47
- package/contracts/instance/IInstanceService.sol +30 -0
- package/contracts/instance/Instance.sol +423 -65
- package/contracts/instance/InstanceAccessManager.sol +288 -0
- package/contracts/instance/InstanceReader.sol +306 -0
- package/contracts/instance/InstanceService.sol +182 -0
- package/contracts/instance/InstanceServiceManager.sol +56 -0
- package/contracts/instance/base/ComponentServiceBase.sol +77 -8
- package/contracts/instance/base/IKeyValueStore.sol +13 -14
- package/contracts/instance/base/ILifecycle.sol +3 -3
- package/contracts/instance/base/KeyValueStore.sol +49 -38
- package/contracts/instance/base/Lifecycle.sol +1 -1
- package/contracts/instance/module/IAccess.sol +38 -0
- package/contracts/instance/module/IBundle.sol +20 -0
- package/contracts/instance/module/IDistribution.sol +39 -0
- package/contracts/instance/module/IPolicy.sol +45 -0
- package/contracts/instance/module/IRisk.sol +11 -0
- package/contracts/instance/module/ISetup.sol +44 -0
- package/contracts/instance/module/ITreasury.sol +23 -0
- package/contracts/instance/service/ComponentOwnerService.sol +145 -100
- package/contracts/instance/service/DistributionService.sol +48 -15
- package/contracts/instance/service/DistributionServiceManager.sol +53 -0
- package/contracts/instance/service/IComponentOwnerService.sol +1 -1
- package/contracts/instance/service/IDistributionService.sol +1 -1
- package/contracts/instance/service/IPoolService.sol +1 -1
- package/contracts/instance/service/IProductService.sol +3 -3
- package/contracts/instance/service/PoolService.sol +96 -52
- package/contracts/instance/service/PoolServiceManager.sol +53 -0
- package/contracts/registry/ChainNft.sol +40 -25
- package/contracts/registry/IRegistry.sol +47 -28
- package/contracts/registry/IRegistryService.sol +16 -12
- package/contracts/registry/Registry.sol +174 -190
- package/contracts/registry/RegistryService.sol +172 -156
- package/contracts/registry/RegistryServiceManager.sol +80 -0
- package/contracts/registry/TokenRegistry.sol +111 -0
- package/contracts/shared/ContractDeployerLib.sol +72 -0
- package/contracts/shared/ERC165.sol +7 -3
- package/contracts/shared/INftOwnable.sol +22 -0
- package/contracts/shared/IRegisterable.sol +3 -8
- package/contracts/{instance/base → shared}/IService.sol +3 -3
- package/contracts/shared/NftOwnable.sol +136 -0
- package/contracts/shared/ProxyManager.sol +16 -37
- package/contracts/shared/Registerable.sol +15 -42
- package/contracts/shared/RegisterableUpgradable.sol +16 -0
- package/contracts/shared/Service.sol +55 -0
- package/contracts/shared/TokenHandler.sol +27 -0
- package/contracts/shared/UpgradableProxyWithAdmin.sol +2 -2
- package/contracts/shared/Versionable.sol +3 -3
- package/contracts/test/TestFee.sol +2 -2
- package/contracts/test/TestRoleId.sol +1 -1
- package/contracts/test/TestService.sol +3 -5
- package/contracts/types/DistributorType.sol +55 -0
- package/contracts/types/Fee.sol +3 -3
- package/contracts/types/Key32.sol +8 -3
- package/contracts/types/NumberId.sol +52 -0
- package/contracts/types/ObjectType.sol +35 -14
- package/contracts/types/Referral.sol +85 -0
- package/contracts/types/RoleId.sol +60 -9
- package/contracts/types/StateId.sol +5 -1
- package/contracts/types/Timestamp.sol +7 -3
- package/contracts/types/UFixed.sol +128 -12
- package/contracts/types/Version.sol +4 -1
- package/package.json +4 -3
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.json +0 -24
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.json +0 -333
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.json +0 -10
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.json +0 -333
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +0 -297
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +0 -297
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.json +0 -10
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.json +0 -117
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.json +0 -10
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.dbg.json +0 -4
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.json +0 -10
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +0 -284
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +0 -284
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.json +0 -10
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +0 -164
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +0 -164
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.json +0 -113
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +0 -131
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +0 -638
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +0 -76
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +0 -638
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +0 -964
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +0 -457
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.json +0 -24
- package/artifacts/contracts/registry/RegistryInstaller.sol/RegistryInstaller.dbg.json +0 -4
- package/artifacts/contracts/registry/RegistryInstaller.sol/RegistryInstaller.json +0 -344
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +0 -4
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.json +0 -24
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.dbg.json +0 -4
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +0 -445
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +0 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +0 -602
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +0 -4
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +0 -632
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.json +0 -99
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/contracts/instance/IInstanceLinked.sol +0 -8
- package/contracts/instance/base/InstanceBase.sol +0 -89
- package/contracts/instance/base/ModuleBase.sol +0 -57
- package/contracts/instance/base/ServiceBase.sol +0 -43
- package/contracts/instance/module/access/Access.sol +0 -149
- package/contracts/instance/module/access/IAccess.sol +0 -53
- package/contracts/instance/module/bundle/BundleModule.sol +0 -134
- package/contracts/instance/module/bundle/IBundle.sol +0 -53
- package/contracts/instance/module/component/ComponentModule.sol +0 -71
- package/contracts/instance/module/component/IComponent.sol +0 -28
- package/contracts/instance/module/distribution/DistributionModule.sol +0 -17
- package/contracts/instance/module/distribution/IDistribution.sol +0 -10
- package/contracts/instance/module/policy/IPolicy.sol +0 -63
- package/contracts/instance/module/policy/PolicyModule.sol +0 -91
- package/contracts/instance/module/pool/IPoolModule.sol +0 -41
- package/contracts/instance/module/pool/PoolModule.sol +0 -95
- package/contracts/instance/module/risk/IRisk.sol +0 -26
- package/contracts/instance/module/risk/RiskModule.sol +0 -62
- package/contracts/instance/module/treasury/ITreasury.sol +0 -84
- package/contracts/instance/module/treasury/TokenHandler.sol +0 -48
- package/contracts/instance/module/treasury/TreasuryModule.sol +0 -131
- package/contracts/instance/service/ProductService.sol +0 -509
- package/contracts/registry/IChainNft.sol +0 -22
- package/contracts/registry/IRegistryLinked.sol +0 -8
- package/contracts/registry/RegistryInstaller.sol +0 -100
- package/contracts/shared/IOwnable.sol +0 -6
- package/contracts/test/TestDistribution.sol +0 -22
- package/contracts/test/TestPool.sol +0 -27
- package/contracts/test/TestProduct.sol +0 -74
- package/contracts/types/ReferralId.sol +0 -48
@@ -1,15 +1,15 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
4
|
+
import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
|
5
|
+
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
5
6
|
|
6
|
-
import {IRegistry} from "
|
7
|
+
import {IRegistry} from "./IRegistry.sol";
|
7
8
|
import {IInstance} from "../instance/IInstance.sol";
|
8
9
|
|
9
|
-
|
10
|
-
//import {
|
11
|
-
import {
|
12
|
-
import {IPool} from "../../contracts/instance/module/pool/IPoolModule.sol";
|
10
|
+
import {ContractDeployerLib} from "../shared/ContractDeployerLib.sol";
|
11
|
+
// import {IComponent, IComponentModule} from "../../contracts/instance/module/component/IComponent.sol";
|
12
|
+
// import {IPool} from "../../contracts/instance/module/pool/IPoolModule.sol";
|
13
13
|
import {IBaseComponent} from "../../contracts/components/IBaseComponent.sol";
|
14
14
|
import {IPoolComponent} from "../../contracts/components/IPoolComponent.sol";
|
15
15
|
import {IProductComponent} from "../../contracts/components/IProductComponent.sol";
|
@@ -20,153 +20,168 @@ import {Versionable} from "../../contracts/shared/Versionable.sol";
|
|
20
20
|
import {IRegisterable} from "../../contracts/shared/IRegisterable.sol";
|
21
21
|
|
22
22
|
import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, ORACLE_OWNER_ROLE} from "../../contracts/types/RoleId.sol";
|
23
|
-
import {ObjectType, REGISTRY,
|
23
|
+
import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, POLICY, BUNDLE} from "../../contracts/types/ObjectType.sol";
|
24
24
|
import {StateId, ACTIVE, PAUSED} from "../../contracts/types/StateId.sol";
|
25
25
|
import {NftId, NftIdLib, zeroNftId} from "../../contracts/types/NftId.sol";
|
26
26
|
import {Fee, FeeLib} from "../../contracts/types/Fee.sol";
|
27
27
|
import {Version, VersionPart, VersionLib} from "../../contracts/types/Version.sol";
|
28
|
-
//import {UFixed, UFixedMathLib} from "../../contracts/types/UFixed.sol";
|
29
28
|
|
30
|
-
|
31
|
-
import {
|
32
|
-
import {IService} from "../../contracts/instance/base/IService.sol";
|
29
|
+
import {Service} from "../shared/Service.sol";
|
30
|
+
import {IService} from "../shared/IService.sol";
|
33
31
|
import {IRegistryService} from "./IRegistryService.sol";
|
34
|
-
import {Registry} from "
|
32
|
+
import {Registry} from "./Registry.sol";
|
33
|
+
import {ChainNft} from "./ChainNft.sol";
|
35
34
|
|
36
35
|
contract RegistryService is
|
37
|
-
|
36
|
+
AccessManagedUpgradeable,
|
37
|
+
Service,
|
38
38
|
IRegistryService
|
39
39
|
{
|
40
40
|
using NftIdLib for NftId;
|
41
41
|
|
42
|
+
// TODO move errors to interface contract
|
43
|
+
error SelfRegistration();
|
42
44
|
error NotRegistryOwner();
|
43
|
-
error MissingAllowance();
|
44
45
|
|
45
|
-
error NotToken();
|
46
46
|
error NotService();
|
47
|
-
error NotComponent();
|
48
47
|
error NotInstance();
|
49
|
-
|
50
|
-
error
|
48
|
+
error NotProduct();
|
49
|
+
error NotPool();
|
50
|
+
error NotDistribution();
|
51
|
+
|
52
|
+
error UnexpectedRegisterableType(ObjectType expected, ObjectType found);
|
53
|
+
error NotRegisterableOwner(address expectedOwner);
|
54
|
+
error RegisterableOwnerIsZero();
|
55
|
+
error RegisterableOwnerIsRegistered();
|
51
56
|
error InvalidInitialOwner(address initialOwner);
|
52
|
-
error
|
53
|
-
error InvalidType(ObjectType objectType);
|
57
|
+
error InvalidAddress(address registerableAddress);
|
54
58
|
|
59
|
+
// Initial value for constant variable has to be compile-time constant
|
60
|
+
// TODO define types as constants?
|
61
|
+
//ObjectType public constant SERVICE_TYPE = REGISTRY();
|
55
62
|
string public constant NAME = "RegistryService";
|
56
63
|
|
57
|
-
|
64
|
+
// TODO update to real hash when registry is stable
|
65
|
+
bytes32 public constant REGISTRY_CREATION_CODE_HASH = bytes32(0);
|
58
66
|
|
59
|
-
address constant
|
67
|
+
address public constant NFT_LOCK_ADDRESS = address(0x1);
|
60
68
|
|
61
69
|
/// @dev
|
62
70
|
// msg.sender - ONLY registry owner
|
63
|
-
// CAN register ANY non IRegisterable address
|
64
|
-
// CAN register ONLY valid object-parent types combinations for TOKEN
|
65
71
|
// CAN NOT register itself
|
66
|
-
//
|
67
|
-
//
|
68
|
-
//
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
72
|
+
// CAN register ONLY valid object-parent types combinations for SERVICE
|
73
|
+
// CAN register ONLY IRegisterable address he owns
|
74
|
+
// IMPORTANT: MUST NOT check owner before calling external contract
|
75
|
+
function registerService(IService service)
|
76
|
+
external
|
77
|
+
// TODO restrict access - registryService.registerService must use accessmanager for checking permissions as
|
78
|
+
// services are not always owned by registry owner - actually only registry service is owned by registry owner
|
79
|
+
|
80
|
+
returns(
|
81
|
+
IRegistry.ObjectInfo memory info,
|
82
|
+
bytes memory data
|
83
|
+
)
|
73
84
|
{
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
try registerable.supportsInterface(type(IRegisterable).interfaceId) returns(bool result) {
|
79
|
-
isRegisterable = result;
|
80
|
-
} catch {
|
81
|
-
isRegisterable = false;
|
85
|
+
|
86
|
+
// CAN revert if no ERC165 support -> will revert with empty message
|
87
|
+
if(!service.supportsInterface(type(IService).interfaceId)) {
|
88
|
+
revert NotService();
|
82
89
|
}
|
83
90
|
|
84
|
-
|
85
|
-
|
86
|
-
|
91
|
+
(
|
92
|
+
info,
|
93
|
+
data
|
94
|
+
) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
87
95
|
|
88
|
-
|
96
|
+
info.nftId = _registry.register(info);
|
97
|
+
service.linkToRegisteredNftId();
|
98
|
+
return (
|
99
|
+
info,
|
100
|
+
data
|
101
|
+
);
|
102
|
+
}
|
89
103
|
|
90
|
-
|
91
|
-
|
104
|
+
// If msg.sender is approved service:
|
105
|
+
// 1) add owner arg (service MUST pass it's msg.sender as owner)
|
106
|
+
// 2) check service allowance
|
107
|
+
// 3) comment self registrstion check
|
108
|
+
//function registerInstance(IRegisterable instance, address owner)
|
109
|
+
function registerInstance(IRegisterable instance)
|
110
|
+
external
|
111
|
+
returns(
|
112
|
+
IRegistry.ObjectInfo memory info,
|
113
|
+
bytes memory data
|
114
|
+
)
|
115
|
+
{
|
116
|
+
if(!instance.supportsInterface(type(IInstance).interfaceId)) {
|
117
|
+
revert NotInstance();
|
92
118
|
}
|
93
119
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
false, // isInterceptor
|
99
|
-
tokenAddress,
|
100
|
-
NFT_LOCK_ADDRESS,
|
101
|
-
"" // any value
|
102
|
-
);
|
120
|
+
(
|
121
|
+
info,
|
122
|
+
data
|
123
|
+
) = _getAndVerifyContractInfo(instance, INSTANCE(), msg.sender);
|
103
124
|
|
104
|
-
nftId =
|
125
|
+
info.nftId = _registry.register(info);
|
126
|
+
instance.linkToRegisteredNftId(); // asume safe
|
127
|
+
|
128
|
+
return (
|
129
|
+
info,
|
130
|
+
data
|
131
|
+
);
|
105
132
|
}
|
106
133
|
|
107
|
-
|
108
|
-
// msg.sender - ONLY registry owner
|
109
|
-
// CAN register ONLY valid object-parent types combinations for SERVICE
|
110
|
-
// CAN register ONLY IRegisterable address he owns
|
111
|
-
// CAN NOT register itself
|
112
|
-
// IMPORTANT: MUST NOT check owner before calling external contract
|
113
|
-
function registerService(IService service)
|
134
|
+
function registerProduct(IBaseComponent product, address owner)
|
114
135
|
external
|
136
|
+
restricted
|
115
137
|
returns(
|
116
138
|
IRegistry.ObjectInfo memory info,
|
117
139
|
bytes memory data
|
118
140
|
)
|
119
141
|
{
|
120
|
-
if
|
121
|
-
|
122
|
-
|
142
|
+
// CAN revert if no ERC165 support -> will revert with empty message
|
143
|
+
if(!product.supportsInterface(type(IProductComponent).interfaceId)) {
|
144
|
+
revert NotProduct();
|
145
|
+
}
|
123
146
|
|
124
147
|
(
|
125
148
|
info,
|
126
149
|
data
|
127
|
-
) = _getAndVerifyContractInfo(
|
128
|
-
|
129
|
-
IRegistry registry = getRegistry();
|
150
|
+
) = _getAndVerifyContractInfo(product, PRODUCT(), owner);
|
130
151
|
|
131
|
-
|
132
|
-
revert NotRegistryOwner();
|
133
|
-
}
|
152
|
+
NftId serviceNftId = _registry.getNftId(msg.sender);
|
134
153
|
|
135
|
-
info.
|
136
|
-
|
154
|
+
info.nftId = _registry.register(info);
|
155
|
+
// TODO unsafe, let component or its owner derive nftId latter, when state assumptions and modifications of GIF contracts are finished
|
156
|
+
product.linkToRegisteredNftId();
|
137
157
|
|
138
158
|
return (
|
139
159
|
info,
|
140
160
|
data
|
141
|
-
);
|
161
|
+
);
|
142
162
|
}
|
143
163
|
|
144
|
-
|
145
|
-
//function registerComponent(IBaseComponent component, ObjectType componentType)
|
146
|
-
function registerComponent(IBaseComponent component, ObjectType componentType, address owner)
|
164
|
+
function registerPool(IBaseComponent pool, address owner)
|
147
165
|
external
|
166
|
+
restricted
|
148
167
|
returns(
|
149
168
|
IRegistry.ObjectInfo memory info,
|
150
169
|
bytes memory data
|
151
170
|
)
|
152
171
|
{
|
153
|
-
if(
|
154
|
-
revert
|
172
|
+
if(!pool.supportsInterface(type(IPoolComponent).interfaceId)) {
|
173
|
+
revert NotPool();
|
155
174
|
}
|
156
175
|
|
157
176
|
(
|
158
177
|
info,
|
159
178
|
data
|
160
|
-
) = _getAndVerifyContractInfo(
|
161
|
-
|
162
|
-
IRegistry registry = getRegistry();
|
163
|
-
NftId serviceNftId = registry.getNftId(msg.sender);
|
179
|
+
) = _getAndVerifyContractInfo(pool, POOL(), owner);
|
164
180
|
|
165
|
-
|
166
|
-
revert MissingAllowance();
|
167
|
-
}
|
181
|
+
NftId serviceNftId = _registry.getNftId(msg.sender);
|
168
182
|
|
169
|
-
info.nftId =
|
183
|
+
info.nftId = _registry.register(info);
|
184
|
+
pool.linkToRegisteredNftId();
|
170
185
|
|
171
186
|
return (
|
172
187
|
info,
|
@@ -174,75 +189,67 @@ contract RegistryService is
|
|
174
189
|
);
|
175
190
|
}
|
176
191
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
external
|
192
|
+
function registerDistribution(IBaseComponent distribution, address owner)
|
193
|
+
external
|
194
|
+
restricted
|
181
195
|
returns(
|
182
196
|
IRegistry.ObjectInfo memory info,
|
183
197
|
bytes memory data
|
184
198
|
)
|
185
199
|
{
|
186
|
-
if(
|
187
|
-
revert
|
200
|
+
if(!distribution.supportsInterface(type(IDistributionComponent).interfaceId)) {
|
201
|
+
revert NotDistribution();
|
188
202
|
}
|
189
203
|
|
190
204
|
(
|
191
205
|
info,
|
192
206
|
data
|
193
|
-
) = _getAndVerifyContractInfo(
|
207
|
+
) = _getAndVerifyContractInfo(distribution, DISTRIBUTION(), owner);
|
194
208
|
|
195
|
-
|
209
|
+
NftId serviceNftId = _registry.getNftId(msg.sender);
|
196
210
|
|
197
|
-
|
198
|
-
|
199
|
-
//}
|
211
|
+
info.nftId = _registry.register(info);
|
212
|
+
distribution.linkToRegisteredNftId();
|
200
213
|
|
201
|
-
info.nftId = registry.register(info);
|
202
|
-
|
203
214
|
return (
|
204
215
|
info,
|
205
|
-
data
|
206
|
-
);
|
216
|
+
data
|
217
|
+
);
|
207
218
|
}
|
208
219
|
|
209
220
|
function registerPolicy(IRegistry.ObjectInfo memory info)
|
210
|
-
external
|
221
|
+
external
|
222
|
+
restricted
|
211
223
|
returns(NftId nftId)
|
212
224
|
{
|
213
|
-
|
214
|
-
NftId senderNftId = registry.getNftId(msg.sender);
|
215
|
-
|
216
|
-
if(registry.allowance(senderNftId, POLICY()) == false) {
|
217
|
-
revert MissingAllowance();
|
218
|
-
}
|
225
|
+
NftId senderNftId = _registry.getNftId(msg.sender);
|
219
226
|
|
220
227
|
_verifyObjectInfo(info, POLICY());
|
221
228
|
|
222
|
-
nftId =
|
229
|
+
nftId = _registry.register(info);
|
223
230
|
}
|
224
231
|
|
225
232
|
function registerBundle(IRegistry.ObjectInfo memory info)
|
226
|
-
external
|
233
|
+
external
|
234
|
+
restricted
|
227
235
|
returns(NftId nftId)
|
228
236
|
{
|
229
|
-
IRegistry registry = getRegistry();
|
230
|
-
NftId senderNftId = registry.getNftId(msg.sender);
|
231
237
|
|
232
|
-
|
233
|
-
revert MissingAllowance();
|
234
|
-
}
|
238
|
+
NftId senderNftId = _registry.getNftId(msg.sender);
|
235
239
|
|
236
240
|
_verifyObjectInfo(info, BUNDLE());
|
237
241
|
|
238
|
-
nftId =
|
242
|
+
nftId = _registry.register(info);
|
239
243
|
}
|
240
244
|
|
241
245
|
|
242
246
|
// From IService
|
243
|
-
function getName() public pure override(IService,
|
247
|
+
function getName() public pure override(IService, Service) returns(string memory) {
|
244
248
|
return NAME;
|
245
249
|
}
|
250
|
+
//function getType() public pure override(IService, ServiceBase) returns(ObjectType serviceType) {
|
251
|
+
// return SERVICE_TYPE;
|
252
|
+
//}
|
246
253
|
|
247
254
|
|
248
255
|
// from Versionable
|
@@ -252,47 +259,51 @@ contract RegistryService is
|
|
252
259
|
// 2) deploy registry service first -> from its initialization func it is easier to deploy registry then vice versa
|
253
260
|
// 3) deploy registry -> pass registry service address as constructor argument
|
254
261
|
// registry is getting instantiated and locked to registry service address forever
|
255
|
-
function _initialize(
|
262
|
+
function _initialize(
|
263
|
+
address owner,
|
264
|
+
bytes memory data
|
265
|
+
)
|
256
266
|
internal
|
257
267
|
initializer
|
258
268
|
virtual override
|
259
269
|
{
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
registryCreationCode,
|
265
|
-
abi.encode(
|
266
|
-
protocolOwner,
|
267
|
-
getMajorVersion()
|
268
|
-
)
|
269
|
-
);
|
270
|
+
(
|
271
|
+
address initialAuthority,
|
272
|
+
bytes memory registryByteCodeWithInitCode
|
273
|
+
) = abi.decode(data, (address, bytes));
|
270
274
|
|
271
|
-
|
275
|
+
__AccessManaged_init(initialAuthority);
|
272
276
|
|
273
|
-
|
274
|
-
|
277
|
+
bytes memory encodedConstructorArguments = abi.encode(
|
278
|
+
owner,
|
279
|
+
getMajorVersion());
|
275
280
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
}
|
281
|
+
bytes memory registryCreationCode = ContractDeployerLib.getCreationCode(
|
282
|
+
registryByteCodeWithInitCode,
|
283
|
+
encodedConstructorArguments);
|
280
284
|
|
281
|
-
IRegistry registry = IRegistry(
|
282
|
-
|
285
|
+
IRegistry registry = IRegistry(ContractDeployerLib.deploy(
|
286
|
+
registryCreationCode,
|
287
|
+
REGISTRY_CREATION_CODE_HASH));
|
283
288
|
|
284
|
-
|
289
|
+
NftId registryNftId = registry.getNftId(address(registry));
|
285
290
|
|
291
|
+
_initializeService(address(registry), owner);
|
292
|
+
|
293
|
+
// TODO why do registry service proxy need to keep its nftId??? -> no registryServiceNftId checks in implementation
|
294
|
+
// if they are -> use registry address to obtain owner of registry service nft (works the same with any registerable and(or) implementation)
|
295
|
+
linkToRegisteredNftId();
|
286
296
|
_registerInterface(type(IRegistryService).interfaceId);
|
287
297
|
}
|
288
298
|
|
289
299
|
// parent check done in registry because of approve()
|
290
300
|
function _getAndVerifyContractInfo(
|
291
301
|
IRegisterable registerable,
|
292
|
-
ObjectType
|
293
|
-
address
|
302
|
+
ObjectType expectedType, // assume can be valid only
|
303
|
+
address expectedOwner // assume can be 0
|
294
304
|
)
|
295
305
|
internal
|
306
|
+
view
|
296
307
|
returns(
|
297
308
|
IRegistry.ObjectInfo memory info,
|
298
309
|
bytes memory data
|
@@ -302,23 +313,33 @@ contract RegistryService is
|
|
302
313
|
info,
|
303
314
|
data
|
304
315
|
) = registerable.getInitialInfo();
|
316
|
+
info.objectAddress = address(registerable);
|
305
317
|
|
306
|
-
if(info.
|
307
|
-
revert
|
318
|
+
if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
|
319
|
+
revert UnexpectedRegisterableType(expectedType, info.objectType);
|
308
320
|
}
|
309
321
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
322
|
+
address owner = info.initialOwner;
|
323
|
+
|
324
|
+
// solhint-disable-next-line
|
325
|
+
if(expectedType == INSTANCE()) {
|
326
|
+
// any address may create a new instance via instance service
|
327
|
+
} else {
|
328
|
+
if(owner != expectedOwner) { // registerable owner protection
|
329
|
+
revert NotRegisterableOwner(expectedOwner);
|
330
|
+
}
|
314
331
|
}
|
315
332
|
|
316
|
-
if(
|
333
|
+
if(owner == address(registerable)) {
|
317
334
|
revert SelfRegistration();
|
318
335
|
}
|
336
|
+
|
337
|
+
if(owner == address(0)) {
|
338
|
+
revert RegisterableOwnerIsZero();
|
339
|
+
}
|
319
340
|
|
320
|
-
if(
|
321
|
-
revert
|
341
|
+
if(getRegistry().isRegistered(owner)) {
|
342
|
+
revert RegisterableOwnerIsRegistered();
|
322
343
|
}
|
323
344
|
|
324
345
|
/*NftId parentNftId = info.parentNftId;
|
@@ -368,11 +389,6 @@ contract RegistryService is
|
|
368
389
|
revert InitialOwnerIsRegistry();
|
369
390
|
}*/
|
370
391
|
|
371
|
-
|
372
|
-
if(info.objectType != objectType) {
|
373
|
-
revert InvalidType(info.objectType);
|
374
|
-
}
|
375
|
-
|
376
392
|
/*NftId parentNftId = info.parentNftId;
|
377
393
|
IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
|
378
394
|
|
@@ -380,4 +396,4 @@ contract RegistryService is
|
|
380
396
|
revert InvalidParent(parentNftId);
|
381
397
|
}*/
|
382
398
|
}
|
383
|
-
}
|
399
|
+
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
// SPDX-License-Identifier: UNLICENSED
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {AccessManager} from "@openzeppelin/contracts/access/manager/AccessManager.sol";
|
5
|
+
|
6
|
+
import {ContractDeployerLib} from "../shared/ContractDeployerLib.sol";
|
7
|
+
|
8
|
+
import {Registry} from "./Registry.sol";
|
9
|
+
import {IVersionable} from "../shared/IVersionable.sol";
|
10
|
+
import {ProxyManager} from "../shared/ProxyManager.sol";
|
11
|
+
import {RegistryService} from "./RegistryService.sol";
|
12
|
+
import {TokenRegistry} from "./TokenRegistry.sol";
|
13
|
+
|
14
|
+
|
15
|
+
contract RegistryServiceManager is
|
16
|
+
ProxyManager
|
17
|
+
{
|
18
|
+
bytes32 constant public ACCESS_MANAGER_CREATION_CODE_HASH = 0x0;
|
19
|
+
|
20
|
+
AccessManager private _accessManager;
|
21
|
+
RegistryService private _registryService;
|
22
|
+
TokenRegistry private _tokenRegistry;
|
23
|
+
|
24
|
+
/// @dev initializes proxy manager with registry service implementation and deploys registry
|
25
|
+
constructor(
|
26
|
+
address accessManager
|
27
|
+
)
|
28
|
+
ProxyManager()
|
29
|
+
{
|
30
|
+
_accessManager = AccessManager(accessManager);
|
31
|
+
|
32
|
+
bytes memory initializationData = abi.encode(accessManager, type(Registry).creationCode);
|
33
|
+
|
34
|
+
IVersionable versionable = deploy(
|
35
|
+
address(new RegistryService()),
|
36
|
+
initializationData);
|
37
|
+
|
38
|
+
_registryService = RegistryService(address(versionable));
|
39
|
+
|
40
|
+
// link ownership of registry service manager ot nft owner of registry service
|
41
|
+
_linkToNftOwnable(
|
42
|
+
address(_registryService.getRegistry()),
|
43
|
+
address(_registryService));
|
44
|
+
|
45
|
+
// deploy token registry
|
46
|
+
|
47
|
+
// _tokenRegistry = new TokenRegistry(
|
48
|
+
// address(_registryService.getRegistry()),
|
49
|
+
// address(_registryService));
|
50
|
+
|
51
|
+
// implies that after this constructor call only upgrade functionality is available
|
52
|
+
_isDeployed = true;
|
53
|
+
}
|
54
|
+
|
55
|
+
//--- view functions ----------------------------------------------------//
|
56
|
+
|
57
|
+
function getAccessManager()
|
58
|
+
external
|
59
|
+
view
|
60
|
+
returns (AccessManager)
|
61
|
+
{
|
62
|
+
return _accessManager;
|
63
|
+
}
|
64
|
+
|
65
|
+
function getRegistryService()
|
66
|
+
external
|
67
|
+
view
|
68
|
+
returns (RegistryService registryService)
|
69
|
+
{
|
70
|
+
return _registryService;
|
71
|
+
}
|
72
|
+
|
73
|
+
function getTokenRegistry()
|
74
|
+
external
|
75
|
+
view
|
76
|
+
returns (TokenRegistry)
|
77
|
+
{
|
78
|
+
return _tokenRegistry;
|
79
|
+
}
|
80
|
+
}
|