@etherisc/gif-next 0.0.2-b9e9dc3-713 → 0.0.2-bb1081a-994
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +67 -1
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/Component.sol/Component.json +613 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +286 -90
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/{instance/service/IComponentOwnerService.sol/IComponentOwnerService.json → components/IComponent.sol/IComponent.json} +188 -152
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +543 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +637 -33
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +643 -5
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +389 -167
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +297 -145
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +764 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1657 -28
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +162 -18
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +232 -632
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +231 -114
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +182 -58
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +328 -67
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +72 -23
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +261 -0
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{ServiceBase.sol/ServiceBase.json → ComponentService.sol/ComponentService.json} +151 -16
- 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 +2 -2
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +59 -16
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.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/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1167 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +449 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +772 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +437 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +780 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -18
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +766 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +15 -82
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +25 -245
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1227 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +505 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +806 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +437 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +856 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +437 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +339 -59
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +220 -111
- 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 +301 -188
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +69 -130
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +51 -91
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +394 -0
- 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/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +0 -5
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/{instance/base → shared}/IService.sol/IService.json +14 -19
- 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 +19 -6
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +19 -6
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +19 -11
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
- package/artifacts/contracts/{instance/base/ComponentServiceBase.sol/ComponentServiceBase.json → shared/Service.sol/Service.json} +28 -33
- 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/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/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +19 -11
- 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 +44 -36
- 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/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
- 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/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- 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/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/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/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
- package/contracts/components/Component.sol +247 -0
- package/contracts/components/Distribution.sol +31 -54
- package/contracts/components/IComponent.sol +50 -0
- package/contracts/components/IDistributionComponent.sol +5 -1
- package/contracts/components/IPoolComponent.sol +44 -29
- package/contracts/components/IProductComponent.sol +7 -3
- package/contracts/components/Pool.sol +143 -145
- package/contracts/components/Product.sol +74 -108
- package/contracts/instance/BundleManager.sol +125 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +54 -10
- package/contracts/instance/IInstanceService.sol +30 -7
- package/contracts/instance/Instance.sol +76 -243
- package/contracts/instance/InstanceAccessManager.sol +88 -78
- package/contracts/instance/InstanceReader.sol +34 -21
- package/contracts/instance/InstanceService.sol +313 -53
- package/contracts/instance/InstanceServiceManager.sol +10 -12
- package/contracts/instance/ObjectManager.sol +84 -0
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/module/IAccess.sol +27 -17
- package/contracts/instance/module/IBundle.sol +1 -0
- package/contracts/instance/module/ISetup.sol +4 -1
- package/contracts/instance/service/BundleService.sol +299 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/DistributionService.sol +106 -0
- package/contracts/instance/service/DistributionServiceManager.sol +51 -0
- package/contracts/instance/service/IBundleService.sol +54 -0
- package/contracts/instance/service/IDistributionService.sol +1 -1
- package/contracts/instance/service/IPolicyService.sol +94 -0
- package/contracts/instance/service/IPoolService.sol +7 -24
- package/contracts/instance/service/IProductService.sol +7 -74
- package/contracts/instance/service/PolicyService.sol +519 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +109 -0
- package/contracts/instance/service/PoolServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +232 -0
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +47 -6
- package/contracts/registry/IRegistryService.sol +50 -20
- package/contracts/registry/Registry.sol +243 -214
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +84 -262
- package/contracts/registry/RegistryServiceManager.sol +20 -22
- package/contracts/registry/ReleaseManager.sol +332 -0
- package/contracts/registry/TokenRegistry.sol +112 -0
- package/contracts/shared/ERC165.sol +6 -2
- package/contracts/shared/IRegisterable.sol +1 -3
- package/contracts/shared/IService.sol +16 -0
- package/contracts/shared/NftOwnable.sol +7 -4
- package/contracts/shared/ProxyManager.sol +1 -1
- package/contracts/shared/Registerable.sol +11 -14
- package/contracts/shared/Service.sol +60 -0
- package/contracts/test/TestService.sol +6 -7
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/RoleId.sol +14 -6
- package/contracts/types/StateId.sol +4 -0
- package/contracts/types/Version.sol +4 -1
- package/package.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +0 -314
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -267
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1119
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/contracts/components/BaseComponent.sol +0 -86
- package/contracts/components/IBaseComponent.sol +0 -24
- package/contracts/instance/AccessManagedSimple.sol +0 -114
- package/contracts/instance/AccessManagerSimple.sol +0 -682
- package/contracts/instance/IAccessManagerSimple.sol +0 -391
- package/contracts/instance/base/ComponentServiceBase.sol +0 -49
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/base/IService.sol +0 -15
- package/contracts/instance/base/ServiceBase.sol +0 -44
- package/contracts/instance/service/ComponentOwnerService.sol +0 -317
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
@@ -1,52 +1,71 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {NftId} from "../types/NftId.sol";
|
5
4
|
import {Fee} from "../types/Fee.sol";
|
5
|
+
import {IComponent} from "./IComponent.sol";
|
6
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
7
|
+
import {NftId} from "../types/NftId.sol";
|
6
8
|
import {UFixed} from "../types/UFixed.sol";
|
7
9
|
|
8
|
-
|
10
|
+
/// @dev pool components hold and manage the collateral to cover active policies
|
11
|
+
/// pools come in different flavors
|
12
|
+
interface IPoolComponent is IComponent {
|
9
13
|
|
10
14
|
event LogUnderwrittenByPool(NftId policyNftId, uint256 collateralizationAmount, address pool);
|
11
15
|
|
16
|
+
error ErrorPoolNotPoolService(address service);
|
17
|
+
|
18
|
+
function getSetupInfo() external view returns (ISetup.PoolSetupInfo memory setupInfo);
|
19
|
+
|
12
20
|
function setFees(
|
13
21
|
Fee memory poolFee,
|
14
22
|
Fee memory stakingFee,
|
15
23
|
Fee memory performanceFee
|
16
24
|
) external;
|
17
25
|
|
18
|
-
|
19
|
-
|
20
|
-
*/
|
21
|
-
function createBundle(
|
22
|
-
Fee memory fee,
|
23
|
-
uint256 initialAmount,
|
24
|
-
uint256 lifetime,
|
25
|
-
bytes memory filter
|
26
|
-
) external returns(NftId bundleNftId);
|
27
|
-
|
26
|
+
/// @dev sets an additional bundle fee, this fee is added on top of the poolFee and deducted from the premium amounts.
|
27
|
+
/// via these fees individual bundler owner may earn income per policy in the context of peer to peer pools
|
28
28
|
function setBundleFee(
|
29
|
-
NftId
|
29
|
+
NftId bundleNftId,
|
30
30
|
Fee memory fee
|
31
31
|
) external;
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
function underwrite(
|
40
|
-
NftId policyNftId,
|
33
|
+
/// @dev this is a callback function that is called by the product service when underwriting a policy.
|
34
|
+
/// the pool has the option to check the details and object to underwriting by reverting.
|
35
|
+
/// the function is only called for "active" pools that ask to be involved/notified
|
36
|
+
/// by product related state changes.
|
37
|
+
function verifyApplication(
|
38
|
+
NftId applicationNftId,
|
41
39
|
bytes memory policyData,
|
42
40
|
bytes memory bundleFilter,
|
43
41
|
uint256 collateralizationAmount
|
44
42
|
) external;
|
45
43
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
function lockBundle(NftId bundleNftId) external;
|
45
|
+
|
46
|
+
function unlockBundle(NftId bundleNftId) external;
|
47
|
+
|
48
|
+
/// @dev defines the multiplier to calculate the required collateral to cover a given sum insured amount
|
49
|
+
function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
|
50
|
+
|
51
|
+
/// @dev declares if pool intercept transfers of bundle nft ids
|
52
|
+
/// - yes: pool may block transfer of bundle ownership or simply updates some bookkeeping related to bundle ownership. callback function is nftTransferFrom
|
53
|
+
/// - no: pool is not involved in transfer of bundle ownership
|
54
|
+
function isInterceptingBundleTransfers() external view returns (bool);
|
55
|
+
|
56
|
+
/// @dev declares if pool relies on external management of collateral (yes/no):
|
57
|
+
/// - yes: underwriting of new policies does not require an actual token balance, instead it is assumed that the pool owner will manage funds externally and inject enough tokens to allow process confirmed payouts
|
58
|
+
/// - no: the pool smart contract ensures that the necessary capacity of the pool prior to underwriting.
|
59
|
+
function isExternallyManaged() external view returns (bool);
|
60
|
+
|
61
|
+
/// @dev declares if pool component is actively involved in underwriting (yes/no):
|
62
|
+
/// - yes: verifying pools components actively confirm underwriting applications, ie the pool component logic explicitly needs to confirm the locking of collateral to cover the sum insured of the policy
|
63
|
+
/// - no: underwriting a policy does not require any interaction with the pool component if the covering bundle can provide the necessary captial
|
64
|
+
function isVerifyingApplications() external view returns (bool);
|
65
|
+
|
66
|
+
/// @dev returns true iff the policy application data in policyData matches
|
67
|
+
/// with the bundle filter criteria encoded in bundleFilter
|
68
|
+
/// this is a callback function that is only called if a pool declares itself as a verifying pool
|
50
69
|
function policyMatchesBundle(
|
51
70
|
bytes memory policyData,
|
52
71
|
bytes memory bundleFilter
|
@@ -55,8 +74,4 @@ interface IPoolComponent {
|
|
55
74
|
view
|
56
75
|
returns (bool isMatching);
|
57
76
|
|
58
|
-
function isVerifying() external view returns (bool verifying);
|
59
|
-
|
60
|
-
function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
|
61
|
-
|
62
77
|
}
|
@@ -2,11 +2,15 @@
|
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {Fee} from "../types/Fee.sol";
|
5
|
+
import {IComponent} from "./IComponent.sol";
|
6
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
5
7
|
import {NftId} from "../types/NftId.sol";
|
6
8
|
import {ReferralId} from "../types/Referral.sol";
|
7
9
|
import {RiskId} from "../types/RiskId.sol";
|
8
10
|
|
9
|
-
interface IProductComponent {
|
11
|
+
interface IProductComponent is IComponent {
|
12
|
+
|
13
|
+
function getSetupInfo() external view returns (ISetup.ProductSetupInfo memory setupInfo);
|
10
14
|
|
11
15
|
function setFees(
|
12
16
|
Fee memory productFee,
|
@@ -18,8 +22,8 @@ interface IProductComponent {
|
|
18
22
|
RiskId riskId,
|
19
23
|
uint256 lifetime,
|
20
24
|
bytes memory applicationData,
|
21
|
-
|
22
|
-
|
25
|
+
NftId bundleNftId,
|
26
|
+
ReferralId referralId
|
23
27
|
) external view returns (uint256 premiumAmount);
|
24
28
|
|
25
29
|
function calculateNetPremium(
|
@@ -1,116 +1,107 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
5
|
-
import {IProductService} from "../instance/service/IProductService.sol";
|
4
|
+
import {POOL} from "../types/ObjectType.sol";
|
6
5
|
import {IPoolService} from "../instance/service/IPoolService.sol";
|
7
|
-
import {
|
6
|
+
import {IBundleService} from "../instance/service/IBundleService.sol";
|
7
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
8
8
|
import {Fee} from "../types/Fee.sol";
|
9
9
|
import {UFixed} from "../types/UFixed.sol";
|
10
10
|
import {IPoolComponent} from "./IPoolComponent.sol";
|
11
|
-
import {
|
11
|
+
import {Component} from "./Component.sol";
|
12
12
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
13
13
|
import {ISetup} from "../instance/module/ISetup.sol";
|
14
14
|
|
15
15
|
import {IRegistry} from "../registry/IRegistry.sol";
|
16
16
|
|
17
|
-
// import {IPool} from "../instance/module/pool/IPoolModule.sol";
|
18
|
-
import {ITreasury} from "../instance/module/ITreasury.sol";
|
19
17
|
import {ISetup} from "../instance/module/ISetup.sol";
|
20
18
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
21
19
|
|
22
20
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
23
21
|
import {Registerable} from "../shared/Registerable.sol";
|
24
22
|
|
25
|
-
contract Pool is
|
26
|
-
|
23
|
+
abstract contract Pool is
|
24
|
+
Component,
|
25
|
+
IPoolComponent
|
26
|
+
{
|
27
|
+
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.component.Pool.sol")) - 1)) & ~bytes32(uint256(0xff));
|
28
|
+
bytes32 public constant POOL_STORAGE_LOCATION_V1 = 0xecf35607b7e822969ee3625cd815bfc27031f3a93d0be2676e5bde943e2e2300;
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
+
struct PoolStorage {
|
31
|
+
UFixed _collateralizationLevel;
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
bool _isExternallyManaged;
|
34
|
+
bool _isInterceptingBundleTransfers;
|
35
|
+
bool _isVerifyingApplications;
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
+
Fee _initialPoolFee;
|
38
|
+
Fee _initialStakingFee;
|
39
|
+
Fee _initialPerformanceFee;
|
37
40
|
|
38
|
-
|
39
|
-
IProductService private _productService;
|
41
|
+
TokenHandler _tokenHandler;
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
"ERROR:POL-001:NOT_POOL_SERVICE");
|
45
|
-
_;
|
43
|
+
// may be used to interact with instance by derived contracts
|
44
|
+
IPoolService _poolService;
|
45
|
+
IBundleService _bundleService;
|
46
46
|
}
|
47
47
|
|
48
|
-
modifier
|
49
|
-
|
50
|
-
msg.sender
|
51
|
-
|
48
|
+
modifier onlyPoolService() {
|
49
|
+
if(msg.sender != address(_getStorage()._poolService)) {
|
50
|
+
revert ErrorPoolNotPoolService(msg.sender);
|
51
|
+
}
|
52
52
|
_;
|
53
53
|
}
|
54
54
|
|
55
|
-
|
55
|
+
|
56
|
+
function _initializePool(
|
56
57
|
address registry,
|
57
58
|
NftId instanceNftId,
|
58
|
-
|
59
|
+
string memory name,
|
59
60
|
// TODO refactor into tokenNftId
|
60
61
|
address token,
|
61
|
-
bool isInterceptor,
|
62
|
-
bool verifying,
|
63
62
|
UFixed collateralizationLevel,
|
63
|
+
bool isInterceptingNftTransfers,
|
64
|
+
bool isExternallyManaging,
|
65
|
+
bool isVerifying,
|
64
66
|
Fee memory poolFee,
|
65
67
|
Fee memory stakingFee,
|
66
68
|
Fee memory performanceFee,
|
67
|
-
address initialOwner
|
69
|
+
address initialOwner,
|
70
|
+
bytes memory data
|
68
71
|
)
|
69
|
-
|
72
|
+
internal
|
73
|
+
//onlyInitializing//TODO uncomment when "fully" upgradeable
|
74
|
+
virtual
|
70
75
|
{
|
71
|
-
|
76
|
+
_initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner, data);
|
77
|
+
|
78
|
+
PoolStorage storage $ = _getStorage();
|
79
|
+
|
80
|
+
$._isExternallyManaged = isExternallyManaging;
|
81
|
+
$._isVerifyingApplications = isVerifying;
|
82
|
+
|
72
83
|
// TODO add validation
|
73
|
-
_collateralizationLevel = collateralizationLevel;
|
74
|
-
_initialPoolFee = poolFee;
|
75
|
-
_initialStakingFee = stakingFee;
|
76
|
-
_initialPerformanceFee = performanceFee;
|
84
|
+
$._collateralizationLevel = collateralizationLevel;
|
85
|
+
$._initialPoolFee = poolFee;
|
86
|
+
$._initialStakingFee = stakingFee;
|
87
|
+
$._initialPerformanceFee = performanceFee;
|
88
|
+
|
89
|
+
$._tokenHandler = new TokenHandler(token);
|
77
90
|
|
78
|
-
|
79
|
-
|
80
|
-
// _productService = _instance.getProductService();
|
91
|
+
$._poolService = getInstance().getPoolService();
|
92
|
+
$._bundleService = getInstance().getBundleService();
|
81
93
|
|
82
94
|
_registerInterface(type(IPoolComponent).interfaceId);
|
83
95
|
}
|
84
96
|
|
85
|
-
function createBundle(
|
86
|
-
Fee memory fee,
|
87
|
-
uint256 initialAmount,
|
88
|
-
uint256 lifetime,
|
89
|
-
bytes memory filter
|
90
|
-
)
|
91
|
-
external
|
92
|
-
virtual override
|
93
|
-
returns(NftId bundleNftId)
|
94
|
-
{
|
95
|
-
address owner = msg.sender;
|
96
|
-
bundleNftId = _poolService.createBundle(
|
97
|
-
owner,
|
98
|
-
fee,
|
99
|
-
initialAmount,
|
100
|
-
lifetime,
|
101
|
-
filter
|
102
|
-
);
|
103
|
-
|
104
|
-
// TODO add logging
|
105
|
-
}
|
106
97
|
|
107
98
|
/**
|
108
|
-
* @dev see {IPool.
|
99
|
+
* @dev see {IPool.verifyApplication}.
|
109
100
|
* Default implementation that only writes a {LogUnderwrittenByPool} entry.
|
110
101
|
*/
|
111
|
-
function
|
112
|
-
NftId
|
113
|
-
bytes memory
|
102
|
+
function verifyApplication(
|
103
|
+
NftId applicationNftId,
|
104
|
+
bytes memory applicationData,
|
114
105
|
bytes memory bundleFilter,
|
115
106
|
uint256 collateralizationAmount
|
116
107
|
)
|
@@ -118,19 +109,43 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
118
109
|
onlyProductService
|
119
110
|
virtual override
|
120
111
|
{
|
121
|
-
|
112
|
+
require(
|
113
|
+
policyMatchesBundle(applicationData, bundleFilter),
|
114
|
+
"ERROR:POL-020:POLICY_BUNDLE_MISMATCH"
|
115
|
+
);
|
116
|
+
|
117
|
+
emit LogUnderwrittenByPool(applicationNftId, collateralizationAmount, address(this));
|
122
118
|
}
|
123
119
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
120
|
+
|
121
|
+
function isInterceptingBundleTransfers() external view override returns (bool) {
|
122
|
+
return isNftInterceptor();
|
123
|
+
}
|
124
|
+
|
125
|
+
|
126
|
+
function isExternallyManaged() external view override returns (bool) {
|
127
|
+
return _getStorage()._isExternallyManaged;
|
128
|
+
}
|
129
|
+
|
130
|
+
|
131
|
+
function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
|
132
|
+
return _getStorage()._collateralizationLevel;
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
function isVerifyingApplications() external view override returns (bool isConfirmingApplication) {
|
137
|
+
return _getStorage()._isVerifyingApplications;
|
138
|
+
}
|
139
|
+
|
140
|
+
|
141
|
+
/// @dev see {IPoolComponent.policyMatchesBundle}.
|
142
|
+
/// Default implementation always returns true
|
128
143
|
function policyMatchesBundle(
|
129
144
|
bytes memory, // policyData
|
130
145
|
bytes memory // bundleFilter
|
131
146
|
)
|
132
147
|
public
|
133
|
-
|
148
|
+
pure
|
134
149
|
virtual override
|
135
150
|
returns (bool isMatching)
|
136
151
|
{
|
@@ -138,14 +153,6 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
138
153
|
}
|
139
154
|
|
140
155
|
|
141
|
-
function isVerifying() external view override returns (bool verifying) {
|
142
|
-
return _isVerifying;
|
143
|
-
}
|
144
|
-
|
145
|
-
function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
|
146
|
-
return _collateralizationLevel;
|
147
|
-
}
|
148
|
-
|
149
156
|
function setFees(
|
150
157
|
Fee memory poolFee,
|
151
158
|
Fee memory stakingFee,
|
@@ -155,7 +162,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
155
162
|
onlyOwner
|
156
163
|
override
|
157
164
|
{
|
158
|
-
_poolService.setFees(poolFee, stakingFee, performanceFee);
|
165
|
+
_getStorage()._poolService.setFees(poolFee, stakingFee, performanceFee);
|
159
166
|
}
|
160
167
|
|
161
168
|
function setBundleFee(
|
@@ -166,94 +173,85 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
166
173
|
override
|
167
174
|
// TODO add onlyBundleOwner
|
168
175
|
{
|
169
|
-
|
176
|
+
_getStorage()._bundleService.setBundleFee(bundleNftId, fee);
|
170
177
|
}
|
171
178
|
|
172
|
-
function
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
_initialStakingFee,
|
181
|
-
_initialPerformanceFee,
|
182
|
-
_isVerifying,
|
183
|
-
_wallet
|
184
|
-
);
|
185
|
-
}
|
186
|
-
|
187
|
-
InstanceReader reader = _instance.getInstanceReader();
|
188
|
-
return reader.getPoolSetupInfo(getNftId());
|
179
|
+
function lockBundle(
|
180
|
+
NftId bundleNftId
|
181
|
+
)
|
182
|
+
external
|
183
|
+
override
|
184
|
+
// TODO add onlyBundleOwner
|
185
|
+
{
|
186
|
+
_getStorage()._bundleService.lockBundle(bundleNftId);
|
189
187
|
}
|
190
188
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
view
|
198
|
-
override (IRegisterable, Registerable)
|
199
|
-
returns (IRegistry.ObjectInfo memory, bytes memory)
|
189
|
+
function unlockBundle(
|
190
|
+
NftId bundleNftId
|
191
|
+
)
|
192
|
+
external
|
193
|
+
override
|
194
|
+
// TODO add onlyBundleOwner
|
200
195
|
{
|
201
|
-
(
|
202
|
-
IRegistry.ObjectInfo memory info,
|
203
|
-
bytes memory data
|
204
|
-
) = super.getInitialInfo();
|
205
|
-
|
206
|
-
return (
|
207
|
-
info,
|
208
|
-
abi.encode(
|
209
|
-
ISetup.PoolSetupInfo(
|
210
|
-
getProductNftId(),
|
211
|
-
TokenHandler(address(0)),
|
212
|
-
_collateralizationLevel,
|
213
|
-
_initialPoolFee,
|
214
|
-
_initialStakingFee,
|
215
|
-
_initialPerformanceFee,
|
216
|
-
_isVerifying,
|
217
|
-
_wallet
|
218
|
-
)
|
219
|
-
)
|
220
|
-
);
|
196
|
+
_getStorage()._bundleService.unlockBundle(bundleNftId);
|
221
197
|
}
|
222
198
|
|
223
|
-
|
199
|
+
function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
|
200
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
201
|
+
setupInfo = reader.getPoolSetupInfo(getNftId());
|
224
202
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
)
|
231
|
-
internal
|
232
|
-
{
|
233
|
-
require(
|
234
|
-
policyMatchesBundle(policyData, bundleFilter),
|
235
|
-
"ERROR:POL-020:POLICY_BUNDLE_MISMATCH"
|
236
|
-
);
|
203
|
+
// fallback to initial setup info (wallet is always != address(0))
|
204
|
+
if(setupInfo.wallet == address(0)) {
|
205
|
+
setupInfo = _getInitialSetupInfo();
|
206
|
+
}
|
207
|
+
}
|
237
208
|
|
238
|
-
|
209
|
+
function _getInitialSetupInfo() internal view returns (ISetup.PoolSetupInfo memory) {
|
210
|
+
PoolStorage storage $ = _getStorage();
|
211
|
+
return ISetup.PoolSetupInfo(
|
212
|
+
getProductNftId(),
|
213
|
+
$._tokenHandler,
|
214
|
+
$._collateralizationLevel,
|
215
|
+
$._initialPoolFee,
|
216
|
+
$._initialStakingFee,
|
217
|
+
$._initialPerformanceFee,
|
218
|
+
isNftInterceptor(),
|
219
|
+
$._isVerifyingApplications,
|
220
|
+
getWallet()
|
221
|
+
);
|
239
222
|
}
|
240
223
|
|
224
|
+
// Internals
|
225
|
+
|
241
226
|
function _createBundle(
|
242
227
|
address bundleOwner,
|
243
228
|
Fee memory fee,
|
244
229
|
uint256 amount,
|
245
230
|
uint256 lifetime,
|
246
|
-
bytes
|
231
|
+
bytes memory filter
|
247
232
|
)
|
248
233
|
internal
|
249
234
|
returns(NftId bundleNftId)
|
250
235
|
{
|
251
|
-
bundleNftId =
|
236
|
+
bundleNftId = _getStorage()._bundleService.createBundle(
|
252
237
|
bundleOwner,
|
253
238
|
fee,
|
254
239
|
amount,
|
255
240
|
lifetime,
|
256
|
-
filter
|
257
|
-
|
241
|
+
filter);
|
242
|
+
|
243
|
+
// TODO add logging
|
244
|
+
}
|
245
|
+
|
246
|
+
function getContractLocation(bytes memory name) external pure returns (bytes32 hash) {
|
247
|
+
return keccak256(abi.encode(uint256(keccak256(name)) - 1)) & ~bytes32(uint256(0xff));
|
258
248
|
}
|
249
|
+
|
250
|
+
|
251
|
+
function _getStorage() private pure returns (PoolStorage storage $) {
|
252
|
+
assembly {
|
253
|
+
$.slot := POOL_STORAGE_LOCATION_V1
|
254
|
+
}
|
255
|
+
}
|
256
|
+
|
259
257
|
}
|