@etherisc/gif-next 0.0.2-bfb44e0-483 → 0.0.2-c00cf5d-513
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +8 -84
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/{components → distribution}/Distribution.sol/Distribution.json +206 -244
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +1583 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +855 -0
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/{components → distribution}/IDistributionComponent.sol/IDistributionComponent.json +206 -156
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service → distribution}/IDistributionService.sol/IDistributionService.json +380 -196
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +68 -54
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +277 -1998
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +172 -230
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +389 -2735
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +692 -0
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +188 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +443 -255
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +217 -479
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +246 -129
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2847 -0
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/{Cloneable.sol → base/Cloneable.sol}/Cloneable.json +6 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +49 -0
- 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 +93 -14
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +38 -13
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +256 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +25 -150
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
- 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/pool/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +1307 -0
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +767 -0
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service → pool}/IBundleService.sol/IBundleService.json +273 -336
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
- package/artifacts/contracts/{components → pool}/IPoolComponent.sol/IPoolComponent.json +386 -185
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +4 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +1077 -0
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +4 -0
- package/artifacts/contracts/{components → pool}/Pool.sol/Pool.json +363 -303
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +1649 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +783 -0
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +937 -0
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +719 -0
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +1405 -0
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +819 -0
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service → product}/IApplicationService.sol/IApplicationService.json +109 -254
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +753 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service → product}/IPolicyService.sol/IPolicyService.json +174 -307
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service/IPoolService.sol/IPoolService.json → product/IPricingService.sol/IPricingService.json} +235 -237
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +4 -0
- package/artifacts/contracts/{components → product}/IProductComponent.sol/IProductComponent.json +212 -164
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service → product}/IProductService.sol/IProductService.json +67 -174
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +1300 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +811 -0
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +1023 -0
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +759 -0
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +4 -0
- package/artifacts/contracts/{components → product}/Product.sol/Product.json +166 -239
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +891 -0
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +715 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +123 -19
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +212 -240
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +146 -34
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +292 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +245 -314
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +240 -123
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +597 -86
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +44 -92
- package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.json +1193 -0
- package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.json +1715 -0
- package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.json +1728 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.json +1806 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +1824 -0
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/{components → shared}/Component.sol/Component.json +146 -151
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/{instance/base → shared}/ComponentService.sol/ComponentService.json +118 -222
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.dbg.json +4 -0
- package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.json +1562 -0
- package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.dbg.json +4 -0
- package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.json +1600 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/{components → shared}/IComponent.sol/IComponent.json +190 -74
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +4 -43
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +69 -9
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +4 -43
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +0 -34
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +66 -173
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +0 -150
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +19 -91
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +80 -47
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +226 -95
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +32 -89
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -36
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +92 -212
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +24 -6
- 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 +0 -150
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +4 -0
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +523 -0
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +786 -0
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +699 -0
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/AddressSet.sol/LibAddressSet.json +3 -3
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +281 -0
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/Blocknumber.sol/BlocknumberLib.json +3 -3
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +179 -0
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/DistributorType.sol/DistributorTypeLib.json +5 -5
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +4 -0
- package/artifacts/contracts/type/Fee.sol/FeeLib.json +312 -0
- package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/Key32.sol/Key32Lib.json +3 -3
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +166 -0
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/NftIdSet.sol/LibNftIdSet.json +3 -3
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/ObjectType.sol/ObjectTypeLib.json +3 -3
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +209 -0
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +4 -0
- package/artifacts/contracts/type/Referral.sol/ReferralLib.json +142 -0
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/RiskId.sol/RiskIdLib.json +5 -5
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/RoleId.sol/RoleIdLib.json +5 -5
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +124 -0
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/StateId.sol/StateIdLib.json +3 -3
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/Timestamp.sol/TimestampLib.json +39 -8
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/UFixed.sol/MathLib.json +3 -3
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/UFixed.sol/UFixedLib.json +3 -3
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/Version.sol/VersionLib.json +3 -3
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/Version.sol/VersionPartLib.json +3 -3
- package/contracts/{components → distribution}/Distribution.sol +47 -60
- package/contracts/distribution/DistributionService.sol +351 -0
- package/contracts/distribution/DistributionServiceManager.sol +42 -0
- package/contracts/{components → distribution}/IDistributionComponent.sol +8 -37
- package/contracts/distribution/IDistributionService.sol +87 -0
- package/contracts/instance/BundleManager.sol +15 -14
- package/contracts/instance/IInstance.sol +52 -59
- package/contracts/instance/IInstanceService.sol +32 -19
- package/contracts/instance/Instance.sol +138 -185
- package/contracts/instance/InstanceAdmin.sol +330 -0
- package/contracts/instance/InstanceAuthorizationsLib.sol +320 -0
- package/contracts/instance/InstanceReader.sol +101 -26
- package/contracts/instance/InstanceService.sol +173 -307
- package/contracts/instance/InstanceServiceManager.sol +12 -22
- package/contracts/instance/InstanceStore.sol +211 -0
- package/contracts/instance/{Cloneable.sol → base/Cloneable.sol} +8 -3
- package/contracts/instance/base/IKeyValueStore.sol +14 -10
- package/contracts/instance/base/ILifecycle.sol +3 -3
- package/contracts/instance/base/KeyValueStore.sol +44 -47
- package/contracts/instance/base/Lifecycle.sol +28 -7
- package/contracts/instance/{ObjectManager.sol → base/ObjectManager.sol} +12 -14
- package/contracts/instance/module/IAccess.sol +19 -20
- package/contracts/instance/module/IBundle.sol +11 -8
- package/contracts/instance/module/IComponents.sol +41 -0
- package/contracts/instance/module/IDistribution.sol +7 -4
- package/contracts/instance/module/IPolicy.sol +50 -17
- package/contracts/instance/module/IRisk.sol +1 -1
- package/contracts/instance/module/ISetup.sol +9 -23
- package/contracts/instance/module/ITreasury.sol +2 -2
- package/contracts/pool/BundleService.sol +384 -0
- package/contracts/pool/BundleServiceManager.sol +42 -0
- package/contracts/pool/IBundleService.sol +118 -0
- package/contracts/pool/IPoolComponent.sol +114 -0
- package/contracts/pool/IPoolService.sol +114 -0
- package/contracts/pool/Pool.sol +302 -0
- package/contracts/pool/PoolService.sol +404 -0
- package/contracts/pool/PoolServiceManager.sol +42 -0
- package/contracts/product/ApplicationService.sol +187 -0
- package/contracts/product/ApplicationServiceManager.sol +38 -0
- package/contracts/product/ClaimService.sol +443 -0
- package/contracts/product/ClaimServiceManager.sol +38 -0
- package/contracts/{instance/service → product}/IApplicationService.sol +16 -36
- package/contracts/product/IClaimService.sol +93 -0
- package/contracts/product/IPolicyService.sol +80 -0
- package/contracts/product/IPricingService.sol +37 -0
- package/contracts/{components → product}/IProductComponent.sol +13 -11
- package/contracts/{instance/service → product}/IProductService.sol +10 -10
- package/contracts/product/PolicyService.sol +378 -0
- package/contracts/product/PolicyServiceManager.sol +42 -0
- package/contracts/product/PricingService.sol +276 -0
- package/contracts/product/PricingServiceManager.sol +42 -0
- package/contracts/{components → product}/Product.sol +186 -85
- package/contracts/product/ProductService.sol +212 -0
- package/contracts/product/ProductServiceManager.sol +42 -0
- package/contracts/registry/ChainNft.sol +8 -0
- package/contracts/registry/IRegistry.sol +31 -17
- package/contracts/registry/IRegistryService.sol +32 -38
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +70 -67
- package/contracts/registry/RegistryAdmin.sol +141 -0
- package/contracts/registry/RegistryService.sol +65 -94
- package/contracts/registry/RegistryServiceManager.sol +22 -24
- package/contracts/registry/ReleaseManager.sol +318 -188
- package/contracts/registry/TokenRegistry.sol +19 -14
- package/contracts/shared/AccessManagerCustom.sol +736 -0
- package/contracts/shared/AccessManagerExtended.sol +469 -0
- package/contracts/shared/AccessManagerExtendedInitializeable.sol +13 -0
- package/contracts/shared/AccessManagerExtendedWithDisable.sol +137 -0
- package/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol +14 -0
- package/contracts/{components → shared}/Component.sol +121 -86
- package/contracts/shared/ComponentService.sol +142 -0
- package/contracts/shared/ERC165.sol +2 -1
- package/contracts/shared/IAccessManagerExtended.sol +74 -0
- package/contracts/shared/IAccessManagerExtendedWithDisable.sol +18 -0
- package/contracts/shared/IComponent.sol +90 -0
- package/contracts/shared/INftOwnable.sol +5 -10
- package/contracts/shared/IPolicyHolder.sol +24 -10
- package/contracts/shared/IRegistryLinked.sol +0 -4
- package/contracts/shared/IService.sol +6 -4
- package/contracts/shared/IVersionable.sol +5 -48
- package/contracts/shared/NftOwnable.sol +20 -93
- package/contracts/shared/PolicyHolder.sol +31 -18
- package/contracts/shared/ProxyManager.sol +129 -24
- package/contracts/shared/Registerable.sol +14 -20
- package/contracts/shared/RegistryLinked.sol +5 -26
- package/contracts/shared/Service.sol +30 -18
- package/contracts/shared/TokenHandler.sol +14 -6
- package/contracts/shared/Versionable.sol +1 -90
- package/contracts/staking/IStakingService.sol +102 -0
- package/contracts/staking/StakingService.sol +169 -0
- package/contracts/staking/StakingServiceManager.sol +40 -0
- package/contracts/type/Amount.sol +109 -0
- package/contracts/{types → type}/Blocknumber.sol +1 -0
- package/contracts/type/ClaimId.sol +75 -0
- package/contracts/{types → type}/Fee.sol +17 -8
- package/contracts/{types → type}/NftId.sol +8 -0
- package/contracts/{types → type}/NftIdSet.sol +1 -1
- package/contracts/{types → type}/ObjectType.sol +13 -7
- package/contracts/type/PayoutId.sol +82 -0
- package/contracts/{types → type}/Referral.sol +4 -0
- package/contracts/{types → type}/RoleId.sol +62 -13
- package/contracts/type/Seconds.sol +54 -0
- package/contracts/{types → type}/StateId.sol +7 -2
- package/contracts/{types → type}/Timestamp.sol +18 -13
- package/contracts/{types → type}/UFixed.sol +1 -0
- package/contracts/{types → type}/Version.sol +1 -0
- package/package.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +0 -4
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +0 -4
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +0 -4
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +0 -4
- package/artifacts/contracts/components/Product.sol/Product.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/IB.sol/IB.json +0 -50
- 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/Cloneable.sol/Cloneable.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +0 -984
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +0 -4
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +0 -261
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +0 -1117
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +0 -1318
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +0 -586
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +0 -1176
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +0 -602
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +0 -1378
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +0 -642
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +0 -957
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +0 -574
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +0 -1007
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +0 -574
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +0 -4
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +0 -285
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +0 -4
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.json +0 -107
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +0 -4
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +0 -119
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +0 -4
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +0 -446
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +0 -4
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +0 -116
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +0 -4
- package/artifacts/contracts/test/TestService.sol/TestService.json +0 -759
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +0 -4
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +0 -376
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +0 -4
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +0 -218
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +0 -4
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +0 -286
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +0 -4
- package/artifacts/contracts/test/Usdc.sol/USDC.json +0 -376
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +0 -4
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +0 -4
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +0 -10
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +0 -4
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +0 -4
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +0 -257
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +0 -4
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +0 -153
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +0 -4
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +0 -100
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +0 -4
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +0 -4
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +0 -123
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +0 -4
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +0 -4
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +0 -4
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +0 -4
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +0 -4
- package/contracts/components/IComponent.sol +0 -50
- package/contracts/components/IPoolComponent.sol +0 -87
- package/contracts/components/Pool.sol +0 -254
- 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/InstanceAccessManager.sol +0 -297
- package/contracts/instance/base/ComponentService.sol +0 -134
- package/contracts/instance/service/ApplicationService.sol +0 -268
- package/contracts/instance/service/BundleService.sol +0 -298
- package/contracts/instance/service/BundleServiceManager.sol +0 -51
- package/contracts/instance/service/DistributionService.sol +0 -274
- package/contracts/instance/service/DistributionServiceManager.sol +0 -51
- package/contracts/instance/service/IBundleService.sol +0 -54
- package/contracts/instance/service/IDistributionService.sol +0 -65
- package/contracts/instance/service/IPolicyService.sol +0 -88
- package/contracts/instance/service/IPoolService.sol +0 -20
- package/contracts/instance/service/PolicyService.sol +0 -524
- package/contracts/instance/service/PolicyServiceManager.sol +0 -54
- package/contracts/instance/service/PoolService.sol +0 -109
- package/contracts/instance/service/PoolServiceManager.sol +0 -51
- package/contracts/instance/service/ProductService.sol +0 -233
- package/contracts/instance/service/ProductServiceManager.sol +0 -54
- package/contracts/registry/RegistryAccessManager.sol +0 -216
- package/contracts/shared/ContractDeployerLib.sol +0 -72
- package/contracts/test/TestFee.sol +0 -25
- package/contracts/test/TestRegisterable.sol +0 -18
- package/contracts/test/TestRoleId.sol +0 -14
- package/contracts/test/TestService.sol +0 -25
- package/contracts/test/TestToken.sol +0 -26
- package/contracts/test/TestVersion.sol +0 -44
- package/contracts/test/TestVersionable.sol +0 -17
- package/contracts/test/Usdc.sol +0 -26
- package/contracts/types/ChainId.sol +0 -38
- package/contracts/types/NumberId.sol +0 -52
- /package/contracts/{types → type}/AddressSet.sol +0 -0
- /package/contracts/{types → type}/DistributorType.sol +0 -0
- /package/contracts/{types → type}/Key32.sol +0 -0
- /package/contracts/{types → type}/RiskId.sol +0 -0
@@ -2,50 +2,61 @@
|
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
|
5
|
+
import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
|
6
|
+
|
7
|
+
import {NftId} from "../type/NftId.sol";
|
8
|
+
import {RoleId} from "../type/RoleId.sol";
|
9
|
+
import {ADMIN_ROLE, INSTANCE_OWNER_ROLE, DISTRIBUTION_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_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, INSTANCE_ROLE} from "../type/RoleId.sol";
|
10
|
+
import {ObjectType, INSTANCE, BUNDLE, APPLICATION, POLICY, CLAIM, PRODUCT, DISTRIBUTION, REGISTRY, POOL} from "../type/ObjectType.sol";
|
11
|
+
|
12
|
+
import {Service} from "../shared/Service.sol";
|
13
|
+
import {IService} from "../shared/IService.sol";
|
14
|
+
import {AccessManagerExtendedInitializeable} from "../shared/AccessManagerExtendedInitializeable.sol";
|
15
|
+
|
16
|
+
import {IDistributionComponent} from "../distribution/IDistributionComponent.sol";
|
17
|
+
import {IPoolComponent} from "../pool/IPoolComponent.sol";
|
18
|
+
import {IProductComponent} from "../product/IProductComponent.sol";
|
19
|
+
|
20
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
21
|
+
import {IRegistryService} from "../registry/IRegistryService.sol";
|
22
|
+
import {ChainNft} from "../registry/ChainNft.sol";
|
5
23
|
|
6
24
|
import {Instance} from "./Instance.sol";
|
7
25
|
import {IInstance} from "./IInstance.sol";
|
8
|
-
import {
|
26
|
+
import {InstanceAdmin} from "./InstanceAdmin.sol";
|
9
27
|
import {IInstanceService} from "./IInstanceService.sol";
|
10
28
|
import {InstanceReader} from "./InstanceReader.sol";
|
11
29
|
import {BundleManager} from "./BundleManager.sol";
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {ChainNft} from "../registry/ChainNft.sol";
|
15
|
-
import {Service} from "../../contracts/shared/Service.sol";
|
16
|
-
import {IService} from "../shared/IService.sol";
|
17
|
-
import {NftId} from "../../contracts/types/NftId.sol";
|
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";
|
21
|
-
import {IDistributionComponent} from "../components/IDistributionComponent.sol";
|
22
|
-
import {IPoolComponent} from "../components/IPoolComponent.sol";
|
23
|
-
import {IProductComponent} from "../components/IProductComponent.sol";
|
30
|
+
import {InstanceStore} from "./InstanceStore.sol";
|
31
|
+
import {InstanceAuthorizationsLib} from "./InstanceAuthorizationsLib.sol";
|
24
32
|
|
25
|
-
contract InstanceService is
|
33
|
+
contract InstanceService is
|
34
|
+
Service,
|
35
|
+
IInstanceService
|
36
|
+
{
|
26
37
|
|
27
|
-
|
38
|
+
// TODO update to real hash when instance is stable
|
39
|
+
bytes32 public constant INSTANCE_CREATION_CODE_HASH = bytes32(0);
|
40
|
+
|
41
|
+
IRegistryService internal _registryService;
|
42
|
+
address internal _masterAccessManager;
|
43
|
+
address internal _masterInstanceAdmin;
|
28
44
|
address internal _masterInstance;
|
29
45
|
address internal _masterInstanceReader;
|
30
46
|
address internal _masterInstanceBundleManager;
|
47
|
+
address internal _masterInstanceStore;
|
31
48
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
modifier onlyInstanceOwner(NftId instanceNftId) {
|
36
|
-
IRegistry registry = getRegistry();
|
37
|
-
ChainNft chainNft = ChainNft(registry.getChainNftAddress());
|
38
|
-
|
39
|
-
if( msg.sender != chainNft.ownerOf(instanceNftId.toInt())) {
|
40
|
-
revert ErrorInstanceServiceNotInstanceOwner(msg.sender, instanceNftId);
|
49
|
+
modifier onlyInstanceOwner(NftId instanceNftId) {
|
50
|
+
if(msg.sender != getRegistry().ownerOf(instanceNftId)) {
|
51
|
+
revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
|
41
52
|
}
|
42
53
|
_;
|
43
54
|
}
|
44
55
|
|
45
|
-
|
46
|
-
|
47
|
-
if (! getRegistry().
|
48
|
-
revert ErrorInstanceServiceRequestUnauhorized(
|
56
|
+
// TODO check component - service - instance version match
|
57
|
+
modifier onlyComponent() {
|
58
|
+
if (! getRegistry().isRegisteredComponent(msg.sender)) {
|
59
|
+
revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
|
49
60
|
}
|
50
61
|
_;
|
51
62
|
}
|
@@ -53,225 +64,116 @@ contract InstanceService is Service, IInstanceService {
|
|
53
64
|
function createInstanceClone()
|
54
65
|
external
|
55
66
|
returns (
|
56
|
-
InstanceAccessManager clonedAccessManager,
|
57
67
|
Instance clonedInstance,
|
58
|
-
NftId clonedInstanceNftId
|
59
|
-
InstanceReader clonedInstanceReader,
|
60
|
-
BundleManager clonedBundleManager
|
68
|
+
NftId clonedInstanceNftId
|
61
69
|
)
|
62
70
|
{
|
63
71
|
address instanceOwner = msg.sender;
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
// initially set the authority of the access managar to this (being the instance service).
|
71
|
-
// This will allow the instance service to bootstrap the authorizations of the instance
|
72
|
-
// and then transfer the ownership of the access manager to the instance owner once everything is setup
|
73
|
-
clonedAccessManager = InstanceAccessManager(Clones.clone(_masterInstanceAccessManager));
|
72
|
+
AccessManagerExtendedInitializeable clonedAccessManager = AccessManagerExtendedInitializeable(
|
73
|
+
Clones.clone(_masterAccessManager));
|
74
|
+
|
75
|
+
// initially grants ADMIN_ROLE to this (being the instance service).
|
76
|
+
// This will allow the instance service to bootstrap the authorizations of the instance.
|
77
|
+
// Instance service will renounce ADMIN_ROLE when bootstraping is finished
|
74
78
|
clonedAccessManager.initialize(address(this));
|
75
79
|
|
76
80
|
clonedInstance = Instance(Clones.clone(_masterInstance));
|
77
|
-
clonedInstance.initialize(
|
81
|
+
clonedInstance.initialize(
|
82
|
+
address(clonedAccessManager),
|
83
|
+
address(getRegistry()),
|
84
|
+
instanceOwner);
|
85
|
+
// initialize and set before instance reader
|
86
|
+
InstanceStore clonedInstanceStore = InstanceStore(Clones.clone(address(_masterInstanceStore)));
|
87
|
+
clonedInstanceStore.initialize(address(clonedInstance));
|
88
|
+
clonedInstance.setInstanceStore(clonedInstanceStore);
|
78
89
|
|
79
|
-
clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
80
|
-
clonedInstanceReader.initialize(
|
90
|
+
InstanceReader clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
91
|
+
clonedInstanceReader.initialize(address(clonedInstance));
|
81
92
|
clonedInstance.setInstanceReader(clonedInstanceReader);
|
82
93
|
|
83
|
-
clonedBundleManager = BundleManager(Clones.clone(_masterInstanceBundleManager));
|
84
|
-
clonedBundleManager.initialize(address(
|
94
|
+
BundleManager clonedBundleManager = BundleManager(Clones.clone(_masterInstanceBundleManager));
|
95
|
+
clonedBundleManager.initialize(address(clonedInstance));
|
85
96
|
clonedInstance.setBundleManager(clonedBundleManager);
|
86
97
|
|
98
|
+
InstanceAdmin clonedInstanceAdmin = InstanceAdmin(Clones.clone(_masterInstanceAdmin));
|
99
|
+
clonedAccessManager.grantRole(ADMIN_ROLE().toInt(), address(clonedInstanceAdmin), 0);
|
100
|
+
clonedInstanceAdmin.initialize(address(clonedInstance));
|
101
|
+
clonedInstance.setInstanceAdmin(clonedInstanceAdmin);
|
102
|
+
|
87
103
|
// TODO amend setters with instance specific , policy manager ...
|
88
104
|
|
89
|
-
|
105
|
+
// TODO library does external calls -> but it is registry and access manager -> find out is it best practice
|
106
|
+
InstanceAuthorizationsLib.grantInitialAuthorizations(
|
107
|
+
clonedAccessManager,
|
108
|
+
clonedInstanceAdmin,
|
109
|
+
clonedInstance,
|
110
|
+
clonedBundleManager,
|
111
|
+
clonedInstanceStore,
|
112
|
+
instanceOwner,
|
113
|
+
getRegistry(),
|
114
|
+
getVersion().toMajorPart());
|
90
115
|
|
91
|
-
|
92
|
-
// TODO: use a role less powerful than admin, maybe INSTANCE_ADMIN (does not exist yet)
|
93
|
-
clonedAccessManager.grantRole(ADMIN_ROLE(), instanceOwner);
|
94
|
-
clonedAccessManager.revokeRole(ADMIN_ROLE(), address(this));
|
116
|
+
clonedAccessManager.renounceRole(ADMIN_ROLE().toInt(), address(this));
|
95
117
|
|
96
|
-
IRegistry.ObjectInfo memory info =
|
118
|
+
IRegistry.ObjectInfo memory info = _registryService.registerInstance(clonedInstance, instanceOwner);
|
97
119
|
clonedInstanceNftId = info.nftId;
|
98
|
-
// clonedInstance.linkToRegisteredNftId();
|
99
|
-
|
100
|
-
emit LogInstanceCloned(address(clonedAccessManager), address(clonedInstance), address(clonedInstanceReader), clonedInstanceNftId);
|
101
|
-
}
|
102
120
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
_grantInstanceServiceAuthorizations(clonedAccessManager, clonedInstance);
|
121
|
+
emit LogInstanceCloned(
|
122
|
+
address(clonedAccessManager),
|
123
|
+
address(clonedInstanceAdmin),
|
124
|
+
address(clonedInstance),
|
125
|
+
address(clonedInstanceStore),
|
126
|
+
address(clonedBundleManager),
|
127
|
+
address(clonedInstanceReader),
|
128
|
+
clonedInstanceNftId);
|
112
129
|
}
|
113
130
|
|
114
|
-
function
|
115
|
-
clonedAccessManager.createGifRole(DISTRIBUTION_OWNER_ROLE(), "DistributionOwnerRole");
|
116
|
-
clonedAccessManager.createGifRole(POOL_OWNER_ROLE(), "PoolOwnerRole");
|
117
|
-
clonedAccessManager.createGifRole(PRODUCT_OWNER_ROLE(), "ProductOwnerRole");
|
118
|
-
|
119
|
-
clonedAccessManager.createGifRole(DISTRIBUTION_SERVICE_ROLE(), "DistributionServiceRole");
|
120
|
-
clonedAccessManager.createGifRole(POOL_SERVICE_ROLE(), "PoolServiceRole");
|
121
|
-
clonedAccessManager.createGifRole(PRODUCT_SERVICE_ROLE(), "ProductServiceRole");
|
122
|
-
clonedAccessManager.createGifRole(POLICY_SERVICE_ROLE(), "PolicyServiceRole");
|
123
|
-
clonedAccessManager.createGifRole(BUNDLE_SERVICE_ROLE(), "BundleServiceRole");
|
124
|
-
clonedAccessManager.createGifRole(INSTANCE_SERVICE_ROLE(), "InstanceServiceRole");
|
125
|
-
}
|
126
|
-
|
127
|
-
function _createGifTargets(InstanceAccessManager clonedAccessManager, Instance clonedInstance, BundleManager clonedBundleManager) internal {
|
128
|
-
clonedAccessManager.createGifTarget(address(clonedAccessManager), "InstanceAccessManager");
|
129
|
-
clonedAccessManager.createGifTarget(address(clonedInstance), "Instance");
|
130
|
-
clonedAccessManager.createGifTarget(address(clonedBundleManager), "BundleManager");
|
131
|
-
}
|
132
|
-
|
133
|
-
function _grantDistributionServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
134
|
-
// configure authorization for distribution service on instance
|
135
|
-
IRegistry registry = getRegistry();
|
136
|
-
address distributionServiceAddress = registry.getServiceAddress(DISTRIBUTION(), getMajorVersion());
|
137
|
-
clonedAccessManager.grantRole(DISTRIBUTION_SERVICE_ROLE(), distributionServiceAddress);
|
138
|
-
bytes4[] memory instanceDistributionServiceSelectors = new bytes4[](2);
|
139
|
-
instanceDistributionServiceSelectors[0] = clonedInstance.createDistributionSetup.selector;
|
140
|
-
instanceDistributionServiceSelectors[1] = clonedInstance.updateDistributionSetup.selector;
|
141
|
-
clonedAccessManager.setTargetFunctionRole(
|
142
|
-
"Instance",
|
143
|
-
instanceDistributionServiceSelectors,
|
144
|
-
DISTRIBUTION_SERVICE_ROLE());
|
145
|
-
}
|
146
|
-
|
147
|
-
function _grantPoolServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
148
|
-
// configure authorization for pool service on instance
|
149
|
-
address poolServiceAddress = getRegistry().getServiceAddress(POOL(), getMajorVersion());
|
150
|
-
clonedAccessManager.grantRole(POOL_SERVICE_ROLE(), address(poolServiceAddress));
|
151
|
-
bytes4[] memory instancePoolServiceSelectors = new bytes4[](4);
|
152
|
-
instancePoolServiceSelectors[0] = clonedInstance.createPoolSetup.selector;
|
153
|
-
instancePoolServiceSelectors[1] = clonedInstance.updatePoolSetup.selector;
|
154
|
-
clonedAccessManager.setTargetFunctionRole(
|
155
|
-
"Instance",
|
156
|
-
instancePoolServiceSelectors,
|
157
|
-
POOL_SERVICE_ROLE());
|
158
|
-
}
|
159
|
-
|
160
|
-
function _grantProductServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
161
|
-
// configure authorization for product service on instance
|
162
|
-
address productServiceAddress = getRegistry().getServiceAddress(PRODUCT(), getMajorVersion());
|
163
|
-
clonedAccessManager.grantRole(PRODUCT_SERVICE_ROLE(), address(productServiceAddress));
|
164
|
-
bytes4[] memory instanceProductServiceSelectors = new bytes4[](5);
|
165
|
-
instanceProductServiceSelectors[0] = clonedInstance.createProductSetup.selector;
|
166
|
-
instanceProductServiceSelectors[1] = clonedInstance.updateProductSetup.selector;
|
167
|
-
instanceProductServiceSelectors[2] = clonedInstance.createRisk.selector;
|
168
|
-
instanceProductServiceSelectors[3] = clonedInstance.updateRisk.selector;
|
169
|
-
instanceProductServiceSelectors[4] = clonedInstance.updateRiskState.selector;
|
170
|
-
clonedAccessManager.setTargetFunctionRole(
|
171
|
-
"Instance",
|
172
|
-
instanceProductServiceSelectors,
|
173
|
-
PRODUCT_SERVICE_ROLE());
|
174
|
-
}
|
175
|
-
|
176
|
-
function _grantPolicyServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
177
|
-
// configure authorization for policy service on instance
|
178
|
-
address policyServiceAddress = getRegistry().getServiceAddress(POLICY(), getMajorVersion());
|
179
|
-
clonedAccessManager.grantRole(POLICY_SERVICE_ROLE(), address(policyServiceAddress));
|
180
|
-
bytes4[] memory instancePolicyServiceSelectors = new bytes4[](3);
|
181
|
-
instancePolicyServiceSelectors[0] = clonedInstance.createPolicy.selector;
|
182
|
-
instancePolicyServiceSelectors[1] = clonedInstance.updatePolicy.selector;
|
183
|
-
instancePolicyServiceSelectors[2] = clonedInstance.updatePolicyState.selector;
|
184
|
-
clonedAccessManager.setTargetFunctionRole(
|
185
|
-
"Instance",
|
186
|
-
instancePolicyServiceSelectors,
|
187
|
-
POLICY_SERVICE_ROLE());
|
188
|
-
}
|
189
|
-
|
190
|
-
function _grantBundleServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance, BundleManager clonedBundleManager) internal {
|
191
|
-
// configure authorization for bundle service on instance
|
192
|
-
address bundleServiceAddress = getRegistry().getServiceAddress(BUNDLE(), getMajorVersion());
|
193
|
-
clonedAccessManager.grantRole(BUNDLE_SERVICE_ROLE(), address(bundleServiceAddress));
|
194
|
-
bytes4[] memory instanceBundleServiceSelectors = new bytes4[](2);
|
195
|
-
instanceBundleServiceSelectors[0] = clonedInstance.createBundle.selector;
|
196
|
-
instanceBundleServiceSelectors[1] = clonedInstance.updateBundle.selector;
|
197
|
-
clonedAccessManager.setTargetFunctionRole(
|
198
|
-
"Instance",
|
199
|
-
instanceBundleServiceSelectors,
|
200
|
-
BUNDLE_SERVICE_ROLE());
|
201
|
-
|
202
|
-
// configure authorization for bundle service on bundle manager
|
203
|
-
bytes4[] memory bundleManagerBundleServiceSelectors = new bytes4[](5);
|
204
|
-
bundleManagerBundleServiceSelectors[0] = clonedBundleManager.linkPolicy.selector;
|
205
|
-
bundleManagerBundleServiceSelectors[1] = clonedBundleManager.unlinkPolicy.selector;
|
206
|
-
bundleManagerBundleServiceSelectors[2] = clonedBundleManager.add.selector;
|
207
|
-
bundleManagerBundleServiceSelectors[3] = clonedBundleManager.lock.selector;
|
208
|
-
bundleManagerBundleServiceSelectors[4] = clonedBundleManager.unlock.selector;
|
209
|
-
clonedAccessManager.setTargetFunctionRole(
|
210
|
-
"BundleManager",
|
211
|
-
bundleManagerBundleServiceSelectors,
|
212
|
-
BUNDLE_SERVICE_ROLE());
|
213
|
-
}
|
214
|
-
|
215
|
-
function _grantInstanceServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
216
|
-
// configure authorization for instance service on instance
|
217
|
-
address instanceServiceAddress = getRegistry().getServiceAddress(INSTANCE(), getMajorVersion());
|
218
|
-
clonedAccessManager.grantRole(INSTANCE_SERVICE_ROLE(), instanceServiceAddress);
|
219
|
-
bytes4[] memory instanceInstanceServiceSelectors = new bytes4[](1);
|
220
|
-
instanceInstanceServiceSelectors[0] = clonedInstance.setInstanceReader.selector;
|
221
|
-
clonedAccessManager.setTargetFunctionRole(
|
222
|
-
"Instance",
|
223
|
-
instanceInstanceServiceSelectors,
|
224
|
-
INSTANCE_SERVICE_ROLE());
|
225
|
-
|
226
|
-
bytes4[] memory instanceAccessManagerInstanceServiceSelectors = new bytes4[](1);
|
227
|
-
instanceAccessManagerInstanceServiceSelectors[0] = clonedAccessManager.createGifTarget.selector;
|
228
|
-
clonedAccessManager.setTargetFunctionRole(
|
229
|
-
"InstanceAccessManager",
|
230
|
-
instanceAccessManagerInstanceServiceSelectors,
|
231
|
-
INSTANCE_SERVICE_ROLE());
|
232
|
-
}
|
233
|
-
|
234
|
-
function setAndRegisterMasterInstance(address instanceAddress)
|
131
|
+
function setAndRegisterMasterInstance(address instanceAddress)
|
235
132
|
external
|
236
133
|
onlyOwner
|
237
134
|
returns(NftId masterInstanceNftId)
|
238
135
|
{
|
239
136
|
if(_masterInstance != address(0)) { revert ErrorInstanceServiceMasterInstanceAlreadySet(); }
|
240
|
-
if(
|
137
|
+
if(_masterAccessManager != address(0)) { revert ErrorInstanceServiceMasterOzAccessManagerAlreadySet(); }
|
138
|
+
if(_masterInstanceAdmin != address(0)) { revert ErrorInstanceServiceMasterInstanceAdminAlreadySet(); }
|
241
139
|
if(_masterInstanceBundleManager != address(0)) { revert ErrorInstanceServiceMasterBundleManagerAlreadySet(); }
|
242
140
|
|
243
141
|
if(instanceAddress == address(0)) { revert ErrorInstanceServiceInstanceAddressZero(); }
|
244
142
|
|
245
143
|
IInstance instance = IInstance(instanceAddress);
|
246
|
-
|
247
|
-
address
|
144
|
+
InstanceAdmin InstanceAdmin = instance.getInstanceAdmin();
|
145
|
+
address InstanceAdminAddress = address(InstanceAdmin);
|
248
146
|
InstanceReader instanceReader = instance.getInstanceReader();
|
249
147
|
address instanceReaderAddress = address(instanceReader);
|
250
148
|
BundleManager bundleManager = instance.getBundleManager();
|
251
149
|
address bundleManagerAddress = address(bundleManager);
|
150
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
151
|
+
address instanceStoreAddress = address(instanceStore);
|
252
152
|
|
253
|
-
if(
|
153
|
+
if(InstanceAdminAddress == address(0)) { revert ErrorInstanceServiceInstanceAdminZero(); }
|
254
154
|
if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderZero(); }
|
255
155
|
if(bundleManagerAddress == address(0)) { revert ErrorInstanceServiceBundleManagerZero(); }
|
156
|
+
if(instanceStoreAddress == address(0)) { revert ErrorInstanceServiceInstanceStoreZero(); }
|
256
157
|
|
257
|
-
if(instance.authority() !=
|
258
|
-
if(
|
158
|
+
if(instance.authority() != InstanceAdmin.authority()) { revert ErrorInstanceServiceInstanceAuthorityMismatch(); }
|
159
|
+
if(bundleManager.authority() != InstanceAdmin.authority()) { revert ErrorInstanceServiceBundleManagerAuthorityMismatch(); }
|
160
|
+
if(instanceStore.authority() != InstanceAdmin.authority()) { revert ErrorInstanceServiceInstanceStoreAuthorityMismatch(); }
|
259
161
|
if(bundleManager.getInstance() != instance) { revert ErrorInstanceServiceBundleMangerInstanceMismatch(); }
|
162
|
+
if(instanceReader.getInstance() != instance) { revert ErrorInstanceServiceInstanceReaderInstanceMismatch2(); }
|
260
163
|
|
261
|
-
|
164
|
+
_masterAccessManager = instance.authority();
|
165
|
+
_masterInstanceAdmin = InstanceAdminAddress;
|
262
166
|
_masterInstance = instanceAddress;
|
263
167
|
_masterInstanceReader = instanceReaderAddress;
|
264
168
|
_masterInstanceBundleManager = bundleManagerAddress;
|
169
|
+
_masterInstanceStore = instanceStoreAddress;
|
265
170
|
|
266
|
-
IRegistryService registryService = IRegistryService(getRegistry().getServiceAddress(REGISTRY(), getMajorVersion()));
|
267
171
|
IInstance masterInstance = IInstance(_masterInstance);
|
268
|
-
IRegistry.ObjectInfo memory info =
|
172
|
+
IRegistry.ObjectInfo memory info = _registryService.registerInstance(masterInstance, getOwner());
|
269
173
|
masterInstanceNftId = info.nftId;
|
270
|
-
|
271
|
-
// masterInstance.linkToRegisteredNftId();
|
272
174
|
}
|
273
175
|
|
274
|
-
function
|
176
|
+
function upgradeMasterInstanceReader(address instanceReaderAddress) external onlyOwner {
|
275
177
|
if(_masterInstanceReader == address(0)) { revert ErrorInstanceServiceMasterInstanceReaderNotSet(); }
|
276
178
|
if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderAddressZero(); }
|
277
179
|
if(instanceReaderAddress == _masterInstanceReader) { revert ErrorInstanceServiceInstanceReaderSameAsMasterInstanceReader(); }
|
@@ -282,40 +184,70 @@ contract InstanceService is Service, IInstanceService {
|
|
282
184
|
_masterInstanceReader = instanceReaderAddress;
|
283
185
|
}
|
284
186
|
|
285
|
-
|
286
|
-
|
187
|
+
function upgradeInstanceReader(NftId instanceNftId)
|
188
|
+
external
|
189
|
+
onlyInstanceOwner(instanceNftId)
|
190
|
+
{
|
287
191
|
IRegistry registry = getRegistry();
|
288
192
|
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
289
193
|
Instance instance = Instance(instanceInfo.objectAddress);
|
290
|
-
address owner = instance.getOwner();
|
291
|
-
|
292
|
-
if (msg.sender != owner) {
|
293
|
-
revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
|
294
|
-
}
|
295
194
|
|
296
195
|
InstanceReader upgradedInstanceReaderClone = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
297
|
-
upgradedInstanceReaderClone.initialize(address(
|
196
|
+
upgradedInstanceReaderClone.initialize(address(instance));
|
298
197
|
instance.setInstanceReader(upgradedInstanceReaderClone);
|
299
198
|
}
|
300
199
|
|
301
|
-
function getMasterInstanceReader() external view returns (address) {
|
302
|
-
return _masterInstanceReader;
|
303
|
-
}
|
304
200
|
|
305
|
-
|
306
|
-
|
201
|
+
// all gif targets MUST be childs of instanceNftId
|
202
|
+
function createGifTarget(
|
203
|
+
NftId instanceNftId,
|
204
|
+
address targetAddress,
|
205
|
+
string memory targetName,
|
206
|
+
bytes4[][] memory selectors,
|
207
|
+
RoleId[] memory roles
|
208
|
+
)
|
209
|
+
external
|
210
|
+
restricted
|
211
|
+
{
|
212
|
+
// TODO instanceAdmin will check target instance match anyway
|
213
|
+
(
|
214
|
+
IInstance instance, // or instanceInfo
|
215
|
+
// or targetInfo
|
216
|
+
) = _validateInstanceAndComponent(instanceNftId, targetAddress);
|
217
|
+
|
218
|
+
InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
|
219
|
+
instanceAdmin.createGifTarget(targetAddress, targetName);
|
220
|
+
// set proposed target config
|
221
|
+
// TODO restriction: gif targets are set only once and only here?
|
222
|
+
// assume config is a mix of gif and custom roles and no further configuration by INSTANCE_OWNER_ROLE is ever needed?
|
223
|
+
for(uint roleIdx = 0; roleIdx < roles.length; roleIdx++)
|
224
|
+
{
|
225
|
+
instanceAdmin.setTargetFunctionRoleByService(targetName, selectors[roleIdx], roles[roleIdx]);
|
226
|
+
}
|
307
227
|
}
|
308
228
|
|
309
|
-
function
|
310
|
-
|
229
|
+
function setComponentLocked(bool locked) onlyComponent external {
|
230
|
+
|
231
|
+
address componentAddress = msg.sender;
|
232
|
+
IRegistry registry = getRegistry();
|
233
|
+
NftId instanceNftId = registry.getObjectInfo(componentAddress).parentNftId;
|
234
|
+
|
235
|
+
IInstance instance = IInstance(
|
236
|
+
registry.getObjectInfo(
|
237
|
+
instanceNftId).objectAddress);
|
238
|
+
|
239
|
+
instance.getInstanceAdmin().setTargetLockedByService(
|
240
|
+
componentAddress,
|
241
|
+
locked);
|
311
242
|
}
|
312
243
|
|
313
|
-
|
314
|
-
|
244
|
+
|
245
|
+
function getMasterInstanceReader() external view returns (address) {
|
246
|
+
return _masterInstanceReader;
|
315
247
|
}
|
316
248
|
|
317
249
|
// From IService
|
318
|
-
function getDomain() public pure override
|
250
|
+
function getDomain() public pure override returns(ObjectType) {
|
319
251
|
return INSTANCE();
|
320
252
|
}
|
321
253
|
|
@@ -328,106 +260,40 @@ contract InstanceService is Service, IInstanceService {
|
|
328
260
|
initializer
|
329
261
|
virtual override
|
330
262
|
{
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
initializeService(registryAddress, owner);
|
337
|
-
registerInterface(type(IInstanceService).interfaceId);
|
338
|
-
}
|
263
|
+
(
|
264
|
+
address registryAddress,,
|
265
|
+
//address managerAddress
|
266
|
+
address authority
|
267
|
+
) = abi.decode(data, (address, address, address));
|
339
268
|
|
340
|
-
|
341
|
-
Instance instance = Instance(instanceAddress);
|
342
|
-
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
343
|
-
return accessManager.hasRole(role, account);
|
344
|
-
}
|
269
|
+
initializeService(registryAddress, authority, owner);
|
345
270
|
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
351
|
-
accessManager.createGifTarget(targetAddress, targetName);
|
352
|
-
}
|
271
|
+
_registryService = IRegistryService(
|
272
|
+
IRegistry(registryAddress).getServiceAddress(
|
273
|
+
REGISTRY(),
|
274
|
+
getVersion().toMajorPart()));
|
353
275
|
|
354
|
-
|
355
|
-
IRegistry registry = getRegistry();
|
356
|
-
IRegistry.ObjectInfo memory distributionInfo = registry.getObjectInfo(distributionAddress);
|
357
|
-
|
358
|
-
if (distributionInfo.objectType != DISTRIBUTION()) {
|
359
|
-
revert ErrorInstanceServiceInvalidComponentType(distributionAddress, DISTRIBUTION(), distributionInfo.objectType);
|
360
|
-
}
|
361
|
-
|
362
|
-
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
363
|
-
Instance instance = Instance(instanceInfo.objectAddress);
|
364
|
-
InstanceAccessManager instanceAccessManager = InstanceAccessManager(instance.authority());
|
365
|
-
|
366
|
-
bytes4[] memory fctSelectors = new bytes4[](1);
|
367
|
-
fctSelectors[0] = IDistributionComponent.setFees.selector;
|
368
|
-
instanceAccessManager.setTargetFunctionRole(distributionName, fctSelectors, DISTRIBUTION_OWNER_ROLE());
|
369
|
-
|
370
|
-
bytes4[] memory fctSelectors2 = new bytes4[](2);
|
371
|
-
fctSelectors2[0] = IDistributionComponent.processSale.selector;
|
372
|
-
fctSelectors2[1] = IDistributionComponent.processRenewal.selector;
|
373
|
-
instanceAccessManager.setTargetFunctionRole(distributionName, fctSelectors2, PRODUCT_SERVICE_ROLE());
|
276
|
+
registerInterface(type(IInstanceService).interfaceId);
|
374
277
|
}
|
375
278
|
|
376
|
-
function grantPoolDefaultPermissions(NftId instanceNftId, address poolAddress, string memory poolName) external onlyRegisteredService {
|
377
|
-
IRegistry registry = getRegistry();
|
378
|
-
IRegistry.ObjectInfo memory poolInfo = registry.getObjectInfo(poolAddress);
|
379
|
-
|
380
|
-
if (poolInfo.objectType != POOL()) {
|
381
|
-
revert ErrorInstanceServiceInvalidComponentType(poolAddress, POOL(), poolInfo.objectType);
|
382
|
-
}
|
383
|
-
|
384
|
-
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
385
|
-
Instance instance = Instance(instanceInfo.objectAddress);
|
386
|
-
InstanceAccessManager instanceAccessManager = InstanceAccessManager(instance.authority());
|
387
|
-
|
388
|
-
bytes4[] memory fctSelectors = new bytes4[](1);
|
389
|
-
fctSelectors[0] = IPoolComponent.setFees.selector;
|
390
|
-
instanceAccessManager.setTargetFunctionRole(poolName, fctSelectors, POOL_OWNER_ROLE());
|
391
279
|
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
function grantProductDefaultPermissions(NftId instanceNftId, address productAddress, string memory productName) external onlyRegisteredService {
|
280
|
+
function _validateInstanceAndComponent(NftId instanceNftId, address componentAddress)
|
281
|
+
internal
|
282
|
+
view
|
283
|
+
returns (IInstance instance, NftId componentNftId)
|
284
|
+
{
|
398
285
|
IRegistry registry = getRegistry();
|
399
|
-
IRegistry.ObjectInfo memory productInfo = registry.getObjectInfo(productAddress);
|
400
|
-
|
401
|
-
if (productInfo.objectType != PRODUCT()) {
|
402
|
-
revert ErrorInstanceServiceInvalidComponentType(productAddress, PRODUCT(), productInfo.objectType);
|
403
|
-
}
|
404
|
-
|
405
286
|
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
bytes4[] memory fctSelectors = new bytes4[](1);
|
410
|
-
fctSelectors[0] = IProductComponent.setFees.selector;
|
411
|
-
instanceAccessManager.setTargetFunctionRole(productName, fctSelectors, PRODUCT_OWNER_ROLE());
|
412
|
-
}
|
287
|
+
if(instanceInfo.objectType != INSTANCE()) {
|
288
|
+
revert ErrorInstanceServiceNotInstance(instanceNftId);
|
289
|
+
}
|
413
290
|
|
414
|
-
function setTargetLocked(string memory targetName, bool locked) external {
|
415
|
-
address componentAddress = msg.sender;
|
416
|
-
IRegistry registry = getRegistry();
|
417
291
|
IRegistry.ObjectInfo memory componentInfo = registry.getObjectInfo(componentAddress);
|
418
|
-
if
|
419
|
-
revert
|
292
|
+
if(componentInfo.parentNftId != instanceNftId) {
|
293
|
+
revert ErrorInstanceServiceInstanceComponentMismatch(instanceNftId, componentInfo.nftId);
|
420
294
|
}
|
421
295
|
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
address instanceAddress = registry.getObjectInfo(componentInfo.parentNftId).objectAddress;
|
426
|
-
IInstance instance = IInstance(instanceAddress);
|
427
|
-
|
428
|
-
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
429
|
-
accessManager.setTargetClosed(targetName, locked);
|
296
|
+
instance = Instance(instanceInfo.objectAddress);
|
297
|
+
componentNftId = componentInfo.nftId;
|
430
298
|
}
|
431
|
-
|
432
|
-
}
|
433
|
-
|
299
|
+
}
|
@@ -7,39 +7,29 @@ import {ProxyManager} from "../shared/ProxyManager.sol";
|
|
7
7
|
import {InstanceService} from "./InstanceService.sol";
|
8
8
|
import {Registry} from "../registry/Registry.sol";
|
9
9
|
import {RegistryService} from "../registry/RegistryService.sol";
|
10
|
-
import {REGISTRY} from "../
|
10
|
+
import {REGISTRY} from "../type/ObjectType.sol";
|
11
11
|
|
12
12
|
contract InstanceServiceManager is ProxyManager {
|
13
13
|
|
14
14
|
InstanceService private _instanceService;
|
15
15
|
|
16
|
-
/// @dev initializes proxy manager with instance service implementation
|
16
|
+
/// @dev initializes proxy manager with instance service implementation
|
17
17
|
constructor(
|
18
|
-
address
|
19
|
-
|
20
|
-
|
18
|
+
address authority,
|
19
|
+
address registryAddress,
|
20
|
+
bytes32 salt
|
21
|
+
)
|
22
|
+
ProxyManager(registryAddress)
|
21
23
|
{
|
22
|
-
InstanceService instSrv = new InstanceService();
|
24
|
+
InstanceService instSrv = new InstanceService{salt: salt}();
|
23
25
|
// bytes memory initCode = type(InstanceService).creationCode;
|
24
|
-
bytes memory data = abi.encode(registryAddress, address(this));
|
25
|
-
IVersionable versionable =
|
26
|
+
bytes memory data = abi.encode(registryAddress, address(this), authority);
|
27
|
+
IVersionable versionable = deployDetermenistic(
|
26
28
|
address(instSrv),
|
27
|
-
data
|
29
|
+
data,
|
30
|
+
salt);
|
28
31
|
|
29
32
|
_instanceService = InstanceService(address(versionable));
|
30
|
-
|
31
|
-
// TODO `this` must have a role or own nft to register service
|
32
|
-
//Registry registry = Registry(registryAddress);
|
33
|
-
//address registryServiceAddress = registry.getServiceAddress(REGISTRY(), _instanceService.getMajorVersion());
|
34
|
-
//RegistryService registryService = RegistryService(registryServiceAddress);
|
35
|
-
//registryService.registerService(_instanceService);
|
36
|
-
// RegistryService registryService = _instanceService.getRegistryService();
|
37
|
-
|
38
|
-
// TODO no nft to link yet
|
39
|
-
// link ownership of instance service manager ot nft owner of instance service
|
40
|
-
//_linkToNftOwnable(
|
41
|
-
// address(registryAddress),
|
42
|
-
// address(_instanceService));
|
43
33
|
}
|
44
34
|
|
45
35
|
//--- view functions ----------------------------------------------------//
|