@etherisc/gif-next 0.0.2-f29e479-370 → 0.0.2-f2df3e2-873
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -83
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +78 -89
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +139 -140
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +156 -64
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +181 -112
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +353 -176
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +162 -138
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +299 -245
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +83 -162
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +64 -50
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +527 -400
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +175 -51
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +500 -612
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +472 -126
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +253 -236
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +305 -211
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +71 -23
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -13
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +86 -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/KeyValueStore.sol/KeyValueStore.json +40 -10
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +56 -73
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +291 -100
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +46 -22
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +422 -252
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +78 -14
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +373 -87
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +55 -7
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +579 -123
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +71 -47
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +200 -46
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +241 -188
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +251 -58
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +444 -25
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +430 -76
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +511 -14
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +80 -14
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +544 -153
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +51 -27
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +562 -52
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +24 -12
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +115 -52
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +16 -12
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +19 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +0 -24
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +31 -12
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -37
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +7 -7
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +23 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +80 -14
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +3 -3
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +87 -16
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +3 -3
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +102 -27
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +185 -0
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +83 -4
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +40 -9
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +116 -7
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +38 -7
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
- package/contracts/components/Component.sol +99 -87
- package/contracts/components/Distribution.sol +18 -21
- package/contracts/components/IComponent.sol +40 -18
- package/contracts/components/IDistributionComponent.sol +1 -22
- package/contracts/components/IPoolComponent.sol +73 -47
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +178 -130
- package/contracts/components/Product.sol +157 -71
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +10 -9
- package/contracts/instance/Cloneable.sol +7 -2
- package/contracts/instance/IInstance.sol +37 -27
- package/contracts/instance/IInstanceService.sol +18 -9
- package/contracts/instance/Instance.sol +117 -98
- package/contracts/instance/InstanceAccessManager.sol +388 -158
- package/contracts/instance/InstanceReader.sol +36 -12
- package/contracts/instance/InstanceService.sol +193 -191
- package/contracts/instance/ObjectManager.sol +6 -8
- package/contracts/instance/base/ComponentService.sol +17 -30
- package/contracts/instance/base/KeyValueStore.sol +13 -5
- package/contracts/instance/base/Lifecycle.sol +23 -6
- package/contracts/instance/module/IAccess.sol +21 -14
- package/contracts/instance/module/IBundle.sol +8 -5
- package/contracts/instance/module/IComponents.sol +41 -0
- package/contracts/instance/module/IDistribution.sol +2 -1
- package/contracts/instance/module/IPolicy.sol +37 -7
- package/contracts/instance/module/ISetup.sol +7 -22
- package/contracts/instance/service/ApplicationService.sol +137 -50
- package/contracts/instance/service/BundleService.sol +221 -83
- package/contracts/instance/service/ClaimService.sol +114 -26
- package/contracts/instance/service/DistributionService.sol +174 -118
- package/contracts/instance/service/IApplicationService.sol +9 -13
- package/contracts/instance/service/IBundleService.sol +68 -26
- package/contracts/instance/service/IClaimService.sol +46 -15
- package/contracts/instance/service/IDistributionService.sol +20 -4
- package/contracts/instance/service/IPolicyService.sol +69 -21
- package/contracts/instance/service/IPoolService.sol +82 -3
- package/contracts/instance/service/PolicyService.sol +297 -232
- package/contracts/instance/service/PoolService.sol +214 -20
- package/contracts/instance/service/ProductService.sol +31 -54
- package/contracts/registry/ChainNft.sol +8 -0
- package/contracts/registry/IRegistry.sol +2 -0
- package/contracts/registry/IRegistryService.sol +4 -3
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +23 -20
- package/contracts/registry/RegistryService.sol +15 -16
- package/contracts/registry/ReleaseManager.sol +20 -18
- package/contracts/shared/IService.sol +4 -6
- package/contracts/shared/Registerable.sol +2 -2
- package/contracts/shared/Service.sol +21 -7
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +65 -0
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +25 -2
- package/contracts/types/Fee.sol +13 -5
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +6 -5
- package/contracts/types/PayoutId.sol +33 -5
- package/contracts/types/Referral.sol +4 -0
- package/contracts/types/RoleId.sol +13 -6
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +7 -2
- package/contracts/types/Timestamp.sol +18 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
@@ -3,85 +3,111 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {Fee} from "../types/Fee.sol";
|
5
5
|
import {IComponent} from "./IComponent.sol";
|
6
|
-
import {
|
6
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
7
7
|
import {NftId} from "../types/NftId.sol";
|
8
|
+
import {RoleId} from "../types/RoleId.sol";
|
9
|
+
import {Seconds} from "../types/Seconds.sol";
|
8
10
|
import {UFixed} from "../types/UFixed.sol";
|
9
11
|
|
10
12
|
/// @dev pool components hold and manage the collateral to cover active policies
|
11
13
|
/// pools come in different flavors
|
12
14
|
interface IPoolComponent is IComponent {
|
13
15
|
|
14
|
-
|
16
|
+
error ErrorPoolNotBundleOwner(NftId bundleNftId, address caller);
|
17
|
+
error ErrorPoolNotPoolService(address caller);
|
15
18
|
|
16
|
-
error
|
19
|
+
error ErrorPoolApplicationBundleMismatch(NftId applicationNftId);
|
17
20
|
|
18
|
-
|
21
|
+
event LogPoolVerifiedByPool(address pool, NftId applicationNftId, uint256 collateralizationAmount);
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
/// @dev increases the staked tokens by the specified amount
|
24
|
+
/// only the bundle owner may stake tokens
|
25
|
+
/// bundle MUST be in active or locked state
|
26
|
+
function stake(NftId bundleNftId, uint256 amount) external;
|
27
|
+
|
28
|
+
/// @dev decreases the staked tokens by the specified amount
|
29
|
+
/// only the bundle owner may unstake tokens from the bundle
|
30
|
+
/// bundle MUST be in active, locked or closed state
|
31
|
+
function unstake(NftId bundleNftId, uint256 amount) external;
|
25
32
|
|
26
|
-
/// @dev
|
33
|
+
/// @dev extends the bundle lifetime of the bundle by the specified time
|
34
|
+
/// only the bundle owner may extend the bundle's lifetime
|
35
|
+
/// bundle MUST be in active or locked state
|
36
|
+
function extend(NftId bundleNftId, Seconds lifetimeExtension) external;
|
37
|
+
|
38
|
+
/// @dev locks the specified bundle
|
39
|
+
/// a bundle to be locked MUST be in active state
|
40
|
+
/// locked bundles may not be used to collateralize any new policy
|
41
|
+
function lockBundle(NftId bundleNftId) external;
|
42
|
+
|
43
|
+
/// @dev unlocks the specified bundle
|
44
|
+
/// a bundle to be unlocked MUST be in locked state
|
45
|
+
function unlockBundle(NftId bundleNftId) external;
|
46
|
+
|
47
|
+
/// @dev close the specified bundle
|
48
|
+
/// a bundle to be closed MUST be in active or locked state
|
49
|
+
/// to close a bundle all all linked policies MUST be in closed state as well
|
50
|
+
/// closing a bundle finalizes the bundle bookkeeping including overall profit calculation
|
51
|
+
/// once a bundle is closed this action cannot be reversed
|
52
|
+
function close(NftId bundleNftId) external;
|
53
|
+
|
54
|
+
/// @dev sets the fee for the specified bundle
|
55
|
+
/// the fee is added on top of the poolFee and deducted from the premium amounts
|
27
56
|
/// via these fees individual bundler owner may earn income per policy in the context of peer to peer pools
|
28
57
|
function setBundleFee(
|
29
58
|
NftId bundleNftId,
|
30
59
|
Fee memory fee
|
31
60
|
) external;
|
32
61
|
|
62
|
+
/// @dev sets the maximum overall capital amound held by this pool
|
63
|
+
/// function may only be called by pool owner
|
64
|
+
function setMaxCapitalAmount(uint256 maxCapitalAmount) external;
|
65
|
+
|
66
|
+
/// @dev sets the required role to create/own bundles
|
67
|
+
/// may only be called once after setting up a pool
|
68
|
+
/// may only be called by pool owner
|
69
|
+
function setBundleOwnerRole(RoleId bundleOwnerRole) external;
|
70
|
+
|
71
|
+
/// @dev update pool fees to the specified values
|
72
|
+
/// pool fees: are deducted from the premium amount and goes to the pool owner
|
73
|
+
/// staking fees: are deducted from the staked tokens by a bundle owner and goes to the pool owner
|
74
|
+
/// performance fees: when a bundle is closed a bundle specific profit is calculated
|
75
|
+
/// the performance fee is deducted from this profit and goes to the pool owner
|
76
|
+
function setFees(
|
77
|
+
Fee memory poolFee,
|
78
|
+
Fee memory stakingFee,
|
79
|
+
Fee memory performanceFee
|
80
|
+
) external;
|
81
|
+
|
33
82
|
/// @dev this is a callback function that is called by the product service when underwriting a policy.
|
34
83
|
/// the pool has the option to check the details and object to underwriting by reverting.
|
35
84
|
/// the function is only called for "active" pools that ask to be involved/notified
|
36
85
|
/// by product related state changes.
|
37
86
|
function verifyApplication(
|
38
87
|
NftId applicationNftId,
|
39
|
-
bytes memory
|
88
|
+
bytes memory applicationData,
|
89
|
+
NftId bundleNftId,
|
40
90
|
bytes memory bundleFilter,
|
41
91
|
uint256 collateralizationAmount
|
42
92
|
) external;
|
43
93
|
|
44
|
-
|
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
|
-
/// default implementation returns 100%
|
50
|
-
function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
|
51
|
-
|
52
|
-
/// @dev defines the amount of collateral held in the pool.
|
53
|
-
/// if the value is < 100% the pool is required to hold a policy that covers the locally missing collateral
|
54
|
-
/// default implementation returns 100%
|
55
|
-
function getRetentionLevel() external view returns (UFixed retentionLevel);
|
56
|
-
|
57
|
-
/// @dev declares if pool intercept transfers of bundle nft ids
|
58
|
-
/// - yes: pool may block transfer of bundle ownership or simply updates some bookkeeping related to bundle ownership. callback function is nftTransferFrom
|
59
|
-
/// - no: pool is not involved in transfer of bundle ownership
|
60
|
-
/// default implementation returns false (no)
|
61
|
-
function isInterceptingBundleTransfers() external view returns (bool);
|
62
|
-
|
63
|
-
/// @dev declares if pool relies on external management of collateral (yes/no):
|
64
|
-
/// - 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
|
65
|
-
/// - no: the pool smart contract ensures that the necessary capacity of the pool prior to underwriting.
|
66
|
-
/// default implementation returns false (no)
|
67
|
-
function isExternallyManaged() external view returns (bool);
|
68
|
-
|
69
|
-
/// @dev declares if pool component is actively involved in underwriting (yes/no):
|
70
|
-
/// - 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
|
71
|
-
/// - no: underwriting a policy does not require any interaction with the pool component if the covering bundle can provide the necessary captial
|
72
|
-
/// default implementation returnsfalse (no)
|
73
|
-
function isVerifyingApplications() external view returns (bool);
|
74
|
-
|
75
|
-
/// @dev returns true iff the policy application data in policyData matches
|
76
|
-
/// with the bundle filter criteria encoded in bundleFilter
|
94
|
+
/// @dev returns true iff the application matches with the bundle
|
77
95
|
/// this is a callback function that is only called if a pool declares itself as a verifying pool
|
78
96
|
/// default implementation returns true
|
79
|
-
function
|
80
|
-
|
81
|
-
bytes memory
|
97
|
+
function applicationMatchesBundle(
|
98
|
+
NftId applicationNftId,
|
99
|
+
bytes memory applicationData,
|
100
|
+
NftId bundleNftId,
|
101
|
+
bytes memory bundleFilter,
|
102
|
+
uint256 collateralizationAmount
|
82
103
|
)
|
83
104
|
external
|
84
105
|
view
|
85
106
|
returns (bool isMatching);
|
86
107
|
|
108
|
+
/// @dev returns pool specific infos for this pool
|
109
|
+
/// when registered with an instance the info is obtained from the data stored in the instance
|
110
|
+
/// when not registered the function returns the info from the component contract
|
111
|
+
function getPoolInfo() external view returns (IComponents.PoolInfo memory info);
|
112
|
+
|
87
113
|
}
|
@@ -7,6 +7,7 @@ import {ISetup} from "../instance/module/ISetup.sol";
|
|
7
7
|
import {NftId} from "../types/NftId.sol";
|
8
8
|
import {ReferralId} from "../types/Referral.sol";
|
9
9
|
import {RiskId} from "../types/RiskId.sol";
|
10
|
+
import {Seconds} from "../types/Seconds.sol";
|
10
11
|
|
11
12
|
interface IProductComponent is IComponent {
|
12
13
|
|
@@ -20,7 +21,7 @@ interface IProductComponent is IComponent {
|
|
20
21
|
function calculatePremium(
|
21
22
|
uint256 sumInsuredAmount,
|
22
23
|
RiskId riskId,
|
23
|
-
|
24
|
+
Seconds lifetime,
|
24
25
|
bytes memory applicationData,
|
25
26
|
NftId bundleNftId,
|
26
27
|
ReferralId referralId
|
@@ -29,7 +30,7 @@ interface IProductComponent is IComponent {
|
|
29
30
|
function calculateNetPremium(
|
30
31
|
uint256 sumInsuredAmount,
|
31
32
|
RiskId riskId,
|
32
|
-
|
33
|
+
Seconds lifetime,
|
33
34
|
bytes memory applicationData
|
34
35
|
) external view returns (uint256 netPremiumAmount);
|
35
36
|
|
@@ -1,20 +1,19 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {IBundleService} from "../instance/service/IBundleService.sol";
|
7
|
-
import {NftId, NftIdLib} from "../types/NftId.sol";
|
4
|
+
import {Amount, AmountLib} from "../types/Amount.sol";
|
5
|
+
import {Component} from "./Component.sol";
|
8
6
|
import {Fee, FeeLib} from "../types/Fee.sol";
|
9
|
-
import {
|
7
|
+
import {IBundleService} from "../instance/service/IBundleService.sol";
|
10
8
|
import {IPoolComponent} from "./IPoolComponent.sol";
|
11
|
-
import {
|
9
|
+
import {IPoolService} from "../instance/service/IPoolService.sol";
|
10
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
11
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
12
|
+
import {BUNDLE, POOL} from "../types/ObjectType.sol";
|
13
|
+
import {RoleId, PUBLIC_ROLE} from "../types/RoleId.sol";
|
14
|
+
import {Seconds} from "../types/Seconds.sol";
|
12
15
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
13
|
-
import {
|
14
|
-
|
15
|
-
import {ISetup} from "../instance/module/ISetup.sol";
|
16
|
-
import {InstanceReader} from "../instance/InstanceReader.sol";
|
17
|
-
|
16
|
+
import {UFixed, UFixedLib} from "../types/UFixed.sol";
|
18
17
|
|
19
18
|
abstract contract Pool is
|
20
19
|
Component,
|
@@ -24,24 +23,19 @@ abstract contract Pool is
|
|
24
23
|
bytes32 public constant POOL_STORAGE_LOCATION_V1 = 0x25e3e51823fbfffb988e0a2744bb93722d9f3e906c07cc0a9e77884c46c58300;
|
25
24
|
|
26
25
|
struct PoolStorage {
|
27
|
-
UFixed _collateralizationLevel;
|
28
|
-
UFixed _retentionLevel;
|
29
|
-
|
30
|
-
bool _isExternallyManaged;
|
31
|
-
bool _isInterceptingBundleTransfers;
|
32
|
-
bool _isVerifyingApplications;
|
33
|
-
|
34
|
-
Fee _initialPoolFee;
|
35
|
-
Fee _initialStakingFee;
|
36
|
-
Fee _initialPerformanceFee;
|
37
|
-
|
38
|
-
TokenHandler _tokenHandler;
|
39
|
-
|
40
|
-
// may be used to interact with instance by derived contracts
|
41
26
|
IPoolService _poolService;
|
42
27
|
IBundleService _bundleService;
|
43
28
|
}
|
44
29
|
|
30
|
+
|
31
|
+
modifier onlyBundleOwner(NftId bundleNftId) {
|
32
|
+
if(msg.sender != getRegistry().ownerOf(bundleNftId)) {
|
33
|
+
revert ErrorPoolNotBundleOwner(bundleNftId, msg.sender);
|
34
|
+
}
|
35
|
+
_;
|
36
|
+
}
|
37
|
+
|
38
|
+
|
45
39
|
modifier onlyPoolService() {
|
46
40
|
if(msg.sender != address(_getPoolStorage()._poolService)) {
|
47
41
|
revert ErrorPoolNotPoolService(msg.sender);
|
@@ -54,98 +48,124 @@ abstract contract Pool is
|
|
54
48
|
address registry,
|
55
49
|
NftId instanceNftId,
|
56
50
|
string memory name,
|
57
|
-
// TODO refactor into tokenNftId
|
58
51
|
address token,
|
59
52
|
bool isInterceptingNftTransfers,
|
60
|
-
bool isExternallyManaging,
|
61
|
-
bool isVerifying,
|
62
|
-
UFixed collateralizationLevel,
|
63
|
-
UFixed retentionLevel,
|
64
53
|
address initialOwner,
|
65
|
-
bytes memory data
|
54
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
66
55
|
)
|
67
56
|
public
|
68
57
|
virtual
|
69
58
|
onlyInitializing()
|
70
59
|
{
|
71
|
-
initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner,
|
60
|
+
initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner, registryData);
|
72
61
|
|
73
62
|
PoolStorage storage $ = _getPoolStorage();
|
74
|
-
|
75
|
-
$.
|
76
|
-
$._isExternallyManaged = isExternallyManaging;
|
77
|
-
$._isVerifyingApplications = isVerifying;
|
78
|
-
$._collateralizationLevel = collateralizationLevel;
|
79
|
-
$._retentionLevel = retentionLevel;
|
80
|
-
$._initialPoolFee = FeeLib.zeroFee();
|
81
|
-
$._initialStakingFee = FeeLib.zeroFee();
|
82
|
-
$._initialPerformanceFee = FeeLib.zeroFee();
|
83
|
-
$._poolService = getInstance().getPoolService();
|
84
|
-
$._bundleService = getInstance().getBundleService();
|
63
|
+
$._poolService = IPoolService(_getServiceAddress(POOL()));
|
64
|
+
$._bundleService = IBundleService(_getServiceAddress(BUNDLE()));
|
85
65
|
|
86
66
|
registerInterface(type(IPoolComponent).interfaceId);
|
87
67
|
}
|
88
68
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
function verifyApplication(
|
94
|
-
NftId applicationNftId,
|
95
|
-
bytes memory applicationData,
|
96
|
-
bytes memory bundleFilter,
|
97
|
-
uint256 collateralizationAmount
|
69
|
+
|
70
|
+
function stake(
|
71
|
+
NftId bundleNftId,
|
72
|
+
uint256 amount
|
98
73
|
)
|
99
|
-
|
74
|
+
public
|
75
|
+
virtual
|
100
76
|
restricted()
|
101
|
-
|
77
|
+
onlyBundleOwner(bundleNftId)
|
102
78
|
{
|
103
|
-
|
104
|
-
policyMatchesBundle(applicationData, bundleFilter),
|
105
|
-
"ERROR:POL-020:POLICY_BUNDLE_MISMATCH"
|
106
|
-
);
|
107
|
-
|
108
|
-
emit LogUnderwrittenByPool(applicationNftId, collateralizationAmount, address(this));
|
79
|
+
// TODO add implementation
|
109
80
|
}
|
110
81
|
|
111
82
|
|
112
|
-
function
|
113
|
-
|
83
|
+
function unstake(
|
84
|
+
NftId bundleNftId,
|
85
|
+
uint256 amount
|
86
|
+
)
|
87
|
+
public
|
88
|
+
virtual
|
89
|
+
restricted()
|
90
|
+
onlyBundleOwner(bundleNftId)
|
91
|
+
{
|
92
|
+
// TODO add implementation
|
114
93
|
}
|
115
94
|
|
116
95
|
|
117
|
-
function
|
118
|
-
|
96
|
+
function extend(
|
97
|
+
NftId bundleNftId,
|
98
|
+
Seconds lifetimeExtension
|
99
|
+
)
|
100
|
+
public
|
101
|
+
virtual
|
102
|
+
restricted()
|
103
|
+
onlyBundleOwner(bundleNftId)
|
104
|
+
{
|
105
|
+
// TODO add implementation
|
119
106
|
}
|
120
107
|
|
121
108
|
|
122
|
-
function
|
123
|
-
|
109
|
+
function lockBundle(NftId bundleNftId)
|
110
|
+
public
|
111
|
+
virtual
|
112
|
+
//restricted() // TODO consider adding this back
|
113
|
+
onlyBundleOwner(bundleNftId)
|
114
|
+
{
|
115
|
+
_getPoolStorage()._bundleService.lock(bundleNftId);
|
124
116
|
}
|
125
117
|
|
126
118
|
|
127
|
-
function
|
128
|
-
|
119
|
+
function unlockBundle(NftId bundleNftId)
|
120
|
+
public
|
121
|
+
virtual
|
122
|
+
//restricted()
|
123
|
+
onlyBundleOwner(bundleNftId)
|
124
|
+
{
|
125
|
+
_getPoolStorage()._bundleService.unlock(bundleNftId);
|
129
126
|
}
|
130
127
|
|
131
128
|
|
132
|
-
function
|
133
|
-
|
129
|
+
function close(NftId bundleNftId)
|
130
|
+
public
|
131
|
+
virtual
|
132
|
+
//restricted()
|
133
|
+
onlyBundleOwner(bundleNftId)
|
134
|
+
{
|
135
|
+
_getPoolStorage()._poolService.closeBundle(bundleNftId);
|
134
136
|
}
|
135
137
|
|
136
138
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
bytes memory, // policyData
|
141
|
-
bytes memory // bundleFilter
|
139
|
+
function setBundleFee(
|
140
|
+
NftId bundleNftId,
|
141
|
+
Fee memory fee
|
142
142
|
)
|
143
143
|
public
|
144
|
-
|
145
|
-
|
146
|
-
|
144
|
+
virtual
|
145
|
+
restricted()
|
146
|
+
onlyBundleOwner(bundleNftId)
|
147
147
|
{
|
148
|
-
|
148
|
+
_getPoolStorage()._bundleService.setFee(bundleNftId, fee);
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
function setMaxCapitalAmount(uint256 maxCapitalAmount)
|
153
|
+
public
|
154
|
+
virtual
|
155
|
+
restricted()
|
156
|
+
onlyOwner()
|
157
|
+
{
|
158
|
+
_getPoolStorage()._poolService.setMaxCapitalAmount(maxCapitalAmount);
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
function setBundleOwnerRole(RoleId bundleOwnerRole)
|
163
|
+
public
|
164
|
+
virtual
|
165
|
+
restricted()
|
166
|
+
onlyOwner()
|
167
|
+
{
|
168
|
+
_getPoolStorage()._poolService.setBundleOwnerRole(bundleOwnerRole);
|
149
169
|
}
|
150
170
|
|
151
171
|
|
@@ -154,70 +174,63 @@ abstract contract Pool is
|
|
154
174
|
Fee memory stakingFee,
|
155
175
|
Fee memory performanceFee
|
156
176
|
)
|
157
|
-
|
158
|
-
|
177
|
+
public
|
178
|
+
virtual
|
159
179
|
restricted()
|
160
|
-
|
180
|
+
onlyOwner()
|
161
181
|
{
|
162
182
|
_getPoolStorage()._poolService.setFees(poolFee, stakingFee, performanceFee);
|
163
183
|
}
|
164
184
|
|
165
|
-
|
185
|
+
|
186
|
+
/// @dev see {IPool.verifyApplication}
|
187
|
+
function verifyApplication(
|
188
|
+
NftId applicationNftId,
|
189
|
+
bytes memory applicationData,
|
166
190
|
NftId bundleNftId,
|
167
|
-
|
191
|
+
bytes memory bundleFilter,
|
192
|
+
uint256 collateralizationAmount
|
168
193
|
)
|
169
|
-
|
170
|
-
|
171
|
-
|
194
|
+
public
|
195
|
+
virtual
|
196
|
+
restricted()
|
172
197
|
{
|
173
|
-
|
174
|
-
|
198
|
+
if(!applicationMatchesBundle(
|
199
|
+
applicationNftId,
|
200
|
+
applicationData,
|
201
|
+
bundleNftId,
|
202
|
+
bundleFilter,
|
203
|
+
collateralizationAmount)
|
204
|
+
)
|
205
|
+
{
|
206
|
+
revert ErrorPoolApplicationBundleMismatch(applicationNftId);
|
207
|
+
}
|
175
208
|
|
176
|
-
|
177
|
-
NftId bundleNftId
|
178
|
-
)
|
179
|
-
external
|
180
|
-
override
|
181
|
-
// TODO add onlyBundleOwner
|
182
|
-
{
|
183
|
-
_getPoolStorage()._bundleService.lockBundle(bundleNftId);
|
209
|
+
emit LogPoolVerifiedByPool(address(this), applicationNftId, collateralizationAmount);
|
184
210
|
}
|
185
211
|
|
186
|
-
|
187
|
-
|
212
|
+
|
213
|
+
/// @dev see {IPoolComponent.applicationMatchesBundle}
|
214
|
+
/// Override this function to implement any custom application verification
|
215
|
+
/// Default implementation always returns true
|
216
|
+
function applicationMatchesBundle(
|
217
|
+
NftId applicationNftId,
|
218
|
+
bytes memory applicationData,
|
219
|
+
NftId bundleNftId,
|
220
|
+
bytes memory bundleFilter,
|
221
|
+
uint256 collateralizationAmount
|
188
222
|
)
|
189
|
-
|
190
|
-
|
191
|
-
|
223
|
+
public
|
224
|
+
view
|
225
|
+
virtual override
|
226
|
+
returns (bool isMatching)
|
192
227
|
{
|
193
|
-
|
228
|
+
return true;
|
194
229
|
}
|
195
230
|
|
196
|
-
function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
|
197
|
-
InstanceReader reader = getInstance().getInstanceReader();
|
198
|
-
setupInfo = reader.getPoolSetupInfo(getNftId());
|
199
|
-
|
200
|
-
// fallback to initial setup info (wallet is always != address(0))
|
201
|
-
if(setupInfo.wallet == address(0)) {
|
202
|
-
setupInfo = _getInitialSetupInfo();
|
203
|
-
}
|
204
|
-
}
|
205
231
|
|
206
|
-
function
|
207
|
-
|
208
|
-
return ISetup.PoolSetupInfo(
|
209
|
-
getProductNftId(),
|
210
|
-
$._tokenHandler,
|
211
|
-
isNftInterceptor(),
|
212
|
-
$._isExternallyManaged,
|
213
|
-
$._isVerifyingApplications,
|
214
|
-
$._collateralizationLevel,
|
215
|
-
$._retentionLevel,
|
216
|
-
$._initialPoolFee,
|
217
|
-
$._initialStakingFee,
|
218
|
-
$._initialPerformanceFee,
|
219
|
-
getWallet()
|
220
|
-
);
|
232
|
+
function getPoolInfo() external view returns (IComponents.PoolInfo memory poolInfo) {
|
233
|
+
poolInfo = abi.decode(getComponentInfo().data, (IComponents.PoolInfo));
|
221
234
|
}
|
222
235
|
|
223
236
|
// Internals
|
@@ -225,14 +238,14 @@ abstract contract Pool is
|
|
225
238
|
function _createBundle(
|
226
239
|
address bundleOwner,
|
227
240
|
Fee memory fee,
|
228
|
-
|
229
|
-
|
241
|
+
Amount amount,
|
242
|
+
Seconds lifetime,
|
230
243
|
bytes memory filter
|
231
244
|
)
|
232
245
|
internal
|
233
246
|
returns(NftId bundleNftId)
|
234
247
|
{
|
235
|
-
bundleNftId = _getPoolStorage().
|
248
|
+
bundleNftId = _getPoolStorage()._poolService.createBundle(
|
236
249
|
bundleOwner,
|
237
250
|
fee,
|
238
251
|
amount,
|
@@ -242,10 +255,45 @@ abstract contract Pool is
|
|
242
255
|
// TODO add logging
|
243
256
|
}
|
244
257
|
|
258
|
+
// TODO remove function once this is no longer used to produce contract locations on the fly ...
|
245
259
|
function getContractLocation(bytes memory name) external pure returns (bytes32 hash) {
|
246
260
|
return keccak256(abi.encode(uint256(keccak256(name)) - 1)) & ~bytes32(uint256(0xff));
|
247
261
|
}
|
248
262
|
|
263
|
+
/// @dev defines initial pool specification
|
264
|
+
/// overwrite this function according to your use case
|
265
|
+
function _getInitialInfo()
|
266
|
+
internal
|
267
|
+
view
|
268
|
+
virtual override
|
269
|
+
returns (IComponents.ComponentInfo memory info)
|
270
|
+
{
|
271
|
+
return IComponents.ComponentInfo(
|
272
|
+
getName(),
|
273
|
+
getToken(),
|
274
|
+
TokenHandler(address(0)), // will be created by GIF service during registration
|
275
|
+
address(this), // contract is its own wallet
|
276
|
+
AmountLib.zero(), // balance amount
|
277
|
+
AmountLib.zero(), // fee amount
|
278
|
+
abi.encode(
|
279
|
+
IComponents.PoolInfo(
|
280
|
+
NftIdLib.zero(), // will be set when GIF registers the related product
|
281
|
+
PUBLIC_ROLE(), // bundleOwnerRole
|
282
|
+
type(uint256).max, // maxCapitalAmount,
|
283
|
+
0, // initial balance amount
|
284
|
+
0, // initial fee amount
|
285
|
+
isNftInterceptor(), // isInterceptingBundleTransfers
|
286
|
+
false, // isExternallyManaged,
|
287
|
+
false, // isVerifyingApplications,
|
288
|
+
UFixedLib.toUFixed(1), // collateralizationLevel,
|
289
|
+
UFixedLib.toUFixed(1), // retentionLevel,
|
290
|
+
FeeLib.zeroFee(), // initialPoolFee,
|
291
|
+
FeeLib.zeroFee(), // initialStakingFee,
|
292
|
+
FeeLib.zeroFee() // initialPerformanceFee,
|
293
|
+
)));
|
294
|
+
}
|
295
|
+
|
296
|
+
|
249
297
|
function _getPoolStorage() private pure returns (PoolStorage storage $) {
|
250
298
|
assembly {
|
251
299
|
$.slot := POOL_STORAGE_LOCATION_V1
|