@etherisc/gif-next 0.0.2-dc95063-418 → 0.0.2-dd40550-413
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -83
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +47 -6
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +70 -13
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +137 -6
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +144 -13
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +161 -20
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +151 -20
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +71 -20
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +62 -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 +310 -2004
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +101 -52
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +425 -2757
- 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 +348 -58
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +153 -207
- 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 +113 -34
- 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 +186 -236
- 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 +377 -182
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +74 -39
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +710 -88
- 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 +266 -442
- 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 +111 -174
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +233 -128
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +385 -51
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +109 -282
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +210 -99
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +682 -33
- 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 +85 -27
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +420 -160
- 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 +880 -82
- 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 +144 -57
- 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 +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 +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 +91 -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/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 +106 -39
- 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 +4 -0
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +281 -0
- 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 +74 -19
- 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 +25 -4
- package/contracts/components/Distribution.sol +11 -6
- package/contracts/components/IComponent.sol +19 -3
- package/contracts/components/IPoolComponent.sol +8 -7
- package/contracts/components/IProductComponent.sol +5 -4
- package/contracts/components/Pool.sol +17 -14
- 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 +85 -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 -39
- package/contracts/instance/base/KeyValueStore.sol +8 -34
- package/contracts/instance/base/Lifecycle.sol +15 -4
- package/contracts/instance/module/IAccess.sol +2 -2
- package/contracts/instance/module/IBundle.sol +6 -4
- package/contracts/instance/module/IComponents.sol +7 -1
- package/contracts/instance/module/IDistribution.sol +3 -2
- package/contracts/instance/module/IPolicy.sol +13 -8
- package/contracts/instance/service/ApplicationService.sol +62 -226
- package/contracts/instance/service/BundleService.sol +172 -126
- package/contracts/instance/service/ClaimService.sol +318 -32
- package/contracts/instance/service/DistributionService.sol +71 -190
- package/contracts/instance/service/IApplicationService.sol +8 -28
- package/contracts/instance/service/IBundleService.sol +82 -26
- 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 +82 -3
- package/contracts/instance/service/IPricingService.sol +37 -0
- package/contracts/instance/service/PolicyService.sol +152 -179
- package/contracts/instance/service/PoolService.sol +239 -56
- package/contracts/instance/service/PricingService.sol +275 -0
- package/contracts/instance/service/PricingServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +27 -58
- package/contracts/registry/IRegistryService.sol +2 -3
- package/contracts/registry/RegistryService.sol +24 -21
- 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 +6 -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 +21 -7
- package/contracts/shared/TokenHandler.sol +4 -2
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +109 -0
- package/contracts/types/ClaimId.sol +25 -2
- package/contracts/types/Fee.sol +16 -8
- 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
@@ -3,11 +3,16 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
5
5
|
|
6
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
7
|
+
import {DistributorType} from "../types/DistributorType.sol";
|
8
|
+
import {PayoutId} from "../types/PayoutId.sol";
|
6
9
|
import {NftId} from "../types/NftId.sol";
|
7
10
|
import {StateId} from "../types/StateId.sol";
|
11
|
+
import {ReferralId} from "../types/Referral.sol";
|
8
12
|
import {RiskId} from "../types/RiskId.sol";
|
9
13
|
import {VersionPart} from "../types/Version.sol";
|
10
14
|
import {Key32} from "../types/Key32.sol";
|
15
|
+
import {RoleId} from "../types/RoleId.sol";
|
11
16
|
|
12
17
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
13
18
|
|
@@ -16,83 +21,57 @@ import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
|
|
16
21
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
17
22
|
import {BundleManager} from "./BundleManager.sol";
|
18
23
|
import {InstanceReader} from "./InstanceReader.sol";
|
24
|
+
import {InstanceStore} from "./InstanceStore.sol";
|
25
|
+
|
26
|
+
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
27
|
+
|
28
|
+
import {IAccess} from "./module/IAccess.sol";
|
19
29
|
|
20
|
-
import {IBundle} from "./module/IBundle.sol";
|
21
30
|
import {IBundleService} from "./service/IBundleService.sol";
|
22
|
-
import {IComponents} from "./module/IComponents.sol";
|
23
31
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
24
|
-
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
25
|
-
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
26
|
-
import {IPolicy} from "./module/IPolicy.sol";
|
27
|
-
import {IDistribution} from "./module/IDistribution.sol";
|
28
32
|
import {IPolicyService} from "./service/IPolicyService.sol";
|
29
33
|
import {IPoolService} from "./service/IPoolService.sol";
|
30
34
|
import {IProductService} from "./service/IProductService.sol";
|
31
35
|
import {IPolicyService} from "./service/IPolicyService.sol";
|
32
36
|
import {IBundleService} from "./service/IBundleService.sol";
|
33
|
-
import {IRisk} from "./module/IRisk.sol";
|
34
|
-
import {ISetup} from "./module/ISetup.sol";
|
35
37
|
|
36
38
|
|
37
39
|
|
38
40
|
interface IInstance is
|
39
41
|
IRegisterable,
|
40
42
|
ITransferInterceptor,
|
41
|
-
IAccessManaged
|
42
|
-
IKeyValueStore
|
43
|
+
IAccessManaged
|
43
44
|
{
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
function getPolicyService() external view returns (IPolicyService);
|
48
|
-
function getBundleService() external view returns (IBundleService);
|
49
|
-
|
50
|
-
function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external;
|
51
|
-
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
|
52
|
-
function updateDistributionSetupState(NftId distributionNftId, StateId newState) external;
|
45
|
+
error ErrorInstanceInstanceAccessManagerZero();
|
46
|
+
error ErrorInstanceInstanceAccessManagerAlreadySet(address instanceAccessManager);
|
47
|
+
error ErrorInstanceInstanceAccessManagerAuthorityMismatch(address instanceAuthority);
|
53
48
|
|
54
|
-
|
55
|
-
|
56
|
-
|
49
|
+
error ErrorInstanceBundleManagerAlreadySet(address instanceBundleManager);
|
50
|
+
error ErrorInstanceBundleManagerInstanceMismatch(address instance);
|
51
|
+
error ErrorInstanceBundleManagerAuthorityMismatch(address instanceAuthority);
|
57
52
|
|
58
|
-
|
59
|
-
function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external;
|
60
|
-
function updateBundleState(NftId bundleNftId, StateId newState) external;
|
53
|
+
error ErrorInstanceInstanceReaderInstanceMismatch(address instanceAuthority);
|
61
54
|
|
62
|
-
|
63
|
-
|
64
|
-
function updateProductSetupState(NftId productNftId, StateId newState) external;
|
55
|
+
error ErrorInstanceInstanceStoreAlreadySet(address instanceStore);
|
56
|
+
error ErrorInstanceInstanceStoreAuthorityMismatch(address instanceAuthority);
|
65
57
|
|
66
|
-
function
|
67
|
-
function
|
68
|
-
function
|
58
|
+
function createRole(string memory roleName, string memory adminName) external returns (RoleId roleId, RoleId admin);
|
59
|
+
function grantRole(RoleId roleId, address account) external;
|
60
|
+
function revokeRole(RoleId roleId, address account) external;
|
69
61
|
|
70
|
-
function
|
71
|
-
function
|
72
|
-
function
|
62
|
+
function createTarget(address target, string memory name) external;
|
63
|
+
function setTargetFunctionRole(string memory targetName, bytes4[] calldata selectors, RoleId roleId) external;
|
64
|
+
function setTargetLocked(address target, bool locked) external;
|
73
65
|
|
74
|
-
function
|
75
|
-
function
|
76
|
-
function
|
77
|
-
|
78
|
-
function
|
79
|
-
function updateRisk(RiskId riskId, IRisk.RiskInfo memory risk, StateId newState) external;
|
80
|
-
function updateRiskState(RiskId riskId, StateId newState) external;
|
81
|
-
|
82
|
-
function createApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy) external;
|
83
|
-
function updateApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
84
|
-
function updateApplicationState(NftId applicationNftId, StateId newState) external;
|
85
|
-
|
86
|
-
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
87
|
-
function updatePolicyState(NftId policyNftId, StateId newState) external;
|
88
|
-
|
89
|
-
// TODO add claims/payouts function to instance
|
90
|
-
// function updateClaims(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
66
|
+
function getDistributionService() external view returns (IDistributionService);
|
67
|
+
function getProductService() external view returns (IProductService);
|
68
|
+
function getPoolService() external view returns (IPoolService);
|
69
|
+
function getPolicyService() external view returns (IPolicyService);
|
70
|
+
function getBundleService() external view returns (IBundleService);
|
91
71
|
|
92
72
|
function getMajorVersion() external pure returns (VersionPart majorVersion);
|
93
73
|
function getInstanceReader() external view returns (InstanceReader);
|
94
74
|
function getBundleManager() external view returns (BundleManager);
|
95
|
-
|
96
|
-
function setInstanceAccessManager(InstanceAccessManager accessManager) external;
|
97
75
|
function getInstanceAccessManager() external view returns (InstanceAccessManager);
|
76
|
+
function getInstanceStore() external view returns (InstanceStore);
|
98
77
|
}
|
@@ -5,16 +5,13 @@ import {NftId} from "../types/NftId.sol";
|
|
5
5
|
import {ObjectType} from "../types/ObjectType.sol";
|
6
6
|
import {RoleId} from "../types/RoleId.sol";
|
7
7
|
import {IService} from "../shared/IService.sol";
|
8
|
-
import {IRegistry} from "../registry/IRegistry.sol";
|
9
8
|
|
10
|
-
import {
|
11
|
-
import {IComponent} from "../components/IComponent.sol";
|
12
|
-
|
13
|
-
import {AccessManagerUpgradeableInitializeable} from "./AccessManagerUpgradeableInitializeable.sol";
|
9
|
+
import {AccessManagerUpgradeableInitializeable} from "../shared/AccessManagerUpgradeableInitializeable.sol";
|
14
10
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
15
11
|
import {Instance} from "./Instance.sol";
|
16
12
|
import {InstanceReader} from "./InstanceReader.sol";
|
17
13
|
import {BundleManager} from "./BundleManager.sol";
|
14
|
+
import {InstanceStore} from "./InstanceStore.sol";
|
18
15
|
|
19
16
|
interface IInstanceService is IService {
|
20
17
|
|
@@ -29,15 +26,16 @@ interface IInstanceService is IService {
|
|
29
26
|
error ErrorInstanceServiceInstanceReaderSameAsMasterInstanceReader();
|
30
27
|
error ErrorInstanceServiceInstanceReaderInstanceMismatch();
|
31
28
|
|
32
|
-
error ErrorInstanceServiceOzAccessManagerZero();
|
33
29
|
error ErrorInstanceServiceInstanceAccessManagerZero();
|
34
30
|
error ErrorInstanceServiceInstanceReaderZero();
|
35
31
|
error ErrorInstanceServiceBundleManagerZero();
|
32
|
+
error ErrorInstanceServiceInstanceStoreZero();
|
36
33
|
|
37
34
|
error ErrorInstanceServiceInstanceAuthorityMismatch();
|
38
35
|
error ErrorInstanceServiceBundleManagerAuthorityMismatch();
|
39
36
|
error ErrorInstanceServiceInstanceReaderInstanceMismatch2();
|
40
37
|
error ErrorInstanceServiceBundleMangerInstanceMismatch();
|
38
|
+
error ErrorInstanceServiceInstanceStoreAuthorityMismatch();
|
41
39
|
|
42
40
|
error ErrorInstanceServiceRequestUnauhorized(address caller);
|
43
41
|
error ErrorInstanceServiceNotInstanceOwner(address caller, NftId instanceNftId);
|
@@ -46,17 +44,21 @@ interface IInstanceService is IService {
|
|
46
44
|
error ErrorInstanceServiceInstanceComponentMismatch(NftId instanceNftId, NftId componentNftId);
|
47
45
|
error ErrorInstanceServiceInvalidComponentType(address componentAddress, ObjectType expectedType, ObjectType componentType);
|
48
46
|
|
49
|
-
event LogInstanceCloned(
|
47
|
+
event LogInstanceCloned(
|
48
|
+
address clonedOzAccessManager,
|
49
|
+
address clonedInstanceAccessManager,
|
50
|
+
address clonedInstance,
|
51
|
+
address clonedInstanceStore,
|
52
|
+
address clonedBundleManager,
|
53
|
+
address clonedInstanceReader,
|
54
|
+
NftId clonedInstanceNftId
|
55
|
+
);
|
50
56
|
|
51
57
|
function createInstanceClone()
|
52
58
|
external
|
53
59
|
returns (
|
54
|
-
AccessManagerUpgradeableInitializeable clonedOzAccessManager,
|
55
|
-
InstanceAccessManager clonedInstanceAccessManager,
|
56
60
|
Instance clonedInstance,
|
57
|
-
NftId instanceNftId
|
58
|
-
InstanceReader clonedInstanceReader,
|
59
|
-
BundleManager clonedBundleManager
|
61
|
+
NftId instanceNftId
|
60
62
|
);
|
61
63
|
|
62
64
|
function createGifTarget(
|
@@ -68,5 +70,4 @@ interface IInstanceService is IService {
|
|
68
70
|
) external;
|
69
71
|
|
70
72
|
function setComponentLocked(bool locked) external;
|
71
|
-
}
|
72
|
-
|
73
|
+
}
|
@@ -3,19 +3,19 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
5
5
|
|
6
|
-
import {Key32
|
6
|
+
import {Key32} from "../types/Key32.sol";
|
7
7
|
import {NftId} from "../types/NftId.sol";
|
8
|
-
import {
|
9
|
-
import {NumberId} from "../types/NumberId.sol";
|
8
|
+
import {RiskId} from "../types/RiskId.sol";
|
10
9
|
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT, DISTRIBUTOR, DISTRIBUTOR_TYPE} from "../types/ObjectType.sol";
|
11
|
-
import {
|
12
|
-
import {RoleId, RoleIdLib, INSTANCE_ROLE, INSTANCE_OWNER_ROLE} from "../types/RoleId.sol";
|
13
|
-
import {StateId, ACTIVE} from "../types/StateId.sol";
|
14
|
-
import {TimestampLib} from "../types/Timestamp.sol";
|
10
|
+
import {RoleId, RoleIdLib, eqRoleId, ADMIN_ROLE, INSTANCE_ROLE, INSTANCE_OWNER_ROLE} from "../types/RoleId.sol";
|
15
11
|
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
12
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
13
|
+
import {ReferralId} from "../types/Referral.sol";
|
14
|
+
import {PayoutId} from "../types/PayoutId.sol";
|
15
|
+
import {DistributorType} from "../types/DistributorType.sol";
|
16
16
|
|
17
|
-
import {ERC165} from "../shared/ERC165.sol";
|
18
17
|
import {Registerable} from "../shared/Registerable.sol";
|
18
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
19
19
|
|
20
20
|
import {IRegistry} from "../registry/IRegistry.sol";
|
21
21
|
|
@@ -23,10 +23,10 @@ import {IInstance} from "./IInstance.sol";
|
|
23
23
|
import {InstanceReader} from "./InstanceReader.sol";
|
24
24
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
25
25
|
import {BundleManager} from "./BundleManager.sol";
|
26
|
+
import {InstanceStore} from "./InstanceStore.sol";
|
26
27
|
|
27
28
|
import {KeyValueStore} from "./base/KeyValueStore.sol";
|
28
29
|
|
29
|
-
import {IAccess} from "./module/IAccess.sol";
|
30
30
|
import {IBundle} from "./module/IBundle.sol";
|
31
31
|
import {IComponents} from "./module/IComponents.sol";
|
32
32
|
import {IDistribution} from "./module/IDistribution.sol";
|
@@ -39,29 +39,20 @@ import {IPoolService} from "./service/IPoolService.sol";
|
|
39
39
|
import {IProductService} from "./service/IProductService.sol";
|
40
40
|
import {IPolicyService} from "./service/IPolicyService.sol";
|
41
41
|
import {IBundleService} from "./service/IBundleService.sol";
|
42
|
-
import {TokenHandler} from "../shared/TokenHandler.sol";
|
43
|
-
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
44
42
|
|
45
43
|
contract Instance is
|
46
44
|
IInstance,
|
47
45
|
AccessManagedUpgradeable,
|
48
|
-
Registerable
|
49
|
-
KeyValueStore
|
46
|
+
Registerable
|
50
47
|
{
|
51
|
-
|
52
48
|
uint256 public constant GIF_MAJOR_VERSION = 3;
|
53
49
|
|
54
|
-
uint64 public constant ADMIN_ROLE = type(uint64).min;
|
55
|
-
uint64 public constant PUBLIC_ROLE = type(uint64).max;
|
56
|
-
uint64 public constant CUSTOM_ROLE_ID_MIN = 10000;
|
57
|
-
|
58
|
-
uint32 public constant EXECUTION_DELAY = 0;
|
59
|
-
|
60
50
|
bool private _initialized;
|
61
51
|
|
62
52
|
InstanceAccessManager internal _accessManager;
|
63
53
|
InstanceReader internal _instanceReader;
|
64
54
|
BundleManager internal _bundleManager;
|
55
|
+
InstanceStore internal _instanceStore;
|
65
56
|
|
66
57
|
modifier onlyChainNft() {
|
67
58
|
if(msg.sender != getRegistry().getChainNftAddress()) {
|
@@ -71,206 +62,149 @@ contract Instance is
|
|
71
62
|
}
|
72
63
|
|
73
64
|
function initialize(address authority, address registryAddress, address initialOwner)
|
74
|
-
|
65
|
+
external
|
75
66
|
initializer()
|
76
67
|
{
|
68
|
+
if(authority == address(0)) {
|
69
|
+
revert ErrorInstanceInstanceAccessManagerZero();
|
70
|
+
}
|
71
|
+
|
77
72
|
__AccessManaged_init(authority);
|
78
73
|
|
79
74
|
IRegistry registry = IRegistry(registryAddress);
|
80
75
|
initializeRegisterable(registryAddress, registry.getNftId(), INSTANCE(), true, initialOwner, "");
|
81
|
-
initializeLifecycle();
|
82
76
|
|
83
77
|
registerInterface(type(IInstance).interfaceId);
|
84
78
|
}
|
85
79
|
|
86
|
-
//---
|
87
|
-
function createProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup) external restricted() {
|
88
|
-
create(_toNftKey32(productNftId, PRODUCT()), abi.encode(setup));
|
89
|
-
}
|
90
|
-
|
91
|
-
function updateProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup, StateId newState) external restricted() {
|
92
|
-
update(_toNftKey32(productNftId, PRODUCT()), abi.encode(setup), newState);
|
93
|
-
}
|
94
|
-
|
95
|
-
function updateProductSetupState(NftId productNftId, StateId newState) external restricted() {
|
96
|
-
updateState(_toNftKey32(productNftId, PRODUCT()), newState);
|
97
|
-
}
|
98
|
-
|
99
|
-
//--- DistributionSetup ------------------------------------------------------//
|
100
|
-
function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external restricted() {
|
101
|
-
create(_toNftKey32(distributionNftId, DISTRIBUTION()), abi.encode(setup));
|
102
|
-
}
|
103
|
-
|
104
|
-
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external restricted() {
|
105
|
-
update(_toNftKey32(distributionNftId, DISTRIBUTION()), abi.encode(setup), newState);
|
106
|
-
}
|
107
|
-
|
108
|
-
function updateDistributionSetupState(NftId distributionNftId, StateId newState) external restricted() {
|
109
|
-
updateState(_toNftKey32(distributionNftId, DISTRIBUTION()), newState);
|
110
|
-
}
|
111
|
-
|
112
|
-
//--- PoolSetup ------------------------------------------------------//
|
113
|
-
function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external restricted() {
|
114
|
-
create(_toNftKey32(poolNftId, POOL()), abi.encode(info));
|
115
|
-
}
|
116
|
-
|
117
|
-
function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external restricted() {
|
118
|
-
update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
|
119
|
-
}
|
120
|
-
|
121
|
-
function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
|
122
|
-
updateState(_toNftKey32(poolNftId, POOL()), newState);
|
123
|
-
}
|
124
|
-
|
125
|
-
//--- DistributorType -------------------------------------------------------//
|
126
|
-
function createDistributorType(Key32 distributorKey, IDistribution.DistributorTypeInfo memory info) external restricted() {
|
127
|
-
create(distributorKey, abi.encode(info));
|
128
|
-
}
|
129
|
-
|
130
|
-
function updateDistributorType(Key32 distributorKey, IDistribution.DistributorTypeInfo memory info, StateId newState) external restricted() {
|
131
|
-
update(distributorKey, abi.encode(info), newState);
|
132
|
-
}
|
133
|
-
|
134
|
-
function updateDistributorTypeState(Key32 distributorKey, StateId newState) external restricted() {
|
135
|
-
updateState(distributorKey, newState);
|
136
|
-
}
|
80
|
+
//--- Roles ------------------------------------------------------------//
|
137
81
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
update(toDistributorKey32(nftId), abi.encode(info), newState);
|
145
|
-
}
|
146
|
-
|
147
|
-
function updateDistributorState(NftId nftId, StateId newState) external restricted() {
|
148
|
-
updateState(toDistributorKey32(nftId), newState);
|
149
|
-
}
|
150
|
-
|
151
|
-
//--- Referral ----------------------------------------------------------//
|
152
|
-
function createReferral(Key32 referralKey, IDistribution.ReferralInfo memory referralInfo) external restricted() {
|
153
|
-
create(referralKey, abi.encode(referralInfo));
|
154
|
-
}
|
155
|
-
|
156
|
-
function updateReferral(Key32 referralKey, IDistribution.ReferralInfo memory referralInfo, StateId newState) external restricted() {
|
157
|
-
update(referralKey, abi.encode(referralInfo), newState);
|
158
|
-
}
|
159
|
-
|
160
|
-
function updateReferralState(Key32 referralKey, StateId newState) external restricted() {
|
161
|
-
updateState(referralKey, newState);
|
162
|
-
}
|
163
|
-
|
164
|
-
//--- Bundle ------------------------------------------------------------//
|
165
|
-
function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external restricted() {
|
166
|
-
create(toBundleKey32(bundleNftId), abi.encode(bundle));
|
167
|
-
}
|
168
|
-
|
169
|
-
function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external restricted() {
|
170
|
-
update(toBundleKey32(bundleNftId), abi.encode(bundle), newState);
|
171
|
-
}
|
172
|
-
|
173
|
-
function updateBundleState(NftId bundleNftId, StateId newState) external restricted() {
|
174
|
-
updateState(toBundleKey32(bundleNftId), newState);
|
82
|
+
function createRole(string memory roleName, string memory adminName)
|
83
|
+
external
|
84
|
+
restricted // INSTANCE_OWNER_ROLE
|
85
|
+
returns (RoleId roleId, RoleId admin)
|
86
|
+
{
|
87
|
+
(roleId, admin) = _accessManager.createRole(roleName, adminName);
|
175
88
|
}
|
176
89
|
|
177
|
-
|
178
|
-
|
179
|
-
|
90
|
+
function grantRole(RoleId roleId, address account)
|
91
|
+
external
|
92
|
+
restricted // INSTANCE_OWNER_ROLE
|
93
|
+
{
|
94
|
+
_accessManager.grantRole(roleId, account);
|
180
95
|
}
|
181
96
|
|
182
|
-
function
|
183
|
-
|
97
|
+
function revokeRole(RoleId roleId, address account)
|
98
|
+
external
|
99
|
+
restricted // INSTANCE_OWNER_ROLE
|
100
|
+
{
|
101
|
+
_accessManager.revokeRole(roleId, account);
|
184
102
|
}
|
185
103
|
|
186
|
-
|
187
|
-
updateState(riskId.toKey32(), newState);
|
188
|
-
}
|
104
|
+
//--- Targets ------------------------------------------------------------//
|
189
105
|
|
190
|
-
|
191
|
-
|
192
|
-
|
106
|
+
function createTarget(address target, string memory name)
|
107
|
+
external
|
108
|
+
restricted // INSTANCE_OWNER_ROLE
|
109
|
+
{
|
110
|
+
_accessManager.createTarget(target, name);
|
193
111
|
}
|
194
112
|
|
195
|
-
function
|
196
|
-
|
113
|
+
function setTargetFunctionRole(
|
114
|
+
string memory targetName,
|
115
|
+
bytes4[] calldata selectors,
|
116
|
+
RoleId roleId
|
117
|
+
)
|
118
|
+
external
|
119
|
+
restricted // INSTANCE_OWNER_ROLE
|
120
|
+
{
|
121
|
+
_accessManager.setTargetFunctionRole(targetName, selectors, roleId);
|
197
122
|
}
|
198
123
|
|
199
|
-
function
|
200
|
-
|
124
|
+
function setTargetLocked(address target, bool locked)
|
125
|
+
external
|
126
|
+
restricted // INSTANCE_OWNER_ROLE
|
127
|
+
{
|
128
|
+
_accessManager.setTargetLockedByInstance(target, locked);
|
201
129
|
}
|
202
130
|
|
203
|
-
//---
|
204
|
-
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
205
|
-
update(toPolicyKey32(policyNftId), abi.encode(policy), newState);
|
206
|
-
}
|
131
|
+
//--- ITransferInterceptor ------------------------------------------------------------//
|
207
132
|
|
208
|
-
function
|
209
|
-
|
133
|
+
function nftMint(address to, uint256 tokenId) external onlyChainNft {
|
134
|
+
assert(_accessManager.roleMembers(INSTANCE_OWNER_ROLE()) == 0);// temp
|
135
|
+
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
210
136
|
}
|
211
137
|
|
212
|
-
|
213
|
-
|
214
|
-
|
138
|
+
function nftTransferFrom(address from, address to, uint256 tokenId) external onlyChainNft {
|
139
|
+
assert(_accessManager.revokeRole(INSTANCE_OWNER_ROLE(), from) == true);
|
140
|
+
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
215
141
|
}
|
216
142
|
|
217
|
-
|
218
|
-
update(toPolicyKey32(policyNftId), abi.encode(claim), newState);
|
219
|
-
}
|
143
|
+
//--- initial setup functions -------------------------------------------//
|
220
144
|
|
221
|
-
function
|
222
|
-
|
145
|
+
function setInstanceAccessManager(InstanceAccessManager accessManager) external restricted {
|
146
|
+
if(address(_accessManager) != address(0)) {
|
147
|
+
revert ErrorInstanceInstanceAccessManagerAlreadySet(address(_accessManager));
|
148
|
+
}
|
149
|
+
if(accessManager.authority() != authority()) {
|
150
|
+
revert ErrorInstanceInstanceAccessManagerAuthorityMismatch(authority());
|
151
|
+
}
|
152
|
+
_accessManager = accessManager;
|
223
153
|
}
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
154
|
+
|
155
|
+
function setBundleManager(BundleManager bundleManager) external restricted() {
|
156
|
+
if(address(_bundleManager) != address(0)) {
|
157
|
+
revert ErrorInstanceBundleManagerAlreadySet(address(_bundleManager));
|
158
|
+
}
|
159
|
+
if(bundleManager.getInstance() != Instance(this)) {
|
160
|
+
revert ErrorInstanceBundleManagerInstanceMismatch(address(this));
|
161
|
+
}
|
162
|
+
if(bundleManager.authority() != authority()) {
|
163
|
+
revert ErrorInstanceBundleManagerAuthorityMismatch(authority());
|
164
|
+
}
|
165
|
+
_bundleManager = bundleManager;
|
228
166
|
}
|
229
167
|
|
230
|
-
function
|
231
|
-
|
232
|
-
|
168
|
+
function setInstanceReader(InstanceReader instanceReader) external restricted() {
|
169
|
+
if(instanceReader.getInstance() != Instance(this)) {
|
170
|
+
revert ErrorInstanceInstanceReaderInstanceMismatch(address(this));
|
171
|
+
}
|
233
172
|
|
234
|
-
|
235
|
-
updateState(toPolicyKey32(policyNftId), newState);
|
173
|
+
_instanceReader = instanceReader;
|
236
174
|
}
|
237
175
|
|
238
|
-
//---
|
239
|
-
function nftMint(address to, uint256 tokenId) external onlyChainNft {
|
240
|
-
assert(_accessManager.roleMembers(INSTANCE_OWNER_ROLE()) == 0);// temp
|
241
|
-
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
242
|
-
}
|
176
|
+
//--- external view functions -------------------------------------------//
|
243
177
|
|
244
|
-
function
|
245
|
-
|
246
|
-
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
178
|
+
function getInstanceReader() external view returns (InstanceReader) {
|
179
|
+
return _instanceReader;
|
247
180
|
}
|
248
181
|
|
249
|
-
|
250
|
-
|
251
|
-
return nftId.toKey32(objectType);
|
182
|
+
function getBundleManager() external view returns (BundleManager) {
|
183
|
+
return _bundleManager;
|
252
184
|
}
|
253
185
|
|
254
|
-
function
|
255
|
-
return
|
186
|
+
function getInstanceAccessManager() external view returns (InstanceAccessManager) {
|
187
|
+
return _accessManager;
|
256
188
|
}
|
257
189
|
|
258
|
-
function
|
259
|
-
|
190
|
+
function setInstanceStore(InstanceStore instanceStore) external restricted {
|
191
|
+
if(address(_instanceStore) != address(0)) {
|
192
|
+
revert ErrorInstanceInstanceStoreAlreadySet(address(_instanceStore));
|
193
|
+
}
|
194
|
+
if(instanceStore.authority() != authority()) {
|
195
|
+
revert ErrorInstanceInstanceStoreAuthorityMismatch(authority());
|
196
|
+
}
|
197
|
+
_instanceStore = instanceStore;
|
260
198
|
}
|
261
199
|
|
262
|
-
function
|
263
|
-
return
|
200
|
+
function getInstanceStore() external view returns (InstanceStore) {
|
201
|
+
return _instanceStore;
|
264
202
|
}
|
265
203
|
|
266
|
-
function
|
267
|
-
return
|
204
|
+
function getMajorVersion() external pure returns (VersionPart majorVersion) {
|
205
|
+
return VersionPartLib.toVersionPart(GIF_MAJOR_VERSION);
|
268
206
|
}
|
269
207
|
|
270
|
-
function toDistributorKey32(NftId distNftId) public pure returns (Key32) {
|
271
|
-
return distNftId.toKey32(DISTRIBUTOR());
|
272
|
-
}
|
273
|
-
|
274
208
|
function getDistributionService() external view returns (IDistributionService) {
|
275
209
|
return IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), VersionPart.wrap(3)));
|
276
210
|
}
|
@@ -291,37 +225,5 @@ contract Instance is
|
|
291
225
|
return IBundleService(getRegistry().getServiceAddress(BUNDLE(), VersionPart.wrap(3)));
|
292
226
|
}
|
293
227
|
|
294
|
-
|
295
|
-
|
296
|
-
_instanceReader = instanceReader;
|
297
|
-
}
|
298
|
-
|
299
|
-
function getMajorVersion() external pure returns (VersionPart majorVersion) {
|
300
|
-
return VersionPartLib.toVersionPart(GIF_MAJOR_VERSION);
|
301
|
-
}
|
302
|
-
|
303
|
-
function getInstanceReader() external view returns (InstanceReader) {
|
304
|
-
return _instanceReader;
|
305
|
-
}
|
306
|
-
|
307
|
-
function setBundleManager(BundleManager bundleManager) external restricted() {
|
308
|
-
require(address(_bundleManager) == address(0), "BundleManager is set");
|
309
|
-
require(bundleManager.getInstance() == Instance(this), "BundleManager instance mismatch");
|
310
|
-
require(bundleManager.authority() == authority(), "BundleManager authority mismatch");
|
311
|
-
_bundleManager = bundleManager;
|
312
|
-
}
|
313
|
-
|
314
|
-
function getBundleManager() external view returns (BundleManager) {
|
315
|
-
return _bundleManager;
|
316
|
-
}
|
317
|
-
|
318
|
-
function setInstanceAccessManager(InstanceAccessManager accessManager) external restricted {
|
319
|
-
require(address(_accessManager) == address(0), "InstanceAccessManager is set");
|
320
|
-
require(accessManager.authority() == authority(), "InstanceAccessManager authority mismatch");
|
321
|
-
_accessManager = accessManager;
|
322
|
-
}
|
323
|
-
|
324
|
-
function getInstanceAccessManager() external view returns (InstanceAccessManager) {
|
325
|
-
return _accessManager;
|
326
|
-
}
|
327
|
-
}
|
228
|
+
//--- internal view/pure functions --------------------------------------//
|
229
|
+
}
|