@etherisc/gif-next 0.0.2-e5a2253-213 → 0.0.2-e69072e-892
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +73 -1
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → Component.sol/Component.json} +340 -59
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +804 -211
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → IComponent.sol/IComponent.json} +95 -56
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +699 -22
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +814 -60
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +519 -4
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +896 -298
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +442 -129
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +910 -289
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +110 -171
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +874 -557
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +52 -115
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +101 -168
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +346 -263
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +319 -86
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +119 -189
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +13 -13
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +968 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +665 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +258 -283
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +305 -80
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +754 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +637 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +983 -221
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +441 -72
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +556 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +130 -217
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/{shared/RegisterableUpgradable.sol/RegisterableUpgradable.json → instance/service/IClaimService.sol/IClaimService.json} +146 -179
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +552 -140
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +40 -292
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +22 -174
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +22 -174
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +161 -407
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +311 -114
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +139 -237
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +302 -77
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +139 -237
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +302 -77
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +98 -5
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +112 -198
- 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 +112 -27
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +18 -18
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +216 -234
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +300 -81
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +70 -53
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +151 -50
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +41 -3
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +40 -29
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +21 -34
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/{experiment/inheritance/IB.sol/IB.json → shared/IRegistryLinked.sol/IRegistryLinked.json} +18 -20
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +22 -174
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -152
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +120 -27
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +248 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +294 -61
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +129 -51
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +84 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +114 -157
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -152
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +129 -51
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +135 -214
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +8 -190
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +100 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +100 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +25 -7
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Component.sol +221 -0
- package/contracts/components/Distribution.sol +206 -67
- package/contracts/components/IComponent.sol +68 -0
- package/contracts/components/IDistributionComponent.sol +44 -9
- package/contracts/components/IPoolComponent.sol +124 -39
- package/contracts/components/IProductComponent.sol +8 -3
- package/contracts/components/Pool.sol +284 -164
- package/contracts/components/Product.sol +110 -116
- package/contracts/instance/BundleManager.sol +8 -12
- package/contracts/instance/IInstance.sol +41 -9
- package/contracts/instance/IInstanceService.sol +20 -1
- package/contracts/instance/Instance.sol +90 -61
- package/contracts/instance/InstanceAccessManager.sol +18 -24
- package/contracts/instance/InstanceReader.sol +3 -25
- package/contracts/instance/InstanceService.sol +195 -50
- package/contracts/instance/InstanceServiceManager.sol +1 -1
- package/contracts/instance/ObjectManager.sol +7 -24
- package/contracts/instance/base/{ComponentServiceBase.sol → ComponentService.sol} +9 -13
- package/contracts/instance/module/IAccess.sol +3 -4
- package/contracts/instance/module/IBundle.sol +2 -1
- package/contracts/instance/module/IDistribution.sol +2 -0
- package/contracts/instance/module/IPolicy.sol +30 -3
- package/contracts/instance/module/ISetup.sol +10 -10
- package/contracts/instance/service/ApplicationService.sol +350 -0
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +17 -12
- package/contracts/instance/service/BundleServiceManager.sol +1 -1
- package/contracts/instance/service/ClaimService.sol +151 -0
- package/contracts/instance/service/ClaimServiceManager.sol +35 -0
- package/contracts/instance/service/DistributionService.sol +312 -33
- package/contracts/instance/service/DistributionServiceManager.sol +1 -1
- package/contracts/instance/service/IApplicationService.sol +82 -0
- package/contracts/instance/service/IBundleService.sol +14 -3
- package/contracts/instance/service/IClaimService.sol +61 -0
- package/contracts/instance/service/IDistributionService.sol +74 -0
- package/contracts/instance/service/IPolicyService.sol +26 -50
- package/contracts/instance/service/PolicyService.sol +127 -262
- package/contracts/instance/service/PolicyServiceManager.sol +2 -2
- package/contracts/instance/service/PoolService.sol +12 -45
- package/contracts/instance/service/PoolServiceManager.sol +1 -1
- package/contracts/instance/service/ProductService.sol +50 -26
- package/contracts/instance/service/ProductServiceManager.sol +2 -2
- package/contracts/registry/IRegistry.sol +16 -8
- package/contracts/registry/IRegistryService.sol +19 -10
- package/contracts/registry/Registry.sol +120 -52
- package/contracts/registry/RegistryAccessManager.sol +31 -25
- package/contracts/registry/RegistryService.sol +91 -128
- package/contracts/registry/RegistryServiceManager.sol +13 -13
- package/contracts/registry/ReleaseManager.sol +86 -106
- package/contracts/registry/TokenRegistry.sol +19 -13
- package/contracts/shared/ERC165.sol +14 -12
- package/contracts/shared/INftOwnable.sol +11 -10
- package/contracts/shared/IPolicyHolder.sol +26 -0
- package/contracts/shared/IRegisterable.sol +4 -4
- package/contracts/shared/IRegistryLinked.sol +12 -0
- package/contracts/shared/IService.sol +2 -0
- package/contracts/shared/IVersionable.sol +4 -47
- package/contracts/shared/NftOwnable.sol +66 -80
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +100 -25
- package/contracts/shared/Registerable.sol +16 -32
- package/contracts/shared/RegistryLinked.sol +48 -0
- package/contracts/shared/Service.sol +19 -19
- package/contracts/shared/Versionable.sol +4 -92
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/ClaimId.sol +52 -0
- package/contracts/types/DistributorType.sol +2 -2
- package/contracts/types/ObjectType.sol +9 -5
- package/contracts/types/PayoutId.sol +54 -0
- package/contracts/types/RoleId.sol +12 -7
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/Timestamp.sol +12 -13
- package/package.json +3 -3
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +0 -66
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +0 -24
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +0 -42
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Require.sol/Require.json +0 -105
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +0 -105
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/A.json +0 -128
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +0 -42
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/B.sol/B.json +0 -76
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/C.sol/C.json +0 -89
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.json +0 -128
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.json +0 -37
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.json +0 -63
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +0 -59
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +0 -74
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +0 -207
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +0 -10
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +0 -10
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -100
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/contracts/components/BaseComponent.sol +0 -168
- package/contracts/components/IBaseComponent.sol +0 -35
- package/contracts/experiment/cloning/Cloner.sol +0 -47
- package/contracts/experiment/errors/Require.sol +0 -38
- package/contracts/experiment/errors/Revert.sol +0 -44
- package/contracts/experiment/inheritance/A.sol +0 -53
- package/contracts/experiment/inheritance/B.sol +0 -28
- package/contracts/experiment/inheritance/C.sol +0 -34
- package/contracts/experiment/inheritance/IA.sol +0 -13
- package/contracts/experiment/inheritance/IB.sol +0 -10
- package/contracts/experiment/inheritance/IC.sol +0 -12
- package/contracts/experiment/statemachine/Dummy.sol +0 -27
- package/contracts/experiment/statemachine/ISM.sol +0 -25
- package/contracts/experiment/statemachine/SM.sol +0 -57
- package/contracts/experiment/statemachine/SimpleStateMachine.sol +0 -31
- package/contracts/experiment/types/TypeA.sol +0 -47
- package/contracts/experiment/types/TypeB.sol +0 -29
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +0 -23
- package/contracts/instance/IInstanceBase.sol +0 -25
- package/contracts/instance/InstanceBase.sol +0 -39
- package/contracts/instance/base/IInstanceBase.sol +0 -21
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -10,16 +10,22 @@ import {IInstanceService} from "./IInstanceService.sol";
|
|
10
10
|
import {InstanceReader} from "./InstanceReader.sol";
|
11
11
|
import {BundleManager} from "./BundleManager.sol";
|
12
12
|
import {IRegistry} from "../registry/IRegistry.sol";
|
13
|
-
import {
|
13
|
+
import {IRegistryService} from "../registry/IRegistryService.sol";
|
14
14
|
import {ChainNft} from "../registry/ChainNft.sol";
|
15
15
|
import {Service} from "../../contracts/shared/Service.sol";
|
16
16
|
import {IService} from "../shared/IService.sol";
|
17
17
|
import {NftId} from "../../contracts/types/NftId.sol";
|
18
18
|
import {RoleId} from "../types/RoleId.sol";
|
19
|
-
import {ADMIN_ROLE, DISTRIBUTION_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE, PRODUCT_SERVICE_ROLE, POLICY_SERVICE_ROLE, BUNDLE_SERVICE_ROLE} from "../types/RoleId.sol";
|
20
|
-
import {ObjectType, INSTANCE, BUNDLE, POLICY, PRODUCT, DISTRIBUTION, REGISTRY, POOL} from "../types/ObjectType.sol";
|
19
|
+
import {ADMIN_ROLE, DISTRIBUTION_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE, PUBLIC_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE, PRODUCT_SERVICE_ROLE, APPLICATION_SERVICE_ROLE, POLICY_SERVICE_ROLE, CLAIM_SERVICE_ROLE, BUNDLE_SERVICE_ROLE} from "../types/RoleId.sol";
|
20
|
+
import {ObjectType, INSTANCE, BUNDLE, APPLICATION, POLICY, CLAIM, PRODUCT, DISTRIBUTION, REGISTRY, POOL} from "../types/ObjectType.sol";
|
21
|
+
import {IDistributionComponent} from "../components/IDistributionComponent.sol";
|
22
|
+
import {IPoolComponent} from "../components/IPoolComponent.sol";
|
23
|
+
import {IProductComponent} from "../components/IProductComponent.sol";
|
21
24
|
|
22
|
-
contract InstanceService is
|
25
|
+
contract InstanceService is
|
26
|
+
Service,
|
27
|
+
IInstanceService
|
28
|
+
{
|
23
29
|
|
24
30
|
address internal _masterInstanceAccessManager;
|
25
31
|
address internal _masterInstance;
|
@@ -28,11 +34,10 @@ contract InstanceService is Service, IInstanceService {
|
|
28
34
|
|
29
35
|
// TODO update to real hash when instance is stable
|
30
36
|
bytes32 public constant INSTANCE_CREATION_CODE_HASH = bytes32(0);
|
31
|
-
string public constant NAME = "InstanceService";
|
32
37
|
|
33
38
|
modifier onlyInstanceOwner(NftId instanceNftId) {
|
34
39
|
IRegistry registry = getRegistry();
|
35
|
-
ChainNft chainNft = registry.
|
40
|
+
ChainNft chainNft = ChainNft(registry.getChainNftAddress());
|
36
41
|
|
37
42
|
if( msg.sender != chainNft.ownerOf(instanceNftId.toInt())) {
|
38
43
|
revert ErrorInstanceServiceNotInstanceOwner(msg.sender, instanceNftId);
|
@@ -63,25 +68,23 @@ contract InstanceService is Service, IInstanceService {
|
|
63
68
|
address registryAddress = address(registry);
|
64
69
|
NftId registryNftId = registry.getNftId(registryAddress);
|
65
70
|
address registryServiceAddress = registry.getServiceAddress(REGISTRY(), getMajorVersion());
|
66
|
-
|
71
|
+
IRegistryService registryService = IRegistryService(registryServiceAddress);
|
67
72
|
|
68
73
|
// initially set the authority of the access managar to this (being the instance service).
|
69
74
|
// This will allow the instance service to bootstrap the authorizations of the instance
|
70
75
|
// and then transfer the ownership of the access manager to the instance owner once everything is setup
|
71
76
|
clonedAccessManager = InstanceAccessManager(Clones.clone(_masterInstanceAccessManager));
|
72
|
-
clonedAccessManager.
|
77
|
+
clonedAccessManager.initialize(address(this));
|
73
78
|
|
74
79
|
clonedInstance = Instance(Clones.clone(_masterInstance));
|
75
80
|
clonedInstance.initialize(address(clonedAccessManager), registryAddress, registryNftId, msg.sender);
|
76
|
-
( IRegistry.ObjectInfo memory info, ) = registryService.registerInstance(clonedInstance);
|
77
|
-
clonedInstanceNftId = info.nftId;
|
78
81
|
|
79
82
|
clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
80
|
-
clonedInstanceReader.initialize(registryAddress,
|
83
|
+
clonedInstanceReader.initialize(registryAddress, address(clonedInstance));
|
81
84
|
clonedInstance.setInstanceReader(clonedInstanceReader);
|
82
85
|
|
83
86
|
clonedBundleManager = BundleManager(Clones.clone(_masterInstanceBundleManager));
|
84
|
-
clonedBundleManager.initialize(address(clonedAccessManager), registryAddress,
|
87
|
+
clonedBundleManager.initialize(address(clonedAccessManager), registryAddress, address(clonedInstance));
|
85
88
|
clonedInstance.setBundleManager(clonedBundleManager);
|
86
89
|
|
87
90
|
// TODO amend setters with instance specific , policy manager ...
|
@@ -93,6 +96,10 @@ contract InstanceService is Service, IInstanceService {
|
|
93
96
|
clonedAccessManager.grantRole(ADMIN_ROLE(), instanceOwner);
|
94
97
|
clonedAccessManager.revokeRole(ADMIN_ROLE(), address(this));
|
95
98
|
|
99
|
+
IRegistry.ObjectInfo memory info = registryService.registerInstance(clonedInstance, instanceOwner);
|
100
|
+
clonedInstanceNftId = info.nftId;
|
101
|
+
// clonedInstance.linkToRegisteredNftId();
|
102
|
+
|
96
103
|
emit LogInstanceCloned(address(clonedAccessManager), address(clonedInstance), address(clonedInstanceReader), clonedInstanceNftId);
|
97
104
|
}
|
98
105
|
|
@@ -102,7 +109,9 @@ contract InstanceService is Service, IInstanceService {
|
|
102
109
|
_grantDistributionServiceAuthorizations(clonedAccessManager, clonedInstance);
|
103
110
|
_grantPoolServiceAuthorizations(clonedAccessManager, clonedInstance);
|
104
111
|
_grantProductServiceAuthorizations(clonedAccessManager, clonedInstance);
|
112
|
+
_grantApplicationServiceAuthorizations(clonedAccessManager, clonedInstance);
|
105
113
|
_grantPolicyServiceAuthorizations(clonedAccessManager, clonedInstance);
|
114
|
+
_grantClaimServiceAuthorizations(clonedAccessManager, clonedInstance);
|
106
115
|
_grantBundleServiceAuthorizations(clonedAccessManager, clonedInstance, clonedBundleManager);
|
107
116
|
_grantInstanceServiceAuthorizations(clonedAccessManager, clonedInstance);
|
108
117
|
}
|
@@ -115,12 +124,15 @@ contract InstanceService is Service, IInstanceService {
|
|
115
124
|
clonedAccessManager.createGifRole(DISTRIBUTION_SERVICE_ROLE(), "DistributionServiceRole");
|
116
125
|
clonedAccessManager.createGifRole(POOL_SERVICE_ROLE(), "PoolServiceRole");
|
117
126
|
clonedAccessManager.createGifRole(PRODUCT_SERVICE_ROLE(), "ProductServiceRole");
|
127
|
+
clonedAccessManager.createGifRole(APPLICATION_SERVICE_ROLE(), "ApplicationServiceRole");
|
118
128
|
clonedAccessManager.createGifRole(POLICY_SERVICE_ROLE(), "PolicyServiceRole");
|
129
|
+
clonedAccessManager.createGifRole(CLAIM_SERVICE_ROLE(), "ClaimServiceRole");
|
119
130
|
clonedAccessManager.createGifRole(BUNDLE_SERVICE_ROLE(), "BundleServiceRole");
|
120
131
|
clonedAccessManager.createGifRole(INSTANCE_SERVICE_ROLE(), "InstanceServiceRole");
|
121
132
|
}
|
122
133
|
|
123
134
|
function _createGifTargets(InstanceAccessManager clonedAccessManager, Instance clonedInstance, BundleManager clonedBundleManager) internal {
|
135
|
+
clonedAccessManager.createGifTarget(address(clonedAccessManager), "InstanceAccessManager");
|
124
136
|
clonedAccessManager.createGifTarget(address(clonedInstance), "Instance");
|
125
137
|
clonedAccessManager.createGifTarget(address(clonedBundleManager), "BundleManager");
|
126
138
|
}
|
@@ -130,18 +142,27 @@ contract InstanceService is Service, IInstanceService {
|
|
130
142
|
IRegistry registry = getRegistry();
|
131
143
|
address distributionServiceAddress = registry.getServiceAddress(DISTRIBUTION(), getMajorVersion());
|
132
144
|
clonedAccessManager.grantRole(DISTRIBUTION_SERVICE_ROLE(), distributionServiceAddress);
|
133
|
-
bytes4[] memory instanceDistributionServiceSelectors = new bytes4[](
|
145
|
+
bytes4[] memory instanceDistributionServiceSelectors = new bytes4[](11);
|
134
146
|
instanceDistributionServiceSelectors[0] = clonedInstance.createDistributionSetup.selector;
|
135
147
|
instanceDistributionServiceSelectors[1] = clonedInstance.updateDistributionSetup.selector;
|
148
|
+
instanceDistributionServiceSelectors[2] = clonedInstance.createDistributorType.selector;
|
149
|
+
instanceDistributionServiceSelectors[3] = clonedInstance.updateDistributorType.selector;
|
150
|
+
instanceDistributionServiceSelectors[4] = clonedInstance.updateDistributorTypeState.selector;
|
151
|
+
instanceDistributionServiceSelectors[5] = clonedInstance.createDistributor.selector;
|
152
|
+
instanceDistributionServiceSelectors[6] = clonedInstance.updateDistributor.selector;
|
153
|
+
instanceDistributionServiceSelectors[7] = clonedInstance.updateDistributorState.selector;
|
154
|
+
instanceDistributionServiceSelectors[8] = clonedInstance.createReferral.selector;
|
155
|
+
instanceDistributionServiceSelectors[9] = clonedInstance.updateReferral.selector;
|
156
|
+
instanceDistributionServiceSelectors[10] = clonedInstance.updateReferralState.selector;
|
136
157
|
clonedAccessManager.setTargetFunctionRole(
|
137
158
|
"Instance",
|
138
159
|
instanceDistributionServiceSelectors,
|
139
|
-
DISTRIBUTION_SERVICE_ROLE());
|
160
|
+
DISTRIBUTION_SERVICE_ROLE());
|
140
161
|
}
|
141
162
|
|
142
163
|
function _grantPoolServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
143
164
|
// configure authorization for pool service on instance
|
144
|
-
address poolServiceAddress =
|
165
|
+
address poolServiceAddress = getRegistry().getServiceAddress(POOL(), getMajorVersion());
|
145
166
|
clonedAccessManager.grantRole(POOL_SERVICE_ROLE(), address(poolServiceAddress));
|
146
167
|
bytes4[] memory instancePoolServiceSelectors = new bytes4[](4);
|
147
168
|
instancePoolServiceSelectors[0] = clonedInstance.createPoolSetup.selector;
|
@@ -154,7 +175,7 @@ contract InstanceService is Service, IInstanceService {
|
|
154
175
|
|
155
176
|
function _grantProductServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
156
177
|
// configure authorization for product service on instance
|
157
|
-
address productServiceAddress =
|
178
|
+
address productServiceAddress = getRegistry().getServiceAddress(PRODUCT(), getMajorVersion());
|
158
179
|
clonedAccessManager.grantRole(PRODUCT_SERVICE_ROLE(), address(productServiceAddress));
|
159
180
|
bytes4[] memory instanceProductServiceSelectors = new bytes4[](5);
|
160
181
|
instanceProductServiceSelectors[0] = clonedInstance.createProductSetup.selector;
|
@@ -168,23 +189,50 @@ contract InstanceService is Service, IInstanceService {
|
|
168
189
|
PRODUCT_SERVICE_ROLE());
|
169
190
|
}
|
170
191
|
|
192
|
+
function _grantApplicationServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
193
|
+
// configure authorization for application services on instance
|
194
|
+
address applicationServiceAddress = getRegistry().getServiceAddress(APPLICATION(), getMajorVersion());
|
195
|
+
clonedAccessManager.grantRole(APPLICATION_SERVICE_ROLE(), applicationServiceAddress);
|
196
|
+
bytes4[] memory instanceApplicationServiceSelectors = new bytes4[](3);
|
197
|
+
instanceApplicationServiceSelectors[0] = clonedInstance.createApplication.selector;
|
198
|
+
instanceApplicationServiceSelectors[1] = clonedInstance.updateApplication.selector;
|
199
|
+
instanceApplicationServiceSelectors[2] = clonedInstance.updateApplicationState.selector;
|
200
|
+
clonedAccessManager.setTargetFunctionRole(
|
201
|
+
"Instance",
|
202
|
+
instanceApplicationServiceSelectors,
|
203
|
+
APPLICATION_SERVICE_ROLE());
|
204
|
+
}
|
205
|
+
|
171
206
|
function _grantPolicyServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
172
|
-
// configure authorization for policy
|
173
|
-
address policyServiceAddress =
|
174
|
-
clonedAccessManager.grantRole(POLICY_SERVICE_ROLE(),
|
175
|
-
bytes4[] memory instancePolicyServiceSelectors = new bytes4[](
|
176
|
-
instancePolicyServiceSelectors[0] = clonedInstance.
|
177
|
-
instancePolicyServiceSelectors[1] = clonedInstance.
|
178
|
-
instancePolicyServiceSelectors[2] = clonedInstance.updatePolicyState.selector;
|
207
|
+
// configure authorization for policy services on instance
|
208
|
+
address policyServiceAddress = getRegistry().getServiceAddress(POLICY(), getMajorVersion());
|
209
|
+
clonedAccessManager.grantRole(POLICY_SERVICE_ROLE(), policyServiceAddress);
|
210
|
+
bytes4[] memory instancePolicyServiceSelectors = new bytes4[](2);
|
211
|
+
instancePolicyServiceSelectors[0] = clonedInstance.updatePolicy.selector;
|
212
|
+
instancePolicyServiceSelectors[1] = clonedInstance.updatePolicyState.selector;
|
179
213
|
clonedAccessManager.setTargetFunctionRole(
|
180
214
|
"Instance",
|
181
215
|
instancePolicyServiceSelectors,
|
182
216
|
POLICY_SERVICE_ROLE());
|
183
217
|
}
|
184
218
|
|
219
|
+
function _grantClaimServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
220
|
+
// configure authorization for claim/payout services on instance
|
221
|
+
address claimServiceAddress = getRegistry().getServiceAddress(CLAIM(), getMajorVersion());
|
222
|
+
clonedAccessManager.grantRole(POLICY_SERVICE_ROLE(), claimServiceAddress);
|
223
|
+
// TODO add claims function authz
|
224
|
+
bytes4[] memory instanceClaimServiceSelectors = new bytes4[](0);
|
225
|
+
// instanceClaimServiceSelectors[0] = clonedInstance.updatePolicy.selector;
|
226
|
+
// instanceClaimServiceSelectors[1] = clonedInstance.updatePolicyState.selector;
|
227
|
+
clonedAccessManager.setTargetFunctionRole(
|
228
|
+
"Instance",
|
229
|
+
instanceClaimServiceSelectors,
|
230
|
+
CLAIM_SERVICE_ROLE());
|
231
|
+
}
|
232
|
+
|
185
233
|
function _grantBundleServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance, BundleManager clonedBundleManager) internal {
|
186
234
|
// configure authorization for bundle service on instance
|
187
|
-
address bundleServiceAddress =
|
235
|
+
address bundleServiceAddress = getRegistry().getServiceAddress(BUNDLE(), getMajorVersion());
|
188
236
|
clonedAccessManager.grantRole(BUNDLE_SERVICE_ROLE(), address(bundleServiceAddress));
|
189
237
|
bytes4[] memory instanceBundleServiceSelectors = new bytes4[](2);
|
190
238
|
instanceBundleServiceSelectors[0] = clonedInstance.createBundle.selector;
|
@@ -209,7 +257,7 @@ contract InstanceService is Service, IInstanceService {
|
|
209
257
|
|
210
258
|
function _grantInstanceServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
211
259
|
// configure authorization for instance service on instance
|
212
|
-
address instanceServiceAddress =
|
260
|
+
address instanceServiceAddress = getRegistry().getServiceAddress(INSTANCE(), getMajorVersion());
|
213
261
|
clonedAccessManager.grantRole(INSTANCE_SERVICE_ROLE(), instanceServiceAddress);
|
214
262
|
bytes4[] memory instanceInstanceServiceSelectors = new bytes4[](1);
|
215
263
|
instanceInstanceServiceSelectors[0] = clonedInstance.setInstanceReader.selector;
|
@@ -217,43 +265,67 @@ contract InstanceService is Service, IInstanceService {
|
|
217
265
|
"Instance",
|
218
266
|
instanceInstanceServiceSelectors,
|
219
267
|
INSTANCE_SERVICE_ROLE());
|
220
|
-
}
|
221
268
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
269
|
+
bytes4[] memory instanceAccessManagerInstanceServiceSelectors = new bytes4[](1);
|
270
|
+
instanceAccessManagerInstanceServiceSelectors[0] = clonedAccessManager.createGifTarget.selector;
|
271
|
+
clonedAccessManager.setTargetFunctionRole(
|
272
|
+
"InstanceAccessManager",
|
273
|
+
instanceAccessManagerInstanceServiceSelectors,
|
274
|
+
INSTANCE_SERVICE_ROLE());
|
275
|
+
}
|
226
276
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
277
|
+
function setAndRegisterMasterInstance(address instanceAddress)
|
278
|
+
external
|
279
|
+
onlyOwner
|
280
|
+
returns(NftId masterInstanceNftId)
|
281
|
+
{
|
282
|
+
if(_masterInstance != address(0)) { revert ErrorInstanceServiceMasterInstanceAlreadySet(); }
|
283
|
+
if(_masterInstanceAccessManager != address(0)) { revert ErrorInstanceServiceMasterInstanceAccessManagerAlreadySet(); }
|
284
|
+
if(_masterInstanceBundleManager != address(0)) { revert ErrorInstanceServiceMasterBundleManagerAlreadySet(); }
|
231
285
|
|
232
|
-
|
233
|
-
InstanceReader instanceReader = InstanceReader(instanceReaderAddress);
|
234
|
-
BundleManager bundleManager = BundleManager(bundleManagerAddress);
|
286
|
+
if(instanceAddress == address(0)) { revert ErrorInstanceServiceInstanceAddressZero(); }
|
235
287
|
|
236
|
-
|
237
|
-
|
238
|
-
|
288
|
+
IInstance instance = IInstance(instanceAddress);
|
289
|
+
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
290
|
+
address accessManagerAddress = address(accessManager);
|
291
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
292
|
+
address instanceReaderAddress = address(instanceReader);
|
293
|
+
BundleManager bundleManager = instance.getBundleManager();
|
294
|
+
address bundleManagerAddress = address(bundleManager);
|
295
|
+
|
296
|
+
if(accessManagerAddress == address(0)) { revert ErrorInstanceServiceAccessManagerZero(); }
|
297
|
+
if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderZero(); }
|
298
|
+
if(bundleManagerAddress == address(0)) { revert ErrorInstanceServiceBundleManagerZero(); }
|
299
|
+
|
300
|
+
if(instance.authority() != accessManagerAddress) { revert ErrorInstanceServiceInstanceAuthorityMismatch(); }
|
301
|
+
if(instanceReader.getInstance() != instance) { revert ErrorInstanceServiceInstanceReaderInstanceMismatch2(); }
|
302
|
+
if(bundleManager.getInstance() != instance) { revert ErrorInstanceServiceBundleMangerInstanceMismatch(); }
|
239
303
|
|
240
304
|
_masterInstanceAccessManager = accessManagerAddress;
|
241
305
|
_masterInstance = instanceAddress;
|
242
306
|
_masterInstanceReader = instanceReaderAddress;
|
243
307
|
_masterInstanceBundleManager = bundleManagerAddress;
|
308
|
+
|
309
|
+
IRegistryService registryService = IRegistryService(getRegistry().getServiceAddress(REGISTRY(), getMajorVersion()));
|
310
|
+
IInstance masterInstance = IInstance(_masterInstance);
|
311
|
+
IRegistry.ObjectInfo memory info = registryService.registerInstance(masterInstance, getOwner());
|
312
|
+
masterInstanceNftId = info.nftId;
|
313
|
+
|
314
|
+
// masterInstance.linkToRegisteredNftId();
|
244
315
|
}
|
245
316
|
|
246
317
|
function setMasterInstanceReader(address instanceReaderAddress) external onlyOwner {
|
247
|
-
|
248
|
-
|
249
|
-
|
318
|
+
if(_masterInstanceReader == address(0)) { revert ErrorInstanceServiceMasterInstanceReaderNotSet(); }
|
319
|
+
if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderAddressZero(); }
|
320
|
+
if(instanceReaderAddress == _masterInstanceReader) { revert ErrorInstanceServiceInstanceReaderSameAsMasterInstanceReader(); }
|
250
321
|
|
251
322
|
InstanceReader instanceReader = InstanceReader(instanceReaderAddress);
|
252
|
-
|
323
|
+
if(instanceReader.getInstance() != IInstance(_masterInstance)) { revert ErrorInstanceServiceInstanceReaderInstanceMismatch(); }
|
253
324
|
|
254
325
|
_masterInstanceReader = instanceReaderAddress;
|
255
326
|
}
|
256
327
|
|
328
|
+
// TODO access restriction
|
257
329
|
function upgradeInstanceReader(NftId instanceNftId) external {
|
258
330
|
IRegistry registry = getRegistry();
|
259
331
|
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
@@ -265,7 +337,7 @@ contract InstanceService is Service, IInstanceService {
|
|
265
337
|
}
|
266
338
|
|
267
339
|
InstanceReader upgradedInstanceReaderClone = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
268
|
-
upgradedInstanceReaderClone.initialize(address(registry),
|
340
|
+
upgradedInstanceReaderClone.initialize(address(registry), address(instance));
|
269
341
|
instance.setInstanceReader(upgradedInstanceReaderClone);
|
270
342
|
}
|
271
343
|
|
@@ -304,9 +376,8 @@ contract InstanceService is Service, IInstanceService {
|
|
304
376
|
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
305
377
|
// TODO while InstanceService is not deployed in InstanceServiceManager constructor
|
306
378
|
// owner is InstanceServiceManager deployer
|
307
|
-
|
308
|
-
|
309
|
-
_registerInterface(type(IInstanceService).interfaceId);
|
379
|
+
initializeService(registryAddress, owner);
|
380
|
+
registerInterface(type(IInstanceService).interfaceId);
|
310
381
|
}
|
311
382
|
|
312
383
|
function hasRole(address account, RoleId role, address instanceAddress) public view returns (bool) {
|
@@ -315,12 +386,86 @@ contract InstanceService is Service, IInstanceService {
|
|
315
386
|
return accessManager.hasRole(role, account);
|
316
387
|
}
|
317
388
|
|
318
|
-
function
|
389
|
+
function createGifTarget(NftId instanceNftId, address targetAddress, string memory targetName) external onlyRegisteredService {
|
319
390
|
IRegistry registry = getRegistry();
|
320
391
|
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
321
392
|
Instance instance = Instance(instanceInfo.objectAddress);
|
322
393
|
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
323
|
-
accessManager.
|
394
|
+
accessManager.createGifTarget(targetAddress, targetName);
|
395
|
+
}
|
396
|
+
|
397
|
+
function grantDistributionDefaultPermissions(NftId instanceNftId, address distributionAddress, string memory distributionName) external onlyRegisteredService {
|
398
|
+
IRegistry registry = getRegistry();
|
399
|
+
IRegistry.ObjectInfo memory distributionInfo = registry.getObjectInfo(distributionAddress);
|
400
|
+
|
401
|
+
if (distributionInfo.objectType != DISTRIBUTION()) {
|
402
|
+
revert ErrorInstanceServiceInvalidComponentType(distributionAddress, DISTRIBUTION(), distributionInfo.objectType);
|
403
|
+
}
|
404
|
+
|
405
|
+
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
406
|
+
Instance instance = Instance(instanceInfo.objectAddress);
|
407
|
+
InstanceAccessManager instanceAccessManager = InstanceAccessManager(instance.authority());
|
408
|
+
|
409
|
+
bytes4[] memory fctSelectors = new bytes4[](1);
|
410
|
+
fctSelectors[0] = IDistributionComponent.setFees.selector;
|
411
|
+
instanceAccessManager.setTargetFunctionRole(distributionName, fctSelectors, DISTRIBUTION_OWNER_ROLE());
|
412
|
+
|
413
|
+
bytes4[] memory fctSelectors2 = new bytes4[](2);
|
414
|
+
fctSelectors2[0] = IDistributionComponent.processSale.selector;
|
415
|
+
fctSelectors2[1] = IDistributionComponent.processRenewal.selector;
|
416
|
+
instanceAccessManager.setTargetFunctionRole(distributionName, fctSelectors2, PRODUCT_SERVICE_ROLE());
|
417
|
+
}
|
418
|
+
|
419
|
+
function grantPoolDefaultPermissions(NftId instanceNftId, address poolAddress, string memory poolName) external onlyRegisteredService {
|
420
|
+
IRegistry registry = getRegistry();
|
421
|
+
IRegistry.ObjectInfo memory poolInfo = registry.getObjectInfo(poolAddress);
|
422
|
+
|
423
|
+
if (poolInfo.objectType != POOL()) {
|
424
|
+
revert ErrorInstanceServiceInvalidComponentType(poolAddress, POOL(), poolInfo.objectType);
|
425
|
+
}
|
426
|
+
|
427
|
+
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
428
|
+
Instance instance = Instance(instanceInfo.objectAddress);
|
429
|
+
InstanceAccessManager instanceAccessManager = InstanceAccessManager(instance.authority());
|
430
|
+
|
431
|
+
bytes4[] memory fctSelectors = new bytes4[](1);
|
432
|
+
fctSelectors[0] = IPoolComponent.setFees.selector;
|
433
|
+
instanceAccessManager.setTargetFunctionRole(poolName, fctSelectors, POOL_OWNER_ROLE());
|
434
|
+
|
435
|
+
bytes4[] memory fctSelectors2 = new bytes4[](1);
|
436
|
+
fctSelectors2[0] = IPoolComponent.verifyApplication.selector;
|
437
|
+
instanceAccessManager.setTargetFunctionRole(poolName, fctSelectors2, POLICY_SERVICE_ROLE());
|
438
|
+
|
439
|
+
// bundle owner specific functions
|
440
|
+
bytes4[] memory fctSelectors3 = new bytes4[](7);
|
441
|
+
fctSelectors3[0] = IPoolComponent.stake.selector;
|
442
|
+
fctSelectors3[1] = IPoolComponent.unstake.selector;
|
443
|
+
fctSelectors3[2] = IPoolComponent.extend.selector;
|
444
|
+
fctSelectors3[3] = IPoolComponent.lockBundle.selector;
|
445
|
+
fctSelectors3[4] = IPoolComponent.unlockBundle.selector;
|
446
|
+
fctSelectors3[5] = IPoolComponent.close.selector;
|
447
|
+
fctSelectors3[6] = IPoolComponent.setBundleFee.selector;
|
448
|
+
instanceAccessManager.setTargetFunctionRole(
|
449
|
+
poolName,
|
450
|
+
fctSelectors3,
|
451
|
+
IPoolComponent(poolAddress).getBundleOwnerRole());
|
452
|
+
}
|
453
|
+
|
454
|
+
function grantProductDefaultPermissions(NftId instanceNftId, address productAddress, string memory productName) external onlyRegisteredService {
|
455
|
+
IRegistry registry = getRegistry();
|
456
|
+
IRegistry.ObjectInfo memory productInfo = registry.getObjectInfo(productAddress);
|
457
|
+
|
458
|
+
if (productInfo.objectType != PRODUCT()) {
|
459
|
+
revert ErrorInstanceServiceInvalidComponentType(productAddress, PRODUCT(), productInfo.objectType);
|
460
|
+
}
|
461
|
+
|
462
|
+
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
463
|
+
Instance instance = Instance(instanceInfo.objectAddress);
|
464
|
+
InstanceAccessManager instanceAccessManager = InstanceAccessManager(instance.authority());
|
465
|
+
|
466
|
+
bytes4[] memory fctSelectors = new bytes4[](1);
|
467
|
+
fctSelectors[0] = IProductComponent.setFees.selector;
|
468
|
+
instanceAccessManager.setTargetFunctionRole(productName, fctSelectors, PRODUCT_OWNER_ROLE());
|
324
469
|
}
|
325
470
|
|
326
471
|
function setTargetLocked(string memory targetName, bool locked) external {
|
@@ -17,7 +17,7 @@ contract InstanceServiceManager is ProxyManager {
|
|
17
17
|
constructor(
|
18
18
|
address registryAddress
|
19
19
|
)
|
20
|
-
ProxyManager()
|
20
|
+
ProxyManager(registryAddress)
|
21
21
|
{
|
22
22
|
InstanceService instSrv = new InstanceService();
|
23
23
|
// bytes memory initCode = type(InstanceService).creationCode;
|
@@ -14,49 +14,32 @@ contract ObjectManager is
|
|
14
14
|
Cloneable
|
15
15
|
{
|
16
16
|
|
17
|
-
event LogObjectManagerInitialized(
|
17
|
+
event LogObjectManagerInitialized(address instance);
|
18
18
|
|
19
19
|
error ErrorObjectManagerNftIdInvalid(NftId instanceNftId);
|
20
20
|
error ErrorObjectManagerAlreadyAdded(NftId componentNftId, NftId objectNftId);
|
21
21
|
|
22
22
|
mapping(NftId compnentNftId => LibNftIdSet.Set objects) internal _activeObjects;
|
23
23
|
mapping(NftId compnentNftId => LibNftIdSet.Set objects) internal _allObjects;
|
24
|
-
|
25
|
-
InstanceReader internal _instanceReader;
|
26
|
-
|
27
|
-
constructor() Cloneable() {
|
28
|
-
_instanceReader = InstanceReader(address(0));
|
29
|
-
}
|
24
|
+
IInstance internal _instance; // store instance address -> more flexible, instance may not be registered during ObjectManager initialization
|
30
25
|
|
31
26
|
/// @dev call to initialize MUST be made in the same transaction as cloning of the contract
|
32
27
|
function initialize(
|
33
28
|
address authority,
|
34
29
|
address registry,
|
35
|
-
|
30
|
+
address instance
|
36
31
|
)
|
37
32
|
external
|
38
33
|
{
|
39
34
|
initialize(authority, registry);
|
40
35
|
|
41
|
-
|
42
|
-
IRegistry.ObjectInfo memory instanceInfo = _registry.getObjectInfo(instanceNftId);
|
43
|
-
if (instanceInfo.objectType != INSTANCE()) {
|
44
|
-
revert ErrorObjectManagerNftIdInvalid(instanceNftId);
|
45
|
-
}
|
46
|
-
|
47
|
-
IInstance instance = IInstance(instanceInfo.objectAddress);
|
48
|
-
_instanceReader = instance.getInstanceReader();
|
49
|
-
_instanceNftId = instanceNftId;
|
36
|
+
_instance = IInstance(instance);
|
50
37
|
|
51
|
-
emit LogObjectManagerInitialized(
|
52
|
-
}
|
53
|
-
|
54
|
-
function getInstanceReader() external view returns (InstanceReader) {
|
55
|
-
return _instanceReader;
|
38
|
+
emit LogObjectManagerInitialized(instance);
|
56
39
|
}
|
57
40
|
|
58
|
-
function
|
59
|
-
return
|
41
|
+
function getInstance() external view returns (IInstance) {
|
42
|
+
return _instance;
|
60
43
|
}
|
61
44
|
|
62
45
|
function _add(NftId componentNftId, NftId objectNftId) internal {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {
|
4
|
+
import {IComponent} from "../../components/IComponent.sol";
|
5
5
|
import {IRegistry} from "../../registry/IRegistry.sol";
|
6
6
|
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
7
7
|
import {IInstance} from "../../instance/IInstance.sol";
|
@@ -14,19 +14,14 @@ import {Service} from "../../shared/Service.sol";
|
|
14
14
|
import {InstanceService} from "../InstanceService.sol";
|
15
15
|
import {InstanceAccessManager} from "../InstanceAccessManager.sol";
|
16
16
|
|
17
|
-
abstract contract
|
18
|
-
|
17
|
+
abstract contract ComponentService is Service {
|
19
18
|
|
20
19
|
error ErrorComponentServiceAlreadyRegistered(address component, NftId nftId);
|
21
20
|
error ErrorComponentServiceNotComponent(address component);
|
22
21
|
error ErrorComponentServiceInvalidType(address component, ObjectType requiredType, ObjectType componentType);
|
23
22
|
error ErrorComponentServiceSenderNotOwner(address component, address initialOwner, address sender);
|
24
23
|
error ErrorComponentServiceExpectedRoleMissing(NftId instanceNftId, RoleId requiredRole, address sender);
|
25
|
-
|
26
|
-
error ErrorComponentServiceBaseComponentLocked(address componentAddress);
|
27
|
-
error ExpectedRoleMissing(RoleId expected, address caller);
|
28
|
-
error ComponentTypeInvalid(ObjectType componentType);
|
29
|
-
|
24
|
+
error ErrorComponentServiceComponentLocked(address component);
|
30
25
|
|
31
26
|
/// @dev modifier to check if caller is a registered service
|
32
27
|
modifier onlyService() {
|
@@ -54,8 +49,9 @@ abstract contract ComponentServiceBase is Service {
|
|
54
49
|
RoleId requiredRole
|
55
50
|
)
|
56
51
|
internal
|
52
|
+
view
|
57
53
|
returns (
|
58
|
-
|
54
|
+
IComponent component,
|
59
55
|
address owner,
|
60
56
|
IInstance instance,
|
61
57
|
NftId instanceNftId
|
@@ -65,19 +61,19 @@ abstract contract ComponentServiceBase is Service {
|
|
65
61
|
owner = msg.sender;
|
66
62
|
|
67
63
|
// check component has not already been registerd
|
68
|
-
NftId compoentNftId =
|
64
|
+
NftId compoentNftId = getRegistry().getNftId(componentAddress);
|
69
65
|
if(compoentNftId.gtz()) {
|
70
66
|
revert ErrorComponentServiceAlreadyRegistered(componentAddress, compoentNftId);
|
71
67
|
}
|
72
68
|
|
73
69
|
// check this is a component
|
74
|
-
component =
|
75
|
-
if(!component.supportsInterface(type(
|
70
|
+
component = IComponent(componentAddress);
|
71
|
+
if(!component.supportsInterface(type(IComponent).interfaceId)) {
|
76
72
|
revert ErrorComponentServiceNotComponent(componentAddress);
|
77
73
|
}
|
78
74
|
|
79
75
|
// check component is of required type
|
80
|
-
|
76
|
+
IRegistry.ObjectInfo memory componentInfo = component.getInitialInfo();
|
81
77
|
if(componentInfo.objectType != requiredType) {
|
82
78
|
revert ErrorComponentServiceInvalidType(componentAddress, requiredType, componentInfo.objectType);
|
83
79
|
}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
5
4
|
import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
|
6
5
|
|
7
6
|
import {RoleId} from "../../types/RoleId.sol";
|
@@ -34,15 +33,15 @@ interface IAccess {
|
|
34
33
|
error ErrorIAccessRoleNameNotUnique(RoleId roleId, ShortString name);
|
35
34
|
error ErrorIAccessRoleInvalidUpdate(RoleId roleId, bool isCustom);
|
36
35
|
error ErrorIAccessRoleIsCustomIsImmutable(RoleId roleId, bool isCustom, bool isCustomExisting);
|
37
|
-
error ErrorIAccessSetLockedForNonexstentRole(RoleId roleId);
|
38
36
|
error ErrorIAccessGrantNonexstentRole(RoleId roleId);
|
39
37
|
error ErrorIAccessRevokeNonexstentRole(RoleId roleId);
|
40
38
|
error ErrorIAccessRenounceNonexstentRole(RoleId roleId);
|
41
39
|
|
42
40
|
error ErrorIAccessTargetAddressZero();
|
43
|
-
error
|
41
|
+
error ErrorIAccessTargetDoesNotExist(ShortString name);
|
42
|
+
error ErrorIAccessTargetAddressDoesNotExist(address target);
|
43
|
+
error ErrorIAccessTargetExists(address target, ShortString name);
|
44
44
|
error ErrorIAccessTargetNameEmpty(address target);
|
45
45
|
error ErrorIAccessTargetNameExists(address target, address existingTarget, ShortString name);
|
46
|
-
error ErrorIAccessSetLockedForNonexstentTarget(address target);
|
47
46
|
error ErrorIAccessTargetLocked(address target);
|
48
47
|
}
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {NftId} from "../../types/NftId.sol";
|
5
5
|
import {Fee} from "../../types/Fee.sol";
|
6
|
+
import {Seconds} from "../../types/Seconds.sol";
|
6
7
|
import {Timestamp} from "../../types/Timestamp.sol";
|
7
8
|
|
8
9
|
interface IBundle {
|
@@ -13,7 +14,7 @@ interface IBundle {
|
|
13
14
|
uint256 capitalAmount; // net investment capital + net premiums - payouts
|
14
15
|
uint256 lockedAmount; // capital amount linked to collateralizaion of non-closed policies (<= balance)
|
15
16
|
uint256 balanceAmount; // total amount of funds: capitalAmount + fees (balance >= captial)
|
16
|
-
|
17
|
+
Seconds lifetime;
|
17
18
|
Timestamp expiredAt; // no new policies
|
18
19
|
Timestamp closedAt; // no open policies, locked amount = 0
|
19
20
|
}
|