@etherisc/gif-next 0.0.2-f30e0eb-805 → 0.0.2-f398177-971
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -83
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +47 -6
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +70 -13
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +137 -6
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +144 -13
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +161 -20
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +151 -20
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +71 -20
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +62 -21
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +310 -2004
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +101 -52
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +425 -2757
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +95 -58
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +124 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +348 -58
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +153 -207
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +38 -83
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2788 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +113 -34
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +8 -8
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +6 -6
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +6 -6
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +186 -236
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +38 -55
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +377 -182
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +74 -39
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +713 -83
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +147 -32
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +266 -442
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +82 -107
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +111 -174
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +233 -128
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +385 -51
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +109 -282
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +210 -99
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +682 -33
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.json +510 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +85 -27
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +420 -160
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +104 -53
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +880 -82
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +90 -39
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.json +1004 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.json +688 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +144 -57
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +28 -37
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +5 -37
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +22 -49
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +21 -34
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +23 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +10 -23
- package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/{instance → shared}/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +3 -3
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +0 -13
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +69 -9
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +0 -13
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +0 -13
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +85 -27
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +6 -19
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +80 -26
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +14 -27
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +6 -19
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +91 -28
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +24 -6
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +6 -19
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +106 -39
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +281 -0
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +83 -4
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +74 -19
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +116 -7
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +17 -4
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Component.sol +25 -4
- package/contracts/components/Distribution.sol +11 -6
- package/contracts/components/IComponent.sol +19 -3
- package/contracts/components/IPoolComponent.sol +8 -7
- package/contracts/components/IProductComponent.sol +5 -4
- package/contracts/components/Pool.sol +17 -14
- package/contracts/components/Product.sol +144 -62
- package/contracts/instance/BundleManager.sol +3 -4
- package/contracts/instance/IInstance.sol +32 -53
- package/contracts/instance/IInstanceService.sol +15 -14
- package/contracts/instance/Instance.sol +107 -205
- package/contracts/instance/InstanceAccessManager.sol +44 -25
- package/contracts/instance/InstanceAuthorizationsLib.sol +308 -0
- package/contracts/instance/InstanceReader.sol +85 -7
- package/contracts/instance/InstanceService.sol +102 -289
- package/contracts/instance/InstanceStore.sol +212 -0
- package/contracts/instance/ObjectManager.sol +1 -1
- package/contracts/instance/base/ComponentService.sol +53 -39
- package/contracts/instance/base/KeyValueStore.sol +8 -34
- package/contracts/instance/base/Lifecycle.sol +15 -4
- package/contracts/instance/module/IAccess.sol +2 -2
- package/contracts/instance/module/IBundle.sol +6 -4
- package/contracts/instance/module/IComponents.sol +7 -1
- package/contracts/instance/module/IDistribution.sol +3 -2
- package/contracts/instance/module/IPolicy.sol +13 -8
- package/contracts/instance/service/ApplicationService.sol +62 -226
- package/contracts/instance/service/BundleService.sol +172 -126
- package/contracts/instance/service/ClaimService.sol +318 -32
- package/contracts/instance/service/DistributionService.sol +71 -190
- package/contracts/instance/service/IApplicationService.sol +8 -28
- package/contracts/instance/service/IBundleService.sol +82 -26
- package/contracts/instance/service/IClaimService.sol +52 -23
- package/contracts/instance/service/IDistributionService.sol +11 -22
- package/contracts/instance/service/IPolicyService.sol +24 -16
- package/contracts/instance/service/IPoolService.sol +82 -3
- package/contracts/instance/service/IPricingService.sol +37 -0
- package/contracts/instance/service/PolicyService.sol +152 -179
- package/contracts/instance/service/PoolService.sol +239 -56
- package/contracts/instance/service/PricingService.sol +275 -0
- package/contracts/instance/service/PricingServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +27 -58
- package/contracts/registry/IRegistryService.sol +2 -3
- package/contracts/registry/RegistryService.sol +24 -21
- package/contracts/registry/ReleaseManager.sol +20 -18
- package/contracts/shared/IPolicyHolder.sol +23 -9
- package/contracts/shared/IRegistryLinked.sol +0 -1
- package/contracts/shared/IService.sol +6 -6
- package/contracts/shared/NftOwnable.sol +0 -2
- package/contracts/shared/PolicyHolder.sol +30 -17
- package/contracts/shared/Registerable.sol +10 -9
- package/contracts/shared/RegistryLinked.sol +0 -5
- package/contracts/shared/Service.sol +21 -7
- package/contracts/shared/TokenHandler.sol +4 -2
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +109 -0
- package/contracts/types/ClaimId.sol +25 -2
- package/contracts/types/Fee.sol +16 -8
- package/contracts/types/ObjectType.sol +9 -5
- package/contracts/types/PayoutId.sol +33 -5
- package/contracts/types/StateId.sol +6 -2
- package/contracts/types/Timestamp.sol +5 -0
- package/package.json +1 -1
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- /package/contracts/{instance → shared}/AccessManagerUpgradeableInitializeable.sol +0 -0
@@ -1,6 +1,7 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
4
5
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
6
|
|
6
7
|
import {IComponents} from "../instance/module/IComponents.sol";
|
@@ -11,12 +12,14 @@ import {IRegisterable} from "../shared/IRegisterable.sol";
|
|
11
12
|
import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
|
12
13
|
import {NftId} from "../types/NftId.sol";
|
13
14
|
import {ObjectType} from "../types/ObjectType.sol";
|
15
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
14
16
|
|
15
17
|
/// @dev component base class
|
16
18
|
/// component examples are product, distribution, pool and oracle
|
17
19
|
interface IComponent is
|
18
20
|
IRegisterable,
|
19
|
-
ITransferInterceptor
|
21
|
+
ITransferInterceptor,
|
22
|
+
IAccessManaged
|
20
23
|
{
|
21
24
|
error ErrorComponentNotChainNft(address caller);
|
22
25
|
error ErrorComponentNotProductService(address caller);
|
@@ -27,9 +30,13 @@ interface IComponent is
|
|
27
30
|
error ErrorComponentWalletAddressIsSameAsCurrent();
|
28
31
|
error ErrorComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
|
29
32
|
|
33
|
+
error ErrorComponentWalletNotComponent();
|
34
|
+
|
30
35
|
event LogComponentWalletAddressChanged(address oldWallet, address newWallet);
|
31
36
|
event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
|
32
37
|
|
38
|
+
event LogComponentTokenHandlerApproved(uint256 limit);
|
39
|
+
|
33
40
|
/// @dev locks component to disable functions that may change state related to this component, the only exception is function "unlock"
|
34
41
|
/// only component owner (nft holder) is authorizes to call this function
|
35
42
|
function lock() external;
|
@@ -38,6 +45,11 @@ interface IComponent is
|
|
38
45
|
/// only component owner (nft holder) is authorizes to call this function
|
39
46
|
function unlock() external;
|
40
47
|
|
48
|
+
/// @dev approves token hanlder to spend up to the specified amount of tokens
|
49
|
+
/// reverts if component wallet is not component itself
|
50
|
+
/// only component owner (nft holder) is authorizes to call this function
|
51
|
+
function approveTokenHandler(uint256 spendingLimitAmount) external;
|
52
|
+
|
41
53
|
/// @dev sets the wallet address for the component
|
42
54
|
/// if the current wallet has tokens, these will be transferred
|
43
55
|
/// if the new wallet address is externally owned, an approval from the
|
@@ -47,6 +59,9 @@ interface IComponent is
|
|
47
59
|
/// @dev only product service may set product nft id during registration of product setup
|
48
60
|
function setProductNftId(NftId productNftId) external;
|
49
61
|
|
62
|
+
/// @dev defines the instance to which this component is linked to
|
63
|
+
function getInstance() external view returns (IInstance instance);
|
64
|
+
|
50
65
|
/// @dev returns the name of this component
|
51
66
|
/// to successfully register the component with an instance the name MUST be unique in the linked instance
|
52
67
|
function getName() external view returns (string memory name);
|
@@ -54,8 +69,9 @@ interface IComponent is
|
|
54
69
|
/// @dev defines which ERC20 token is used by this component
|
55
70
|
function getToken() external view returns (IERC20Metadata token);
|
56
71
|
|
57
|
-
/// @dev
|
58
|
-
|
72
|
+
/// @dev returns token handler for this component
|
73
|
+
/// only registered components return a non zero token handler
|
74
|
+
function getTokenHandler() external view returns (TokenHandler tokenHandler);
|
59
75
|
|
60
76
|
/// @dev defines the wallet address used to hold the ERC20 tokens related to this component
|
61
77
|
/// the default address is the component token address
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {Amount} from "../types/Amount.sol";
|
4
5
|
import {Fee} from "../types/Fee.sol";
|
5
6
|
import {IComponent} from "./IComponent.sol";
|
6
7
|
import {IComponents} from "../instance/module/IComponents.sol";
|
@@ -18,17 +19,17 @@ interface IPoolComponent is IComponent {
|
|
18
19
|
|
19
20
|
error ErrorPoolApplicationBundleMismatch(NftId applicationNftId);
|
20
21
|
|
21
|
-
event LogPoolVerifiedByPool(address pool, NftId applicationNftId,
|
22
|
+
event LogPoolVerifiedByPool(address pool, NftId applicationNftId, Amount collateralizationAmount);
|
22
23
|
|
23
24
|
/// @dev increases the staked tokens by the specified amount
|
24
25
|
/// only the bundle owner may stake tokens
|
25
26
|
/// bundle MUST be in active or locked state
|
26
|
-
function stake(NftId bundleNftId,
|
27
|
+
function stake(NftId bundleNftId, Amount amount) external;
|
27
28
|
|
28
29
|
/// @dev decreases the staked tokens by the specified amount
|
29
30
|
/// only the bundle owner may unstake tokens from the bundle
|
30
31
|
/// bundle MUST be in active, locked or closed state
|
31
|
-
function unstake(NftId bundleNftId,
|
32
|
+
function unstake(NftId bundleNftId, Amount amount) external;
|
32
33
|
|
33
34
|
/// @dev extends the bundle lifetime of the bundle by the specified time
|
34
35
|
/// only the bundle owner may extend the bundle's lifetime
|
@@ -37,7 +38,7 @@ interface IPoolComponent is IComponent {
|
|
37
38
|
|
38
39
|
/// @dev locks the specified bundle
|
39
40
|
/// a bundle to be locked MUST be in active state
|
40
|
-
/// locked bundles may not be used to
|
41
|
+
/// locked bundles may not be used to collateralize any new policy
|
41
42
|
function lockBundle(NftId bundleNftId) external;
|
42
43
|
|
43
44
|
/// @dev unlocks the specified bundle
|
@@ -61,7 +62,7 @@ interface IPoolComponent is IComponent {
|
|
61
62
|
|
62
63
|
/// @dev sets the maximum overall capital amound held by this pool
|
63
64
|
/// function may only be called by pool owner
|
64
|
-
function setMaxCapitalAmount(
|
65
|
+
function setMaxCapitalAmount(Amount maxCapitalAmount) external;
|
65
66
|
|
66
67
|
/// @dev sets the required role to create/own bundles
|
67
68
|
/// may only be called once after setting up a pool
|
@@ -88,7 +89,7 @@ interface IPoolComponent is IComponent {
|
|
88
89
|
bytes memory applicationData,
|
89
90
|
NftId bundleNftId,
|
90
91
|
bytes memory bundleFilter,
|
91
|
-
|
92
|
+
Amount collateralizationAmount
|
92
93
|
) external;
|
93
94
|
|
94
95
|
/// @dev returns true iff the application matches with the bundle
|
@@ -99,7 +100,7 @@ interface IPoolComponent is IComponent {
|
|
99
100
|
bytes memory applicationData,
|
100
101
|
NftId bundleNftId,
|
101
102
|
bytes memory bundleFilter,
|
102
|
-
|
103
|
+
Amount collateralizationAmount
|
103
104
|
)
|
104
105
|
external
|
105
106
|
view
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {Amount} from "../types/Amount.sol";
|
4
5
|
import {Fee} from "../types/Fee.sol";
|
5
6
|
import {IComponent} from "./IComponent.sol";
|
6
7
|
import {ISetup} from "../instance/module/ISetup.sol";
|
@@ -19,20 +20,20 @@ interface IProductComponent is IComponent {
|
|
19
20
|
) external;
|
20
21
|
|
21
22
|
function calculatePremium(
|
22
|
-
|
23
|
+
Amount sumInsuredAmount,
|
23
24
|
RiskId riskId,
|
24
25
|
Seconds lifetime,
|
25
26
|
bytes memory applicationData,
|
26
27
|
NftId bundleNftId,
|
27
28
|
ReferralId referralId
|
28
|
-
) external view returns (
|
29
|
+
) external view returns (Amount premiumAmount);
|
29
30
|
|
30
31
|
function calculateNetPremium(
|
31
|
-
|
32
|
+
Amount sumInsuredAmount,
|
32
33
|
RiskId riskId,
|
33
34
|
Seconds lifetime,
|
34
35
|
bytes memory applicationData
|
35
|
-
) external view returns (
|
36
|
+
) external view returns (Amount netPremiumAmount);
|
36
37
|
|
37
38
|
|
38
39
|
function getPoolNftId() external view returns (NftId poolNftId);
|
@@ -1,21 +1,20 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {Amount, AmountLib} from "../types/Amount.sol";
|
4
5
|
import {Component} from "./Component.sol";
|
5
6
|
import {Fee, FeeLib} from "../types/Fee.sol";
|
6
7
|
import {IBundleService} from "../instance/service/IBundleService.sol";
|
7
|
-
import {InstanceReader} from "../instance/InstanceReader.sol";
|
8
8
|
import {IPoolComponent} from "./IPoolComponent.sol";
|
9
9
|
import {IPoolService} from "../instance/service/IPoolService.sol";
|
10
10
|
import {IComponents} from "../instance/module/IComponents.sol";
|
11
11
|
import {NftId, NftIdLib} from "../types/NftId.sol";
|
12
|
-
import {POOL} from "../types/ObjectType.sol";
|
12
|
+
import {BUNDLE, POOL} from "../types/ObjectType.sol";
|
13
13
|
import {RoleId, PUBLIC_ROLE} from "../types/RoleId.sol";
|
14
14
|
import {Seconds} from "../types/Seconds.sol";
|
15
15
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
16
16
|
import {UFixed, UFixedLib} from "../types/UFixed.sol";
|
17
17
|
|
18
|
-
|
19
18
|
abstract contract Pool is
|
20
19
|
Component,
|
21
20
|
IPoolComponent
|
@@ -61,8 +60,8 @@ abstract contract Pool is
|
|
61
60
|
initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner, registryData);
|
62
61
|
|
63
62
|
PoolStorage storage $ = _getPoolStorage();
|
64
|
-
$._poolService =
|
65
|
-
$._bundleService =
|
63
|
+
$._poolService = IPoolService(_getServiceAddress(POOL()));
|
64
|
+
$._bundleService = IBundleService(_getServiceAddress(BUNDLE()));
|
66
65
|
|
67
66
|
registerInterface(type(IPoolComponent).interfaceId);
|
68
67
|
}
|
@@ -70,7 +69,7 @@ abstract contract Pool is
|
|
70
69
|
|
71
70
|
function stake(
|
72
71
|
NftId bundleNftId,
|
73
|
-
|
72
|
+
Amount amount
|
74
73
|
)
|
75
74
|
public
|
76
75
|
virtual
|
@@ -83,7 +82,7 @@ abstract contract Pool is
|
|
83
82
|
|
84
83
|
function unstake(
|
85
84
|
NftId bundleNftId,
|
86
|
-
|
85
|
+
Amount amount
|
87
86
|
)
|
88
87
|
public
|
89
88
|
virtual
|
@@ -133,7 +132,7 @@ abstract contract Pool is
|
|
133
132
|
//restricted()
|
134
133
|
onlyBundleOwner(bundleNftId)
|
135
134
|
{
|
136
|
-
_getPoolStorage().
|
135
|
+
_getPoolStorage()._poolService.closeBundle(bundleNftId);
|
137
136
|
}
|
138
137
|
|
139
138
|
|
@@ -150,7 +149,7 @@ abstract contract Pool is
|
|
150
149
|
}
|
151
150
|
|
152
151
|
|
153
|
-
function setMaxCapitalAmount(
|
152
|
+
function setMaxCapitalAmount(Amount maxCapitalAmount)
|
154
153
|
public
|
155
154
|
virtual
|
156
155
|
restricted()
|
@@ -190,7 +189,7 @@ abstract contract Pool is
|
|
190
189
|
bytes memory applicationData,
|
191
190
|
NftId bundleNftId,
|
192
191
|
bytes memory bundleFilter,
|
193
|
-
|
192
|
+
Amount collateralizationAmount
|
194
193
|
)
|
195
194
|
public
|
196
195
|
virtual
|
@@ -219,7 +218,7 @@ abstract contract Pool is
|
|
219
218
|
bytes memory applicationData,
|
220
219
|
NftId bundleNftId,
|
221
220
|
bytes memory bundleFilter,
|
222
|
-
|
221
|
+
Amount collateralizationAmount
|
223
222
|
)
|
224
223
|
public
|
225
224
|
view
|
@@ -239,14 +238,14 @@ abstract contract Pool is
|
|
239
238
|
function _createBundle(
|
240
239
|
address bundleOwner,
|
241
240
|
Fee memory fee,
|
242
|
-
|
241
|
+
Amount amount,
|
243
242
|
Seconds lifetime,
|
244
243
|
bytes memory filter
|
245
244
|
)
|
246
245
|
internal
|
247
246
|
returns(NftId bundleNftId)
|
248
247
|
{
|
249
|
-
bundleNftId = _getPoolStorage().
|
248
|
+
bundleNftId = _getPoolStorage()._poolService.createBundle(
|
250
249
|
bundleOwner,
|
251
250
|
fee,
|
252
251
|
amount,
|
@@ -274,11 +273,15 @@ abstract contract Pool is
|
|
274
273
|
getToken(),
|
275
274
|
TokenHandler(address(0)), // will be created by GIF service during registration
|
276
275
|
address(this), // contract is its own wallet
|
276
|
+
AmountLib.zero(), // balance amount
|
277
|
+
AmountLib.zero(), // fee amount
|
277
278
|
abi.encode(
|
278
279
|
IComponents.PoolInfo(
|
279
280
|
NftIdLib.zero(), // will be set when GIF registers the related product
|
280
281
|
PUBLIC_ROLE(), // bundleOwnerRole
|
281
|
-
|
282
|
+
AmountLib.max(), // maxCapitalAmount,
|
283
|
+
AmountLib.zero(), // initial balance amount
|
284
|
+
AmountLib.zero(), // initial fee amount
|
282
285
|
isNftInterceptor(), // isInterceptingBundleTransfers
|
283
286
|
false, // isExternallyManaged,
|
284
287
|
false, // isVerifyingApplications,
|
@@ -3,21 +3,25 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
|
+
import {Amount, AmountLib} from "../types/Amount.sol";
|
7
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
8
|
+
import {Component} from "./Component.sol";
|
9
|
+
import {Fee} from "../types/Fee.sol";
|
6
10
|
import {IRisk} from "../instance/module/IRisk.sol";
|
7
11
|
import {IApplicationService} from "../instance/service/IApplicationService.sol";
|
8
12
|
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
9
13
|
import {IProductService} from "../instance/service/IProductService.sol";
|
10
14
|
import {IClaimService} from "../instance/service/IClaimService.sol";
|
15
|
+
import {IPricingService} from "../instance/service/IPricingService.sol";
|
11
16
|
import {IProductComponent} from "./IProductComponent.sol";
|
12
17
|
import {NftId, NftIdLib} from "../types/NftId.sol";
|
13
|
-
import {
|
18
|
+
import {PayoutId} from "../types/PayoutId.sol";
|
19
|
+
import {PRODUCT, APPLICATION, POLICY, CLAIM, PRICE } from "../types/ObjectType.sol";
|
14
20
|
import {ReferralId} from "../types/Referral.sol";
|
15
21
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
16
22
|
import {Seconds} from "../types/Seconds.sol";
|
17
23
|
import {StateId} from "../types/StateId.sol";
|
18
24
|
import {Timestamp} from "../types/Timestamp.sol";
|
19
|
-
import {Fee} from "../types/Fee.sol";
|
20
|
-
import {Component} from "./Component.sol";
|
21
25
|
|
22
26
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
23
27
|
|
@@ -40,6 +44,7 @@ abstract contract Product is
|
|
40
44
|
IApplicationService _applicationService;
|
41
45
|
IPolicyService _policyService;
|
42
46
|
IClaimService _claimService;
|
47
|
+
IPricingService _pricingService;
|
43
48
|
Pool _pool;
|
44
49
|
Distribution _distribution;
|
45
50
|
Fee _initialProductFee;
|
@@ -70,11 +75,12 @@ abstract contract Product is
|
|
70
75
|
|
71
76
|
ProductStorage storage $ = _getProductStorage();
|
72
77
|
// TODO add validation
|
73
|
-
// TODO refactor to go via registry
|
78
|
+
// TODO refactor to go via registry ?
|
74
79
|
$._productService = IProductService(_getServiceAddress(PRODUCT()));
|
75
80
|
$._applicationService = IApplicationService(_getServiceAddress(APPLICATION()));
|
76
81
|
$._policyService = IPolicyService(_getServiceAddress(POLICY()));
|
77
82
|
$._claimService = IClaimService(_getServiceAddress(CLAIM()));
|
83
|
+
$._pricingService = IPricingService(_getServiceAddress(PRICE()));
|
78
84
|
$._pool = Pool(pool);
|
79
85
|
$._distribution = Distribution(distribution);
|
80
86
|
$._initialProductFee = productFee;
|
@@ -86,50 +92,17 @@ abstract contract Product is
|
|
86
92
|
registerInterface(type(IProductComponent).interfaceId);
|
87
93
|
}
|
88
94
|
|
89
|
-
|
90
|
-
function
|
91
|
-
|
92
|
-
|
93
|
-
Seconds lifetime,
|
94
|
-
bytes memory applicationData,
|
95
|
-
NftId bundleNftId,
|
96
|
-
ReferralId referralId
|
97
|
-
)
|
98
|
-
external
|
99
|
-
view
|
100
|
-
override
|
101
|
-
returns (uint256 premiumAmount)
|
102
|
-
{
|
103
|
-
IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
|
104
|
-
getNftId(),
|
105
|
-
riskId,
|
106
|
-
sumInsuredAmount,
|
107
|
-
lifetime,
|
108
|
-
applicationData,
|
109
|
-
bundleNftId,
|
110
|
-
referralId
|
111
|
-
);
|
112
|
-
premiumAmount = premium.premiumAmount;
|
113
|
-
}
|
114
|
-
|
115
|
-
|
116
|
-
function calculateNetPremium(
|
117
|
-
uint256 sumInsuredAmount,
|
118
|
-
RiskId riskId,
|
119
|
-
Seconds lifetime,
|
120
|
-
bytes memory applicationData
|
95
|
+
// from product component
|
96
|
+
function setFees(
|
97
|
+
Fee memory productFee,
|
98
|
+
Fee memory processingFee
|
121
99
|
)
|
122
100
|
external
|
123
|
-
|
124
|
-
|
125
|
-
|
101
|
+
onlyOwner
|
102
|
+
restricted()
|
103
|
+
override
|
126
104
|
{
|
127
|
-
|
128
|
-
return sumInsuredAmount / 10;
|
129
|
-
}
|
130
|
-
|
131
|
-
function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
|
132
|
-
return RiskIdLib.toRiskId(riskName);
|
105
|
+
_getProductService().setFees(productFee, processingFee);
|
133
106
|
}
|
134
107
|
|
135
108
|
function _createRisk(
|
@@ -169,7 +142,7 @@ abstract contract Product is
|
|
169
142
|
function _createApplication(
|
170
143
|
address applicationOwner,
|
171
144
|
RiskId riskId,
|
172
|
-
|
145
|
+
Amount sumInsuredAmount,
|
173
146
|
Seconds lifetime,
|
174
147
|
NftId bundleNftId,
|
175
148
|
ReferralId referralId,
|
@@ -189,14 +162,14 @@ abstract contract Product is
|
|
189
162
|
);
|
190
163
|
}
|
191
164
|
|
192
|
-
function
|
165
|
+
function _collateralize(
|
193
166
|
NftId policyNftId,
|
194
167
|
bool requirePremiumPayment,
|
195
168
|
Timestamp activateAt
|
196
169
|
)
|
197
170
|
internal
|
198
171
|
{
|
199
|
-
_getProductStorage()._policyService.
|
172
|
+
_getProductStorage()._policyService.collateralize(
|
200
173
|
policyNftId,
|
201
174
|
requirePremiumPayment,
|
202
175
|
activateAt);
|
@@ -229,28 +202,137 @@ abstract contract Product is
|
|
229
202
|
)
|
230
203
|
internal
|
231
204
|
{
|
232
|
-
_getProductStorage()._policyService.close(
|
205
|
+
_getProductStorage()._policyService.close(
|
206
|
+
policyNftId);
|
233
207
|
}
|
234
208
|
|
235
|
-
function
|
236
|
-
|
209
|
+
function _submitClaim(
|
210
|
+
NftId policyNftId,
|
211
|
+
Amount claimAmount,
|
212
|
+
bytes memory claimData
|
213
|
+
)
|
214
|
+
internal
|
215
|
+
returns(ClaimId)
|
216
|
+
{
|
217
|
+
return _getProductStorage()._claimService.submit(
|
218
|
+
policyNftId,
|
219
|
+
claimAmount,
|
220
|
+
claimData);
|
237
221
|
}
|
238
222
|
|
239
|
-
function
|
240
|
-
|
223
|
+
function _confirmClaim(
|
224
|
+
NftId policyNftId,
|
225
|
+
ClaimId claimId,
|
226
|
+
Amount confirmedAmount
|
227
|
+
)
|
228
|
+
internal
|
229
|
+
{
|
230
|
+
_getProductStorage()._claimService.confirm(
|
231
|
+
policyNftId,
|
232
|
+
claimId,
|
233
|
+
confirmedAmount);
|
241
234
|
}
|
242
235
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
236
|
+
function _declineClaim(
|
237
|
+
NftId policyNftId,
|
238
|
+
ClaimId claimId
|
239
|
+
)
|
240
|
+
internal
|
241
|
+
{
|
242
|
+
_getProductStorage()._claimService.decline(
|
243
|
+
policyNftId,
|
244
|
+
claimId);
|
245
|
+
}
|
246
|
+
|
247
|
+
function _closeClaim(
|
248
|
+
NftId policyNftId,
|
249
|
+
ClaimId claimId
|
250
|
+
)
|
251
|
+
internal
|
252
|
+
{
|
253
|
+
_getProductStorage()._claimService.close(
|
254
|
+
policyNftId,
|
255
|
+
claimId);
|
256
|
+
}
|
257
|
+
|
258
|
+
function _createPayout(
|
259
|
+
NftId policyNftId,
|
260
|
+
ClaimId claimId,
|
261
|
+
Amount amount,
|
262
|
+
bytes memory data
|
263
|
+
)
|
264
|
+
internal
|
265
|
+
returns (PayoutId)
|
266
|
+
{
|
267
|
+
return _getProductStorage()._claimService.createPayout(
|
268
|
+
policyNftId,
|
269
|
+
claimId,
|
270
|
+
amount,
|
271
|
+
data);
|
272
|
+
}
|
273
|
+
|
274
|
+
function _processPayout(
|
275
|
+
NftId policyNftId,
|
276
|
+
PayoutId payoutId
|
277
|
+
)
|
278
|
+
internal
|
279
|
+
{
|
280
|
+
_getProductStorage()._claimService.processPayout(
|
281
|
+
policyNftId,
|
282
|
+
payoutId);
|
283
|
+
}
|
284
|
+
|
285
|
+
function calculatePremium(
|
286
|
+
Amount sumInsuredAmount,
|
287
|
+
RiskId riskId,
|
288
|
+
Seconds lifetime,
|
289
|
+
bytes memory applicationData,
|
290
|
+
NftId bundleNftId,
|
291
|
+
ReferralId referralId
|
292
|
+
)
|
293
|
+
external
|
294
|
+
view
|
295
|
+
override
|
296
|
+
returns (Amount premiumAmount)
|
297
|
+
{
|
298
|
+
IPolicy.Premium memory premium = _getProductStorage()._pricingService.calculatePremium(
|
299
|
+
getNftId(),
|
300
|
+
riskId,
|
301
|
+
sumInsuredAmount,
|
302
|
+
lifetime,
|
303
|
+
applicationData,
|
304
|
+
bundleNftId,
|
305
|
+
referralId
|
306
|
+
);
|
307
|
+
|
308
|
+
return AmountLib.toAmount(premium.premiumAmount);
|
309
|
+
}
|
310
|
+
|
311
|
+
function calculateNetPremium(
|
312
|
+
Amount sumInsuredAmount,
|
313
|
+
RiskId riskId,
|
314
|
+
Seconds lifetime,
|
315
|
+
bytes memory applicationData
|
247
316
|
)
|
248
317
|
external
|
249
|
-
|
250
|
-
|
251
|
-
|
318
|
+
view
|
319
|
+
virtual override
|
320
|
+
returns (Amount netPremiumAmount)
|
252
321
|
{
|
253
|
-
|
322
|
+
// default 10% of sum insured
|
323
|
+
return AmountLib.toAmount(sumInsuredAmount.toInt() / 10);
|
324
|
+
}
|
325
|
+
|
326
|
+
function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
|
327
|
+
return RiskIdLib.toRiskId(riskName);
|
328
|
+
}
|
329
|
+
|
330
|
+
function getPoolNftId() external view override returns (NftId poolNftId) {
|
331
|
+
return getRegistry().getNftId(address(_getProductStorage()._pool));
|
332
|
+
}
|
333
|
+
|
334
|
+
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
335
|
+
return getRegistry().getNftId(address(_getProductStorage()._distribution));
|
254
336
|
}
|
255
337
|
|
256
338
|
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
@@ -290,4 +372,4 @@ abstract contract Product is
|
|
290
372
|
function _getProductService() internal view returns (IProductService) {
|
291
373
|
return _getProductStorage()._productService;
|
292
374
|
}
|
293
|
-
}
|
375
|
+
}
|
@@ -34,8 +34,7 @@ contract BundleManager is
|
|
34
34
|
mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
|
35
35
|
|
36
36
|
/// @dev links a policy to its bundle
|
37
|
-
// to link a policy it MUST NOT yet have been
|
38
|
-
// the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
|
37
|
+
// to link a policy it MUST NOT yet have been linked
|
39
38
|
function linkPolicy(NftId policyNftId) external restricted() {
|
40
39
|
NftId bundleNftId = _instance.getInstanceReader().getPolicyInfo(policyNftId).bundleNftId;
|
41
40
|
// decision will likely depend on the decision what to check here and what in the service
|
@@ -87,14 +86,14 @@ contract BundleManager is
|
|
87
86
|
}
|
88
87
|
|
89
88
|
|
90
|
-
/// @dev unlocked (active) bundles are available to
|
89
|
+
/// @dev unlocked (active) bundles are available to collateralize new policies
|
91
90
|
function unlock(NftId bundleNftId) external restricted() {
|
92
91
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
93
92
|
_activate(poolNftId, bundleNftId);
|
94
93
|
emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
|
95
94
|
}
|
96
95
|
|
97
|
-
/// @dev locked (deactivated) bundles may not
|
96
|
+
/// @dev locked (deactivated) bundles may not collateralize any new policies
|
98
97
|
function lock(NftId bundleNftId) external restricted() {
|
99
98
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
100
99
|
_deactivate(poolNftId, bundleNftId);
|