@etherisc/gif-next 0.0.2-d086e6d-456 → 0.0.2-d1f0662-893
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -88
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +37 -6
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +60 -13
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +37 -6
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +44 -13
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +55 -24
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +52 -21
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +55 -24
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +52 -21
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +309 -2023
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +21 -62
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +424 -2776
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +95 -58
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +124 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +331 -51
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +71 -215
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +38 -83
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2788 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +25 -36
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +8 -8
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +6 -6
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +6 -6
- 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/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +106 -246
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +38 -55
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +166 -136
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +38 -59
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +623 -91
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +143 -32
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +185 -451
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +82 -107
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +38 -191
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +97 -45
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +306 -62
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +34 -297
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +124 -103
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +269 -60
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.json +510 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +5 -37
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +332 -162
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +104 -53
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +442 -84
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +90 -39
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.json +1004 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.json +688 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +56 -59
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +28 -37
- 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/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +5 -37
- 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 +2 -2
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +22 -49
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +21 -34
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +23 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +10 -23
- 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/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- 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 +5 -37
- 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 +6 -19
- 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 +14 -27
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +6 -19
- 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 +11 -38
- 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/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +6 -19
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +26 -49
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +124 -4
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +83 -4
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +42 -18
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +116 -7
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +17 -4
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Component.sol +21 -2
- package/contracts/components/Distribution.sol +11 -6
- package/contracts/components/IComponent.sol +16 -2
- package/contracts/components/IPoolComponent.sol +8 -7
- package/contracts/components/IProductComponent.sol +5 -4
- package/contracts/components/Pool.sol +11 -12
- package/contracts/components/Product.sol +144 -62
- package/contracts/instance/BundleManager.sol +3 -4
- package/contracts/instance/IInstance.sol +32 -53
- package/contracts/instance/IInstanceService.sol +15 -14
- package/contracts/instance/Instance.sol +107 -205
- package/contracts/instance/InstanceAccessManager.sol +44 -25
- package/contracts/instance/InstanceAuthorizationsLib.sol +308 -0
- package/contracts/instance/InstanceReader.sol +84 -7
- package/contracts/instance/InstanceService.sol +102 -289
- package/contracts/instance/InstanceStore.sol +212 -0
- package/contracts/instance/ObjectManager.sol +1 -1
- package/contracts/instance/base/ComponentService.sol +53 -41
- package/contracts/instance/base/KeyValueStore.sol +0 -31
- package/contracts/instance/base/Lifecycle.sol +15 -4
- package/contracts/instance/module/IAccess.sol +2 -2
- package/contracts/instance/module/IComponents.sol +3 -3
- package/contracts/instance/module/IDistribution.sol +3 -2
- package/contracts/instance/module/IPolicy.sol +13 -8
- package/contracts/instance/service/ApplicationService.sol +60 -224
- package/contracts/instance/service/BundleService.sol +73 -122
- package/contracts/instance/service/ClaimService.sol +318 -32
- package/contracts/instance/service/DistributionService.sol +64 -151
- package/contracts/instance/service/IApplicationService.sol +8 -28
- package/contracts/instance/service/IBundleService.sol +34 -9
- package/contracts/instance/service/IClaimService.sol +52 -23
- package/contracts/instance/service/IDistributionService.sol +11 -22
- package/contracts/instance/service/IPolicyService.sol +24 -16
- package/contracts/instance/service/IPoolService.sol +18 -3
- package/contracts/instance/service/IPricingService.sol +37 -0
- package/contracts/instance/service/PolicyService.sol +134 -118
- package/contracts/instance/service/PoolService.sol +124 -64
- package/contracts/instance/service/PricingService.sol +275 -0
- package/contracts/instance/service/PricingServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +14 -14
- package/contracts/registry/IRegistryService.sol +0 -2
- package/contracts/registry/RegistryService.sol +16 -15
- package/contracts/registry/ReleaseManager.sol +20 -18
- package/contracts/shared/IPolicyHolder.sol +23 -9
- package/contracts/shared/IRegistryLinked.sol +0 -1
- package/contracts/shared/IService.sol +3 -6
- package/contracts/shared/NftOwnable.sol +0 -2
- package/contracts/shared/PolicyHolder.sol +30 -17
- package/contracts/shared/Registerable.sol +10 -9
- package/contracts/shared/RegistryLinked.sol +0 -5
- package/contracts/shared/Service.sol +16 -7
- package/contracts/shared/TokenHandler.sol +4 -2
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +49 -0
- package/contracts/types/ClaimId.sol +25 -2
- package/contracts/types/Fee.sol +7 -6
- package/contracts/types/ObjectType.sol +9 -5
- package/contracts/types/PayoutId.sol +33 -5
- package/contracts/types/StateId.sol +6 -2
- package/contracts/types/Timestamp.sol +5 -0
- package/package.json +1 -1
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- /package/contracts/{instance → shared}/AccessManagerUpgradeableInitializeable.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 {Instance} from "./Instance.sol";
|
8
|
-
import {IInstance} from "./IInstance.sol";
|
9
|
-
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
10
|
-
import {IInstanceService} from "./IInstanceService.sol";
|
11
|
-
import {InstanceReader} from "./InstanceReader.sol";
|
12
|
-
import {BundleManager} from "./BundleManager.sol";
|
13
|
-
import {AccessManagerUpgradeableInitializeable} from "./AccessManagerUpgradeableInitializeable.sol";
|
14
|
-
import {IRegistry} from "../registry/IRegistry.sol";
|
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
7
|
import {NftId} from "../../contracts/types/NftId.sol";
|
20
8
|
import {RoleId} from "../types/RoleId.sol";
|
21
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 "../types/RoleId.sol";
|
22
10
|
import {ObjectType, INSTANCE, BUNDLE, APPLICATION, POLICY, CLAIM, PRODUCT, DISTRIBUTION, REGISTRY, POOL} from "../types/ObjectType.sol";
|
11
|
+
|
12
|
+
import {Service} from "../shared/Service.sol";
|
13
|
+
import {IService} from "../shared/IService.sol";
|
14
|
+
import {AccessManagerUpgradeableInitializeable} from "../shared/AccessManagerUpgradeableInitializeable.sol";
|
15
|
+
|
23
16
|
import {IDistributionComponent} from "../components/IDistributionComponent.sol";
|
24
17
|
import {IPoolComponent} from "../components/IPoolComponent.sol";
|
25
18
|
import {IProductComponent} from "../components/IProductComponent.sol";
|
26
19
|
|
20
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
21
|
+
import {IRegistryService} from "../registry/IRegistryService.sol";
|
22
|
+
import {ChainNft} from "../registry/ChainNft.sol";
|
23
|
+
|
24
|
+
import {Instance} from "./Instance.sol";
|
25
|
+
import {IInstance} from "./IInstance.sol";
|
26
|
+
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
27
|
+
import {IInstanceService} from "./IInstanceService.sol";
|
28
|
+
import {InstanceReader} from "./InstanceReader.sol";
|
29
|
+
import {BundleManager} from "./BundleManager.sol";
|
30
|
+
import {InstanceStore} from "./InstanceStore.sol";
|
31
|
+
import {InstanceAuthorizationsLib} from "./InstanceAuthorizationsLib.sol";
|
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
43
|
address internal _masterInstanceAccessManager;
|
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)) {
|
@@ -62,22 +71,12 @@ contract InstanceService is
|
|
62
71
|
function createInstanceClone()
|
63
72
|
external
|
64
73
|
returns (
|
65
|
-
AccessManagerUpgradeableInitializeable clonedOzAccessManager,
|
66
|
-
InstanceAccessManager clonedInstanceAccessManager,
|
67
74
|
Instance clonedInstance,
|
68
|
-
NftId clonedInstanceNftId
|
69
|
-
InstanceReader clonedInstanceReader,
|
70
|
-
BundleManager clonedBundleManager
|
75
|
+
NftId clonedInstanceNftId
|
71
76
|
)
|
72
77
|
{
|
73
78
|
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(
|
79
|
+
AccessManagerUpgradeableInitializeable clonedOzAccessManager = AccessManagerUpgradeableInitializeable(
|
81
80
|
Clones.clone(_masterOzAccessManager));
|
82
81
|
|
83
82
|
// initially grants ADMIN_ROLE to this (being the instance service).
|
@@ -89,239 +88,54 @@ contract InstanceService is
|
|
89
88
|
clonedInstance = Instance(Clones.clone(_masterInstance));
|
90
89
|
clonedInstance.initialize(
|
91
90
|
address(clonedOzAccessManager),
|
92
|
-
|
91
|
+
address(getRegistry()),
|
93
92
|
instanceOwner);
|
93
|
+
// initialize and set before instance reader
|
94
|
+
InstanceStore clonedInstanceStore = InstanceStore(Clones.clone(address(_masterInstanceStore)));
|
95
|
+
clonedInstanceStore.initialize(address(clonedInstance));
|
96
|
+
clonedInstance.setInstanceStore(clonedInstanceStore);
|
94
97
|
|
95
|
-
clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
98
|
+
InstanceReader clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
96
99
|
clonedInstanceReader.initialize(address(clonedInstance));
|
97
100
|
clonedInstance.setInstanceReader(clonedInstanceReader);
|
98
101
|
|
99
|
-
clonedBundleManager = BundleManager(Clones.clone(_masterInstanceBundleManager));
|
102
|
+
BundleManager clonedBundleManager = BundleManager(Clones.clone(_masterInstanceBundleManager));
|
100
103
|
clonedBundleManager.initialize(address(clonedInstance));
|
101
104
|
clonedInstance.setBundleManager(clonedBundleManager);
|
102
105
|
|
103
|
-
clonedInstanceAccessManager = InstanceAccessManager(Clones.clone(_masterInstanceAccessManager));
|
106
|
+
InstanceAccessManager clonedInstanceAccessManager = InstanceAccessManager(Clones.clone(_masterInstanceAccessManager));
|
104
107
|
clonedOzAccessManager.grantRole(ADMIN_ROLE().toInt(), address(clonedInstanceAccessManager), 0);
|
105
108
|
clonedInstanceAccessManager.initialize(address(clonedInstance));
|
106
109
|
clonedInstance.setInstanceAccessManager(clonedInstanceAccessManager);
|
107
110
|
|
108
111
|
// TODO amend setters with instance specific , policy manager ...
|
109
112
|
|
110
|
-
|
113
|
+
// TODO library does external calls -> but it is registry and access manager -> find out is it best practice
|
114
|
+
InstanceAuthorizationsLib.grantInitialAuthorizations(
|
115
|
+
clonedInstanceAccessManager,
|
116
|
+
clonedInstance,
|
117
|
+
clonedBundleManager,
|
118
|
+
clonedInstanceStore,
|
119
|
+
instanceOwner,
|
120
|
+
getRegistry(),
|
121
|
+
getVersion().toMajorPart());
|
111
122
|
|
112
123
|
clonedOzAccessManager.renounceRole(ADMIN_ROLE().toInt(), address(this));
|
113
124
|
|
114
|
-
IRegistry.ObjectInfo memory info =
|
125
|
+
IRegistry.ObjectInfo memory info = _registryService.registerInstance(clonedInstance, instanceOwner);
|
115
126
|
clonedInstanceNftId = info.nftId;
|
116
|
-
// clonedInstance.linkToRegisteredNftId();
|
117
127
|
|
118
128
|
emit LogInstanceCloned(
|
119
129
|
address(clonedOzAccessManager),
|
120
130
|
address(clonedInstanceAccessManager),
|
121
|
-
address(clonedInstance),
|
131
|
+
address(clonedInstance),
|
132
|
+
address(clonedInstanceStore),
|
122
133
|
address(clonedBundleManager),
|
123
134
|
address(clonedInstanceReader),
|
124
135
|
clonedInstanceNftId);
|
125
136
|
}
|
126
137
|
|
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)
|
138
|
+
function setAndRegisterMasterInstance(address instanceAddress)
|
325
139
|
external
|
326
140
|
onlyOwner
|
327
141
|
returns(NftId masterInstanceNftId)
|
@@ -334,37 +148,36 @@ contract InstanceService is
|
|
334
148
|
if(instanceAddress == address(0)) { revert ErrorInstanceServiceInstanceAddressZero(); }
|
335
149
|
|
336
150
|
IInstance instance = IInstance(instanceAddress);
|
337
|
-
AccessManagerUpgradeableInitializeable ozAccessManager = AccessManagerUpgradeableInitializeable(instance.authority());
|
338
|
-
address ozAccessManagerAddress = address(ozAccessManager);
|
339
151
|
InstanceAccessManager instanceAccessManager = instance.getInstanceAccessManager();
|
340
152
|
address instanceAccessManagerAddress = address(instanceAccessManager);
|
341
153
|
InstanceReader instanceReader = instance.getInstanceReader();
|
342
154
|
address instanceReaderAddress = address(instanceReader);
|
343
155
|
BundleManager bundleManager = instance.getBundleManager();
|
344
156
|
address bundleManagerAddress = address(bundleManager);
|
157
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
158
|
+
address instanceStoreAddress = address(instanceStore);
|
345
159
|
|
346
|
-
if(ozAccessManagerAddress == address(0)) { revert ErrorInstanceServiceOzAccessManagerZero();}
|
347
160
|
if(instanceAccessManagerAddress == address(0)) { revert ErrorInstanceServiceInstanceAccessManagerZero(); }
|
348
161
|
if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderZero(); }
|
349
162
|
if(bundleManagerAddress == address(0)) { revert ErrorInstanceServiceBundleManagerZero(); }
|
163
|
+
if(instanceStoreAddress == address(0)) { revert ErrorInstanceServiceInstanceStoreZero(); }
|
350
164
|
|
351
165
|
if(instance.authority() != instanceAccessManager.authority()) { revert ErrorInstanceServiceInstanceAuthorityMismatch(); }
|
352
166
|
if(bundleManager.authority() != instanceAccessManager.authority()) { revert ErrorInstanceServiceBundleManagerAuthorityMismatch(); }
|
353
|
-
if(
|
167
|
+
if(instanceStore.authority() != instanceAccessManager.authority()) { revert ErrorInstanceServiceInstanceStoreAuthorityMismatch(); }
|
354
168
|
if(bundleManager.getInstance() != instance) { revert ErrorInstanceServiceBundleMangerInstanceMismatch(); }
|
169
|
+
if(instanceReader.getInstance() != instance) { revert ErrorInstanceServiceInstanceReaderInstanceMismatch2(); }
|
355
170
|
|
356
|
-
_masterOzAccessManager =
|
171
|
+
_masterOzAccessManager = instance.authority();
|
357
172
|
_masterInstanceAccessManager = instanceAccessManagerAddress;
|
358
173
|
_masterInstance = instanceAddress;
|
359
174
|
_masterInstanceReader = instanceReaderAddress;
|
360
175
|
_masterInstanceBundleManager = bundleManagerAddress;
|
176
|
+
_masterInstanceStore = instanceStoreAddress;
|
361
177
|
|
362
|
-
IRegistryService registryService = IRegistryService(getRegistry().getServiceAddress(REGISTRY(), getMajorVersion()));
|
363
178
|
IInstance masterInstance = IInstance(_masterInstance);
|
364
|
-
IRegistry.ObjectInfo memory info =
|
179
|
+
IRegistry.ObjectInfo memory info = _registryService.registerInstance(masterInstance, getOwner());
|
365
180
|
masterInstanceNftId = info.nftId;
|
366
|
-
|
367
|
-
// masterInstance.linkToRegisteredNftId();
|
368
181
|
}
|
369
182
|
|
370
183
|
function setMasterInstanceReader(address instanceReaderAddress) external onlyOwner {
|
@@ -391,44 +204,6 @@ contract InstanceService is
|
|
391
204
|
instance.setInstanceReader(upgradedInstanceReaderClone);
|
392
205
|
}
|
393
206
|
|
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
207
|
|
433
208
|
// all gif targets MUST be childs of instanceNftId
|
434
209
|
function createGifTarget(
|
@@ -443,13 +218,13 @@ contract InstanceService is
|
|
443
218
|
{
|
444
219
|
(
|
445
220
|
IInstance instance, // or instanceInfo
|
446
|
-
|
221
|
+
// or targetInfo
|
447
222
|
) = _validateInstanceAndComponent(instanceNftId, targetAddress);
|
448
223
|
|
449
224
|
InstanceAccessManager accessManager = instance.getInstanceAccessManager();
|
450
225
|
accessManager.createGifTarget(targetAddress, targetName);
|
451
226
|
// set proposed target config
|
452
|
-
// TODO restriction:
|
227
|
+
// TODO restriction: gif targets are set only once and only here?
|
453
228
|
// assume config is a mix of gif and custom roles and no further configuration by INSTANCE_OWNER_ROLE is ever needed?
|
454
229
|
for(uint roleIdx = 0; roleIdx < roles.length; roleIdx++)
|
455
230
|
{
|
@@ -457,22 +232,60 @@ contract InstanceService is
|
|
457
232
|
}
|
458
233
|
}
|
459
234
|
|
235
|
+
|
460
236
|
// TODO called by component, but target can be component helper...so needs target name
|
461
237
|
// TODO check that targetName associated with component...how???
|
462
|
-
//function setTargetLocked(string memory targetName, bool locked) onlyComponent external {
|
463
238
|
function setComponentLocked(bool locked) onlyComponent external {
|
239
|
+
|
464
240
|
address componentAddress = msg.sender;
|
465
241
|
IRegistry registry = getRegistry();
|
466
242
|
NftId instanceNftId = registry.getObjectInfo(componentAddress).parentNftId;
|
467
|
-
address instanceAddress = registry.getObjectInfo(instanceNftId).objectAddress;
|
468
|
-
IInstance instance = IInstance(instanceAddress);
|
469
243
|
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
244
|
+
IInstance instance = IInstance(
|
245
|
+
registry.getObjectInfo(
|
246
|
+
instanceNftId).objectAddress);
|
247
|
+
|
248
|
+
instance.getInstanceAccessManager().setTargetLockedByService(
|
249
|
+
componentAddress,
|
250
|
+
locked);
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
function getMasterInstanceReader() external view returns (address) {
|
255
|
+
return _masterInstanceReader;
|
474
256
|
}
|
475
257
|
|
258
|
+
// From IService
|
259
|
+
function getDomain() public pure override returns(ObjectType) {
|
260
|
+
return INSTANCE();
|
261
|
+
}
|
262
|
+
|
263
|
+
/// @dev top level initializer
|
264
|
+
function _initialize(
|
265
|
+
address owner,
|
266
|
+
bytes memory data
|
267
|
+
)
|
268
|
+
internal
|
269
|
+
initializer
|
270
|
+
virtual override
|
271
|
+
{
|
272
|
+
(
|
273
|
+
address registryAddress,
|
274
|
+
address initialOwner
|
275
|
+
) = abi.decode(data, (address, address));
|
276
|
+
|
277
|
+
_registryService = IRegistryService(
|
278
|
+
IRegistry(registryAddress).getServiceAddress(
|
279
|
+
REGISTRY(),
|
280
|
+
getVersion().toMajorPart()));
|
281
|
+
|
282
|
+
// TODO while InstanceService is not deployed in InstanceServiceManager constructor
|
283
|
+
// owner is InstanceServiceManager deployer
|
284
|
+
initializeService(registryAddress, address(0), owner);
|
285
|
+
registerInterface(type(IInstanceService).interfaceId);
|
286
|
+
}
|
287
|
+
|
288
|
+
|
476
289
|
function _validateInstanceAndComponent(NftId instanceNftId, address componentAddress)
|
477
290
|
internal
|
478
291
|
view
|