@etherisc/gif-next 0.0.2-ce87da3-250 → 0.0.2-ceb30b2-601
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 +78 -102
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +139 -153
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +155 -76
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +181 -125
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +342 -178
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +162 -151
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +286 -245
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +83 -175
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +64 -50
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +707 -463
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +167 -76
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +630 -625
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +472 -126
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +258 -236
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +291 -238
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +79 -48
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -13
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +114 -35
- 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 +40 -10
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +56 -73
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +322 -99
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +59 -44
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +459 -242
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +90 -39
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +646 -84
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +119 -32
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +673 -129
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +96 -69
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +205 -59
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +253 -185
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +373 -51
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +480 -37
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +170 -102
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +776 -46
- 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 +255 -222
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +37 -78
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +929 -58
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +84 -37
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +145 -58
- 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/ChainNft.sol/ChainNft.json +15 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +19 -0
- 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/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +31 -12
- 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 +23 -50
- 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/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 +45 -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 +47 -24
- 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 +7 -20
- 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 +92 -29
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/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 +7 -20
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +107 -40
- 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/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
- 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 +209 -0
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
- 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 +17 -4
- 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 +23 -4
- 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 +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- 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 +38 -7
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
- package/contracts/components/Component.sol +99 -87
- package/contracts/components/Distribution.sol +18 -21
- package/contracts/components/IComponent.sol +40 -18
- package/contracts/components/IDistributionComponent.sol +1 -22
- package/contracts/components/IPoolComponent.sol +73 -47
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +178 -130
- package/contracts/components/Product.sol +157 -71
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +10 -9
- package/contracts/instance/Cloneable.sol +7 -2
- package/contracts/instance/IInstance.sol +39 -27
- package/contracts/instance/IInstanceService.sol +16 -12
- package/contracts/instance/Instance.sol +125 -98
- package/contracts/instance/InstanceAccessManager.sol +388 -158
- package/contracts/instance/InstanceReader.sol +36 -12
- package/contracts/instance/InstanceService.sol +220 -212
- package/contracts/instance/ObjectManager.sol +6 -8
- package/contracts/instance/base/ComponentService.sol +28 -32
- package/contracts/instance/base/KeyValueStore.sol +13 -36
- package/contracts/instance/base/Lifecycle.sol +23 -6
- package/contracts/instance/module/IAccess.sol +21 -14
- package/contracts/instance/module/IBundle.sol +8 -5
- package/contracts/instance/module/IComponents.sol +41 -0
- package/contracts/instance/module/IDistribution.sol +2 -1
- package/contracts/instance/module/IPolicy.sol +38 -7
- package/contracts/instance/module/ISetup.sol +7 -22
- package/contracts/instance/service/ApplicationService.sol +138 -50
- package/contracts/instance/service/BundleService.sol +228 -83
- package/contracts/instance/service/ClaimService.sol +240 -30
- package/contracts/instance/service/DistributionService.sol +179 -114
- package/contracts/instance/service/IApplicationService.sol +9 -13
- package/contracts/instance/service/IBundleService.sol +74 -26
- package/contracts/instance/service/IClaimService.sol +52 -23
- package/contracts/instance/service/IDistributionService.sol +21 -3
- package/contracts/instance/service/IPolicyService.sol +20 -29
- package/contracts/instance/service/IPoolService.sol +127 -3
- package/contracts/instance/service/PolicyService.sol +133 -251
- package/contracts/instance/service/PoolService.sol +258 -18
- package/contracts/instance/service/ProductService.sol +31 -54
- package/contracts/registry/ChainNft.sol +8 -0
- package/contracts/registry/IRegistry.sol +2 -0
- package/contracts/registry/IRegistryService.sol +2 -3
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +23 -20
- package/contracts/registry/RegistryService.sol +15 -16
- package/contracts/registry/ReleaseManager.sol +20 -18
- package/contracts/shared/IPolicyHolder.sol +20 -8
- 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 +14 -8
- package/contracts/shared/Registerable.sol +12 -11
- package/contracts/shared/RegistryLinked.sol +0 -5
- package/contracts/shared/Service.sol +21 -7
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +70 -0
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +25 -2
- package/contracts/types/Fee.sol +13 -5
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +6 -5
- package/contracts/types/PayoutId.sol +33 -5
- package/contracts/types/Referral.sol +4 -0
- package/contracts/types/RoleId.sol +13 -6
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +7 -2
- package/contracts/types/Timestamp.sol +18 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
@@ -3,20 +3,22 @@ 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 {
|
15
|
-
import {
|
16
|
-
|
17
|
-
|
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";
|
16
|
+
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
17
|
+
|
18
18
|
import {Registerable} from "../shared/Registerable.sol";
|
19
19
|
|
20
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
21
|
+
|
20
22
|
import {IInstance} from "./IInstance.sol";
|
21
23
|
import {InstanceReader} from "./InstanceReader.sol";
|
22
24
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
@@ -24,18 +26,13 @@ import {BundleManager} from "./BundleManager.sol";
|
|
24
26
|
|
25
27
|
import {KeyValueStore} from "./base/KeyValueStore.sol";
|
26
28
|
|
27
|
-
import {IAccess} from "./module/IAccess.sol";
|
28
29
|
import {IBundle} from "./module/IBundle.sol";
|
30
|
+
import {IComponents} from "./module/IComponents.sol";
|
29
31
|
import {IDistribution} from "./module/IDistribution.sol";
|
30
32
|
import {IPolicy} from "./module/IPolicy.sol";
|
31
33
|
import {IRisk} from "./module/IRisk.sol";
|
32
34
|
import {ISetup} from "./module/ISetup.sol";
|
33
35
|
|
34
|
-
import {IDistributionService} from "./service/IDistributionService.sol";
|
35
|
-
import {IPoolService} from "./service/IPoolService.sol";
|
36
|
-
import {IProductService} from "./service/IProductService.sol";
|
37
|
-
import {IPolicyService} from "./service/IPolicyService.sol";
|
38
|
-
import {IBundleService} from "./service/IBundleService.sol";
|
39
36
|
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
40
37
|
|
41
38
|
contract Instance is
|
@@ -59,13 +56,27 @@ contract Instance is
|
|
59
56
|
InstanceReader internal _instanceReader;
|
60
57
|
BundleManager internal _bundleManager;
|
61
58
|
|
62
|
-
|
59
|
+
modifier onlyChainNft() {
|
60
|
+
if(msg.sender != getRegistry().getChainNftAddress()) {
|
61
|
+
revert();
|
62
|
+
}
|
63
|
+
_;
|
64
|
+
}
|
65
|
+
|
66
|
+
function initialize(address authority, address registryAddress, address initialOwner)
|
63
67
|
public
|
64
68
|
initializer()
|
65
69
|
{
|
66
|
-
|
70
|
+
if(authority == address(0)) {
|
71
|
+
revert ErrorInstanceInstanceAccessManagerZero();
|
72
|
+
}
|
73
|
+
|
74
|
+
__AccessManaged_init(authority);
|
67
75
|
|
68
|
-
|
76
|
+
IRegistry registry = IRegistry(registryAddress);
|
77
|
+
initializeRegisterable(registryAddress, registry.getNftId(), INSTANCE(), true, initialOwner, "");
|
78
|
+
initializeLifecycle();
|
79
|
+
|
69
80
|
registerInterface(type(IInstance).interfaceId);
|
70
81
|
}
|
71
82
|
|
@@ -96,12 +107,12 @@ contract Instance is
|
|
96
107
|
}
|
97
108
|
|
98
109
|
//--- PoolSetup ------------------------------------------------------//
|
99
|
-
function createPoolSetup(NftId poolNftId,
|
100
|
-
create(_toNftKey32(poolNftId, POOL()), abi.encode(
|
110
|
+
function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external restricted() {
|
111
|
+
create(_toNftKey32(poolNftId, POOL()), abi.encode(info));
|
101
112
|
}
|
102
113
|
|
103
|
-
function updatePoolSetup(NftId poolNftId,
|
104
|
-
update(_toNftKey32(poolNftId, POOL()), abi.encode(
|
114
|
+
function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external restricted() {
|
115
|
+
update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
|
105
116
|
}
|
106
117
|
|
107
118
|
function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
|
@@ -109,55 +120,55 @@ contract Instance is
|
|
109
120
|
}
|
110
121
|
|
111
122
|
//--- DistributorType -------------------------------------------------------//
|
112
|
-
function createDistributorType(
|
113
|
-
create(
|
123
|
+
function createDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info) external restricted() {
|
124
|
+
create(distributorType.toKey32(), abi.encode(info));
|
114
125
|
}
|
115
126
|
|
116
|
-
function updateDistributorType(
|
117
|
-
update(
|
127
|
+
function updateDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info, StateId newState) external restricted() {
|
128
|
+
update(distributorType.toKey32(), abi.encode(info), newState);
|
118
129
|
}
|
119
130
|
|
120
|
-
function updateDistributorTypeState(
|
121
|
-
updateState(
|
131
|
+
function updateDistributorTypeState(DistributorType distributorType, StateId newState) external restricted() {
|
132
|
+
updateState(distributorType.toKey32(), newState);
|
122
133
|
}
|
123
134
|
|
124
135
|
//--- Distributor -------------------------------------------------------//
|
125
|
-
function createDistributor(NftId
|
126
|
-
create(
|
136
|
+
function createDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info) external restricted() {
|
137
|
+
create(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info));
|
127
138
|
}
|
128
139
|
|
129
|
-
function updateDistributor(NftId
|
130
|
-
update(
|
140
|
+
function updateDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info, StateId newState) external restricted() {
|
141
|
+
update(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info), newState);
|
131
142
|
}
|
132
143
|
|
133
|
-
function updateDistributorState(NftId
|
134
|
-
updateState(
|
144
|
+
function updateDistributorState(NftId distributorNftId, StateId newState) external restricted() {
|
145
|
+
updateState(_toNftKey32(distributorNftId, DISTRIBUTOR()), newState);
|
135
146
|
}
|
136
147
|
|
137
148
|
//--- Referral ----------------------------------------------------------//
|
138
|
-
function createReferral(
|
139
|
-
create(
|
149
|
+
function createReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo) external restricted() {
|
150
|
+
create(referralId.toKey32(), abi.encode(referralInfo));
|
140
151
|
}
|
141
152
|
|
142
|
-
function updateReferral(
|
143
|
-
update(
|
153
|
+
function updateReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo, StateId newState) external restricted() {
|
154
|
+
update(referralId.toKey32(), abi.encode(referralInfo), newState);
|
144
155
|
}
|
145
156
|
|
146
|
-
function updateReferralState(
|
147
|
-
updateState(
|
157
|
+
function updateReferralState(ReferralId referralId, StateId newState) external restricted() {
|
158
|
+
updateState(referralId.toKey32(), newState);
|
148
159
|
}
|
149
160
|
|
150
161
|
//--- Bundle ------------------------------------------------------------//
|
151
162
|
function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external restricted() {
|
152
|
-
create(
|
163
|
+
create(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle));
|
153
164
|
}
|
154
165
|
|
155
166
|
function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external restricted() {
|
156
|
-
update(
|
167
|
+
update(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle), newState);
|
157
168
|
}
|
158
169
|
|
159
170
|
function updateBundleState(NftId bundleNftId, StateId newState) external restricted() {
|
160
|
-
updateState(
|
171
|
+
updateState(_toNftKey32(bundleNftId, BUNDLE()), newState);
|
161
172
|
}
|
162
173
|
|
163
174
|
//--- Risk --------------------------------------------------------------//
|
@@ -175,117 +186,133 @@ contract Instance is
|
|
175
186
|
|
176
187
|
//--- Application (Policy) ----------------------------------------------//
|
177
188
|
function createApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy) external restricted() {
|
178
|
-
create(
|
189
|
+
create(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy));
|
179
190
|
}
|
180
191
|
|
181
192
|
function updateApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
182
|
-
update(
|
193
|
+
update(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy), newState);
|
183
194
|
}
|
184
195
|
|
185
196
|
function updateApplicationState(NftId applicationNftId, StateId newState) external restricted() {
|
186
|
-
updateState(
|
197
|
+
updateState(_toNftKey32(applicationNftId, POLICY()), newState);
|
187
198
|
}
|
188
199
|
|
189
200
|
//--- Policy ------------------------------------------------------------//
|
190
201
|
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
191
|
-
update(
|
202
|
+
update(_toNftKey32(policyNftId, POLICY()), abi.encode(policy), newState);
|
203
|
+
}
|
204
|
+
|
205
|
+
function updatePolicyClaims(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
206
|
+
update(_toNftKey32(policyNftId, POLICY()), abi.encode(policy), newState);
|
192
207
|
}
|
193
208
|
|
194
209
|
function updatePolicyState(NftId policyNftId, StateId newState) external restricted() {
|
195
|
-
updateState(
|
210
|
+
updateState(_toNftKey32(policyNftId, POLICY()), newState);
|
196
211
|
}
|
197
212
|
|
198
213
|
//--- Claim -------------------------------------------------------------//
|
199
214
|
function createClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim) external restricted() {
|
200
|
-
create(
|
215
|
+
create(_toClaimKey32(policyNftId, claimId), abi.encode(claim));
|
201
216
|
}
|
202
217
|
|
203
218
|
function updateClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim, StateId newState) external restricted() {
|
204
|
-
update(
|
219
|
+
update(_toClaimKey32(policyNftId, claimId), abi.encode(claim), newState);
|
205
220
|
}
|
206
221
|
|
207
222
|
function updateClaimState(NftId policyNftId, ClaimId claimId, StateId newState) external restricted() {
|
208
|
-
updateState(
|
223
|
+
updateState(_toClaimKey32(policyNftId, claimId), newState);
|
209
224
|
}
|
210
225
|
|
211
226
|
//--- Payout ------------------------------------------------------------//
|
212
|
-
function createPayout(NftId policyNftId,
|
213
|
-
create(
|
227
|
+
function createPayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory payout) external restricted() {
|
228
|
+
create(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout));
|
214
229
|
}
|
215
230
|
|
216
|
-
function updatePayout(NftId policyNftId,
|
217
|
-
update(
|
231
|
+
function updatePayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory payout, StateId newState) external restricted() {
|
232
|
+
update(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout), newState);
|
218
233
|
}
|
219
234
|
|
220
|
-
function updatePayoutState(NftId policyNftId, StateId newState) external restricted() {
|
221
|
-
updateState(
|
235
|
+
function updatePayoutState(NftId policyNftId, PayoutId payoutId, StateId newState) external restricted() {
|
236
|
+
updateState(_toPayoutKey32(policyNftId, payoutId), newState);
|
222
237
|
}
|
223
238
|
|
224
|
-
//---
|
225
|
-
function
|
226
|
-
|
239
|
+
//--- ITransferInterceptor ------------------------------------------------------------//
|
240
|
+
function nftMint(address to, uint256 tokenId) external onlyChainNft {
|
241
|
+
assert(_accessManager.roleMembers(INSTANCE_OWNER_ROLE()) == 0);// temp
|
242
|
+
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
227
243
|
}
|
228
244
|
|
229
|
-
function
|
230
|
-
|
245
|
+
function nftTransferFrom(address from, address to, uint256 tokenId) external onlyChainNft {
|
246
|
+
assert(_accessManager.revokeRole(INSTANCE_OWNER_ROLE(), from) == true);
|
247
|
+
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
231
248
|
}
|
232
249
|
|
233
|
-
|
234
|
-
return policyNftId.toKey32(POLICY());
|
235
|
-
}
|
250
|
+
//--- initial setup functions -------------------------------------------//
|
236
251
|
|
237
|
-
function
|
238
|
-
|
239
|
-
|
252
|
+
function setInstanceAccessManager(InstanceAccessManager accessManager) external restricted {
|
253
|
+
if(address(_accessManager) != address(0)) {
|
254
|
+
revert ErrorInstanceInstanceAccessManagerAlreadySet(address(_accessManager));
|
255
|
+
}
|
240
256
|
|
241
|
-
|
242
|
-
|
243
|
-
|
257
|
+
if(accessManager.authority() != authority()) {
|
258
|
+
revert ErrorInstanceInstanceAccessManagerAuthorityMismatch(authority());
|
259
|
+
}
|
244
260
|
|
245
|
-
|
246
|
-
return distNftId.toKey32(DISTRIBUTOR());
|
247
|
-
}
|
248
|
-
|
249
|
-
function getDistributionService() external view returns (IDistributionService) {
|
250
|
-
return IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), VersionPart.wrap(3)));
|
261
|
+
_accessManager = accessManager;
|
251
262
|
}
|
252
263
|
|
253
|
-
function
|
254
|
-
|
264
|
+
function setBundleManager(BundleManager bundleManager) external restricted() {
|
265
|
+
if(address(_bundleManager) != address(0)) {
|
266
|
+
revert ErrorInstanceBundleManagerAlreadySet(address(_bundleManager));
|
267
|
+
}
|
268
|
+
|
269
|
+
if(bundleManager.getInstance() != Instance(this)) {
|
270
|
+
revert ErrorInstanceBundleManagerInstanceMismatch(address(this));
|
271
|
+
}
|
272
|
+
|
273
|
+
if(bundleManager.authority() != authority()) {
|
274
|
+
revert ErrorInstanceBundleManagerAuthorityMismatch(authority());
|
275
|
+
}
|
276
|
+
|
277
|
+
_bundleManager = bundleManager;
|
255
278
|
}
|
256
279
|
|
257
|
-
function
|
258
|
-
|
280
|
+
function setInstanceReader(InstanceReader instanceReader) external restricted() {
|
281
|
+
if(instanceReader.getInstance() != Instance(this)) {
|
282
|
+
revert ErrorInstanceInstanceReaderInstanceMismatch(address(this));
|
283
|
+
}
|
284
|
+
|
285
|
+
_instanceReader = instanceReader;
|
259
286
|
}
|
260
287
|
|
261
|
-
|
262
|
-
|
288
|
+
//--- external view functions -------------------------------------------//
|
289
|
+
|
290
|
+
function getInstanceReader() external view returns (InstanceReader) {
|
291
|
+
return _instanceReader;
|
263
292
|
}
|
264
293
|
|
265
|
-
function
|
266
|
-
return
|
294
|
+
function getBundleManager() external view returns (BundleManager) {
|
295
|
+
return _bundleManager;
|
267
296
|
}
|
268
297
|
|
269
|
-
function
|
270
|
-
|
271
|
-
_instanceReader = instanceReader;
|
298
|
+
function getInstanceAccessManager() external view returns (InstanceAccessManager) {
|
299
|
+
return _accessManager;
|
272
300
|
}
|
273
301
|
|
274
302
|
function getMajorVersion() external pure returns (VersionPart majorVersion) {
|
275
303
|
return VersionPartLib.toVersionPart(GIF_MAJOR_VERSION);
|
276
304
|
}
|
277
305
|
|
278
|
-
|
279
|
-
|
306
|
+
//--- internal view/pure functions --------------------------------------//
|
307
|
+
function _toNftKey32(NftId nftId, ObjectType objectType) private pure returns (Key32) {
|
308
|
+
return nftId.toKey32(objectType);
|
280
309
|
}
|
281
|
-
|
282
|
-
function
|
283
|
-
|
284
|
-
require(bundleManager.getInstance() == Instance(this), "BundleManager instance mismatch");
|
285
|
-
_bundleManager = bundleManager;
|
310
|
+
|
311
|
+
function _toClaimKey32(NftId policyNftId, ClaimId claimId) private pure returns (Key32) {
|
312
|
+
return claimId.toKey32(policyNftId);
|
286
313
|
}
|
287
314
|
|
288
|
-
function
|
289
|
-
return
|
315
|
+
function _toPayoutKey32(NftId policyNftId, PayoutId payoutId) private pure returns (Key32) {
|
316
|
+
return payoutId.toKey32(policyNftId);
|
290
317
|
}
|
291
318
|
}
|