@etherisc/gif-next 0.0.2-743affe-003 → 0.0.2-770fd3b-604
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 +243 -2
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/Component.sol/Component.json +897 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +1140 -152
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/{registry/IChainNft.sol/IChainNft.json → components/IComponent.sol/IComponent.json} +291 -228
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +616 -9
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +533 -113
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +485 -45
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +1035 -271
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +919 -131
- 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/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +764 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +185 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1389 -1174
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/{base/ServiceBase.sol/ServiceBase.json → IInstanceService.sol/IInstanceService.json} +336 -42
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +2037 -1293
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +984 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1386 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +1260 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +610 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +261 -0
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +754 -0
- 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 +254 -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/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 +694 -44
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +602 -0
- 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} +293 -48
- 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 +309 -22
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +784 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +114 -86
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +108 -233
- 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 +414 -106
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +574 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +398 -355
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +574 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +47 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +231 -65
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +384 -53
- 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 +210 -206
- 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 +615 -125
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +601 -0
- 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 +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +531 -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 +41 -3
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +164 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/{instance/module/component/IComponent.sol/IComponentModule.json → shared/IPolicyHolder.sol/IPolicyHolder.json} +69 -57
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +98 -8
- 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 +4 -0
- package/artifacts/contracts/{instance/service/IComponentOwnerService.sol/IComponentOwnerService.json → shared/IService.sol/IService.json} +103 -58
- 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 +4 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +303 -0
- 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 +245 -56
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +266 -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 +4 -0
- package/artifacts/contracts/{instance/base/InstanceBase.sol/InstanceBase.json → shared/Service.sol/Service.json} +249 -78
- 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/shared/Versionable.sol/Versionable.json +2 -2
- 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 +266 -11
- 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 +320 -33
- 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 +24 -8
- 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 +26 -3
- 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/Component.sol +236 -0
- package/contracts/components/Distribution.sol +204 -61
- package/contracts/components/IComponent.sol +50 -0
- package/contracts/components/IDistributionComponent.sol +59 -6
- package/contracts/components/IPoolComponent.sol +54 -32
- package/contracts/components/IProductComponent.sol +8 -8
- package/contracts/components/Pool.sol +155 -147
- package/contracts/components/Product.sol +117 -138
- package/contracts/experiment/cloning/Cloner.sol +47 -0
- package/contracts/instance/BundleManager.sol +125 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +78 -46
- package/contracts/instance/IInstanceService.sol +59 -0
- package/contracts/instance/Instance.sol +263 -67
- package/contracts/instance/InstanceAccessManager.sol +297 -0
- package/contracts/instance/InstanceReader.sol +293 -0
- package/contracts/instance/InstanceService.sol +433 -0
- package/contracts/instance/InstanceServiceManager.sol +54 -0
- package/contracts/instance/ObjectManager.sol +84 -0
- package/contracts/instance/base/ComponentService.sol +134 -0
- 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 +47 -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 +47 -0
- package/contracts/instance/module/ITreasury.sol +23 -0
- 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 +241 -21
- package/contracts/instance/service/DistributionServiceManager.sol +51 -0
- package/contracts/instance/service/IApplicationService.sol +82 -0
- package/contracts/instance/service/IBundleService.sol +54 -0
- package/contracts/instance/service/IDistributionService.sol +54 -1
- package/contracts/instance/service/IPolicyService.sol +88 -0
- package/contracts/instance/service/IPoolService.sol +7 -24
- package/contracts/instance/service/IProductService.sol +9 -76
- package/contracts/instance/service/PolicyService.sol +524 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +77 -117
- package/contracts/instance/service/PoolServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +157 -433
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +41 -26
- package/contracts/registry/IRegistry.sol +55 -31
- package/contracts/registry/IRegistryService.sol +52 -16
- package/contracts/registry/Registry.sol +274 -317
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +138 -260
- package/contracts/registry/RegistryServiceManager.sol +62 -0
- package/contracts/registry/ReleaseManager.sol +332 -0
- package/contracts/registry/TokenRegistry.sol +113 -0
- package/contracts/shared/ContractDeployerLib.sol +72 -0
- package/contracts/shared/ERC165.sol +14 -9
- package/contracts/shared/INftOwnable.sol +28 -0
- package/contracts/shared/IPolicyHolder.sol +26 -0
- package/contracts/shared/IRegisterable.sol +5 -12
- package/contracts/shared/IRegistryLinked.sol +15 -0
- package/contracts/shared/IService.sol +16 -0
- package/contracts/shared/IVersionable.sol +2 -2
- package/contracts/shared/NftOwnable.sol +190 -0
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +21 -41
- package/contracts/shared/Registerable.sol +24 -60
- package/contracts/shared/RegistryLinked.sol +64 -0
- package/contracts/shared/Service.sol +60 -0
- package/contracts/shared/TokenHandler.sol +27 -0
- package/contracts/shared/UpgradableProxyWithAdmin.sol +2 -2
- package/contracts/shared/Versionable.sol +6 -5
- package/contracts/test/TestFee.sol +2 -2
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestRoleId.sol +1 -1
- package/contracts/test/TestService.sol +6 -7
- package/contracts/types/DistributorType.sol +55 -0
- package/contracts/types/Fee.sol +3 -3
- package/contracts/types/Key32.sol +8 -3
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/NumberId.sol +52 -0
- package/contracts/types/ObjectType.sol +40 -15
- package/contracts/types/Referral.sol +85 -0
- package/contracts/types/RoleId.sol +61 -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 +6 -5
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +0 -213
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -177
- 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/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/base/IService.sol/IService.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IService.sol/IService.json +0 -344
- 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/ComponentModule.sol/ComponentModule.json +0 -117
- 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/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/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -690
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
- 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/components/BaseComponent.sol +0 -79
- package/contracts/components/IBaseComponent.sol +0 -19
- package/contracts/instance/IInstanceLinked.sol +0 -8
- package/contracts/instance/base/ComponentServiceBase.sol +0 -49
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/base/IService.sol +0 -15
- 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/ComponentOwnerService.sol +0 -272
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- 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,16 +1,14 @@
|
|
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
|
-
|
11
|
-
import {IComponent, IComponentModule} from "../../contracts/instance/module/component/IComponent.sol";
|
12
|
-
import {IPool} from "../../contracts/instance/module/pool/IPoolModule.sol";
|
13
|
-
import {IBaseComponent} from "../../contracts/components/IBaseComponent.sol";
|
10
|
+
import {ContractDeployerLib} from "../shared/ContractDeployerLib.sol";
|
11
|
+
import {IComponent} from "../../contracts/components/IComponent.sol";
|
14
12
|
import {IPoolComponent} from "../../contracts/components/IPoolComponent.sol";
|
15
13
|
import {IProductComponent} from "../../contracts/components/IProductComponent.sol";
|
16
14
|
import {IDistributionComponent} from "../../contracts/components/IDistributionComponent.sol";
|
@@ -18,366 +16,246 @@ import {IDistributionComponent} from "../../contracts/components/IDistributionCo
|
|
18
16
|
import {IVersionable} from "../../contracts/shared/IVersionable.sol";
|
19
17
|
import {Versionable} from "../../contracts/shared/Versionable.sol";
|
20
18
|
import {IRegisterable} from "../../contracts/shared/IRegisterable.sol";
|
19
|
+
import {Registerable} from "../../contracts/shared/Registerable.sol";
|
21
20
|
|
22
21
|
import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, ORACLE_OWNER_ROLE} from "../../contracts/types/RoleId.sol";
|
23
|
-
import {ObjectType, REGISTRY,
|
22
|
+
import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, POLICY, BUNDLE, STAKE} from "../../contracts/types/ObjectType.sol";
|
24
23
|
import {StateId, ACTIVE, PAUSED} from "../../contracts/types/StateId.sol";
|
25
24
|
import {NftId, NftIdLib, zeroNftId} from "../../contracts/types/NftId.sol";
|
26
25
|
import {Fee, FeeLib} from "../../contracts/types/Fee.sol";
|
27
26
|
import {Version, VersionPart, VersionLib} from "../../contracts/types/Version.sol";
|
28
|
-
//import {UFixed, UFixedMathLib} from "../../contracts/types/UFixed.sol";
|
29
27
|
|
30
|
-
|
31
|
-
import {
|
32
|
-
import {IService} from "../../contracts/instance/base/IService.sol";
|
28
|
+
import {Service} from "../shared/Service.sol";
|
29
|
+
import {IService} from "../shared/IService.sol";
|
33
30
|
import {IRegistryService} from "./IRegistryService.sol";
|
34
|
-
import {Registry} from "
|
31
|
+
import {Registry} from "./Registry.sol";
|
35
32
|
|
36
33
|
contract RegistryService is
|
37
|
-
|
34
|
+
AccessManagedUpgradeable,
|
35
|
+
Service,
|
38
36
|
IRegistryService
|
39
37
|
{
|
40
38
|
using NftIdLib for NftId;
|
41
39
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
error NotToken();
|
46
|
-
error NotService();
|
47
|
-
error NotComponent();
|
48
|
-
error NotInstance();
|
49
|
-
|
50
|
-
error InvalidAddress(address registerableAddress);
|
51
|
-
error InvalidInitialOwner(address initialOwner);
|
52
|
-
error SelfRegistration();
|
53
|
-
error InvalidType(ObjectType objectType);
|
54
|
-
|
55
|
-
string public constant NAME = "RegistryService";
|
56
|
-
|
57
|
-
bytes32 public constant REGISTRY_CREATIONCODE_HASH = 0x7e569c7200a12c63728b648d78f84be7e32ef6804f9ee723e15363ce34d01251;
|
40
|
+
// TODO update to real hash when registry is stable
|
41
|
+
bytes32 public constant REGISTRY_CREATION_CODE_HASH = bytes32(0);
|
58
42
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
// CAN NOT register itself
|
66
|
-
// IMPORTANT: MUST NOT call untrusted contract inbetween calls to registry/instance (trusted contracts)
|
67
|
-
// motivation: registry/instance state may change during external call
|
68
|
-
// TODO it may be usefull to have transferable token nft in order to delist token, make it invalid for new beginings
|
69
|
-
// TODO: MUST prohibit registration of precompiles addresses
|
70
|
-
function registerToken(address tokenAddress)
|
71
|
-
external
|
72
|
-
returns(NftId nftId)
|
43
|
+
function registerInstance(IRegisterable instance, address owner)
|
44
|
+
external
|
45
|
+
restricted
|
46
|
+
returns(
|
47
|
+
IRegistry.ObjectInfo memory info
|
48
|
+
)
|
73
49
|
{
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
// registryOwner can not register IRegisterable as TOKEN
|
78
|
-
try registerable.supportsInterface(type(IRegisterable).interfaceId) returns(bool result) {
|
79
|
-
isRegisterable = result;
|
80
|
-
} catch {
|
81
|
-
isRegisterable = false;
|
50
|
+
if(!instance.supportsInterface(type(IInstance).interfaceId)) {
|
51
|
+
revert NotInstance();
|
82
52
|
}
|
83
53
|
|
84
|
-
|
85
|
-
|
86
|
-
}
|
87
|
-
|
88
|
-
IRegistry registry = getRegistry();
|
89
|
-
|
90
|
-
if(msg.sender != registry.ownerOf(address(registry))) {
|
91
|
-
revert NotRegistryOwner();
|
92
|
-
}
|
54
|
+
info = _getAndVerifyContractInfo(instance, INSTANCE(), owner);
|
55
|
+
info.nftId = getRegistry().register(info);
|
93
56
|
|
94
|
-
|
95
|
-
zeroNftId(), // any value
|
96
|
-
registry.getNftId(address(registry)),
|
97
|
-
TOKEN(),
|
98
|
-
false, // isInterceptor
|
99
|
-
tokenAddress,
|
100
|
-
NFT_LOCK_ADDRESS,
|
101
|
-
"" // any value
|
102
|
-
);
|
103
|
-
|
104
|
-
nftId = registry.register(info);
|
57
|
+
instance.linkToRegisteredNftId(); // asume safe
|
105
58
|
}
|
106
59
|
|
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)
|
60
|
+
function registerProduct(IComponent product, address owner)
|
114
61
|
external
|
62
|
+
restricted
|
115
63
|
returns(
|
116
|
-
IRegistry.ObjectInfo memory info
|
117
|
-
bytes memory data
|
64
|
+
IRegistry.ObjectInfo memory info
|
118
65
|
)
|
119
66
|
{
|
120
|
-
if
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
(
|
125
|
-
info,
|
126
|
-
data
|
127
|
-
) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
128
|
-
|
129
|
-
IRegistry registry = getRegistry();
|
130
|
-
|
131
|
-
if(msg.sender != registry.ownerOf(address(registry))) {
|
132
|
-
revert NotRegistryOwner();
|
67
|
+
// CAN revert if no ERC165 support -> will revert with empty message
|
68
|
+
if(!product.supportsInterface(type(IProductComponent).interfaceId)) {
|
69
|
+
revert NotProduct();
|
133
70
|
}
|
134
71
|
|
135
|
-
info
|
136
|
-
info.nftId =
|
137
|
-
|
138
|
-
return (
|
139
|
-
info,
|
140
|
-
data
|
141
|
-
);
|
72
|
+
info = _getAndVerifyContractInfo(product, PRODUCT(), owner);
|
73
|
+
info.nftId = getRegistry().register(info);
|
142
74
|
}
|
143
75
|
|
144
|
-
|
145
|
-
//function registerComponent(IBaseComponent component, ObjectType componentType)
|
146
|
-
function registerComponent(IBaseComponent component, ObjectType componentType, address owner)
|
76
|
+
function registerPool(IComponent pool, address owner)
|
147
77
|
external
|
78
|
+
restricted
|
148
79
|
returns(
|
149
|
-
IRegistry.ObjectInfo memory info
|
150
|
-
bytes memory data
|
80
|
+
IRegistry.ObjectInfo memory info
|
151
81
|
)
|
152
82
|
{
|
153
|
-
if(
|
154
|
-
revert
|
83
|
+
if(!pool.supportsInterface(type(IPoolComponent).interfaceId)) {
|
84
|
+
revert NotPool();
|
155
85
|
}
|
156
86
|
|
157
|
-
(
|
158
|
-
|
159
|
-
data
|
160
|
-
) = _getAndVerifyContractInfo(component, componentType, owner);
|
161
|
-
|
162
|
-
IRegistry registry = getRegistry();
|
163
|
-
NftId serviceNftId = registry.getNftId(msg.sender);
|
164
|
-
|
165
|
-
if(registry.allowance(serviceNftId, componentType) == false) {
|
166
|
-
revert MissingAllowance();
|
167
|
-
}
|
168
|
-
|
169
|
-
info.nftId = registry.register(info);
|
170
|
-
|
171
|
-
return (
|
172
|
-
info,
|
173
|
-
data
|
174
|
-
);
|
87
|
+
info = _getAndVerifyContractInfo(pool, POOL(), owner);
|
88
|
+
info.nftId = getRegistry().register(info);
|
175
89
|
}
|
176
90
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
external
|
91
|
+
function registerDistribution(IComponent distribution, address owner)
|
92
|
+
external
|
93
|
+
restricted
|
181
94
|
returns(
|
182
|
-
IRegistry.ObjectInfo memory info
|
183
|
-
bytes memory data
|
95
|
+
IRegistry.ObjectInfo memory info
|
184
96
|
)
|
185
97
|
{
|
186
|
-
if(
|
187
|
-
revert
|
98
|
+
if(!distribution.supportsInterface(type(IDistributionComponent).interfaceId)) {
|
99
|
+
revert NotDistribution();
|
188
100
|
}
|
189
101
|
|
190
|
-
(
|
191
|
-
|
192
|
-
data
|
193
|
-
) = _getAndVerifyContractInfo(instance, INSTANCE(), msg.sender);// owner);
|
194
|
-
|
195
|
-
IRegistry registry = getRegistry();
|
196
|
-
|
197
|
-
//if(registry.allowance(registry.getNftId(msg.sender), INSTANCE()) == false) {
|
198
|
-
// revert MissingAllowance();
|
199
|
-
//}
|
200
|
-
|
201
|
-
info.nftId = registry.register(info);
|
202
|
-
|
203
|
-
return (
|
204
|
-
info,
|
205
|
-
data
|
206
|
-
);
|
102
|
+
info = _getAndVerifyContractInfo(distribution, DISTRIBUTION(), owner);
|
103
|
+
info.nftId = getRegistry().register(info);
|
207
104
|
}
|
208
105
|
|
209
106
|
function registerPolicy(IRegistry.ObjectInfo memory info)
|
210
|
-
external
|
107
|
+
external
|
108
|
+
restricted
|
211
109
|
returns(NftId nftId)
|
212
110
|
{
|
213
|
-
IRegistry registry = getRegistry();
|
214
|
-
NftId senderNftId = registry.getNftId(msg.sender);
|
215
|
-
|
216
|
-
if(registry.allowance(senderNftId, POLICY()) == false) {
|
217
|
-
revert MissingAllowance();
|
218
|
-
}
|
219
|
-
|
220
111
|
_verifyObjectInfo(info, POLICY());
|
221
112
|
|
222
|
-
nftId =
|
113
|
+
nftId = getRegistry().register(info);
|
223
114
|
}
|
224
115
|
|
225
116
|
function registerBundle(IRegistry.ObjectInfo memory info)
|
226
|
-
external
|
117
|
+
external
|
118
|
+
restricted
|
227
119
|
returns(NftId nftId)
|
228
120
|
{
|
229
|
-
IRegistry registry = getRegistry();
|
230
|
-
NftId senderNftId = registry.getNftId(msg.sender);
|
231
|
-
|
232
|
-
if(registry.allowance(senderNftId, BUNDLE()) == false) {
|
233
|
-
revert MissingAllowance();
|
234
|
-
}
|
235
|
-
|
236
121
|
_verifyObjectInfo(info, BUNDLE());
|
237
122
|
|
238
|
-
nftId =
|
123
|
+
nftId = getRegistry().register(info);
|
239
124
|
}
|
240
125
|
|
126
|
+
function registerStake(IRegistry.ObjectInfo memory info)
|
127
|
+
external
|
128
|
+
restricted
|
129
|
+
returns(NftId nftId)
|
130
|
+
{
|
131
|
+
_verifyObjectInfo(info, STAKE());
|
241
132
|
|
242
|
-
|
243
|
-
function getName() public pure override(IService, ServiceBase) returns(string memory) {
|
244
|
-
return NAME;
|
133
|
+
nftId = getRegistry().register(info);
|
245
134
|
}
|
246
135
|
|
136
|
+
// From IService
|
137
|
+
function getDomain() public pure override(IService, Service) returns(ObjectType serviceDomain) {
|
138
|
+
return REGISTRY();
|
139
|
+
}
|
247
140
|
|
248
141
|
// from Versionable
|
249
142
|
|
250
143
|
/// @dev top level initializer
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
function _initialize(address protocolOwner, bytes memory registryCreationCode)
|
144
|
+
function _initialize(
|
145
|
+
address owner,
|
146
|
+
bytes memory data
|
147
|
+
)
|
256
148
|
internal
|
257
149
|
initializer
|
258
150
|
virtual override
|
259
151
|
{
|
260
|
-
|
261
|
-
|
152
|
+
(
|
153
|
+
address initialAuthority,
|
154
|
+
address registry
|
155
|
+
) = abi.decode(data, (address, address));
|
262
156
|
|
263
|
-
|
264
|
-
registryCreationCode,
|
265
|
-
abi.encode(
|
266
|
-
protocolOwner,
|
267
|
-
getMajorVersion()
|
268
|
-
)
|
269
|
-
);
|
157
|
+
__AccessManaged_init(initialAuthority);
|
270
158
|
|
271
|
-
address
|
159
|
+
initializeService(address(registry), owner);
|
160
|
+
registerInterface(type(IRegistryService).interfaceId);
|
161
|
+
}
|
272
162
|
|
273
|
-
|
274
|
-
registryAddress := create(0, add(bytecode, 0x20), mload(bytecode))
|
163
|
+
// from IRegisterable
|
275
164
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
165
|
+
function getFunctionConfigs()
|
166
|
+
external
|
167
|
+
pure
|
168
|
+
returns(
|
169
|
+
FunctionConfig[] memory config
|
170
|
+
)
|
171
|
+
{
|
172
|
+
config = new FunctionConfig[](6);
|
173
|
+
|
174
|
+
// order of service registrations MUST be reverse to this array
|
175
|
+
/*config[-1].serviceDomain = STAKE();
|
176
|
+
config[-1].selector = RegistryService.registerStake.selector;*/
|
280
177
|
|
281
|
-
|
282
|
-
|
178
|
+
config[0].serviceDomain = POLICY();
|
179
|
+
config[0].selector = RegistryService.registerPolicy.selector;
|
283
180
|
|
284
|
-
|
181
|
+
config[1].serviceDomain = BUNDLE();
|
182
|
+
config[1].selector = RegistryService.registerBundle.selector;
|
285
183
|
|
286
|
-
|
184
|
+
config[2].serviceDomain = PRODUCT();
|
185
|
+
config[2].selector = RegistryService.registerProduct.selector;
|
186
|
+
|
187
|
+
config[3].serviceDomain = POOL();
|
188
|
+
config[3].selector = RegistryService.registerPool.selector;
|
189
|
+
|
190
|
+
config[4].serviceDomain = DISTRIBUTION();
|
191
|
+
config[4].selector = RegistryService.registerDistribution.selector;
|
192
|
+
|
193
|
+
// registerInstance() have no restriction
|
194
|
+
config[5].serviceDomain = INSTANCE();
|
195
|
+
config[5].selector = RegistryService.registerInstance.selector;
|
287
196
|
}
|
288
197
|
|
289
|
-
//
|
198
|
+
// Internal
|
199
|
+
|
290
200
|
function _getAndVerifyContractInfo(
|
291
201
|
IRegisterable registerable,
|
292
|
-
ObjectType
|
293
|
-
address
|
202
|
+
ObjectType expectedType, // assume can be valid only
|
203
|
+
address expectedOwner // assume can be 0 when given by other service
|
294
204
|
)
|
295
205
|
internal
|
206
|
+
// view
|
296
207
|
returns(
|
297
|
-
IRegistry.ObjectInfo memory info
|
298
|
-
bytes memory data
|
208
|
+
IRegistry.ObjectInfo memory info
|
299
209
|
)
|
300
210
|
{
|
301
|
-
(
|
302
|
-
|
303
|
-
data
|
304
|
-
) = registerable.getInitialInfo();
|
211
|
+
info = registerable.getInitialInfo();
|
212
|
+
info.objectAddress = address(registerable);
|
305
213
|
|
306
|
-
if(info.
|
307
|
-
revert
|
214
|
+
if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
|
215
|
+
revert UnexpectedRegisterableType(expectedType, info.objectType);
|
308
216
|
}
|
309
217
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
revert
|
218
|
+
address owner = info.initialOwner;
|
219
|
+
|
220
|
+
if(owner != expectedOwner) { // registerable owner protection
|
221
|
+
revert NotRegisterableOwner(expectedOwner);
|
314
222
|
}
|
315
223
|
|
316
|
-
if(
|
224
|
+
if(owner == address(registerable)) {
|
317
225
|
revert SelfRegistration();
|
318
226
|
}
|
227
|
+
|
228
|
+
if(owner == address(0)) {
|
229
|
+
revert RegisterableOwnerIsZero();
|
230
|
+
}
|
319
231
|
|
320
|
-
if(
|
321
|
-
revert
|
232
|
+
if(getRegistry().isRegistered(owner)) {
|
233
|
+
revert RegisterableOwnerIsRegistered();
|
322
234
|
}
|
323
|
-
|
324
|
-
/*NftId parentNftId = info.parentNftId;
|
325
|
-
IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
|
326
|
-
|
327
|
-
if(parentInfo.objectType != parentType) { // parent registration + type
|
328
|
-
revert InvalidParent(parentNftId);
|
329
|
-
}*/
|
330
|
-
|
331
|
-
return(
|
332
|
-
info,
|
333
|
-
data
|
334
|
-
);
|
335
235
|
}
|
336
236
|
|
337
|
-
// parent checks done in registry because of approve()
|
338
237
|
function _verifyObjectInfo(
|
339
238
|
IRegistry.ObjectInfo memory info,
|
340
|
-
ObjectType
|
239
|
+
ObjectType expectedType
|
341
240
|
)
|
342
241
|
internal
|
343
242
|
view
|
344
243
|
{
|
345
|
-
|
346
|
-
|
347
|
-
}
|
244
|
+
// enforce instead of check
|
245
|
+
info.objectAddress = address(0);
|
348
246
|
|
349
|
-
if(
|
350
|
-
|
351
|
-
info.initialOwner == address(0)) {
|
352
|
-
// TODO non registered address can register object(e.g. POLICY()) and then transfer associated nft to registered contract
|
353
|
-
// what are motivations to do so?
|
354
|
-
// at least registered contract can not register objects by itself, SERVICE,
|
355
|
-
revert InvalidInitialOwner(info.initialOwner);
|
247
|
+
if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
|
248
|
+
revert UnexpectedRegisterableType(expectedType, info.objectType);
|
356
249
|
}
|
357
250
|
|
358
|
-
|
359
|
-
/*if(info.initialOwner == msg.sender) {
|
360
|
-
revert InitialOwnerIsParent();
|
361
|
-
}
|
251
|
+
address owner = info.initialOwner;
|
362
252
|
|
363
|
-
if(
|
364
|
-
revert
|
253
|
+
if(owner == address(0)) {
|
254
|
+
revert RegisterableOwnerIsZero();
|
365
255
|
}
|
366
256
|
|
367
|
-
if(
|
368
|
-
revert
|
369
|
-
}*/
|
370
|
-
|
371
|
-
|
372
|
-
if(info.objectType != objectType) {
|
373
|
-
revert InvalidType(info.objectType);
|
257
|
+
if(getRegistry().isRegistered(owner)) {
|
258
|
+
revert RegisterableOwnerIsRegistered();
|
374
259
|
}
|
375
|
-
|
376
|
-
/*NftId parentNftId = info.parentNftId;
|
377
|
-
IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
|
378
|
-
|
379
|
-
if(parentInfo.objectType != parentType) { // parent registration + type
|
380
|
-
revert InvalidParent(parentNftId);
|
381
|
-
}*/
|
382
260
|
}
|
383
|
-
}
|
261
|
+
}
|
@@ -0,0 +1,62 @@
|
|
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
|
+
RegistryService private immutable _registryService;
|
21
|
+
|
22
|
+
/// @dev initializes proxy manager with registry service implementation and deploys registry
|
23
|
+
constructor(
|
24
|
+
address initialAuthority, // used by implementation
|
25
|
+
address registry) // used by implementation
|
26
|
+
ProxyManager()
|
27
|
+
{
|
28
|
+
require(initialAuthority > address(0), "RegistryServiceManager: initial authority is 0");
|
29
|
+
require(registry > address(0), "RegistryServiceManager: registry is 0");
|
30
|
+
|
31
|
+
// implementation's initializer func `data` argument
|
32
|
+
bytes memory initializationData = abi.encode(
|
33
|
+
initialAuthority,
|
34
|
+
registry);
|
35
|
+
|
36
|
+
IVersionable versionable = deploy(
|
37
|
+
address(new RegistryService()),
|
38
|
+
initializationData);
|
39
|
+
|
40
|
+
_registryService = RegistryService(address(versionable));
|
41
|
+
}
|
42
|
+
|
43
|
+
// from IRegisterable
|
44
|
+
|
45
|
+
// IMPORTANT: registry here and in constructor MUST be the same
|
46
|
+
function linkToNftOwnable(address registry)
|
47
|
+
public
|
48
|
+
onlyOwner
|
49
|
+
{
|
50
|
+
_linkToNftOwnable(registry, address(_registryService));
|
51
|
+
}
|
52
|
+
|
53
|
+
//--- view functions ----------------------------------------------------//
|
54
|
+
|
55
|
+
function getRegistryService()
|
56
|
+
external
|
57
|
+
view
|
58
|
+
returns (RegistryService registryService)
|
59
|
+
{
|
60
|
+
return _registryService;
|
61
|
+
}
|
62
|
+
}
|