@etherisc/gif-next 0.0.2-e37834a-021 → 0.0.2-e38b7e6-931
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 +171 -2
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +282 -2
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +313 -72
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +234 -3
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +0 -25
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +24 -57
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +5 -55
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +378 -127
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +391 -107
- 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/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +788 -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 +813 -1184
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +448 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/{base/IService.sol/IService.json → IInstanceService.sol/IInstanceService.json} +244 -18
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +1762 -1332
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +1047 -0
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +763 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1422 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +963 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +460 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +285 -0
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +240 -11
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -13
- 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/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1121 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +436 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +304 -39
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +424 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +720 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +93 -16
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +771 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +95 -80
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +89 -227
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1246 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +492 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +287 -111
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +424 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +258 -347
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +424 -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 +157 -71
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +339 -31
- 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 +131 -212
- 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 +382 -72
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +68 -77
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +530 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +397 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +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/service/IComponentOwnerService.sol/IComponentOwnerService.json → shared/IService.sol/IService.json} +90 -58
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +32 -6
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +21 -16
- 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/ServiceBase.sol/ServiceBase.json → shared/RegisterableUpgradable.sol/RegisterableUpgradable.json} +92 -30
- 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} +100 -88
- 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 +155 -27
- 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 +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/BaseComponent.sol +107 -18
- package/contracts/components/Distribution.sol +24 -25
- package/contracts/components/IBaseComponent.sol +20 -4
- package/contracts/components/IDistributionComponent.sol +2 -4
- package/contracts/components/IPoolComponent.sol +5 -3
- package/contracts/components/IProductComponent.sol +4 -6
- package/contracts/components/Pool.sol +58 -46
- package/contracts/components/Product.sol +71 -75
- package/contracts/experiment/cloning/Cloner.sol +47 -0
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +23 -0
- package/contracts/instance/BundleManager.sol +129 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +54 -48
- package/contracts/instance/IInstanceBase.sol +25 -0
- package/contracts/instance/IInstanceService.sol +40 -0
- package/contracts/instance/Instance.sol +245 -68
- package/contracts/instance/InstanceAccessManager.sol +303 -0
- package/contracts/instance/InstanceBase.sol +39 -0
- package/contracts/instance/InstanceReader.sol +315 -0
- package/contracts/instance/InstanceService.sol +345 -0
- package/contracts/instance/InstanceServiceManager.sol +54 -0
- package/contracts/instance/ObjectManager.sol +101 -0
- package/contracts/instance/base/ComponentServiceBase.sol +109 -20
- package/contracts/instance/base/IInstanceBase.sol +0 -2
- 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 +48 -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 +46 -0
- package/contracts/instance/module/ITreasury.sol +23 -0
- package/contracts/instance/service/BundleService.sol +294 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/DistributionService.sol +79 -18
- package/contracts/instance/service/DistributionServiceManager.sol +51 -0
- package/contracts/instance/service/IBundleService.sol +44 -0
- package/contracts/instance/service/IDistributionService.sol +1 -1
- package/contracts/instance/service/IPolicyService.sol +94 -0
- package/contracts/instance/service/IPoolService.sol +7 -24
- package/contracts/instance/service/IProductService.sol +9 -76
- package/contracts/instance/service/PolicyService.sol +539 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +101 -108
- package/contracts/instance/service/PoolServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +130 -431
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +41 -26
- package/contracts/registry/IRegistry.sol +48 -30
- package/contracts/registry/IRegistryService.sol +53 -24
- package/contracts/registry/Registry.sol +212 -306
- package/contracts/registry/RegistryAccessManager.sol +210 -0
- package/contracts/registry/RegistryService.sol +151 -206
- package/contracts/registry/RegistryServiceManager.sol +26 -16
- package/contracts/registry/ReleaseManager.sol +342 -0
- package/contracts/registry/TokenRegistry.sol +110 -0
- package/contracts/shared/ERC165.sol +7 -3
- package/contracts/shared/INftOwnable.sol +22 -0
- package/contracts/shared/IRegisterable.sol +3 -10
- package/contracts/shared/IService.sol +16 -0
- package/contracts/shared/NftOwnable.sol +85 -38
- package/contracts/shared/ProxyManager.sol +4 -13
- package/contracts/shared/Registerable.sol +15 -42
- package/contracts/shared/RegisterableUpgradable.sol +16 -0
- package/contracts/shared/Service.sol +58 -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 +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 +35 -14
- 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 +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/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/IChainNft.sol/IChainNft.json +0 -457
- 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/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/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,278 +1,156 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
5
|
-
import {IService} from "../instance/base/IService.sol";
|
6
4
|
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {IRegistry} from "./IRegistry.sol";
|
10
|
-
import {NftId, toNftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
|
11
|
-
import {Version, VersionPart, VersionLib} from "../types/Version.sol";
|
5
|
+
import {NftId, toNftId, zeroNftId} from "../types/NftId.sol";
|
6
|
+
import {VersionPart} from "../types/Version.sol";
|
12
7
|
import {ObjectType, PROTOCOL, REGISTRY, TOKEN, SERVICE, INSTANCE, STAKE, PRODUCT, DISTRIBUTION, ORACLE, POOL, POLICY, BUNDLE} from "../types/ObjectType.sol";
|
13
|
-
import {ITransferInterceptor} from "./ITransferInterceptor.sol";
|
14
8
|
|
15
|
-
import {IOwnable} from "../shared/IOwnable.sol";
|
16
9
|
import {ERC165} from "../shared/ERC165.sol";
|
17
10
|
|
11
|
+
import {ChainNft} from "./ChainNft.sol";
|
12
|
+
import {IRegistry} from "./IRegistry.sol";
|
13
|
+
import {ReleaseManager} from "./ReleaseManager.sol";
|
18
14
|
|
19
15
|
// IMPORTANT
|
20
16
|
// Each NFT minted by registry is accosiated with:
|
21
17
|
// 1) NFT owner
|
22
18
|
// 2) registred contract OR object stored in registered (parent) contract
|
23
19
|
// Four registration flows:
|
24
|
-
// 1)
|
25
|
-
// 2)
|
26
|
-
// 3) IRegisterable address by
|
27
|
-
// 4) state object by
|
20
|
+
// 1) IService address by release manager (SERVICE of domain SERVICE aka registry service aka release creation)
|
21
|
+
// 2) IService address by release manager (SERVICE of domain !SERVICE aka regular service)
|
22
|
+
// 3) IRegisterable address by regular service (INSTANCE, PRODUCT, POOL, DISTRIBUTION, ORACLE)
|
23
|
+
// 4) state object by regular service (POLICY, BUNDLE, STAKE)
|
28
24
|
|
29
25
|
contract Registry is
|
30
26
|
ERC165,
|
31
27
|
IRegistry
|
32
28
|
{
|
33
|
-
// register
|
34
|
-
error NotRegistryService();
|
35
|
-
error ZeroParentAddress();
|
36
|
-
error ContractAlreadyRegistered(address objectAddress);
|
37
|
-
error InvalidServiceVersion(VersionPart majorVersion);
|
38
|
-
error ServiceNameAlreadyRegistered(string name, VersionPart majorVersion);
|
39
|
-
|
40
|
-
// approve
|
41
|
-
error NotOwner();
|
42
|
-
error NotRegisteredContract(NftId registrarNftId);
|
43
|
-
error NotService(NftId registrarNftId);
|
44
|
-
error InvalidTypesCombination(ObjectType objectType, ObjectType parentType);
|
45
|
-
|
46
|
-
uint256 public constant MAJOR_VERSION_MIN = 3;
|
47
29
|
address public constant NFT_LOCK_ADDRESS = address(0x1);
|
48
|
-
uint256 public constant
|
30
|
+
uint256 public constant REGISTRY_TOKEN_SEQUENCE_ID = 2;
|
49
31
|
string public constant EMPTY_URI = "";
|
50
32
|
|
51
|
-
mapping(NftId nftId => ObjectInfo info) _info;
|
52
|
-
mapping(address object => NftId nftId) _nftIdByAddress;
|
33
|
+
mapping(NftId nftId => ObjectInfo info) internal _info;
|
34
|
+
mapping(address object => NftId nftId) internal _nftIdByAddress;
|
53
35
|
|
54
|
-
mapping(
|
55
|
-
ObjectType objectType => bool)) _isApproved;
|
36
|
+
mapping(VersionPart version => mapping(ObjectType serviceDomain => address)) _service;
|
56
37
|
|
57
38
|
mapping(ObjectType objectType => mapping(
|
58
|
-
ObjectType parentType => bool)) _isValidContractCombination;
|
39
|
+
ObjectType parentType => bool)) internal _isValidContractCombination;
|
59
40
|
|
60
41
|
mapping(ObjectType objectType => mapping(
|
61
|
-
ObjectType parentType => bool)) _isValidObjectCombination;
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
VersionPart majorVersion => address service)) _service;
|
66
|
-
|
67
|
-
NftId _registryNftId;
|
68
|
-
NftId _serviceNftId; // set in stone upon registry creation
|
69
|
-
IChainNft _chainNft;
|
70
|
-
ChainNft _chainNftInternal;
|
71
|
-
|
72
|
-
/*
|
73
|
-
modifier onlyInitialOwner() {
|
74
|
-
if(
|
75
|
-
msg.sender != getOwner() ||
|
76
|
-
msg.sender != _info[_registryNftId].initialOwner) {
|
77
|
-
revert NotInitialOwner();
|
78
|
-
}
|
79
|
-
}*/
|
42
|
+
ObjectType parentType => bool)) internal _isValidObjectCombination;
|
43
|
+
|
44
|
+
NftId internal _registryNftId;
|
45
|
+
ChainNft internal _chainNft;
|
80
46
|
|
81
|
-
|
82
|
-
|
83
|
-
|
47
|
+
ReleaseManager internal _releaseManager;
|
48
|
+
|
49
|
+
modifier onlyRegistryService() {
|
50
|
+
if(!_releaseManager.isActiveRegistryService(msg.sender)) {
|
51
|
+
revert CallerNotRegistryService();
|
84
52
|
}
|
85
53
|
_;
|
86
54
|
}
|
87
55
|
|
88
|
-
modifier
|
89
|
-
|
90
|
-
|
91
|
-
revert NotRegistryService();
|
56
|
+
modifier onlyReleaseManager() {
|
57
|
+
if(msg.sender != address(_releaseManager)) {
|
58
|
+
revert CallerNotReleaseManager();
|
92
59
|
}
|
93
60
|
_;
|
94
61
|
}
|
95
62
|
|
96
|
-
constructor(
|
63
|
+
constructor()
|
97
64
|
{
|
98
|
-
|
99
|
-
require(majorVersion.toInt() == MAJOR_VERSION_MIN, "Registry: initial major version of registry service is not MAJOR_VERSION_MIN");
|
65
|
+
_releaseManager = ReleaseManager(msg.sender);
|
100
66
|
|
101
67
|
// deploy NFT
|
102
|
-
|
103
|
-
_chainNft = IChainNft(_chainNftInternal);
|
68
|
+
_chainNft = new ChainNft(address(this));// adds 10kb to deployment size
|
104
69
|
|
105
70
|
// initial registry setup
|
106
71
|
_registerProtocol();
|
107
|
-
_registerRegistry(
|
108
|
-
_registerRegistryService(registryOwner);
|
72
|
+
_registerRegistry();
|
109
73
|
|
110
74
|
// set object parent relations
|
111
75
|
_setupValidObjectParentCombinations();
|
112
76
|
|
113
77
|
_registerInterface(type(IRegistry).interfaceId);
|
114
|
-
_registerInterface(type(IOwnable).interfaceId);
|
115
78
|
}
|
116
79
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
80
|
+
function registerService(
|
81
|
+
ObjectInfo memory info,
|
82
|
+
VersionPart version,
|
83
|
+
ObjectType domain
|
84
|
+
)
|
122
85
|
external
|
123
|
-
|
86
|
+
onlyReleaseManager
|
124
87
|
returns(NftId nftId)
|
125
88
|
{
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
ObjectType parentType = parentInfo.objectType; // see function header
|
130
|
-
address parentAddress = parentInfo.objectAddress;
|
131
|
-
|
132
|
-
// parent is contract -> need to check? -> check before minting
|
133
|
-
// special case: global registry nft as parent when not on mainnet -> global registry address is 0
|
134
|
-
// special case: when parentNftId == _chainNft.mint(), check for zero parent address before mint
|
135
|
-
// special case: when parentNftId == _chainNft.mint() && objectAddress == initialOwner
|
136
|
-
if(parentAddress == address(0)) {
|
137
|
-
revert ZeroParentAddress();
|
89
|
+
/* must be guaranteed by release manager
|
90
|
+
if(info.objectType != SERVICE()) {
|
91
|
+
revert();
|
138
92
|
}
|
93
|
+
info.initialOwner = NFT_LOCK_ADDRESS <- if services are access managed
|
94
|
+
*/
|
139
95
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
info.initialOwner,
|
144
|
-
interceptor,
|
145
|
-
EMPTY_URI);
|
146
|
-
nftId = toNftId(mintedTokenId);
|
147
|
-
|
148
|
-
// TODO move nftId out of info struct
|
149
|
-
// getters by nftId -> return struct without nftId
|
150
|
-
// getters by address -> return nftId AND struct
|
151
|
-
info.nftId = nftId;
|
152
|
-
_info[nftId] = info;
|
153
|
-
|
154
|
-
if(info.objectAddress > address(0))
|
155
|
-
{
|
156
|
-
// TODO if need to add types latter -> at least call this check from registry service
|
157
|
-
// parent is registered + object-parent types are valid
|
158
|
-
if(_isValidContractCombination[objectType][parentType] == false) {
|
159
|
-
revert InvalidTypesCombination(objectType, parentType);
|
160
|
-
}
|
161
|
-
|
162
|
-
address contractAddress = info.objectAddress;
|
96
|
+
if(_service[version][domain] > address(0)) {
|
97
|
+
revert ServiceAlreadyRegistered(info.objectAddress);
|
98
|
+
}
|
163
99
|
|
164
|
-
|
165
|
-
revert ContractAlreadyRegistered(contractAddress);
|
166
|
-
}
|
100
|
+
_service[version][domain] = info.objectAddress; // nftId;
|
167
101
|
|
168
|
-
|
102
|
+
nftId = _register(info);
|
169
103
|
|
170
|
-
|
171
|
-
if(objectType == SERVICE())
|
172
|
-
{
|
173
|
-
(
|
174
|
-
string memory serviceName,
|
175
|
-
VersionPart majorVersion
|
176
|
-
) = abi.decode(info.data, (string, VersionPart));
|
177
|
-
bytes32 serviceNameHash = keccak256(abi.encode(serviceName));
|
178
|
-
|
179
|
-
// TODO MUST guarantee consistency of registerable.getVersion() and majorVersion here
|
180
|
-
// TODO update _serviceNftId when registryService with new major version is registered? -> it is fixed in current setup
|
181
|
-
// TODO do not use names -> each object type is registered by corresponding service -> conflicting with approve()
|
182
|
-
if(
|
183
|
-
majorVersion.toInt() < MAJOR_VERSION_MIN ||
|
184
|
-
(majorVersion.toInt() > MAJOR_VERSION_MIN &&
|
185
|
-
_service[serviceNameHash][VersionLib.toVersionPart(majorVersion.toInt() - 1)] == address(0) )
|
186
|
-
) {
|
187
|
-
revert InvalidServiceVersion(majorVersion);
|
188
|
-
}
|
189
|
-
|
190
|
-
if(_service[serviceNameHash][majorVersion] != address(0)) {
|
191
|
-
revert ServiceNameAlreadyRegistered(serviceName, majorVersion);
|
192
|
-
}
|
193
|
-
|
194
|
-
_string[nftId] = serviceName;
|
195
|
-
_service[serviceNameHash][majorVersion] = contractAddress;
|
196
|
-
|
197
|
-
emit LogServiceNameRegistration(serviceName, majorVersion);
|
198
|
-
}
|
199
|
-
}
|
200
|
-
else
|
201
|
-
{
|
202
|
-
if(_isValidObjectCombination[objectType][parentType] == false) {
|
203
|
-
revert InvalidTypesCombination(objectType, parentType);
|
204
|
-
}
|
205
|
-
}
|
206
|
-
|
207
|
-
emit LogRegistration(nftId, info.parentNftId, info.objectType, info.objectAddress, info.initialOwner);
|
104
|
+
emit LogServiceRegistration(version, domain);
|
208
105
|
}
|
209
106
|
|
210
|
-
function
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
{
|
215
|
-
revert();
|
216
|
-
}
|
217
|
-
|
218
|
-
|
219
|
-
/// @dev
|
220
|
-
// msg.sender - registry owner
|
221
|
-
// CAN approve only registered service contract
|
222
|
-
// CAN approve any combination specified in _isValidCombination
|
223
|
-
// CAN NOT approve itself
|
224
|
-
// TODO in case where exists exactly one registered service per objectType (and major version):
|
225
|
-
// - registration and approve is a single operation, no need for separate approve() function
|
226
|
-
// - then approve can be used to adding new valid object-parent combinations???
|
227
|
-
function approve(
|
228
|
-
NftId serviceNftId,
|
229
|
-
ObjectType objectType,
|
230
|
-
ObjectType parentType
|
231
|
-
)
|
232
|
-
public
|
233
|
-
onlyOwner()
|
107
|
+
function register(ObjectInfo memory info)
|
108
|
+
external
|
109
|
+
onlyRegistryService
|
110
|
+
returns(NftId nftId)
|
234
111
|
{
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
revert NotRegisteredContract(serviceNftId);
|
112
|
+
// no service registrations
|
113
|
+
if(info.objectType == SERVICE()) {
|
114
|
+
revert ServiceRegistration();
|
239
115
|
}
|
240
116
|
|
241
|
-
|
242
|
-
|
243
|
-
}
|
117
|
+
nftId = _register(info);
|
118
|
+
}
|
244
119
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
}
|
120
|
+
/// @dev earliest GIF major version
|
121
|
+
function getMajorVersionMin() external view returns (VersionPart) {
|
122
|
+
return _releaseManager.getInitialVersion();
|
123
|
+
}
|
250
124
|
|
251
|
-
|
125
|
+
// TODO make distinction between active an not yet active version
|
126
|
+
// need to be thought trough, not yet clear if necessary
|
127
|
+
// need to answer question: what is the latest version during the upgrade process?
|
128
|
+
// likely setting up a new gif version does not fit into a single tx
|
129
|
+
// in this case we might want to have a period where the latest version is
|
130
|
+
// in the process of being set up while the latest active version is 1 major release smaller
|
131
|
+
/// @dev latest GIF major version (might not yet be active)
|
132
|
+
function getMajorVersionMax() external view returns (VersionPart) {
|
133
|
+
return _releaseManager.getNextVersion();
|
134
|
+
}
|
252
135
|
|
253
|
-
|
136
|
+
/// @dev latest active GIF release version
|
137
|
+
function getMajorVersion() external view returns (VersionPart) {
|
138
|
+
return _releaseManager.getLatestVersion();
|
254
139
|
}
|
255
140
|
|
256
|
-
|
257
|
-
// TODO allowance by address?
|
258
|
-
// TODO checked by registry service -> but registry owner can upgrade registry service not to check allowance....
|
259
|
-
function allowance(
|
260
|
-
NftId nftId,
|
261
|
-
ObjectType object
|
262
|
-
)
|
263
|
-
public
|
264
|
-
view
|
265
|
-
returns (bool)
|
141
|
+
function getReleaseInfo(VersionPart version) external view returns (ReleaseInfo memory)
|
266
142
|
{
|
267
|
-
return
|
143
|
+
return _releaseManager.getReleaseInfo(version);
|
268
144
|
}
|
269
145
|
|
270
|
-
// from IRegistry
|
271
146
|
function getObjectCount() external view override returns (uint256) {
|
272
|
-
|
273
147
|
return _chainNft.totalSupply();
|
274
148
|
}
|
275
149
|
|
150
|
+
function getNftId() external view returns (NftId nftId) {
|
151
|
+
return _registryNftId;
|
152
|
+
}
|
153
|
+
|
276
154
|
function getNftId(address object) external view override returns (NftId id) {
|
277
155
|
return _nftIdByAddress[object];
|
278
156
|
}
|
@@ -282,7 +160,6 @@ contract Registry is
|
|
282
160
|
}
|
283
161
|
|
284
162
|
function ownerOf(address contractAddress) public view returns (address) {
|
285
|
-
|
286
163
|
return _chainNft.ownerOf(_nftIdByAddress[contractAddress].toInt());
|
287
164
|
}
|
288
165
|
|
@@ -291,7 +168,6 @@ contract Registry is
|
|
291
168
|
}
|
292
169
|
|
293
170
|
function getObjectInfo(address object) external view override returns (ObjectInfo memory) {
|
294
|
-
|
295
171
|
return _info[_nftIdByAddress[object]];
|
296
172
|
}
|
297
173
|
|
@@ -303,133 +179,87 @@ contract Registry is
|
|
303
179
|
return _nftIdByAddress[object].gtz();
|
304
180
|
}
|
305
181
|
|
306
|
-
function
|
307
|
-
return
|
182
|
+
function isRegisteredService(address object) external view override returns (bool) {
|
183
|
+
return _nftIdByAddress[object].gtz() && _info[_nftIdByAddress[object]].objectType == SERVICE();
|
308
184
|
}
|
309
185
|
|
310
|
-
// special case to retrive a gif service
|
311
186
|
function getServiceAddress(
|
312
|
-
|
313
|
-
VersionPart
|
187
|
+
ObjectType serviceDomain,
|
188
|
+
VersionPart releaseVersion
|
314
189
|
) external view returns (address)
|
315
190
|
{
|
316
|
-
|
317
|
-
return _service[serviceNameHash][majorVersion];
|
191
|
+
return _service[releaseVersion][serviceDomain];
|
318
192
|
}
|
319
193
|
|
320
|
-
function getChainNft() external view override returns (
|
194
|
+
function getChainNft() external view override returns (ChainNft) {
|
321
195
|
return _chainNft;
|
322
196
|
}
|
323
197
|
|
324
|
-
// from IOwnable
|
325
198
|
function getOwner() public view returns (address owner) {
|
326
199
|
return ownerOf(address(this));
|
327
200
|
}
|
328
201
|
|
329
|
-
// Internals
|
330
|
-
|
331
|
-
/// @dev protocol registration used to anchor the dip ecosystem relations
|
332
|
-
function _registerProtocol()
|
333
|
-
internal
|
334
|
-
{
|
335
|
-
uint256 protocolId = _chainNftInternal.PROTOCOL_NFT_ID();
|
336
|
-
NftId protocolNftId = toNftId(protocolId);
|
337
|
-
|
338
|
-
_chainNftInternal.mint(NFT_LOCK_ADDRESS, protocolId);
|
339
|
-
|
340
|
-
_info[protocolNftId] = ObjectInfo(
|
341
|
-
protocolNftId,
|
342
|
-
zeroNftId(), // parent
|
343
|
-
PROTOCOL(),
|
344
|
-
false, // isInterceptor
|
345
|
-
address(0), // objectAddress
|
346
|
-
NFT_LOCK_ADDRESS,// initialOwner
|
347
|
-
""
|
348
|
-
);
|
349
|
-
}
|
202
|
+
// Internals
|
350
203
|
|
351
|
-
/// @dev registry
|
352
|
-
|
353
|
-
function
|
204
|
+
/// @dev registry protects only against tampering existing records, registering with invalid types pairs and 0 parent address
|
205
|
+
// TODO registration of precompile addresses
|
206
|
+
function _register(ObjectInfo memory info)
|
354
207
|
internal
|
208
|
+
returns(NftId nftId)
|
355
209
|
{
|
356
|
-
|
357
|
-
NftId
|
358
|
-
|
359
|
-
|
210
|
+
ObjectType objectType = info.objectType;
|
211
|
+
NftId parentNftId = info.parentNftId;
|
212
|
+
ObjectInfo memory parentInfo = _info[parentNftId];
|
213
|
+
ObjectType parentType = parentInfo.objectType; // see function header
|
214
|
+
address parentAddress = parentInfo.objectAddress;
|
360
215
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
{// we are global registry
|
368
|
-
parentNftId = toNftId(_chainNftInternal.PROTOCOL_NFT_ID());
|
216
|
+
// parent is contract -> need to check? -> check before minting
|
217
|
+
// special case: global registry nft as parent when not on mainnet -> global registry address is 0
|
218
|
+
// special case: when parentNftId == _chainNft.mint(), check for zero parent address before mint
|
219
|
+
// special case: when parentNftId == _chainNft.mint() && objectAddress == initialOwner
|
220
|
+
if(parentAddress == address(0)) {
|
221
|
+
revert ZeroParentAddress();
|
369
222
|
}
|
370
223
|
|
371
|
-
|
372
|
-
|
373
|
-
_info[registryNftId] = ObjectInfo(
|
374
|
-
registryNftId,
|
375
|
-
parentNftId,
|
376
|
-
REGISTRY(),
|
377
|
-
false, // isInterceptor
|
378
|
-
address(this),
|
379
|
-
registryOwner,
|
380
|
-
""
|
381
|
-
);
|
382
|
-
_nftIdByAddress[address(this)] = registryNftId;
|
383
|
-
_registryNftId = registryNftId;
|
384
|
-
}
|
224
|
+
address interceptor = _getInterceptor(info.isInterceptor, info.objectAddress, parentInfo.isInterceptor, parentAddress);
|
385
225
|
|
226
|
+
// TODO does external call
|
227
|
+
// compute next nftId, do all checks and stores, mint() at most end...
|
228
|
+
uint256 mintedTokenId = _chainNft.mint(
|
229
|
+
info.initialOwner,
|
230
|
+
interceptor,
|
231
|
+
EMPTY_URI);
|
232
|
+
nftId = toNftId(mintedTokenId);
|
386
233
|
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
234
|
+
// TODO move nftId out of info struct
|
235
|
+
// getters by nftId -> return struct without nftId
|
236
|
+
// getters by address -> return nftId AND struct
|
237
|
+
info.nftId = nftId;
|
238
|
+
_info[nftId] = info;
|
392
239
|
|
393
|
-
|
240
|
+
if(info.objectAddress > address(0))
|
241
|
+
{
|
242
|
+
// parent is registered + object-parent types are valid
|
243
|
+
if(_isValidContractCombination[objectType][parentType] == false) {
|
244
|
+
revert InvalidTypesCombination(objectType, parentType);
|
245
|
+
}
|
394
246
|
|
395
|
-
|
247
|
+
address contractAddress = info.objectAddress;
|
396
248
|
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
REGISTRY(),
|
401
|
-
false, // isInterceptor
|
402
|
-
address(0), // objectAddress
|
403
|
-
NFT_LOCK_ADDRESS, // initialOwner
|
404
|
-
"" // data
|
405
|
-
);
|
406
|
-
}
|
249
|
+
if(_nftIdByAddress[contractAddress].gtz()) {
|
250
|
+
revert ContractAlreadyRegistered(contractAddress);
|
251
|
+
}
|
407
252
|
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
_registryNftId,
|
419
|
-
SERVICE(),
|
420
|
-
false, // isInterceptor
|
421
|
-
msg.sender, // service deploys registry
|
422
|
-
registryOwner, // initialOwner,
|
423
|
-
""
|
424
|
-
);
|
425
|
-
|
426
|
-
_nftIdByAddress[msg.sender] = serviceNftId;
|
427
|
-
|
428
|
-
string memory serviceName = "RegistryService";
|
429
|
-
bytes32 serviceNameHash = keccak256(abi.encode(serviceName));
|
430
|
-
_service[serviceNameHash][VersionLib.toVersionPart(MAJOR_VERSION_MIN)] = msg.sender;
|
431
|
-
_string[serviceNftId] = serviceName;
|
432
|
-
_serviceNftId = serviceNftId;
|
253
|
+
_nftIdByAddress[contractAddress] = nftId;
|
254
|
+
}
|
255
|
+
else
|
256
|
+
{
|
257
|
+
if(_isValidObjectCombination[objectType][parentType] == false) {
|
258
|
+
revert InvalidTypesCombination(objectType, parentType);
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
262
|
+
emit LogRegistration(nftId, parentNftId, objectType, info.isInterceptor, info.objectAddress, info.initialOwner);
|
433
263
|
}
|
434
264
|
|
435
265
|
/// @dev obtain interceptor address for this nft if applicable, address(0) otherwise
|
@@ -458,6 +288,82 @@ contract Registry is
|
|
458
288
|
return address(0);
|
459
289
|
}
|
460
290
|
|
291
|
+
// Internals called only in constructor
|
292
|
+
|
293
|
+
/// @dev protocol registration used to anchor the dip ecosystem relations
|
294
|
+
function _registerProtocol()
|
295
|
+
private
|
296
|
+
{
|
297
|
+
uint256 protocolId = _chainNft.PROTOCOL_NFT_ID();
|
298
|
+
NftId protocolNftId = toNftId(protocolId);
|
299
|
+
|
300
|
+
_info[protocolNftId] = ObjectInfo({
|
301
|
+
nftId: protocolNftId,
|
302
|
+
parentNftId: zeroNftId(),
|
303
|
+
objectType: PROTOCOL(),
|
304
|
+
isInterceptor: false,
|
305
|
+
objectAddress: address(0),
|
306
|
+
initialOwner: NFT_LOCK_ADDRESS,
|
307
|
+
data: ""
|
308
|
+
});
|
309
|
+
|
310
|
+
_chainNft.mint(NFT_LOCK_ADDRESS, protocolId);
|
311
|
+
}
|
312
|
+
|
313
|
+
/// @dev registry registration
|
314
|
+
/// might also register the global registry when not on mainnet
|
315
|
+
function _registerRegistry()
|
316
|
+
private
|
317
|
+
{
|
318
|
+
uint256 registryId = _chainNft.calculateTokenId(REGISTRY_TOKEN_SEQUENCE_ID);
|
319
|
+
NftId registryNftId = toNftId(registryId);
|
320
|
+
NftId parentNftId;
|
321
|
+
|
322
|
+
if(registryId != _chainNft.GLOBAL_REGISTRY_ID())
|
323
|
+
{// we're not the global registry
|
324
|
+
_registerGlobalRegistry();
|
325
|
+
parentNftId = toNftId(_chainNft.GLOBAL_REGISTRY_ID());
|
326
|
+
}
|
327
|
+
else
|
328
|
+
{// we are global registry
|
329
|
+
parentNftId = toNftId(_chainNft.PROTOCOL_NFT_ID());
|
330
|
+
}
|
331
|
+
|
332
|
+
_info[registryNftId] = ObjectInfo({
|
333
|
+
nftId: registryNftId,
|
334
|
+
parentNftId: parentNftId,
|
335
|
+
objectType: REGISTRY(),
|
336
|
+
isInterceptor: false,
|
337
|
+
objectAddress: address(this),
|
338
|
+
initialOwner: NFT_LOCK_ADDRESS,
|
339
|
+
data: ""
|
340
|
+
});
|
341
|
+
_nftIdByAddress[address(this)] = registryNftId;
|
342
|
+
_registryNftId = registryNftId;
|
343
|
+
|
344
|
+
_chainNft.mint(NFT_LOCK_ADDRESS, registryId);
|
345
|
+
}
|
346
|
+
|
347
|
+
/// @dev global registry registration for non mainnet registries
|
348
|
+
function _registerGlobalRegistry()
|
349
|
+
private
|
350
|
+
{
|
351
|
+
uint256 globalRegistryId = _chainNft.GLOBAL_REGISTRY_ID();
|
352
|
+
NftId globalRegistryNftId = toNftId(globalRegistryId);
|
353
|
+
|
354
|
+
_info[globalRegistryNftId] = ObjectInfo({
|
355
|
+
nftId: globalRegistryNftId,
|
356
|
+
parentNftId: toNftId(_chainNft.PROTOCOL_NFT_ID()),
|
357
|
+
objectType: REGISTRY(),
|
358
|
+
isInterceptor: false,
|
359
|
+
objectAddress: address(0),
|
360
|
+
initialOwner: NFT_LOCK_ADDRESS,
|
361
|
+
data: ""
|
362
|
+
});
|
363
|
+
|
364
|
+
_chainNft.mint(NFT_LOCK_ADDRESS, globalRegistryId);
|
365
|
+
}
|
366
|
+
|
461
367
|
/// @dev defines which object - parent types relations are allowed to register
|
462
368
|
// IMPORTANT:
|
463
369
|
// 1) EACH object type MUST have only one parent type across ALL mappings
|
@@ -465,7 +371,7 @@ contract Registry is
|
|
465
371
|
// 3) DO NOT use REGISTRY as object type
|
466
372
|
// 2) DO NOT use PROTOCOL and "zeroObjectType"
|
467
373
|
function _setupValidObjectParentCombinations()
|
468
|
-
|
374
|
+
private
|
469
375
|
{
|
470
376
|
// registry as parent, ONLY registry owner
|
471
377
|
_isValidContractCombination[TOKEN()][REGISTRY()] = true;
|
@@ -487,4 +393,4 @@ contract Registry is
|
|
487
393
|
_isValidObjectCombination[BUNDLE()][POOL()] = true;
|
488
394
|
_isValidObjectCombination[STAKE()][POOL()] = true;
|
489
395
|
}
|
490
|
-
}
|
396
|
+
}
|