@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
@@ -0,0 +1,190 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
// import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
5
|
+
|
6
|
+
import {ERC165} from "./ERC165.sol";
|
7
|
+
import {INftOwnable} from "./INftOwnable.sol";
|
8
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
9
|
+
import {NftId, zeroNftId} from "../types/NftId.sol";
|
10
|
+
import {RegistryLinked} from "./RegistryLinked.sol";
|
11
|
+
|
12
|
+
contract NftOwnable is
|
13
|
+
ERC165,
|
14
|
+
RegistryLinked,
|
15
|
+
INftOwnable
|
16
|
+
{
|
17
|
+
// keccak256(abi.encode(uint256(keccak256("etherisc.storage.NftOwnable")) - 1)) & ~bytes32(uint256(0xff));
|
18
|
+
bytes32 public constant NFT_OWNABLE_STORAGE_LOCATION_V1 = 0x07ebcf49758b6ed3af50fa146bec0abe157c0218fe65dc0874c286e9d5da4f00;
|
19
|
+
|
20
|
+
struct NftOwnableStorage {
|
21
|
+
// IRegistry _registry;
|
22
|
+
NftId _nftId;
|
23
|
+
address _initialOwner;
|
24
|
+
}
|
25
|
+
|
26
|
+
/// @dev enforces msg.sender is owner of nft (or initial owner of nft ownable)
|
27
|
+
modifier onlyOwner() {
|
28
|
+
if (msg.sender != getOwner()) {
|
29
|
+
revert ErrorNotOwner(msg.sender);
|
30
|
+
}
|
31
|
+
_;
|
32
|
+
}
|
33
|
+
|
34
|
+
|
35
|
+
/// @dev initialization for upgradable contracts
|
36
|
+
// used in _initializeRegisterable
|
37
|
+
function initializeNftOwnable(
|
38
|
+
address initialOwner,
|
39
|
+
address registryAddress
|
40
|
+
)
|
41
|
+
public
|
42
|
+
virtual
|
43
|
+
onlyInitializing()
|
44
|
+
{
|
45
|
+
_setInitialOwner(initialOwner);
|
46
|
+
|
47
|
+
initializeRegistryLinked(registryAddress);
|
48
|
+
initializeERC165();
|
49
|
+
registerInterface(type(INftOwnable).interfaceId);
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
function initializeOwner(address initialOwner)
|
54
|
+
public
|
55
|
+
initializer()
|
56
|
+
{
|
57
|
+
_setInitialOwner(initialOwner);
|
58
|
+
initializeERC165();
|
59
|
+
registerInterface(type(INftOwnable).interfaceId);
|
60
|
+
}
|
61
|
+
|
62
|
+
|
63
|
+
/// @dev links this contract to nft after registration
|
64
|
+
// needs to be done once per registered contract and
|
65
|
+
// reduces registry calls to check ownership
|
66
|
+
// does not need any protection as function can only do the "right thing"
|
67
|
+
function linkToRegisteredNftId()
|
68
|
+
public
|
69
|
+
virtual
|
70
|
+
{
|
71
|
+
NftOwnableStorage storage $ = _getNftOwnableStorage();
|
72
|
+
|
73
|
+
if ($._nftId.gtz()) {
|
74
|
+
revert ErrorAlreadyLinked(address(getRegistry()), $._nftId);
|
75
|
+
}
|
76
|
+
|
77
|
+
if (address(getRegistry()) == address(0)) {
|
78
|
+
revert ErrorRegistryNotInitialized();
|
79
|
+
}
|
80
|
+
|
81
|
+
address contractAddress = address(this);
|
82
|
+
|
83
|
+
if (!getRegistry().isRegistered(contractAddress)) {
|
84
|
+
revert ErrorContractNotRegistered(contractAddress);
|
85
|
+
}
|
86
|
+
|
87
|
+
$._nftId = getRegistry().getNftId(contractAddress);
|
88
|
+
}
|
89
|
+
|
90
|
+
|
91
|
+
// function getRegistry() public view virtual override returns (IRegistry) {
|
92
|
+
// return _getNftOwnableStorage()._registry;
|
93
|
+
// }
|
94
|
+
|
95
|
+
function getNftId() public view virtual override returns (NftId) {
|
96
|
+
return _getNftOwnableStorage()._nftId;
|
97
|
+
}
|
98
|
+
|
99
|
+
function getInitialOwner() public view returns (address) {
|
100
|
+
return _getNftOwnableStorage()._initialOwner;
|
101
|
+
}
|
102
|
+
|
103
|
+
function getOwner() public view virtual override returns (address) {
|
104
|
+
NftOwnableStorage storage $ = _getNftOwnableStorage();
|
105
|
+
|
106
|
+
if ($._nftId.gtz()) {
|
107
|
+
return getRegistry().ownerOf($._nftId);
|
108
|
+
}
|
109
|
+
|
110
|
+
return $._initialOwner;
|
111
|
+
}
|
112
|
+
|
113
|
+
/// @dev set initialOwner
|
114
|
+
/// initial owner may only be set during initialization
|
115
|
+
function _setInitialOwner(address initialOwner)
|
116
|
+
internal
|
117
|
+
virtual
|
118
|
+
onlyInitializing()
|
119
|
+
{
|
120
|
+
if(initialOwner == address(0)) {
|
121
|
+
revert ErrorInitialOwnerZero();
|
122
|
+
}
|
123
|
+
|
124
|
+
_getNftOwnableStorage()._initialOwner = initialOwner;
|
125
|
+
}
|
126
|
+
|
127
|
+
// TODO check if function can be refactored to work with a registry address set in an initializer
|
128
|
+
/// @dev used in constructor of registry service manager
|
129
|
+
// links ownership of registry service manager ot nft owner of registry service
|
130
|
+
function _linkToNftOwnable(
|
131
|
+
address registryAddress,
|
132
|
+
address nftOwnableAddress
|
133
|
+
)
|
134
|
+
internal
|
135
|
+
onlyOwner()
|
136
|
+
returns (NftId)
|
137
|
+
{
|
138
|
+
NftOwnableStorage storage $ = _getNftOwnableStorage();
|
139
|
+
|
140
|
+
if ($._nftId.gtz()) {
|
141
|
+
revert ErrorAlreadyLinked(address(getRegistry()), $._nftId);
|
142
|
+
}
|
143
|
+
|
144
|
+
_setRegistry(registryAddress);
|
145
|
+
|
146
|
+
if (!getRegistry().isRegistered(nftOwnableAddress)) {
|
147
|
+
revert ErrorContractNotRegistered(nftOwnableAddress);
|
148
|
+
}
|
149
|
+
|
150
|
+
$._nftId = getRegistry().getNftId(nftOwnableAddress);
|
151
|
+
|
152
|
+
return $._nftId;
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
// function _setRegistry(address registryAddress)
|
157
|
+
// private
|
158
|
+
// {
|
159
|
+
// NftOwnableStorage storage $ = _getNftOwnableStorage();
|
160
|
+
|
161
|
+
// if (address($._registry) != address(0)) {
|
162
|
+
// revert ErrorRegistryAlreadyInitialized(address($._registry));
|
163
|
+
// }
|
164
|
+
|
165
|
+
// if (registryAddress == address(0)) {
|
166
|
+
// revert ErrorRegistryAddressZero();
|
167
|
+
// }
|
168
|
+
|
169
|
+
// if (registryAddress.code.length == 0) {
|
170
|
+
// revert ErrorNotRegistry(registryAddress);
|
171
|
+
// }
|
172
|
+
|
173
|
+
// $._registry = IRegistry(registryAddress);
|
174
|
+
|
175
|
+
// try $._registry.supportsInterface(type(IRegistry).interfaceId) returns (bool isRegistry) {
|
176
|
+
// if (!isRegistry) {
|
177
|
+
// revert ErrorNotRegistry(registryAddress);
|
178
|
+
// }
|
179
|
+
// } catch {
|
180
|
+
// revert ErrorNotRegistry(registryAddress);
|
181
|
+
// }
|
182
|
+
// }
|
183
|
+
|
184
|
+
|
185
|
+
function _getNftOwnableStorage() private pure returns (NftOwnableStorage storage $) {
|
186
|
+
assembly {
|
187
|
+
$.slot := NFT_OWNABLE_STORAGE_LOCATION_V1
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
|
+
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
|
6
|
+
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
7
|
+
|
8
|
+
import {ERC165} from "./ERC165.sol";
|
9
|
+
import {IPolicyHolder} from "./IPolicyHolder.sol";
|
10
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
11
|
+
import {NftId} from "../types/NftId.sol";
|
12
|
+
import {NumberId} from "../types/NumberId.sol";
|
13
|
+
import {RegistryLinked} from "./RegistryLinked.sol";
|
14
|
+
|
15
|
+
/// @dev template implementation for IPolicyHolder
|
16
|
+
contract PolicyHolder is
|
17
|
+
ERC165,
|
18
|
+
RegistryLinked,
|
19
|
+
IPolicyHolder
|
20
|
+
{
|
21
|
+
// keccak256(abi.encode(uint256(keccak256("etherisc.storage.PolicyHolder")) - 1)) & ~bytes32(uint256(0xff));
|
22
|
+
// TODO fix address
|
23
|
+
bytes32 public constant POLICY_HOLDER_STORAGE_LOCATION_V1 = 0x07ebcf49758b6ed3af50fa146bec0abe157c0218fe65dc0874c286e9d5da4f00;
|
24
|
+
|
25
|
+
// TODO uncomment/fix/refactor
|
26
|
+
struct PolicyHolderStorage {
|
27
|
+
// mapping(NftId policyId => mapping(NumberId claimId => address beneficiary)) private _claimBeneficiary;
|
28
|
+
// mapping(NftId policyId => address beneficiary) private _beneficiary;
|
29
|
+
bool dummy;
|
30
|
+
}
|
31
|
+
|
32
|
+
function initializePolicyHolder(
|
33
|
+
address registryAddress
|
34
|
+
)
|
35
|
+
public
|
36
|
+
virtual
|
37
|
+
onlyInitializing()
|
38
|
+
{
|
39
|
+
initializeRegistryLinked(registryAddress);
|
40
|
+
}
|
41
|
+
|
42
|
+
/// @dev empty default implementation
|
43
|
+
function policyCreatedCallback(NftId policyNftId) external virtual { }
|
44
|
+
|
45
|
+
/// @dev empty default implementation
|
46
|
+
function payoutExecutedCallback(NftId policyNftId, NumberId payoutId, address beneficiary, uint256 amount) external virtual { }
|
47
|
+
|
48
|
+
/// @dev determines beneficiary address that will be used in payouts targeting this contract
|
49
|
+
/// returned address will override GIF default where the policy nft holder is treated as beneficiary
|
50
|
+
function getBeneficiary(NftId policyId, NumberId claimId) external virtual view returns (address beneficiary) {
|
51
|
+
// TODO add implementation
|
52
|
+
}
|
53
|
+
|
54
|
+
//--- IERC165 functions ---------------//
|
55
|
+
function onERC721Received(
|
56
|
+
address, // operator
|
57
|
+
address, // from
|
58
|
+
uint256, // tokenId
|
59
|
+
bytes calldata // data
|
60
|
+
)
|
61
|
+
external
|
62
|
+
virtual
|
63
|
+
returns (bytes4)
|
64
|
+
{
|
65
|
+
return IERC721Receiver.onERC721Received.selector;
|
66
|
+
}
|
67
|
+
|
68
|
+
function _setBeneficiary(address beneficiary) internal {
|
69
|
+
|
70
|
+
}
|
71
|
+
|
72
|
+
function _setBeneficiary(NftId policyId, address beneficiary) internal {
|
73
|
+
|
74
|
+
}
|
75
|
+
|
76
|
+
function _getPolicyHolderStorage() private pure returns (PolicyHolderStorage storage $) {
|
77
|
+
assembly {
|
78
|
+
$.slot := POLICY_HOLDER_STORAGE_LOCATION_V1
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
@@ -1,16 +1,18 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {Ownable} from "@
|
5
|
-
import {ProxyAdmin} from "@
|
6
|
-
import {ITransparentUpgradeableProxy} from "@
|
4
|
+
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
5
|
+
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
|
6
|
+
import {ITransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
|
7
7
|
|
8
8
|
import {IVersionable} from "./IVersionable.sol";
|
9
|
+
import {NftOwnable} from "./NftOwnable.sol";
|
9
10
|
import {UpgradableProxyWithAdmin} from "./UpgradableProxyWithAdmin.sol";
|
10
|
-
import {IVersionable} from "./IVersionable.sol";
|
11
11
|
|
12
12
|
/// @dev manages proxy deployments for upgradable contracs of type IVersionable
|
13
|
-
contract ProxyManager is
|
13
|
+
contract ProxyManager is
|
14
|
+
NftOwnable
|
15
|
+
{
|
14
16
|
|
15
17
|
event LogProxyDeployed(address indexed proxy, address initialImplementation);
|
16
18
|
event LogProxyDeployedWithSalt(address indexed proxy, address initialImplementation);
|
@@ -20,23 +22,26 @@ contract ProxyManager is Ownable {
|
|
20
22
|
error ErrorAlreadyDeployedWithSalt();
|
21
23
|
error ErrorNotYetDeployed();
|
22
24
|
|
23
|
-
UpgradableProxyWithAdmin
|
24
|
-
bool
|
25
|
+
UpgradableProxyWithAdmin internal _proxy;
|
26
|
+
bool internal _isDeployed;
|
25
27
|
|
26
28
|
/// @dev only used to capture proxy owner
|
27
29
|
constructor()
|
28
|
-
|
29
|
-
|
30
|
+
{
|
31
|
+
initializeOwner(msg.sender);
|
32
|
+
}
|
30
33
|
|
31
34
|
/// @dev deploy initial contract
|
32
35
|
function deploy(address initialImplementation, bytes memory initializationData)
|
33
36
|
public
|
37
|
+
virtual
|
34
38
|
onlyOwner()
|
35
39
|
returns (IVersionable versionable)
|
36
40
|
{
|
37
41
|
if (_isDeployed) { revert ErrorAlreadyDeployed(); }
|
42
|
+
_isDeployed = true;
|
38
43
|
|
39
|
-
address currentProxyOwner =
|
44
|
+
address currentProxyOwner = getOwner(); // used by implementation
|
40
45
|
address initialProxyAdminOwner = address(this); // used by proxy
|
41
46
|
bytes memory data = getDeployData(initialImplementation, currentProxyOwner, initializationData);
|
42
47
|
|
@@ -46,36 +51,11 @@ contract ProxyManager is Ownable {
|
|
46
51
|
data
|
47
52
|
);
|
48
53
|
|
49
|
-
_isDeployed = true;
|
50
54
|
versionable = IVersionable(address(_proxy));
|
51
55
|
|
52
56
|
emit LogProxyDeployed(address(_proxy), initialImplementation);
|
53
57
|
}
|
54
58
|
|
55
|
-
function deployWithSalt(address initialImplementation, bytes memory initializationData, bytes32 salt)
|
56
|
-
public
|
57
|
-
onlyOwner()
|
58
|
-
returns (IVersionable versionable)
|
59
|
-
{
|
60
|
-
if (_isDeployed) { revert ErrorAlreadyDeployedWithSalt(); }
|
61
|
-
|
62
|
-
address currentProxyOwner = owner(); // used by implementation
|
63
|
-
address initialProxyAdminOwner = address(this); // used by proxy
|
64
|
-
bytes memory data = getDeployData(initialImplementation, currentProxyOwner, initializationData);
|
65
|
-
|
66
|
-
// via create2
|
67
|
-
_proxy = new UpgradableProxyWithAdmin{salt: salt}(
|
68
|
-
initialImplementation,
|
69
|
-
initialProxyAdminOwner,
|
70
|
-
data
|
71
|
-
);
|
72
|
-
|
73
|
-
_isDeployed = true;
|
74
|
-
versionable = IVersionable(address(_proxy));
|
75
|
-
|
76
|
-
emit LogProxyDeployedWithSalt(address(_proxy), initialImplementation);
|
77
|
-
}
|
78
|
-
|
79
59
|
/// @dev upgrade existing contract
|
80
60
|
function upgrade(address newImplementation, bytes memory upgradeData)
|
81
61
|
public
|
@@ -85,8 +65,8 @@ contract ProxyManager is Ownable {
|
|
85
65
|
{
|
86
66
|
if (!_isDeployed) { revert ErrorNotYetDeployed(); }
|
87
67
|
|
88
|
-
address currentProxyOwner =
|
89
|
-
ProxyAdmin proxyAdmin = getProxyAdmin();
|
68
|
+
address currentProxyOwner = getOwner();
|
69
|
+
ProxyAdmin proxyAdmin = getProxy().getProxyAdmin();
|
90
70
|
ITransparentUpgradeableProxy proxy = ITransparentUpgradeableProxy(address(_proxy));
|
91
71
|
bytes memory data = getUpgradeData(newImplementation, currentProxyOwner, upgradeData);
|
92
72
|
|
@@ -102,14 +82,14 @@ contract ProxyManager is Ownable {
|
|
102
82
|
}
|
103
83
|
|
104
84
|
function getDeployData(address implementation, address proxyOwner, bytes memory deployData) public pure returns (bytes memory data) {
|
105
|
-
return abi.encodeWithSelector(IVersionable.
|
85
|
+
return abi.encodeWithSelector(IVersionable.initializeVersionable.selector, implementation, proxyOwner, deployData);
|
106
86
|
}
|
107
87
|
|
108
88
|
function getUpgradeData(address implementation, address proxyOwner, bytes memory upgradeData) public pure returns (bytes memory data) {
|
109
|
-
return abi.encodeWithSelector(IVersionable.
|
89
|
+
return abi.encodeWithSelector(IVersionable.upgradeVersionable.selector, implementation, proxyOwner, upgradeData);
|
110
90
|
}
|
111
91
|
|
112
|
-
function
|
113
|
-
return _proxy
|
92
|
+
function getProxy() public returns (UpgradableProxyWithAdmin) {
|
93
|
+
return _proxy;
|
114
94
|
}
|
115
95
|
}
|
@@ -1,29 +1,27 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {Initializable} from "@
|
4
|
+
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
5
5
|
|
6
6
|
import {NftId, zeroNftId} from "../types/NftId.sol";
|
7
|
+
import {NftOwnable} from "../shared/NftOwnable.sol";
|
7
8
|
import {ObjectType} from "../types/ObjectType.sol";
|
8
9
|
|
9
10
|
import {IRegistry} from "../registry/IRegistry.sol";
|
10
11
|
import {IRegisterable} from "./IRegisterable.sol";
|
11
12
|
import {Versionable} from "./Versionable.sol";
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
ERC165,
|
17
|
-
IRegisterable,
|
18
|
-
Initializable
|
14
|
+
contract Registerable is
|
15
|
+
NftOwnable,
|
16
|
+
IRegisterable
|
19
17
|
{
|
20
18
|
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.shared.Registerable.sol")) - 1)) & ~bytes32(uint256(0xff));
|
21
19
|
bytes32 public constant REGISTERABLE_LOCATION_V1 = 0x6548007c3f4340f82f348c576c0ff69f4f529cadd5ad41f96aae61abceeaa300;
|
22
20
|
|
21
|
+
error ErrorRegisterableNotRegistry(address registryAddress);
|
22
|
+
|
23
23
|
struct RegisterableStorage {
|
24
|
-
IRegistry _registry;
|
25
24
|
NftId _parentNftId;
|
26
|
-
address _initialOwner;
|
27
25
|
ObjectType _objectType;
|
28
26
|
bool _isInterceptor;
|
29
27
|
bytes _data;
|
@@ -35,15 +33,7 @@ abstract contract Registerable is
|
|
35
33
|
}
|
36
34
|
}
|
37
35
|
|
38
|
-
|
39
|
-
require(
|
40
|
-
msg.sender == getOwner(),
|
41
|
-
"ERROR:RGB-001:NOT_OWNER"
|
42
|
-
);
|
43
|
-
_;
|
44
|
-
}
|
45
|
-
|
46
|
-
function _initializeRegisterable(
|
36
|
+
function initializeRegisterable(
|
47
37
|
address registryAddress,
|
48
38
|
NftId parentNftId,
|
49
39
|
ObjectType objectType,
|
@@ -51,67 +41,41 @@ abstract contract Registerable is
|
|
51
41
|
address initialOwner,
|
52
42
|
bytes memory data
|
53
43
|
)
|
54
|
-
|
55
|
-
//onlyInitializing//TODO uncomment when "fully" upgradeable
|
44
|
+
public
|
56
45
|
virtual
|
46
|
+
onlyInitializing
|
57
47
|
{
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
);
|
48
|
+
initializeNftOwnable(
|
49
|
+
initialOwner,
|
50
|
+
registryAddress);
|
62
51
|
|
63
52
|
// TODO check parentNftId -> registry.isRegistered(parentNftId)
|
64
53
|
// TODO check object-parent type pair -> registry.isValidTypeCombo() or something...verify with registry that setup will be able to register...
|
65
54
|
|
66
|
-
IRegistry registry = IRegistry(registryAddress);
|
67
|
-
require(
|
68
|
-
registry.supportsInterface(type(IRegistry).interfaceId),
|
69
|
-
"ERROR:RGB-011:NOT_REGISTRY"
|
70
|
-
);
|
71
|
-
|
72
55
|
RegisterableStorage storage $ = _getRegisterableStorage();
|
73
|
-
$._registry = registry;
|
74
56
|
$._parentNftId = parentNftId;
|
75
57
|
$._objectType = objectType;
|
76
58
|
$._isInterceptor = isInterceptor;
|
77
|
-
$._initialOwner = initialOwner;// not msg.sender because called in proxy constructor where msg.sender is proxy deployer
|
78
59
|
$._data = data;
|
79
60
|
|
80
|
-
|
61
|
+
registerInterface(type(IRegisterable).interfaceId);
|
81
62
|
}
|
82
63
|
|
83
|
-
// from IOwnable
|
84
|
-
function getOwner() public view virtual returns (address) {
|
85
|
-
return _getRegisterableStorage()._registry.ownerOf(address(this));
|
86
|
-
}
|
87
|
-
|
88
|
-
// from IRegisterable
|
89
|
-
function getRegistry() public view virtual returns (IRegistry registry) {
|
90
|
-
return _getRegisterableStorage()._registry;
|
91
|
-
}
|
92
|
-
|
93
|
-
function getNftId() public view virtual returns (NftId nftId) {
|
94
|
-
return _getRegisterableStorage()._registry.getNftId(address(this));
|
95
|
-
}
|
96
64
|
|
97
65
|
function getInitialInfo()
|
98
66
|
public
|
99
67
|
view
|
100
68
|
virtual
|
101
|
-
returns (IRegistry.ObjectInfo memory
|
69
|
+
returns (IRegistry.ObjectInfo memory info)
|
102
70
|
{
|
103
|
-
RegisterableStorage
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
$._data
|
113
|
-
),
|
114
|
-
bytes("")
|
115
|
-
);
|
71
|
+
RegisterableStorage memory $ = _getRegisterableStorage();
|
72
|
+
info = IRegistry.ObjectInfo(
|
73
|
+
zeroNftId(),
|
74
|
+
$._parentNftId,
|
75
|
+
$._objectType,
|
76
|
+
$._isInterceptor,
|
77
|
+
address(this),
|
78
|
+
getInitialOwner(),
|
79
|
+
$._data);
|
116
80
|
}
|
117
81
|
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
5
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
6
|
+
import {IRegistryLinked} from "./IRegistryLinked.sol";
|
7
|
+
|
8
|
+
contract RegistryLinked is
|
9
|
+
Initializable,
|
10
|
+
IRegistryLinked
|
11
|
+
{
|
12
|
+
|
13
|
+
IRegistry private _registry;
|
14
|
+
|
15
|
+
/// @dev initialization for upgradable contracts
|
16
|
+
// used in _initializeRegisterable
|
17
|
+
function initializeRegistryLinked(
|
18
|
+
address registryAddress
|
19
|
+
)
|
20
|
+
public
|
21
|
+
virtual
|
22
|
+
onlyInitializing()
|
23
|
+
{
|
24
|
+
_setRegistry(registryAddress);
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
function getRegistry() public view returns (IRegistry) {
|
29
|
+
return _registry;
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
function getRegistryAddress() public view returns (address) {
|
34
|
+
return address(_registry);
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
function _setRegistry(address registryAddress)
|
39
|
+
internal
|
40
|
+
{
|
41
|
+
|
42
|
+
if (address(_registry) != address(0)) {
|
43
|
+
revert ErrorRegistryAlreadyInitialized(address(_registry));
|
44
|
+
}
|
45
|
+
|
46
|
+
if (registryAddress == address(0)) {
|
47
|
+
revert ErrorRegistryAddressZero();
|
48
|
+
}
|
49
|
+
|
50
|
+
if (registryAddress.code.length == 0) {
|
51
|
+
revert ErrorNotRegistry(registryAddress);
|
52
|
+
}
|
53
|
+
|
54
|
+
_registry = IRegistry(registryAddress);
|
55
|
+
|
56
|
+
try _registry.supportsInterface(type(IRegistry).interfaceId) returns (bool isRegistry) {
|
57
|
+
if (!isRegistry) {
|
58
|
+
revert ErrorNotRegistry(registryAddress);
|
59
|
+
}
|
60
|
+
} catch {
|
61
|
+
revert ErrorNotRegistry(registryAddress);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {ObjectType, SERVICE} from "../types/ObjectType.sol";
|
5
|
+
import {NftId, zeroNftId} from "../types/NftId.sol";
|
6
|
+
import {Version, VersionPart, VersionLib} from "../types/Version.sol";
|
7
|
+
|
8
|
+
import {Versionable} from "./Versionable.sol";
|
9
|
+
import {IService} from "./IService.sol";
|
10
|
+
import {IVersionable} from "./IVersionable.sol";
|
11
|
+
import {Versionable} from "./Versionable.sol";
|
12
|
+
import {Registerable} from "./Registerable.sol";
|
13
|
+
|
14
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
15
|
+
|
16
|
+
|
17
|
+
/// @dev service base contract
|
18
|
+
abstract contract Service is
|
19
|
+
Registerable,
|
20
|
+
Versionable,
|
21
|
+
IService
|
22
|
+
{
|
23
|
+
function getDomain() public pure virtual override returns(ObjectType);
|
24
|
+
|
25
|
+
function getMajorVersion() public view virtual override returns(VersionPart majorVersion) {
|
26
|
+
return getVersion().toMajorPart();
|
27
|
+
}
|
28
|
+
|
29
|
+
// from Versionable
|
30
|
+
function getVersion()
|
31
|
+
public
|
32
|
+
pure
|
33
|
+
virtual override (IVersionable, Versionable)
|
34
|
+
returns(Version)
|
35
|
+
{
|
36
|
+
return VersionLib.toVersion(3,0,0);
|
37
|
+
}
|
38
|
+
|
39
|
+
function initializeService(
|
40
|
+
address registry,
|
41
|
+
address initialOwner
|
42
|
+
)
|
43
|
+
public
|
44
|
+
virtual
|
45
|
+
onlyInitializing()
|
46
|
+
{
|
47
|
+
// service must provide its name and version upon registration
|
48
|
+
bytes memory data = abi.encode(getDomain(), getMajorVersion());
|
49
|
+
NftId registryNftId = _getRegistryNftId(registry);
|
50
|
+
bool isInterceptor = false;
|
51
|
+
|
52
|
+
initializeRegisterable(registry, registryNftId, SERVICE(), isInterceptor, initialOwner, data);
|
53
|
+
registerInterface(type(IService).interfaceId);
|
54
|
+
}
|
55
|
+
|
56
|
+
// this is just a conveniene function, actual validation will be done upon registration
|
57
|
+
function _getRegistryNftId(address registryAddress) internal view returns (NftId) {
|
58
|
+
return IRegistry(registryAddress).getNftId(registryAddress);
|
59
|
+
}
|
60
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
6
|
+
|
7
|
+
contract TokenHandler {
|
8
|
+
IERC20Metadata private _token;
|
9
|
+
|
10
|
+
constructor(address token) {
|
11
|
+
_token = IERC20Metadata(token);
|
12
|
+
}
|
13
|
+
|
14
|
+
// TODO add logging
|
15
|
+
function transfer(
|
16
|
+
address from,
|
17
|
+
address to,
|
18
|
+
uint256 amount // TODO add authz (only treasury/instance/product/pool/ service)
|
19
|
+
) external {
|
20
|
+
SafeERC20.safeTransferFrom(_token, from, to, amount);
|
21
|
+
// _token.transferFrom(from, to, amount);
|
22
|
+
}
|
23
|
+
|
24
|
+
function getToken() external view returns (IERC20Metadata) {
|
25
|
+
return _token;
|
26
|
+
}
|
27
|
+
}
|