@etherisc/gif-next 0.0.2-b9e43cf-870 → 0.0.2-bb1081a-994
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → Component.sol/Component.json} +230 -14
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +141 -10
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → IComponent.sol/IComponent.json} +107 -87
- 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 +623 -45
- 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 +227 -73
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +146 -15
- 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/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/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- 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 +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
- 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 +181 -15
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +0 -5
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +113 -76
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +47 -60
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +42 -83
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +59 -58
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +37 -24
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +102 -31
- 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/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- 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 +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +229 -93
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +31 -18
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +126 -47
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +31 -14
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +98 -38
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +0 -5
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +0 -5
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +0 -5
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +0 -5
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +153 -82
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +44 -31
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +126 -47
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +31 -14
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +126 -47
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +31 -14
- 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/IRegistry.sol/IRegistry.json +83 -3
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +33 -28
- 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 +96 -24
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +18 -18
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +61 -56
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +28 -15
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +70 -53
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +23 -26
- 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/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 +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +0 -5
- 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 +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +13 -5
- 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/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 +29 -21
- 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/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/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/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/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Component.sol +247 -0
- package/contracts/components/Distribution.sol +27 -48
- package/contracts/components/IComponent.sol +50 -0
- package/contracts/components/IDistributionComponent.sol +5 -2
- package/contracts/components/IPoolComponent.sol +40 -29
- package/contracts/components/IProductComponent.sol +7 -3
- package/contracts/components/Pool.sol +123 -138
- package/contracts/components/Product.sol +48 -86
- package/contracts/instance/BundleManager.sol +7 -11
- package/contracts/instance/IInstance.sol +20 -10
- package/contracts/instance/IInstanceService.sol +1 -1
- package/contracts/instance/Instance.sol +28 -31
- package/contracts/instance/InstanceAccessManager.sol +6 -11
- package/contracts/instance/InstanceReader.sol +3 -25
- package/contracts/instance/InstanceService.sol +31 -14
- package/contracts/instance/ObjectManager.sol +7 -24
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/module/ISetup.sol +2 -2
- package/contracts/instance/service/BundleService.sol +11 -6
- package/contracts/instance/service/DistributionService.sol +22 -36
- package/contracts/instance/service/IBundleService.sol +11 -1
- package/contracts/instance/service/PolicyService.sol +56 -76
- package/contracts/instance/service/PoolService.sol +19 -55
- package/contracts/instance/service/ProductService.sol +49 -30
- package/contracts/registry/IRegistry.sol +13 -6
- package/contracts/registry/IRegistryService.sol +16 -9
- package/contracts/registry/Registry.sol +100 -44
- package/contracts/registry/RegistryAccessManager.sol +31 -25
- package/contracts/registry/RegistryService.sol +27 -85
- package/contracts/registry/ReleaseManager.sol +72 -82
- package/contracts/registry/TokenRegistry.sol +5 -3
- package/contracts/shared/IRegisterable.sol +1 -3
- package/contracts/shared/NftOwnable.sol +5 -0
- package/contracts/shared/Registerable.sol +10 -14
- package/contracts/shared/Service.sol +4 -2
- package/contracts/types/RoleId.sol +2 -2
- package/package.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
- 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/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -814
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +0 -442
- package/contracts/components/BaseComponent.sol +0 -159
- package/contracts/components/IBaseComponent.sol +0 -34
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +0 -23
- package/contracts/instance/IInstanceBase.sol +0 -26
- package/contracts/instance/InstanceBase.sol +0 -41
- package/contracts/instance/base/ComponentServiceBase.sol +0 -76
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/service/ComponentOwnerService.sol +0 -315
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -1,43 +1,41 @@
|
|
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
|
@@ -47,10 +45,27 @@ interface IPoolComponent {
|
|
47
45
|
|
48
46
|
function unlockBundle(NftId bundleNftId) external;
|
49
47
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
54
69
|
function policyMatchesBundle(
|
55
70
|
bytes memory policyData,
|
56
71
|
bytes memory bundleFilter
|
@@ -59,8 +74,4 @@ interface IPoolComponent {
|
|
59
74
|
view
|
60
75
|
returns (bool isMatching);
|
61
76
|
|
62
|
-
function isConfirmingApplication() external view returns (bool isConfirmingApplication);
|
63
|
-
|
64
|
-
function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
|
65
|
-
|
66
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,122 +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
6
|
import {IBundleService} from "../instance/service/IBundleService.sol";
|
8
|
-
import {NftId,
|
7
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
9
8
|
import {Fee} from "../types/Fee.sol";
|
10
9
|
import {UFixed} from "../types/UFixed.sol";
|
11
10
|
import {IPoolComponent} from "./IPoolComponent.sol";
|
12
|
-
import {
|
11
|
+
import {Component} from "./Component.sol";
|
13
12
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
14
13
|
import {ISetup} from "../instance/module/ISetup.sol";
|
15
14
|
|
16
15
|
import {IRegistry} from "../registry/IRegistry.sol";
|
17
16
|
|
18
|
-
// import {IPool} from "../instance/module/pool/IPoolModule.sol";
|
19
|
-
import {ITreasury} from "../instance/module/ITreasury.sol";
|
20
17
|
import {ISetup} from "../instance/module/ISetup.sol";
|
21
18
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
22
19
|
|
23
20
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
24
21
|
import {Registerable} from "../shared/Registerable.sol";
|
25
22
|
|
26
|
-
abstract contract Pool is
|
27
|
-
|
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;
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
struct PoolStorage {
|
31
|
+
UFixed _collateralizationLevel;
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
bool _isExternallyManaged;
|
34
|
+
bool _isInterceptingBundleTransfers;
|
35
|
+
bool _isVerifyingApplications;
|
35
36
|
|
36
|
-
|
37
|
+
Fee _initialPoolFee;
|
38
|
+
Fee _initialStakingFee;
|
39
|
+
Fee _initialPerformanceFee;
|
37
40
|
|
38
|
-
|
39
|
-
IPoolService internal _poolService;
|
41
|
+
TokenHandler _tokenHandler;
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
// may be used to interact with instance by derived contracts
|
44
|
+
IPoolService _poolService;
|
45
|
+
IBundleService _bundleService;
|
46
|
+
}
|
45
47
|
|
46
48
|
modifier onlyPoolService() {
|
47
|
-
|
48
|
-
msg.sender
|
49
|
-
|
49
|
+
if(msg.sender != address(_getStorage()._poolService)) {
|
50
|
+
revert ErrorPoolNotPoolService(msg.sender);
|
51
|
+
}
|
50
52
|
_;
|
51
53
|
}
|
52
54
|
|
53
|
-
modifier onlyProductService() {
|
54
|
-
require(
|
55
|
-
msg.sender == address(_productService),
|
56
|
-
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
57
|
-
_;
|
58
|
-
}
|
59
55
|
|
60
|
-
|
56
|
+
function _initializePool(
|
61
57
|
address registry,
|
62
58
|
NftId instanceNftId,
|
59
|
+
string memory name,
|
63
60
|
// TODO refactor into tokenNftId
|
64
61
|
address token,
|
65
|
-
bool isInterceptor,
|
66
|
-
bool isConfirmingApplication,
|
67
62
|
UFixed collateralizationLevel,
|
63
|
+
bool isInterceptingNftTransfers,
|
64
|
+
bool isExternallyManaging,
|
65
|
+
bool isVerifying,
|
68
66
|
Fee memory poolFee,
|
69
67
|
Fee memory stakingFee,
|
70
68
|
Fee memory performanceFee,
|
71
|
-
address initialOwner
|
69
|
+
address initialOwner,
|
70
|
+
bytes memory data
|
72
71
|
)
|
73
|
-
|
72
|
+
internal
|
73
|
+
//onlyInitializing//TODO uncomment when "fully" upgradeable
|
74
|
+
virtual
|
74
75
|
{
|
75
|
-
|
76
|
+
_initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner, data);
|
77
|
+
|
78
|
+
PoolStorage storage $ = _getStorage();
|
79
|
+
|
80
|
+
$._isExternallyManaged = isExternallyManaging;
|
81
|
+
$._isVerifyingApplications = isVerifying;
|
82
|
+
|
76
83
|
// TODO add validation
|
77
|
-
_collateralizationLevel = collateralizationLevel;
|
78
|
-
_initialPoolFee = poolFee;
|
79
|
-
_initialStakingFee = stakingFee;
|
80
|
-
_initialPerformanceFee = performanceFee;
|
84
|
+
$._collateralizationLevel = collateralizationLevel;
|
85
|
+
$._initialPoolFee = poolFee;
|
86
|
+
$._initialStakingFee = stakingFee;
|
87
|
+
$._initialPerformanceFee = performanceFee;
|
81
88
|
|
82
|
-
_tokenHandler = new TokenHandler(token);
|
89
|
+
$._tokenHandler = new TokenHandler(token);
|
83
90
|
|
84
|
-
_poolService =
|
85
|
-
|
86
|
-
_bundleService = _instance.getBundleService();
|
91
|
+
$._poolService = getInstance().getPoolService();
|
92
|
+
$._bundleService = getInstance().getBundleService();
|
87
93
|
|
88
94
|
_registerInterface(type(IPoolComponent).interfaceId);
|
89
95
|
}
|
90
96
|
|
91
|
-
function createBundle(
|
92
|
-
Fee memory fee,
|
93
|
-
uint256 initialAmount,
|
94
|
-
uint256 lifetime,
|
95
|
-
bytes memory filter
|
96
|
-
)
|
97
|
-
external
|
98
|
-
virtual override
|
99
|
-
returns(NftId bundleNftId)
|
100
|
-
{
|
101
|
-
address owner = msg.sender;
|
102
|
-
bundleNftId = _bundleService.createBundle(
|
103
|
-
owner,
|
104
|
-
fee,
|
105
|
-
initialAmount,
|
106
|
-
lifetime,
|
107
|
-
filter
|
108
|
-
);
|
109
|
-
|
110
|
-
// TODO add logging
|
111
|
-
}
|
112
97
|
|
113
98
|
/**
|
114
|
-
* @dev see {IPool.
|
99
|
+
* @dev see {IPool.verifyApplication}.
|
115
100
|
* Default implementation that only writes a {LogUnderwrittenByPool} entry.
|
116
101
|
*/
|
117
|
-
function
|
118
|
-
NftId
|
119
|
-
bytes memory
|
102
|
+
function verifyApplication(
|
103
|
+
NftId applicationNftId,
|
104
|
+
bytes memory applicationData,
|
120
105
|
bytes memory bundleFilter,
|
121
106
|
uint256 collateralizationAmount
|
122
107
|
)
|
@@ -124,19 +109,43 @@ abstract contract Pool is BaseComponent, IPoolComponent {
|
|
124
109
|
onlyProductService
|
125
110
|
virtual override
|
126
111
|
{
|
127
|
-
|
112
|
+
require(
|
113
|
+
policyMatchesBundle(applicationData, bundleFilter),
|
114
|
+
"ERROR:POL-020:POLICY_BUNDLE_MISMATCH"
|
115
|
+
);
|
116
|
+
|
117
|
+
emit LogUnderwrittenByPool(applicationNftId, collateralizationAmount, address(this));
|
128
118
|
}
|
129
119
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
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
|
134
143
|
function policyMatchesBundle(
|
135
144
|
bytes memory, // policyData
|
136
145
|
bytes memory // bundleFilter
|
137
146
|
)
|
138
147
|
public
|
139
|
-
|
148
|
+
pure
|
140
149
|
virtual override
|
141
150
|
returns (bool isMatching)
|
142
151
|
{
|
@@ -144,14 +153,6 @@ abstract contract Pool is BaseComponent, IPoolComponent {
|
|
144
153
|
}
|
145
154
|
|
146
155
|
|
147
|
-
function isConfirmingApplication() external view override returns (bool isConfirmingApplication) {
|
148
|
-
return _isConfirmingApplication;
|
149
|
-
}
|
150
|
-
|
151
|
-
function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
|
152
|
-
return _collateralizationLevel;
|
153
|
-
}
|
154
|
-
|
155
156
|
function setFees(
|
156
157
|
Fee memory poolFee,
|
157
158
|
Fee memory stakingFee,
|
@@ -161,7 +162,7 @@ abstract contract Pool is BaseComponent, IPoolComponent {
|
|
161
162
|
onlyOwner
|
162
163
|
override
|
163
164
|
{
|
164
|
-
_poolService.setFees(poolFee, stakingFee, performanceFee);
|
165
|
+
_getStorage()._poolService.setFees(poolFee, stakingFee, performanceFee);
|
165
166
|
}
|
166
167
|
|
167
168
|
function setBundleFee(
|
@@ -172,7 +173,7 @@ abstract contract Pool is BaseComponent, IPoolComponent {
|
|
172
173
|
override
|
173
174
|
// TODO add onlyBundleOwner
|
174
175
|
{
|
175
|
-
_bundleService.setBundleFee(bundleNftId, fee);
|
176
|
+
_getStorage()._bundleService.setBundleFee(bundleNftId, fee);
|
176
177
|
}
|
177
178
|
|
178
179
|
function lockBundle(
|
@@ -182,7 +183,7 @@ abstract contract Pool is BaseComponent, IPoolComponent {
|
|
182
183
|
override
|
183
184
|
// TODO add onlyBundleOwner
|
184
185
|
{
|
185
|
-
_bundleService.lockBundle(bundleNftId);
|
186
|
+
_getStorage()._bundleService.lockBundle(bundleNftId);
|
186
187
|
}
|
187
188
|
|
188
189
|
function unlockBundle(
|
@@ -192,81 +193,65 @@ abstract contract Pool is BaseComponent, IPoolComponent {
|
|
192
193
|
override
|
193
194
|
// TODO add onlyBundleOwner
|
194
195
|
{
|
195
|
-
_bundleService.unlockBundle(bundleNftId);
|
196
|
+
_getStorage()._bundleService.unlockBundle(bundleNftId);
|
196
197
|
}
|
197
198
|
|
198
199
|
function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
|
199
|
-
InstanceReader reader =
|
200
|
-
|
201
|
-
}
|
200
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
201
|
+
setupInfo = reader.getPoolSetupInfo(getNftId());
|
202
202
|
|
203
|
-
|
203
|
+
// fallback to initial setup info (wallet is always != address(0))
|
204
|
+
if(setupInfo.wallet == address(0)) {
|
205
|
+
setupInfo = _getInitialSetupInfo();
|
206
|
+
}
|
207
|
+
}
|
204
208
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
return (
|
218
|
-
info,
|
219
|
-
abi.encode(
|
220
|
-
getName(),
|
221
|
-
ISetup.PoolSetupInfo(
|
222
|
-
_productNftId,
|
223
|
-
_tokenHandler,
|
224
|
-
_collateralizationLevel,
|
225
|
-
_initialPoolFee,
|
226
|
-
_initialStakingFee,
|
227
|
-
_initialPerformanceFee,
|
228
|
-
false,
|
229
|
-
_isConfirmingApplication,
|
230
|
-
_wallet
|
231
|
-
)
|
232
|
-
)
|
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()
|
233
221
|
);
|
234
222
|
}
|
235
223
|
|
236
224
|
// Internals
|
237
225
|
|
238
|
-
function _underwrite(
|
239
|
-
NftId policyNftId,
|
240
|
-
bytes memory policyData,
|
241
|
-
bytes memory bundleFilter,
|
242
|
-
uint256 collateralizationAmount
|
243
|
-
)
|
244
|
-
internal
|
245
|
-
{
|
246
|
-
require(
|
247
|
-
policyMatchesBundle(policyData, bundleFilter),
|
248
|
-
"ERROR:POL-020:POLICY_BUNDLE_MISMATCH"
|
249
|
-
);
|
250
|
-
|
251
|
-
emit LogUnderwrittenByPool(policyNftId, collateralizationAmount, address(this));
|
252
|
-
}
|
253
|
-
|
254
226
|
function _createBundle(
|
255
227
|
address bundleOwner,
|
256
228
|
Fee memory fee,
|
257
229
|
uint256 amount,
|
258
230
|
uint256 lifetime,
|
259
|
-
bytes
|
231
|
+
bytes memory filter
|
260
232
|
)
|
261
233
|
internal
|
262
234
|
returns(NftId bundleNftId)
|
263
235
|
{
|
264
|
-
bundleNftId = _bundleService.createBundle(
|
236
|
+
bundleNftId = _getStorage()._bundleService.createBundle(
|
265
237
|
bundleOwner,
|
266
238
|
fee,
|
267
239
|
amount,
|
268
240
|
lifetime,
|
269
|
-
filter
|
270
|
-
|
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));
|
271
248
|
}
|
249
|
+
|
250
|
+
|
251
|
+
function _getStorage() private pure returns (PoolStorage storage $) {
|
252
|
+
assembly {
|
253
|
+
$.slot := POOL_STORAGE_LOCATION_V1
|
254
|
+
}
|
255
|
+
}
|
256
|
+
|
272
257
|
}
|