@etherisc/gif-next 0.0.2-d5b7b78-706 → 0.0.2-d5fac82-078
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 +90 -14
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +1575 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +851 -0
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/{components → distribution}/IDistributionComponent.sol/IDistributionComponent.json +145 -14
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service → distribution}/IDistributionService.sol/IDistributionService.json +110 -283
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +6 -6
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +310 -2004
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +104 -55
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +420 -2725
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +746 -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 +366 -71
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +179 -214
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +121 -95
- 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 +1 -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 +61 -12
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +8 -8
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/{ObjectManager.sol → base/ObjectManager.sol}/ObjectManager.json +3 -3
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +1 -130
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.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/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 +234 -129
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
- package/artifacts/contracts/{components → pool}/IPoolComponent.sol/IPoolComponent.json +162 -21
- 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 +91 -21
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +1641 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +779 -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/IClaimService.sol/IClaimService.json → product/IApplicationService.sol/IApplicationService.json} +184 -100
- 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 +211 -100
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service/IApplicationService.sol/IApplicationService.json → product/IPricingService.sol/IPricingService.json} +120 -166
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +4 -0
- package/artifacts/contracts/{components → product}/IProductComponent.sol/IProductComponent.json +152 -21
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service → product}/IProductService.sol/IProductService.json +86 -28
- 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 +82 -22
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +883 -0
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +711 -0
- 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 +110 -30
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +165 -84
- 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 +133 -45
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +305 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +209 -104
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +103 -55
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +542 -86
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +20 -35
- 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 +1747 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +1765 -0
- package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/{instance → shared}/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +3 -3
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/{components → shared}/Component.sol/Component.json +67 -7
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/{instance/base → shared}/ComponentService.sol/ComponentService.json +133 -35
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- 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 +1594 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/{components → shared}/IComponent.sol/IComponent.json +138 -7
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +0 -13
- 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 +0 -13
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +0 -13
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +85 -27
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +23 -43
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +80 -26
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +81 -33
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +27 -21
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +110 -28
- 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/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/{types → type}/NftId.sol/NftIdLib.json +5 -5
- 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/{types → type}/Referral.sol/ReferralLib.json +5 -5
- 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/{types → type}/Seconds.sol/SecondsLib.json +3 -3
- 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 +20 -7
- 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 +21 -16
- package/contracts/distribution/DistributionService.sol +351 -0
- package/contracts/distribution/DistributionServiceManager.sol +42 -0
- package/contracts/{components → distribution}/IDistributionComponent.sol +7 -7
- package/contracts/{instance/service → distribution}/IDistributionService.sol +19 -30
- package/contracts/instance/BundleManager.sol +8 -9
- package/contracts/instance/IInstance.sol +45 -66
- package/contracts/instance/IInstanceService.sol +21 -20
- package/contracts/instance/Instance.sol +121 -218
- package/contracts/instance/InstanceAdmin.sol +354 -0
- package/contracts/instance/InstanceAuthorizationsLib.sol +320 -0
- package/contracts/instance/InstanceReader.sol +96 -18
- package/contracts/instance/InstanceService.sol +120 -317
- package/contracts/instance/InstanceServiceManager.sol +11 -21
- package/contracts/instance/InstanceStore.sol +211 -0
- package/contracts/instance/{Cloneable.sol → base/Cloneable.sol} +1 -1
- package/contracts/instance/base/IKeyValueStore.sol +14 -10
- package/contracts/instance/base/ILifecycle.sol +3 -3
- package/contracts/instance/base/KeyValueStore.sol +39 -45
- package/contracts/instance/base/Lifecycle.sol +17 -5
- package/contracts/instance/{ObjectManager.sol → base/ObjectManager.sol} +7 -7
- package/contracts/instance/module/IAccess.sol +3 -13
- package/contracts/instance/module/IBundle.sol +10 -8
- package/contracts/instance/module/IComponents.sol +11 -5
- package/contracts/instance/module/IDistribution.sol +7 -6
- package/contracts/instance/module/IPolicy.sol +22 -16
- package/contracts/instance/module/IRisk.sol +1 -1
- package/contracts/instance/module/ISetup.sol +4 -4
- 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/{components → pool}/IPoolComponent.sol +14 -13
- package/contracts/pool/IPoolService.sol +114 -0
- package/contracts/{components → pool}/Pool.sol +25 -22
- package/contracts/pool/PoolService.sol +404 -0
- package/contracts/pool/PoolServiceManager.sol +42 -0
- package/contracts/product/ApplicationService.sol +187 -0
- package/contracts/{instance/service → product}/ApplicationServiceManager.sol +11 -8
- package/contracts/product/ClaimService.sol +443 -0
- package/contracts/{instance/service → product}/ClaimServiceManager.sol +11 -8
- package/contracts/{instance/service → product}/IApplicationService.sol +14 -34
- package/contracts/product/IClaimService.sol +93 -0
- package/contracts/{instance/service → product}/IPolicyService.sol +34 -26
- package/contracts/product/IPricingService.sol +37 -0
- package/contracts/{components → product}/IProductComponent.sol +11 -10
- 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 +160 -74
- package/contracts/product/ProductService.sol +212 -0
- package/contracts/product/ProductServiceManager.sol +42 -0
- package/contracts/registry/IRegistry.sol +28 -17
- package/contracts/registry/IRegistryService.sol +29 -37
- package/contracts/registry/Registry.sol +46 -48
- package/contracts/registry/RegistryAdmin.sol +143 -0
- package/contracts/registry/RegistryService.sol +37 -88
- package/contracts/registry/RegistryServiceManager.sol +21 -23
- package/contracts/registry/ReleaseManager.sol +318 -177
- package/contracts/registry/TokenRegistry.sol +6 -4
- 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 +125 -0
- package/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol +14 -0
- package/contracts/{components → shared}/Component.sol +31 -11
- package/contracts/shared/ComponentService.sol +141 -0
- package/contracts/shared/IAccessManagerExtended.sol +74 -0
- package/contracts/shared/IAccessManagerExtendedWithDisable.sol +17 -0
- package/contracts/{components → shared}/IComponent.sol +22 -6
- package/contracts/shared/INftOwnable.sol +1 -1
- package/contracts/shared/IPolicyHolder.sol +24 -10
- package/contracts/shared/IRegistryLinked.sol +0 -1
- package/contracts/shared/IService.sol +6 -6
- package/contracts/shared/IVersionable.sol +1 -1
- package/contracts/shared/NftOwnable.sol +13 -16
- package/contracts/shared/PolicyHolder.sol +31 -18
- package/contracts/shared/ProxyManager.sol +34 -3
- package/contracts/shared/Registerable.sol +12 -11
- package/contracts/shared/RegistryLinked.sol +0 -5
- package/contracts/shared/Service.sol +23 -9
- package/contracts/shared/TokenHandler.sol +4 -2
- package/contracts/shared/Versionable.sol +1 -1
- 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}/ClaimId.sol +25 -2
- package/contracts/{types → type}/Fee.sol +16 -8
- package/contracts/{types → type}/NftIdSet.sol +1 -1
- package/contracts/{types → type}/ObjectType.sol +10 -5
- package/contracts/{types → type}/PayoutId.sol +33 -5
- package/contracts/{types → type}/RoleId.sol +50 -8
- package/contracts/{types → type}/StateId.sol +6 -2
- package/contracts/{types → type}/Timestamp.sol +5 -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/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- 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 -1311
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +0 -4
- 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 -968
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +0 -665
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +0 -1093
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +0 -661
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +0 -754
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +0 -637
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +0 -1732
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +0 -805
- 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/IClaimService.sol/IClaimService.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/IPoolService.sol/IPoolService.json +0 -428
- 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 -1021
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +0 -689
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +0 -824
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +0 -657
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +0 -777
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +0 -649
- 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 -383
- 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 -521
- 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 -104
- 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/ClaimId.sol/ClaimIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +0 -100
- 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/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/PayoutId.sol/PayoutIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +0 -100
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +0 -4
- 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/Seconds.sol/SecondsLib.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/instance/InstanceAccessManager.sol +0 -522
- package/contracts/instance/base/ComponentService.sol +0 -134
- package/contracts/instance/service/ApplicationService.sol +0 -350
- package/contracts/instance/service/BundleService.sol +0 -336
- package/contracts/instance/service/BundleServiceManager.sol +0 -51
- package/contracts/instance/service/ClaimService.sol +0 -151
- package/contracts/instance/service/DistributionService.sol +0 -467
- package/contracts/instance/service/DistributionServiceManager.sol +0 -51
- package/contracts/instance/service/IBundleService.sol +0 -62
- package/contracts/instance/service/IClaimService.sol +0 -61
- package/contracts/instance/service/IPoolService.sol +0 -35
- package/contracts/instance/service/PolicyService.sol +0 -403
- package/contracts/instance/service/PolicyServiceManager.sol +0 -54
- package/contracts/instance/service/PoolService.sol +0 -220
- package/contracts/instance/service/PoolServiceManager.sol +0 -51
- package/contracts/instance/service/ProductService.sol +0 -241
- 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/{instance → shared}/AccessManagerUpgradeableInitializeable.sol +0 -0
- /package/contracts/{types → type}/AddressSet.sol +0 -0
- /package/contracts/{types → type}/Blocknumber.sol +0 -0
- /package/contracts/{types → type}/DistributorType.sol +0 -0
- /package/contracts/{types → type}/Key32.sol +0 -0
- /package/contracts/{types → type}/NftId.sol +0 -0
- /package/contracts/{types → type}/Referral.sol +0 -0
- /package/contracts/{types → type}/RiskId.sol +0 -0
- /package/contracts/{types → type}/Seconds.sol +0 -0
- /package/contracts/{types → type}/UFixed.sol +0 -0
- /package/contracts/{types → type}/Version.sol +0 -0
@@ -4,38 +4,47 @@ pragma solidity ^0.8.20;
|
|
4
4
|
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
|
5
5
|
import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
|
6
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";
|
23
|
+
|
7
24
|
import {Instance} from "./Instance.sol";
|
8
25
|
import {IInstance} from "./IInstance.sol";
|
9
|
-
import {
|
26
|
+
import {InstanceAdmin} from "./InstanceAdmin.sol";
|
10
27
|
import {IInstanceService} from "./IInstanceService.sol";
|
11
28
|
import {InstanceReader} from "./InstanceReader.sol";
|
12
29
|
import {BundleManager} from "./BundleManager.sol";
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import {IRegistryService} from "../registry/IRegistryService.sol";
|
16
|
-
import {ChainNft} from "../registry/ChainNft.sol";
|
17
|
-
import {Service} from "../../contracts/shared/Service.sol";
|
18
|
-
import {IService} from "../shared/IService.sol";
|
19
|
-
import {NftId} from "../../contracts/types/NftId.sol";
|
20
|
-
import {RoleId} from "../types/RoleId.sol";
|
21
|
-
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 "../types/RoleId.sol";
|
22
|
-
import {ObjectType, INSTANCE, BUNDLE, APPLICATION, POLICY, CLAIM, PRODUCT, DISTRIBUTION, REGISTRY, POOL} from "../types/ObjectType.sol";
|
23
|
-
import {IDistributionComponent} from "../components/IDistributionComponent.sol";
|
24
|
-
import {IPoolComponent} from "../components/IPoolComponent.sol";
|
25
|
-
import {IProductComponent} from "../components/IProductComponent.sol";
|
30
|
+
import {InstanceStore} from "./InstanceStore.sol";
|
31
|
+
import {InstanceAuthorizationsLib} from "./InstanceAuthorizationsLib.sol";
|
26
32
|
|
27
33
|
contract InstanceService is
|
28
34
|
Service,
|
29
35
|
IInstanceService
|
30
36
|
{
|
37
|
+
|
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;
|
31
42
|
address internal _masterOzAccessManager;
|
32
|
-
address internal
|
43
|
+
address internal _masterInstanceAdmin;
|
33
44
|
address internal _masterInstance;
|
34
45
|
address internal _masterInstanceReader;
|
35
46
|
address internal _masterInstanceBundleManager;
|
36
|
-
|
37
|
-
// TODO update to real hash when instance is stable
|
38
|
-
bytes32 public constant INSTANCE_CREATION_CODE_HASH = bytes32(0);
|
47
|
+
address internal _masterInstanceStore;
|
39
48
|
|
40
49
|
modifier onlyInstanceOwner(NftId instanceNftId) {
|
41
50
|
if(msg.sender != getRegistry().ownerOf(instanceNftId)) {
|
@@ -43,15 +52,8 @@ contract InstanceService is
|
|
43
52
|
}
|
44
53
|
_;
|
45
54
|
}
|
46
|
-
|
47
|
-
// TODO check
|
48
|
-
modifier onlyRegisteredService() {
|
49
|
-
if (! getRegistry().isRegisteredService(msg.sender)) {
|
50
|
-
revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
|
51
|
-
}
|
52
|
-
_;
|
53
|
-
}
|
54
|
-
// TODO check release version?
|
55
|
+
|
56
|
+
// TODO check component - service - instance version match
|
55
57
|
modifier onlyComponent() {
|
56
58
|
if (! getRegistry().isRegisteredComponent(msg.sender)) {
|
57
59
|
revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
|
@@ -62,309 +64,113 @@ contract InstanceService is
|
|
62
64
|
function createInstanceClone()
|
63
65
|
external
|
64
66
|
returns (
|
65
|
-
AccessManagerUpgradeableInitializeable clonedOzAccessManager,
|
66
|
-
InstanceAccessManager clonedInstanceAccessManager,
|
67
67
|
Instance clonedInstance,
|
68
|
-
NftId clonedInstanceNftId
|
69
|
-
InstanceReader clonedInstanceReader,
|
70
|
-
BundleManager clonedBundleManager
|
68
|
+
NftId clonedInstanceNftId
|
71
69
|
)
|
72
70
|
{
|
73
71
|
address instanceOwner = msg.sender;
|
74
|
-
|
75
|
-
address registryAddress = address(registry);
|
76
|
-
NftId registryNftId = registry.getNftId(registryAddress);
|
77
|
-
address registryServiceAddress = registry.getServiceAddress(REGISTRY(), getMajorVersion());
|
78
|
-
IRegistryService registryService = IRegistryService(registryServiceAddress);
|
79
|
-
|
80
|
-
clonedOzAccessManager = AccessManagerUpgradeableInitializeable(
|
72
|
+
AccessManagerExtendedInitializeable clonedOzAccessManager = AccessManagerExtendedInitializeable(
|
81
73
|
Clones.clone(_masterOzAccessManager));
|
82
74
|
|
83
75
|
// initially grants ADMIN_ROLE to this (being the instance service).
|
84
76
|
// This will allow the instance service to bootstrap the authorizations of the instance.
|
85
|
-
// Instance service will not use oz access manager directlly but through instance access manager instead
|
86
77
|
// Instance service will renounce ADMIN_ROLE when bootstraping is finished
|
87
78
|
clonedOzAccessManager.initialize(address(this));
|
88
79
|
|
89
80
|
clonedInstance = Instance(Clones.clone(_masterInstance));
|
90
81
|
clonedInstance.initialize(
|
91
82
|
address(clonedOzAccessManager),
|
92
|
-
|
83
|
+
address(getRegistry()),
|
93
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);
|
94
89
|
|
95
|
-
clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
90
|
+
InstanceReader clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
96
91
|
clonedInstanceReader.initialize(address(clonedInstance));
|
97
92
|
clonedInstance.setInstanceReader(clonedInstanceReader);
|
98
93
|
|
99
|
-
clonedBundleManager = BundleManager(Clones.clone(_masterInstanceBundleManager));
|
94
|
+
BundleManager clonedBundleManager = BundleManager(Clones.clone(_masterInstanceBundleManager));
|
100
95
|
clonedBundleManager.initialize(address(clonedInstance));
|
101
96
|
clonedInstance.setBundleManager(clonedBundleManager);
|
102
97
|
|
103
|
-
|
104
|
-
clonedOzAccessManager.grantRole(ADMIN_ROLE().toInt(), address(
|
105
|
-
|
106
|
-
clonedInstance.
|
98
|
+
InstanceAdmin clonedInstanceAdmin = InstanceAdmin(Clones.clone(_masterInstanceAdmin));
|
99
|
+
clonedOzAccessManager.grantRole(ADMIN_ROLE().toInt(), address(clonedInstanceAdmin), 0);
|
100
|
+
clonedInstanceAdmin.initialize(address(clonedInstance));
|
101
|
+
clonedInstance.setInstanceAdmin(clonedInstanceAdmin);
|
107
102
|
|
108
103
|
// TODO amend setters with instance specific , policy manager ...
|
109
104
|
|
110
|
-
|
105
|
+
// TODO library does external calls -> but it is registry and access manager -> find out is it best practice
|
106
|
+
InstanceAuthorizationsLib.grantInitialAuthorizations(
|
107
|
+
clonedOzAccessManager,
|
108
|
+
clonedInstanceAdmin,
|
109
|
+
clonedInstance,
|
110
|
+
clonedBundleManager,
|
111
|
+
clonedInstanceStore,
|
112
|
+
instanceOwner,
|
113
|
+
getRegistry(),
|
114
|
+
getVersion().toMajorPart());
|
111
115
|
|
112
116
|
clonedOzAccessManager.renounceRole(ADMIN_ROLE().toInt(), address(this));
|
113
117
|
|
114
|
-
IRegistry.ObjectInfo memory info =
|
118
|
+
IRegistry.ObjectInfo memory info = _registryService.registerInstance(clonedInstance, instanceOwner);
|
115
119
|
clonedInstanceNftId = info.nftId;
|
116
|
-
// clonedInstance.linkToRegisteredNftId();
|
117
120
|
|
118
121
|
emit LogInstanceCloned(
|
119
122
|
address(clonedOzAccessManager),
|
120
|
-
address(
|
121
|
-
address(clonedInstance),
|
123
|
+
address(clonedInstanceAdmin),
|
124
|
+
address(clonedInstance),
|
125
|
+
address(clonedInstanceStore),
|
122
126
|
address(clonedBundleManager),
|
123
127
|
address(clonedInstanceReader),
|
124
128
|
clonedInstanceNftId);
|
125
129
|
}
|
126
130
|
|
127
|
-
function
|
128
|
-
InstanceAccessManager clonedAccessManager,
|
129
|
-
Instance clonedInstance,
|
130
|
-
BundleManager clonedBundleManager,
|
131
|
-
address instanceOwner)
|
132
|
-
internal
|
133
|
-
{
|
134
|
-
_createCoreAndGifRoles(clonedAccessManager);
|
135
|
-
_createCoreTargets(clonedAccessManager, clonedInstance, clonedBundleManager);
|
136
|
-
_grantDistributionServiceAuthorizations(clonedAccessManager, clonedInstance);
|
137
|
-
_grantPoolServiceAuthorizations(clonedAccessManager, clonedInstance);
|
138
|
-
_grantProductServiceAuthorizations(clonedAccessManager, clonedInstance);
|
139
|
-
_grantApplicationServiceAuthorizations(clonedAccessManager, clonedInstance);
|
140
|
-
_grantPolicyServiceAuthorizations(clonedAccessManager, clonedInstance);
|
141
|
-
_grantClaimServiceAuthorizations(clonedAccessManager, clonedInstance);
|
142
|
-
_grantBundleServiceAuthorizations(clonedAccessManager, clonedInstance, clonedBundleManager);
|
143
|
-
_grantInstanceServiceAuthorizations(clonedAccessManager, clonedInstance);
|
144
|
-
_grantInstanceOwnerAuthorizations(clonedAccessManager, instanceOwner);
|
145
|
-
}
|
146
|
-
|
147
|
-
function _createCoreAndGifRoles(InstanceAccessManager clonedAccessManager) internal {
|
148
|
-
// default roles controlled by ADMIN_ROLE -> core roles
|
149
|
-
// all set/granted only once during cloning (the only exception is INSTANCE_OWNER_ROLE, hooked to instance nft)
|
150
|
-
clonedAccessManager.createCoreRole(INSTANCE_SERVICE_ROLE(), "InstanceServiceRole");
|
151
|
-
clonedAccessManager.createCoreRole(DISTRIBUTION_SERVICE_ROLE(), "DistributionServiceRole");
|
152
|
-
clonedAccessManager.createCoreRole(POOL_SERVICE_ROLE(), "PoolServiceRole");
|
153
|
-
clonedAccessManager.createCoreRole(APPLICATION_SERVICE_ROLE(), "ApplicationServiceRole");
|
154
|
-
clonedAccessManager.createCoreRole(PRODUCT_SERVICE_ROLE(), "ProductServiceRole");
|
155
|
-
clonedAccessManager.createCoreRole(CLAIM_SERVICE_ROLE(), "ClaimServiceRole");
|
156
|
-
clonedAccessManager.createCoreRole(POLICY_SERVICE_ROLE(), "PolicyServiceRole");
|
157
|
-
clonedAccessManager.createCoreRole(BUNDLE_SERVICE_ROLE(), "BundleServiceRole");
|
158
|
-
// default roles controlled by INSTANCE_OWNER_ROLE -> gif roles
|
159
|
-
clonedAccessManager.createGifRole(DISTRIBUTION_OWNER_ROLE(), "DistributionOwnerRole", INSTANCE_OWNER_ROLE());
|
160
|
-
clonedAccessManager.createGifRole(POOL_OWNER_ROLE(), "PoolOwnerRole", INSTANCE_OWNER_ROLE());
|
161
|
-
clonedAccessManager.createGifRole(PRODUCT_OWNER_ROLE(), "ProductOwnerRole", INSTANCE_OWNER_ROLE());
|
162
|
-
}
|
163
|
-
|
164
|
-
function _createCoreTargets(InstanceAccessManager clonedAccessManager, Instance clonedInstance, BundleManager clonedBundleManager) internal {
|
165
|
-
clonedAccessManager.createCoreTarget(address(clonedAccessManager), "InstanceAccessManager");
|
166
|
-
clonedAccessManager.createCoreTarget(address(clonedInstance), "Instance");
|
167
|
-
clonedAccessManager.createCoreTarget(address(clonedBundleManager), "BundleManager");
|
168
|
-
}
|
169
|
-
|
170
|
-
function _grantDistributionServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
171
|
-
// configure authorization for distribution service on instance
|
172
|
-
address distributionServiceAddress = getRegistry().getServiceAddress(DISTRIBUTION(), getMajorVersion());
|
173
|
-
clonedAccessManager.grantRole(DISTRIBUTION_SERVICE_ROLE(), distributionServiceAddress);
|
174
|
-
bytes4[] memory instanceDistributionServiceSelectors = new bytes4[](11);
|
175
|
-
instanceDistributionServiceSelectors[0] = clonedInstance.createDistributionSetup.selector;
|
176
|
-
instanceDistributionServiceSelectors[1] = clonedInstance.updateDistributionSetup.selector;
|
177
|
-
instanceDistributionServiceSelectors[2] = clonedInstance.createDistributorType.selector;
|
178
|
-
instanceDistributionServiceSelectors[3] = clonedInstance.updateDistributorType.selector;
|
179
|
-
instanceDistributionServiceSelectors[4] = clonedInstance.updateDistributorTypeState.selector;
|
180
|
-
instanceDistributionServiceSelectors[5] = clonedInstance.createDistributor.selector;
|
181
|
-
instanceDistributionServiceSelectors[6] = clonedInstance.updateDistributor.selector;
|
182
|
-
instanceDistributionServiceSelectors[7] = clonedInstance.updateDistributorState.selector;
|
183
|
-
instanceDistributionServiceSelectors[8] = clonedInstance.createReferral.selector;
|
184
|
-
instanceDistributionServiceSelectors[9] = clonedInstance.updateReferral.selector;
|
185
|
-
instanceDistributionServiceSelectors[10] = clonedInstance.updateReferralState.selector;
|
186
|
-
clonedAccessManager.setCoreTargetFunctionRole(
|
187
|
-
"Instance",
|
188
|
-
instanceDistributionServiceSelectors,
|
189
|
-
DISTRIBUTION_SERVICE_ROLE());
|
190
|
-
}
|
191
|
-
|
192
|
-
function _grantPoolServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
193
|
-
// configure authorization for pool service on instance
|
194
|
-
address poolServiceAddress = getRegistry().getServiceAddress(POOL(), getMajorVersion());
|
195
|
-
clonedAccessManager.grantRole(POOL_SERVICE_ROLE(), address(poolServiceAddress));
|
196
|
-
bytes4[] memory instancePoolServiceSelectors = new bytes4[](4);
|
197
|
-
instancePoolServiceSelectors[0] = clonedInstance.createPoolSetup.selector;
|
198
|
-
instancePoolServiceSelectors[1] = clonedInstance.updatePoolSetup.selector;
|
199
|
-
clonedAccessManager.setCoreTargetFunctionRole(
|
200
|
-
"Instance",
|
201
|
-
instancePoolServiceSelectors,
|
202
|
-
POOL_SERVICE_ROLE());
|
203
|
-
}
|
204
|
-
|
205
|
-
function _grantProductServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
206
|
-
// configure authorization for product service on instance
|
207
|
-
address productServiceAddress = getRegistry().getServiceAddress(PRODUCT(), getMajorVersion());
|
208
|
-
clonedAccessManager.grantRole(PRODUCT_SERVICE_ROLE(), address(productServiceAddress));
|
209
|
-
bytes4[] memory instanceProductServiceSelectors = new bytes4[](5);
|
210
|
-
instanceProductServiceSelectors[0] = clonedInstance.createProductSetup.selector;
|
211
|
-
instanceProductServiceSelectors[1] = clonedInstance.updateProductSetup.selector;
|
212
|
-
instanceProductServiceSelectors[2] = clonedInstance.createRisk.selector;
|
213
|
-
instanceProductServiceSelectors[3] = clonedInstance.updateRisk.selector;
|
214
|
-
instanceProductServiceSelectors[4] = clonedInstance.updateRiskState.selector;
|
215
|
-
clonedAccessManager.setCoreTargetFunctionRole(
|
216
|
-
"Instance",
|
217
|
-
instanceProductServiceSelectors,
|
218
|
-
PRODUCT_SERVICE_ROLE());
|
219
|
-
}
|
220
|
-
|
221
|
-
function _grantApplicationServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
222
|
-
// configure authorization for application services on instance
|
223
|
-
address applicationServiceAddress = getRegistry().getServiceAddress(APPLICATION(), getMajorVersion());
|
224
|
-
clonedAccessManager.grantRole(APPLICATION_SERVICE_ROLE(), applicationServiceAddress);
|
225
|
-
bytes4[] memory instanceApplicationServiceSelectors = new bytes4[](3);
|
226
|
-
instanceApplicationServiceSelectors[0] = clonedInstance.createApplication.selector;
|
227
|
-
instanceApplicationServiceSelectors[1] = clonedInstance.updateApplication.selector;
|
228
|
-
instanceApplicationServiceSelectors[2] = clonedInstance.updateApplicationState.selector;
|
229
|
-
clonedAccessManager.setCoreTargetFunctionRole(
|
230
|
-
"Instance",
|
231
|
-
instanceApplicationServiceSelectors,
|
232
|
-
APPLICATION_SERVICE_ROLE());
|
233
|
-
}
|
234
|
-
|
235
|
-
function _grantPolicyServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
236
|
-
// configure authorization for policy services on instance
|
237
|
-
address policyServiceAddress = getRegistry().getServiceAddress(POLICY(), getMajorVersion());
|
238
|
-
clonedAccessManager.grantRole(POLICY_SERVICE_ROLE(), policyServiceAddress);
|
239
|
-
bytes4[] memory instancePolicyServiceSelectors = new bytes4[](2);
|
240
|
-
instancePolicyServiceSelectors[0] = clonedInstance.updatePolicy.selector;
|
241
|
-
instancePolicyServiceSelectors[1] = clonedInstance.updatePolicyState.selector;
|
242
|
-
clonedAccessManager.setCoreTargetFunctionRole(
|
243
|
-
"Instance",
|
244
|
-
instancePolicyServiceSelectors,
|
245
|
-
POLICY_SERVICE_ROLE());
|
246
|
-
}
|
247
|
-
|
248
|
-
function _grantClaimServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
249
|
-
// configure authorization for claim/payout services on instance
|
250
|
-
address claimServiceAddress = getRegistry().getServiceAddress(CLAIM(), getMajorVersion());
|
251
|
-
clonedAccessManager.grantRole(POLICY_SERVICE_ROLE(), claimServiceAddress);
|
252
|
-
// TODO add claims function authz
|
253
|
-
bytes4[] memory instanceClaimServiceSelectors = new bytes4[](0);
|
254
|
-
// instanceClaimServiceSelectors[0] = clonedInstance.updatePolicy.selector;
|
255
|
-
// instanceClaimServiceSelectors[1] = clonedInstance.updatePolicyState.selector;
|
256
|
-
clonedAccessManager.setCoreTargetFunctionRole(
|
257
|
-
"Instance",
|
258
|
-
instanceClaimServiceSelectors,
|
259
|
-
CLAIM_SERVICE_ROLE());
|
260
|
-
}
|
261
|
-
|
262
|
-
function _grantBundleServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance, BundleManager clonedBundleManager) internal {
|
263
|
-
// configure authorization for bundle service on instance
|
264
|
-
address bundleServiceAddress = getRegistry().getServiceAddress(BUNDLE(), getMajorVersion());
|
265
|
-
clonedAccessManager.grantRole(BUNDLE_SERVICE_ROLE(), address(bundleServiceAddress));
|
266
|
-
bytes4[] memory instanceBundleServiceSelectors = new bytes4[](3);
|
267
|
-
instanceBundleServiceSelectors[0] = clonedInstance.createBundle.selector;
|
268
|
-
instanceBundleServiceSelectors[1] = clonedInstance.updateBundle.selector;
|
269
|
-
instanceBundleServiceSelectors[2] = clonedInstance.updateBundleState.selector;
|
270
|
-
clonedAccessManager.setCoreTargetFunctionRole(
|
271
|
-
"Instance",
|
272
|
-
instanceBundleServiceSelectors,
|
273
|
-
BUNDLE_SERVICE_ROLE());
|
274
|
-
|
275
|
-
// configure authorization for bundle service on bundle manager
|
276
|
-
bytes4[] memory bundleManagerBundleServiceSelectors = new bytes4[](5);
|
277
|
-
bundleManagerBundleServiceSelectors[0] = clonedBundleManager.linkPolicy.selector;
|
278
|
-
bundleManagerBundleServiceSelectors[1] = clonedBundleManager.unlinkPolicy.selector;
|
279
|
-
bundleManagerBundleServiceSelectors[2] = clonedBundleManager.add.selector;
|
280
|
-
bundleManagerBundleServiceSelectors[3] = clonedBundleManager.lock.selector;
|
281
|
-
bundleManagerBundleServiceSelectors[4] = clonedBundleManager.unlock.selector;
|
282
|
-
clonedAccessManager.setCoreTargetFunctionRole(
|
283
|
-
"BundleManager",
|
284
|
-
bundleManagerBundleServiceSelectors,
|
285
|
-
BUNDLE_SERVICE_ROLE());
|
286
|
-
}
|
287
|
-
|
288
|
-
function _grantInstanceServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
289
|
-
// configure authorization for instance service on instance
|
290
|
-
address instanceServiceAddress = getRegistry().getServiceAddress(INSTANCE(), getMajorVersion());
|
291
|
-
clonedAccessManager.grantRole(INSTANCE_SERVICE_ROLE(), instanceServiceAddress);
|
292
|
-
bytes4[] memory instanceInstanceServiceSelectors = new bytes4[](1);
|
293
|
-
instanceInstanceServiceSelectors[0] = clonedInstance.setInstanceReader.selector;
|
294
|
-
clonedAccessManager.setCoreTargetFunctionRole(
|
295
|
-
"Instance",
|
296
|
-
instanceInstanceServiceSelectors,
|
297
|
-
INSTANCE_SERVICE_ROLE());
|
298
|
-
|
299
|
-
// configure authorizations for instance service on instance access manager
|
300
|
-
bytes4[] memory accessManagerInstanceServiceSelectors = new bytes4[](3);
|
301
|
-
accessManagerInstanceServiceSelectors[0] = clonedAccessManager.createGifTarget.selector;
|
302
|
-
accessManagerInstanceServiceSelectors[1] = clonedAccessManager.setTargetLocked.selector;
|
303
|
-
accessManagerInstanceServiceSelectors[2] = clonedAccessManager.setCoreTargetFunctionRole.selector;
|
304
|
-
clonedAccessManager.setCoreTargetFunctionRole(
|
305
|
-
"InstanceAccessManager",
|
306
|
-
accessManagerInstanceServiceSelectors,
|
307
|
-
INSTANCE_SERVICE_ROLE());
|
308
|
-
}
|
309
|
-
|
310
|
-
function _grantInstanceOwnerAuthorizations(InstanceAccessManager clonedAccessManager, address instanceOwner) internal {
|
311
|
-
// configure authorization for instance owner on instance access manager
|
312
|
-
// instance owner role is granted/revoked ONLY by INSTANCE_ROLE
|
313
|
-
bytes4[] memory accessManagerInstanceOwnerSelectors = new bytes4[](3);
|
314
|
-
accessManagerInstanceOwnerSelectors[0] = clonedAccessManager.createRole.selector;
|
315
|
-
accessManagerInstanceOwnerSelectors[1] = clonedAccessManager.createTarget.selector;
|
316
|
-
accessManagerInstanceOwnerSelectors[2] = clonedAccessManager.setTargetFunctionRole.selector;
|
317
|
-
clonedAccessManager.setCoreTargetFunctionRole(
|
318
|
-
"InstanceAccessManager",
|
319
|
-
accessManagerInstanceOwnerSelectors,
|
320
|
-
INSTANCE_OWNER_ROLE());
|
321
|
-
}
|
322
|
-
|
323
|
-
|
324
|
-
function setAndRegisterMasterInstance(address instanceAddress)
|
131
|
+
function setAndRegisterMasterInstance(address instanceAddress)
|
325
132
|
external
|
326
133
|
onlyOwner
|
327
134
|
returns(NftId masterInstanceNftId)
|
328
135
|
{
|
329
136
|
if(_masterInstance != address(0)) { revert ErrorInstanceServiceMasterInstanceAlreadySet(); }
|
330
137
|
if(_masterOzAccessManager != address(0)) { revert ErrorInstanceServiceMasterOzAccessManagerAlreadySet(); }
|
331
|
-
if(
|
138
|
+
if(_masterInstanceAdmin != address(0)) { revert ErrorInstanceServiceMasterInstanceAdminAlreadySet(); }
|
332
139
|
if(_masterInstanceBundleManager != address(0)) { revert ErrorInstanceServiceMasterBundleManagerAlreadySet(); }
|
333
140
|
|
334
141
|
if(instanceAddress == address(0)) { revert ErrorInstanceServiceInstanceAddressZero(); }
|
335
142
|
|
336
143
|
IInstance instance = IInstance(instanceAddress);
|
337
|
-
|
338
|
-
address
|
339
|
-
InstanceAccessManager instanceAccessManager = instance.getInstanceAccessManager();
|
340
|
-
address instanceAccessManagerAddress = address(instanceAccessManager);
|
144
|
+
InstanceAdmin InstanceAdmin = instance.getInstanceAdmin();
|
145
|
+
address InstanceAdminAddress = address(InstanceAdmin);
|
341
146
|
InstanceReader instanceReader = instance.getInstanceReader();
|
342
147
|
address instanceReaderAddress = address(instanceReader);
|
343
148
|
BundleManager bundleManager = instance.getBundleManager();
|
344
149
|
address bundleManagerAddress = address(bundleManager);
|
150
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
151
|
+
address instanceStoreAddress = address(instanceStore);
|
345
152
|
|
346
|
-
if(
|
347
|
-
if(instanceAccessManagerAddress == address(0)) { revert ErrorInstanceServiceInstanceAccessManagerZero(); }
|
153
|
+
if(InstanceAdminAddress == address(0)) { revert ErrorInstanceServiceInstanceAdminZero(); }
|
348
154
|
if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderZero(); }
|
349
155
|
if(bundleManagerAddress == address(0)) { revert ErrorInstanceServiceBundleManagerZero(); }
|
156
|
+
if(instanceStoreAddress == address(0)) { revert ErrorInstanceServiceInstanceStoreZero(); }
|
350
157
|
|
351
|
-
if(instance.authority() !=
|
352
|
-
if(bundleManager.authority() !=
|
353
|
-
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(); }
|
354
161
|
if(bundleManager.getInstance() != instance) { revert ErrorInstanceServiceBundleMangerInstanceMismatch(); }
|
162
|
+
if(instanceReader.getInstance() != instance) { revert ErrorInstanceServiceInstanceReaderInstanceMismatch2(); }
|
355
163
|
|
356
|
-
_masterOzAccessManager =
|
357
|
-
|
164
|
+
_masterOzAccessManager = instance.authority();
|
165
|
+
_masterInstanceAdmin = InstanceAdminAddress;
|
358
166
|
_masterInstance = instanceAddress;
|
359
167
|
_masterInstanceReader = instanceReaderAddress;
|
360
168
|
_masterInstanceBundleManager = bundleManagerAddress;
|
169
|
+
_masterInstanceStore = instanceStoreAddress;
|
361
170
|
|
362
|
-
IRegistryService registryService = IRegistryService(getRegistry().getServiceAddress(REGISTRY(), getMajorVersion()));
|
363
171
|
IInstance masterInstance = IInstance(_masterInstance);
|
364
|
-
IRegistry.ObjectInfo memory info =
|
172
|
+
IRegistry.ObjectInfo memory info = _registryService.registerInstance(masterInstance, getOwner());
|
365
173
|
masterInstanceNftId = info.nftId;
|
366
|
-
|
367
|
-
// masterInstance.linkToRegisteredNftId();
|
368
174
|
}
|
369
175
|
|
370
176
|
function setMasterInstanceReader(address instanceReaderAddress) external onlyOwner {
|
@@ -391,44 +197,6 @@ contract InstanceService is
|
|
391
197
|
instance.setInstanceReader(upgradedInstanceReaderClone);
|
392
198
|
}
|
393
199
|
|
394
|
-
function getMasterInstanceReader() external view returns (address) {
|
395
|
-
return _masterInstanceReader;
|
396
|
-
}
|
397
|
-
|
398
|
-
function getMasterInstance() external view returns (address) {
|
399
|
-
return _masterInstance;
|
400
|
-
}
|
401
|
-
|
402
|
-
function getMasterInstanceAccessManager() external view returns (address) {
|
403
|
-
return _masterInstanceAccessManager;
|
404
|
-
}
|
405
|
-
|
406
|
-
function getMasterInstanceBundleManager() external view returns (address) {
|
407
|
-
return _masterInstanceBundleManager;
|
408
|
-
}
|
409
|
-
|
410
|
-
// From IService
|
411
|
-
function getDomain() public pure override(Service, IService) returns(ObjectType) {
|
412
|
-
return INSTANCE();
|
413
|
-
}
|
414
|
-
|
415
|
-
/// @dev top level initializer
|
416
|
-
function _initialize(
|
417
|
-
address owner,
|
418
|
-
bytes memory data
|
419
|
-
)
|
420
|
-
internal
|
421
|
-
initializer
|
422
|
-
virtual override
|
423
|
-
{
|
424
|
-
address initialOwner;
|
425
|
-
address registryAddress;
|
426
|
-
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
427
|
-
// TODO while InstanceService is not deployed in InstanceServiceManager constructor
|
428
|
-
// owner is InstanceServiceManager deployer
|
429
|
-
initializeService(registryAddress, owner);
|
430
|
-
registerInterface(type(IInstanceService).interfaceId);
|
431
|
-
}
|
432
200
|
|
433
201
|
// all gif targets MUST be childs of instanceNftId
|
434
202
|
function createGifTarget(
|
@@ -439,17 +207,17 @@ contract InstanceService is
|
|
439
207
|
RoleId[] memory roles
|
440
208
|
)
|
441
209
|
external
|
442
|
-
|
210
|
+
restricted
|
443
211
|
{
|
444
212
|
(
|
445
213
|
IInstance instance, // or instanceInfo
|
446
|
-
|
214
|
+
// or targetInfo
|
447
215
|
) = _validateInstanceAndComponent(instanceNftId, targetAddress);
|
448
216
|
|
449
|
-
|
217
|
+
InstanceAdmin accessManager = instance.getInstanceAdmin();
|
450
218
|
accessManager.createGifTarget(targetAddress, targetName);
|
451
219
|
// set proposed target config
|
452
|
-
// TODO restriction:
|
220
|
+
// TODO restriction: gif targets are set only once and only here?
|
453
221
|
// assume config is a mix of gif and custom roles and no further configuration by INSTANCE_OWNER_ROLE is ever needed?
|
454
222
|
for(uint roleIdx = 0; roleIdx < roles.length; roleIdx++)
|
455
223
|
{
|
@@ -457,22 +225,57 @@ contract InstanceService is
|
|
457
225
|
}
|
458
226
|
}
|
459
227
|
|
460
|
-
// TODO called by component, but target can be component helper...so needs target name
|
461
|
-
// TODO check that targetName associated with component...how???
|
462
|
-
//function setTargetLocked(string memory targetName, bool locked) onlyComponent external {
|
463
228
|
function setComponentLocked(bool locked) onlyComponent external {
|
229
|
+
|
464
230
|
address componentAddress = msg.sender;
|
465
231
|
IRegistry registry = getRegistry();
|
466
232
|
NftId instanceNftId = registry.getObjectInfo(componentAddress).parentNftId;
|
467
|
-
address instanceAddress = registry.getObjectInfo(instanceNftId).objectAddress;
|
468
|
-
IInstance instance = IInstance(instanceAddress);
|
469
233
|
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
234
|
+
IInstance instance = IInstance(
|
235
|
+
registry.getObjectInfo(
|
236
|
+
instanceNftId).objectAddress);
|
237
|
+
|
238
|
+
instance.getInstanceAdmin().setTargetLockedByService(
|
239
|
+
componentAddress,
|
240
|
+
locked);
|
474
241
|
}
|
475
242
|
|
243
|
+
|
244
|
+
function getMasterInstanceReader() external view returns (address) {
|
245
|
+
return _masterInstanceReader;
|
246
|
+
}
|
247
|
+
|
248
|
+
// From IService
|
249
|
+
function getDomain() public pure override returns(ObjectType) {
|
250
|
+
return INSTANCE();
|
251
|
+
}
|
252
|
+
|
253
|
+
/// @dev top level initializer
|
254
|
+
function _initialize(
|
255
|
+
address owner,
|
256
|
+
bytes memory data
|
257
|
+
)
|
258
|
+
internal
|
259
|
+
initializer
|
260
|
+
virtual override
|
261
|
+
{
|
262
|
+
(
|
263
|
+
address registryAddress,,
|
264
|
+
//address managerAddress
|
265
|
+
address authority
|
266
|
+
) = abi.decode(data, (address, address, address));
|
267
|
+
|
268
|
+
initializeService(registryAddress, authority, owner);
|
269
|
+
|
270
|
+
_registryService = IRegistryService(
|
271
|
+
IRegistry(registryAddress).getServiceAddress(
|
272
|
+
REGISTRY(),
|
273
|
+
getVersion().toMajorPart()));
|
274
|
+
|
275
|
+
registerInterface(type(IInstanceService).interfaceId);
|
276
|
+
}
|
277
|
+
|
278
|
+
|
476
279
|
function _validateInstanceAndComponent(NftId instanceNftId, address componentAddress)
|
477
280
|
internal
|
478
281
|
view
|
@@ -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
|
-
|
18
|
+
address authority,
|
19
|
+
address registryAddress,
|
20
|
+
bytes32 salt
|
21
|
+
)
|
20
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 ----------------------------------------------------//
|