@etherisc/gif-next 0.0.2-83d1db6-607 → 0.0.2-83e248c-054
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -83
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +10 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +26 -0
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +100 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +100 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +110 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +100 -0
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +20 -0
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +10 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +1 -1
- 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 +380 -116
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +80 -14
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +310 -303
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +76 -57
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +171 -47
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +208 -101
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +62 -22
- 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 +85 -30
- 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 +175 -83
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +29 -13
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +333 -160
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +78 -14
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +372 -86
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +55 -7
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +183 -141
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +45 -57
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +111 -40
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +169 -113
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +251 -58
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +101 -24
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +438 -41
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +430 -14
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +80 -14
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +575 -85
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +71 -19
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +468 -55
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +18 -14
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +114 -51
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +16 -12
- 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 +0 -24
- 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 +17 -36
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +7 -7
- 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 +2 -2
- 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/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +80 -14
- 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 +2 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +86 -15
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/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 +2 -2
- 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 +101 -26
- 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 +185 -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 +40 -9
- 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 +4 -2
- package/contracts/components/Distribution.sol +6 -2
- package/contracts/components/IComponent.sol +3 -1
- package/contracts/components/IPoolComponent.sol +1 -1
- package/contracts/components/Pool.sol +11 -8
- package/contracts/components/Product.sol +137 -59
- package/contracts/instance/BundleManager.sol +3 -4
- package/contracts/instance/IInstance.sol +25 -21
- package/contracts/instance/IInstanceService.sol +0 -4
- package/contracts/instance/Instance.sol +85 -102
- package/contracts/instance/InstanceAccessManager.sol +16 -11
- package/contracts/instance/InstanceReader.sol +31 -4
- package/contracts/instance/InstanceService.sol +29 -46
- package/contracts/instance/base/ComponentService.sol +17 -30
- package/contracts/instance/base/KeyValueStore.sol +8 -3
- package/contracts/instance/base/Lifecycle.sol +12 -4
- package/contracts/instance/module/IAccess.sol +2 -2
- package/contracts/instance/module/IBundle.sol +6 -4
- package/contracts/instance/module/IComponents.sol +6 -0
- package/contracts/instance/module/IPolicy.sol +11 -6
- package/contracts/instance/service/ApplicationService.sol +19 -14
- package/contracts/instance/service/BundleService.sol +163 -63
- package/contracts/instance/service/ClaimService.sol +114 -26
- package/contracts/instance/service/DistributionService.sol +38 -74
- package/contracts/instance/service/IApplicationService.sol +3 -7
- package/contracts/instance/service/IBundleService.sol +56 -22
- package/contracts/instance/service/IClaimService.sol +46 -15
- package/contracts/instance/service/IDistributionService.sol +1 -0
- package/contracts/instance/service/IPolicyService.sol +70 -5
- package/contracts/instance/service/IPoolService.sol +65 -1
- package/contracts/instance/service/PolicyService.sol +254 -116
- package/contracts/instance/service/PoolService.sol +132 -49
- package/contracts/instance/service/ProductService.sol +21 -52
- package/contracts/registry/IRegistryService.sol +4 -3
- package/contracts/registry/RegistryService.sol +10 -11
- package/contracts/registry/ReleaseManager.sol +20 -18
- package/contracts/shared/IService.sol +4 -6
- package/contracts/shared/Service.sol +21 -7
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +65 -0
- package/contracts/types/ClaimId.sol +25 -2
- package/contracts/types/Fee.sol +12 -5
- package/contracts/types/ObjectType.sol +5 -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
@@ -3,8 +3,12 @@ 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";
|
@@ -20,16 +24,10 @@ import {InstanceReader} from "./InstanceReader.sol";
|
|
20
24
|
import {IBundle} from "./module/IBundle.sol";
|
21
25
|
import {IBundleService} from "./service/IBundleService.sol";
|
22
26
|
import {IComponents} from "./module/IComponents.sol";
|
23
|
-
import {IDistributionService} from "./service/IDistributionService.sol";
|
24
27
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
25
28
|
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
26
29
|
import {IPolicy} from "./module/IPolicy.sol";
|
27
30
|
import {IDistribution} from "./module/IDistribution.sol";
|
28
|
-
import {IPolicyService} from "./service/IPolicyService.sol";
|
29
|
-
import {IPoolService} from "./service/IPoolService.sol";
|
30
|
-
import {IProductService} from "./service/IProductService.sol";
|
31
|
-
import {IPolicyService} from "./service/IPolicyService.sol";
|
32
|
-
import {IBundleService} from "./service/IBundleService.sol";
|
33
31
|
import {IRisk} from "./module/IRisk.sol";
|
34
32
|
import {ISetup} from "./module/ISetup.sol";
|
35
33
|
|
@@ -41,11 +39,14 @@ interface IInstance is
|
|
41
39
|
IAccessManaged,
|
42
40
|
IKeyValueStore
|
43
41
|
{
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
42
|
+
error ErrorInstanceInstanceAccessManagerAlreadySet(address instanceAccessManager);
|
43
|
+
error ErrorInstanceInstanceAccessManagerAuthorityMismatch(address instanceAuthority);
|
44
|
+
|
45
|
+
error ErrorInstanceBundleManagerAlreadySet(address instanceBundleManager);
|
46
|
+
error ErrorInstanceBundleManagerInstanceMismatch(address instance);
|
47
|
+
error ErrorInstanceBundleManagerAuthorityMismatch(address instanceAuthority);
|
48
|
+
|
49
|
+
error ErrorInstanceInstanceReaderInstanceMismatch(address instanceAuthority);
|
49
50
|
|
50
51
|
function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external;
|
51
52
|
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
|
@@ -63,17 +64,17 @@ interface IInstance is
|
|
63
64
|
function updateProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup, StateId newState) external;
|
64
65
|
function updateProductSetupState(NftId productNftId, StateId newState) external;
|
65
66
|
|
66
|
-
function createDistributorType(
|
67
|
-
function updateDistributorType(
|
68
|
-
function updateDistributorTypeState(
|
67
|
+
function createDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info) external;
|
68
|
+
function updateDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info, StateId newState) external;
|
69
|
+
function updateDistributorTypeState(DistributorType distributorType, StateId newState) external;
|
69
70
|
|
70
71
|
function createDistributor(NftId nftId, IDistribution.DistributorInfo memory info) external;
|
71
72
|
function updateDistributor(NftId nftId, IDistribution.DistributorInfo memory info, StateId newState) external;
|
72
73
|
function updateDistributorState(NftId nftId, StateId newState) external;
|
73
74
|
|
74
|
-
function createReferral(
|
75
|
-
function updateReferral(
|
76
|
-
function updateReferralState(
|
75
|
+
function createReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo) external;
|
76
|
+
function updateReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo, StateId newState) external;
|
77
|
+
function updateReferralState(ReferralId referralId, StateId newState) external;
|
77
78
|
|
78
79
|
function createRisk(RiskId riskId, IRisk.RiskInfo memory risk) external;
|
79
80
|
function updateRisk(RiskId riskId, IRisk.RiskInfo memory risk, StateId newState) external;
|
@@ -86,13 +87,16 @@ interface IInstance is
|
|
86
87
|
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
87
88
|
function updatePolicyState(NftId policyNftId, StateId newState) external;
|
88
89
|
|
89
|
-
|
90
|
-
|
90
|
+
function createClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim) external;
|
91
|
+
function updateClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim, StateId newState) external;
|
92
|
+
function updateClaimState(NftId policyNftId, ClaimId claimId, StateId newState) external;
|
93
|
+
|
94
|
+
function createPayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory claim) external;
|
95
|
+
function updatePayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory claim, StateId newState) external;
|
96
|
+
function updatePayoutState(NftId policyNftId, PayoutId payoutId, StateId newState) external;
|
91
97
|
|
92
98
|
function getMajorVersion() external pure returns (VersionPart majorVersion);
|
93
99
|
function getInstanceReader() external view returns (InstanceReader);
|
94
100
|
function getBundleManager() external view returns (BundleManager);
|
95
|
-
|
96
|
-
function setInstanceAccessManager(InstanceAccessManager accessManager) external;
|
97
101
|
function getInstanceAccessManager() external view returns (InstanceAccessManager);
|
98
102
|
}
|
@@ -5,10 +5,6 @@ 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
|
-
|
10
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
11
|
-
import {IComponent} from "../components/IComponent.sol";
|
12
8
|
|
13
9
|
import {AccessManagerUpgradeableInitializeable} from "./AccessManagerUpgradeableInitializeable.sol";
|
14
10
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
@@ -3,18 +3,18 @@ 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
8
|
import {ClaimId} from "../types/ClaimId.sol";
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
9
|
+
import {DistributorType} from "../types/DistributorType.sol";
|
10
|
+
import {PayoutId} from "../types/PayoutId.sol";
|
11
|
+
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, PRODUCT, DISTRIBUTOR} from "../types/ObjectType.sol";
|
12
|
+
import {ReferralId} from "../types/Referral.sol";
|
13
|
+
import {RiskId} from "../types/RiskId.sol";
|
14
|
+
import {INSTANCE_OWNER_ROLE} from "../types/RoleId.sol";
|
15
|
+
import {StateId} from "../types/StateId.sol";
|
15
16
|
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
16
17
|
|
17
|
-
import {ERC165} from "../shared/ERC165.sol";
|
18
18
|
import {Registerable} from "../shared/Registerable.sol";
|
19
19
|
|
20
20
|
import {IRegistry} from "../registry/IRegistry.sol";
|
@@ -26,7 +26,6 @@ import {BundleManager} from "./BundleManager.sol";
|
|
26
26
|
|
27
27
|
import {KeyValueStore} from "./base/KeyValueStore.sol";
|
28
28
|
|
29
|
-
import {IAccess} from "./module/IAccess.sol";
|
30
29
|
import {IBundle} from "./module/IBundle.sol";
|
31
30
|
import {IComponents} from "./module/IComponents.sol";
|
32
31
|
import {IDistribution} from "./module/IDistribution.sol";
|
@@ -34,12 +33,6 @@ import {IPolicy} from "./module/IPolicy.sol";
|
|
34
33
|
import {IRisk} from "./module/IRisk.sol";
|
35
34
|
import {ISetup} from "./module/ISetup.sol";
|
36
35
|
|
37
|
-
import {IDistributionService} from "./service/IDistributionService.sol";
|
38
|
-
import {IPoolService} from "./service/IPoolService.sol";
|
39
|
-
import {IProductService} from "./service/IProductService.sol";
|
40
|
-
import {IPolicyService} from "./service/IPolicyService.sol";
|
41
|
-
import {IBundleService} from "./service/IBundleService.sol";
|
42
|
-
import {TokenHandler} from "../shared/TokenHandler.sol";
|
43
36
|
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
44
37
|
|
45
38
|
contract Instance is
|
@@ -123,55 +116,55 @@ contract Instance is
|
|
123
116
|
}
|
124
117
|
|
125
118
|
//--- DistributorType -------------------------------------------------------//
|
126
|
-
function createDistributorType(
|
127
|
-
create(
|
119
|
+
function createDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info) external restricted() {
|
120
|
+
create(distributorType.toKey32(), abi.encode(info));
|
128
121
|
}
|
129
122
|
|
130
|
-
function updateDistributorType(
|
131
|
-
update(
|
123
|
+
function updateDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info, StateId newState) external restricted() {
|
124
|
+
update(distributorType.toKey32(), abi.encode(info), newState);
|
132
125
|
}
|
133
126
|
|
134
|
-
function updateDistributorTypeState(
|
135
|
-
updateState(
|
127
|
+
function updateDistributorTypeState(DistributorType distributorType, StateId newState) external restricted() {
|
128
|
+
updateState(distributorType.toKey32(), newState);
|
136
129
|
}
|
137
130
|
|
138
131
|
//--- Distributor -------------------------------------------------------//
|
139
|
-
function createDistributor(NftId
|
140
|
-
create(
|
132
|
+
function createDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info) external restricted() {
|
133
|
+
create(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info));
|
141
134
|
}
|
142
135
|
|
143
|
-
function updateDistributor(NftId
|
144
|
-
update(
|
136
|
+
function updateDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info, StateId newState) external restricted() {
|
137
|
+
update(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info), newState);
|
145
138
|
}
|
146
139
|
|
147
|
-
function updateDistributorState(NftId
|
148
|
-
updateState(
|
140
|
+
function updateDistributorState(NftId distributorNftId, StateId newState) external restricted() {
|
141
|
+
updateState(_toNftKey32(distributorNftId, DISTRIBUTOR()), newState);
|
149
142
|
}
|
150
143
|
|
151
144
|
//--- Referral ----------------------------------------------------------//
|
152
|
-
function createReferral(
|
153
|
-
create(
|
145
|
+
function createReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo) external restricted() {
|
146
|
+
create(referralId.toKey32(), abi.encode(referralInfo));
|
154
147
|
}
|
155
148
|
|
156
|
-
function updateReferral(
|
157
|
-
update(
|
149
|
+
function updateReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo, StateId newState) external restricted() {
|
150
|
+
update(referralId.toKey32(), abi.encode(referralInfo), newState);
|
158
151
|
}
|
159
152
|
|
160
|
-
function updateReferralState(
|
161
|
-
updateState(
|
153
|
+
function updateReferralState(ReferralId referralId, StateId newState) external restricted() {
|
154
|
+
updateState(referralId.toKey32(), newState);
|
162
155
|
}
|
163
156
|
|
164
157
|
//--- Bundle ------------------------------------------------------------//
|
165
158
|
function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external restricted() {
|
166
|
-
create(
|
159
|
+
create(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle));
|
167
160
|
}
|
168
161
|
|
169
162
|
function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external restricted() {
|
170
|
-
update(
|
163
|
+
update(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle), newState);
|
171
164
|
}
|
172
165
|
|
173
166
|
function updateBundleState(NftId bundleNftId, StateId newState) external restricted() {
|
174
|
-
updateState(
|
167
|
+
updateState(_toNftKey32(bundleNftId, BUNDLE()), newState);
|
175
168
|
}
|
176
169
|
|
177
170
|
//--- Risk --------------------------------------------------------------//
|
@@ -189,50 +182,50 @@ contract Instance is
|
|
189
182
|
|
190
183
|
//--- Application (Policy) ----------------------------------------------//
|
191
184
|
function createApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy) external restricted() {
|
192
|
-
create(
|
185
|
+
create(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy));
|
193
186
|
}
|
194
187
|
|
195
188
|
function updateApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
196
|
-
update(
|
189
|
+
update(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy), newState);
|
197
190
|
}
|
198
191
|
|
199
192
|
function updateApplicationState(NftId applicationNftId, StateId newState) external restricted() {
|
200
|
-
updateState(
|
193
|
+
updateState(_toNftKey32(applicationNftId, POLICY()), newState);
|
201
194
|
}
|
202
195
|
|
203
196
|
//--- Policy ------------------------------------------------------------//
|
204
197
|
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
205
|
-
update(
|
198
|
+
update(_toNftKey32(policyNftId, POLICY()), abi.encode(policy), newState);
|
206
199
|
}
|
207
200
|
|
208
201
|
function updatePolicyState(NftId policyNftId, StateId newState) external restricted() {
|
209
|
-
updateState(
|
202
|
+
updateState(_toNftKey32(policyNftId, POLICY()), newState);
|
210
203
|
}
|
211
204
|
|
212
205
|
//--- Claim -------------------------------------------------------------//
|
213
206
|
function createClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim) external restricted() {
|
214
|
-
create(
|
207
|
+
create(_toClaimKey32(policyNftId, claimId), abi.encode(claim));
|
215
208
|
}
|
216
209
|
|
217
210
|
function updateClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim, StateId newState) external restricted() {
|
218
|
-
update(
|
211
|
+
update(_toClaimKey32(policyNftId, claimId), abi.encode(claim), newState);
|
219
212
|
}
|
220
213
|
|
221
214
|
function updateClaimState(NftId policyNftId, ClaimId claimId, StateId newState) external restricted() {
|
222
|
-
updateState(
|
215
|
+
updateState(_toClaimKey32(policyNftId, claimId), newState);
|
223
216
|
}
|
224
217
|
|
225
218
|
//--- Payout ------------------------------------------------------------//
|
226
|
-
function createPayout(NftId policyNftId,
|
227
|
-
create(
|
219
|
+
function createPayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory payout) external restricted() {
|
220
|
+
create(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout));
|
228
221
|
}
|
229
222
|
|
230
|
-
function updatePayout(NftId policyNftId,
|
231
|
-
update(
|
223
|
+
function updatePayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory payout, StateId newState) external restricted() {
|
224
|
+
update(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout), newState);
|
232
225
|
}
|
233
226
|
|
234
|
-
function updatePayoutState(NftId policyNftId, StateId newState) external restricted() {
|
235
|
-
updateState(
|
227
|
+
function updatePayoutState(NftId policyNftId, PayoutId payoutId, StateId newState) external restricted() {
|
228
|
+
updateState(_toPayoutKey32(policyNftId, payoutId), newState);
|
236
229
|
}
|
237
230
|
|
238
231
|
//--- ITransferInterceptor ------------------------------------------------------------//
|
@@ -246,82 +239,72 @@ contract Instance is
|
|
246
239
|
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
247
240
|
}
|
248
241
|
|
249
|
-
//---
|
250
|
-
function _toNftKey32(NftId nftId, ObjectType objectType) internal pure returns (Key32) {
|
251
|
-
return nftId.toKey32(objectType);
|
252
|
-
}
|
253
|
-
|
254
|
-
function toBundleKey32(NftId bundleNftId) public pure returns (Key32) {
|
255
|
-
return bundleNftId.toKey32(BUNDLE());
|
256
|
-
}
|
257
|
-
|
258
|
-
function toPolicyKey32(NftId policyNftId) public pure returns (Key32) {
|
259
|
-
return policyNftId.toKey32(POLICY());
|
260
|
-
}
|
242
|
+
//--- initial setup functions -------------------------------------------//
|
261
243
|
|
262
|
-
function
|
263
|
-
|
264
|
-
|
244
|
+
function setInstanceAccessManager(InstanceAccessManager accessManager) external restricted {
|
245
|
+
if(address(_accessManager) != address(0)) {
|
246
|
+
revert ErrorInstanceInstanceAccessManagerAlreadySet(address(_accessManager));
|
247
|
+
}
|
265
248
|
|
266
|
-
|
267
|
-
|
268
|
-
|
249
|
+
if(accessManager.authority() != authority()) {
|
250
|
+
revert ErrorInstanceInstanceAccessManagerAuthorityMismatch(authority());
|
251
|
+
}
|
269
252
|
|
270
|
-
|
271
|
-
return distNftId.toKey32(DISTRIBUTOR());
|
272
|
-
}
|
273
|
-
|
274
|
-
function getDistributionService() external view returns (IDistributionService) {
|
275
|
-
return IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), VersionPart.wrap(3)));
|
253
|
+
_accessManager = accessManager;
|
276
254
|
}
|
277
255
|
|
278
|
-
function
|
279
|
-
|
280
|
-
|
256
|
+
function setBundleManager(BundleManager bundleManager) external restricted() {
|
257
|
+
if(address(_bundleManager) != address(0)) {
|
258
|
+
revert ErrorInstanceBundleManagerAlreadySet(address(_bundleManager));
|
259
|
+
}
|
281
260
|
|
282
|
-
|
283
|
-
|
284
|
-
|
261
|
+
if(bundleManager.getInstance() != Instance(this)) {
|
262
|
+
revert ErrorInstanceBundleManagerInstanceMismatch(address(this));
|
263
|
+
}
|
285
264
|
|
286
|
-
|
287
|
-
|
288
|
-
|
265
|
+
if(bundleManager.authority() != authority()) {
|
266
|
+
revert ErrorInstanceBundleManagerAuthorityMismatch(authority());
|
267
|
+
}
|
289
268
|
|
290
|
-
|
291
|
-
return IBundleService(getRegistry().getServiceAddress(BUNDLE(), VersionPart.wrap(3)));
|
269
|
+
_bundleManager = bundleManager;
|
292
270
|
}
|
293
271
|
|
294
272
|
function setInstanceReader(InstanceReader instanceReader) external restricted() {
|
295
|
-
|
273
|
+
if(instanceReader.getInstance() != Instance(this)) {
|
274
|
+
revert ErrorInstanceInstanceReaderInstanceMismatch(address(this));
|
275
|
+
}
|
276
|
+
|
296
277
|
_instanceReader = instanceReader;
|
297
278
|
}
|
298
279
|
|
299
|
-
|
300
|
-
return VersionPartLib.toVersionPart(GIF_MAJOR_VERSION);
|
301
|
-
}
|
280
|
+
//--- external view functions -------------------------------------------//
|
302
281
|
|
303
282
|
function getInstanceReader() external view returns (InstanceReader) {
|
304
283
|
return _instanceReader;
|
305
284
|
}
|
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
285
|
|
314
286
|
function getBundleManager() external view returns (BundleManager) {
|
315
287
|
return _bundleManager;
|
316
288
|
}
|
317
289
|
|
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
290
|
function getInstanceAccessManager() external view returns (InstanceAccessManager) {
|
325
291
|
return _accessManager;
|
326
292
|
}
|
293
|
+
|
294
|
+
function getMajorVersion() external pure returns (VersionPart majorVersion) {
|
295
|
+
return VersionPartLib.toVersionPart(GIF_MAJOR_VERSION);
|
296
|
+
}
|
297
|
+
|
298
|
+
//--- internal view/pure functions --------------------------------------//
|
299
|
+
function _toNftKey32(NftId nftId, ObjectType objectType) private pure returns (Key32) {
|
300
|
+
return nftId.toKey32(objectType);
|
301
|
+
}
|
302
|
+
|
303
|
+
function _toClaimKey32(NftId policyNftId, ClaimId claimId) private pure returns (Key32) {
|
304
|
+
return claimId.toKey32(policyNftId);
|
305
|
+
}
|
306
|
+
|
307
|
+
function _toPayoutKey32(NftId policyNftId, PayoutId payoutId) private pure returns (Key32) {
|
308
|
+
return payoutId.toKey32(policyNftId);
|
309
|
+
}
|
327
310
|
}
|
@@ -268,22 +268,22 @@ contract InstanceAccessManager is
|
|
268
268
|
{
|
269
269
|
_createTarget(target, name, IAccess.Type.Custom);
|
270
270
|
}
|
271
|
+
|
271
272
|
// INSTANCE_SERVICE_ROLE
|
272
273
|
// IMPORTANT: instance access manager MUST be of Core type -> otherwise will be locked forever
|
273
|
-
function setTargetLocked(
|
274
|
+
function setTargetLocked(address target, bool locked)
|
274
275
|
external
|
275
276
|
restricted()
|
276
277
|
{
|
277
|
-
|
278
|
-
address
|
279
|
-
|
280
|
-
if (target == address(0)) {
|
281
|
-
revert IAccess.ErrorIAccessTargetDoesNotExist(nameShort);
|
278
|
+
IAccess.Type targetType = _targetInfo[target].ttype;
|
279
|
+
if(target == address(0) || targetType == IAccess.Type.NotInitialized) {
|
280
|
+
revert IAccess.ErrorIAccessTargetDoesNotExist(target);
|
282
281
|
}
|
283
282
|
|
284
|
-
if(
|
285
|
-
revert IAccess.ErrorIAccessTargetTypeInvalid(
|
283
|
+
if(targetType == IAccess.Type.Core) {
|
284
|
+
revert IAccess.ErrorIAccessTargetTypeInvalid(target, targetType);
|
286
285
|
}
|
286
|
+
|
287
287
|
// TODO isLocked is redundant but makes getTargetInfo() faster
|
288
288
|
_targetInfo[target].isLocked = locked;
|
289
289
|
_accessManager.setTargetClosed(target, locked);
|
@@ -314,7 +314,7 @@ contract InstanceAccessManager is
|
|
314
314
|
|
315
315
|
// not custom target
|
316
316
|
if(_targetInfo[target].ttype == IAccess.Type.Custom) {
|
317
|
-
revert IAccess.ErrorIAccessTargetTypeInvalid(
|
317
|
+
revert IAccess.ErrorIAccessTargetTypeInvalid(target, IAccess.Type.Custom);
|
318
318
|
}
|
319
319
|
|
320
320
|
// not custom role
|
@@ -345,7 +345,7 @@ contract InstanceAccessManager is
|
|
345
345
|
|
346
346
|
// not core target
|
347
347
|
if(_targetInfo[target].ttype == IAccess.Type.Core) {
|
348
|
-
revert IAccess.ErrorIAccessTargetTypeInvalid(
|
348
|
+
revert IAccess.ErrorIAccessTargetTypeInvalid(target, IAccess.Type.Core);
|
349
349
|
}
|
350
350
|
|
351
351
|
// not core role
|
@@ -356,6 +356,11 @@ contract InstanceAccessManager is
|
|
356
356
|
_setTargetFunctionRole(target, nameShort, selectors, roleId);
|
357
357
|
}
|
358
358
|
|
359
|
+
function getTargetAddress(string memory targetName) public view returns(address targetAddress) {
|
360
|
+
ShortString nameShort = ShortStrings.toShortString(targetName);
|
361
|
+
return _targetAddressForName[nameShort];
|
362
|
+
}
|
363
|
+
|
359
364
|
function isTargetLocked(address target) public view returns (bool locked) {
|
360
365
|
return _accessManager.isTargetClosed(target);
|
361
366
|
}
|
@@ -501,7 +506,7 @@ contract InstanceAccessManager is
|
|
501
506
|
internal
|
502
507
|
{
|
503
508
|
if (target == address(0)) {
|
504
|
-
revert IAccess.ErrorIAccessTargetDoesNotExist(
|
509
|
+
revert IAccess.ErrorIAccessTargetDoesNotExist(target);
|
505
510
|
}
|
506
511
|
|
507
512
|
if (!roleExists(roleId)) {
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
6
7
|
import {DistributorType} from "../types/DistributorType.sol";
|
7
8
|
import {Fee, FeeLib} from "../types/Fee.sol";
|
8
9
|
import {Key32} from "../types/Key32.sol";
|
@@ -29,17 +30,23 @@ import {TimestampLib} from "../types/Timestamp.sol";
|
|
29
30
|
|
30
31
|
|
31
32
|
contract InstanceReader {
|
33
|
+
|
34
|
+
error ErrorInstanceReaderAlreadyInitialized();
|
35
|
+
error ErrorInstanceReaderInstanceAddressZero();
|
36
|
+
|
32
37
|
bool private _initialized;
|
33
38
|
|
34
39
|
IInstance internal _instance;
|
35
40
|
IKeyValueStore internal _store;
|
36
41
|
|
37
42
|
function initialize(address instance) public {
|
38
|
-
|
43
|
+
if(_initialized) {
|
44
|
+
revert ErrorInstanceReaderAlreadyInitialized();
|
45
|
+
}
|
39
46
|
|
40
|
-
|
41
|
-
|
42
|
-
|
47
|
+
if(address(instance) == address(0)) {
|
48
|
+
revert ErrorInstanceReaderInstanceAddressZero();
|
49
|
+
}
|
43
50
|
|
44
51
|
_instance = IInstance(instance);
|
45
52
|
_store = IKeyValueStore(instance);
|
@@ -69,6 +76,25 @@ contract InstanceReader {
|
|
69
76
|
return _instance.getState(toPolicyKey(policyNftId));
|
70
77
|
}
|
71
78
|
|
79
|
+
function getClaimInfo(NftId policyNftId, ClaimId claimId)
|
80
|
+
public
|
81
|
+
view
|
82
|
+
returns (IPolicy.ClaimInfo memory info)
|
83
|
+
{
|
84
|
+
bytes memory data = _store.getData(claimId.toKey32(policyNftId));
|
85
|
+
if (data.length > 0) {
|
86
|
+
return abi.decode(data, (IPolicy.ClaimInfo));
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
function getClaimState(NftId policyNftId, ClaimId claimId)
|
91
|
+
public
|
92
|
+
view
|
93
|
+
returns (StateId state)
|
94
|
+
{
|
95
|
+
return _instance.getState(claimId.toKey32(policyNftId));
|
96
|
+
}
|
97
|
+
|
72
98
|
function getRiskInfo(RiskId riskId)
|
73
99
|
public
|
74
100
|
view
|
@@ -148,6 +174,7 @@ contract InstanceReader {
|
|
148
174
|
}
|
149
175
|
}
|
150
176
|
|
177
|
+
// TODO consider to replace by component type specific getXyzInfo
|
151
178
|
function getComponentInfo(NftId poolNftId)
|
152
179
|
public
|
153
180
|
view
|