@etherisc/gif-next 0.0.2-cff6256-424 → 0.0.2-d02cb80-460
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +63 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +142 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +164 -62
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +104 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +0 -52
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +28 -2
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +193 -16
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +166 -58
- 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/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 +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +788 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1373 -93
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +448 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +108 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +160 -641
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +291 -143
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +763 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +177 -38
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +333 -67
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +91 -23
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +285 -0
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +40 -0
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- 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/IAccess.sol/IAccess.json +54 -22
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +923 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +440 -0
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +16 -16
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +69 -26
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +18 -18
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +669 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +664 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +9 -71
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +17 -232
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +984 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +464 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +718 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +428 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +768 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +420 -0
- 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 +2 -110
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +94 -0
- 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 +35 -146
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +76 -20
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +26 -34
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +12 -12
- 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/IService.sol/IService.dbg.json +1 -1
- 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/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 +2 -2
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- 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 +4 -4
- 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 +9 -9
- 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/NftIdSet.sol/LibNftIdSet.json +26 -3
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/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/BaseComponent.sol +62 -8
- package/contracts/components/Distribution.sol +12 -15
- package/contracts/components/IBaseComponent.sol +7 -0
- package/contracts/components/IDistributionComponent.sol +0 -2
- package/contracts/components/IPoolComponent.sol +5 -1
- package/contracts/components/Pool.sol +42 -29
- package/contracts/components/Product.sol +41 -46
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +23 -0
- package/contracts/instance/BundleManager.sol +129 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +34 -7
- package/contracts/instance/IInstanceBase.sol +26 -0
- package/contracts/instance/IInstanceService.sol +15 -3
- package/contracts/instance/Instance.sol +57 -224
- package/contracts/instance/InstanceAccessManager.sol +95 -78
- package/contracts/instance/InstanceBase.sol +41 -0
- package/contracts/instance/InstanceReader.sol +26 -1
- package/contracts/instance/InstanceService.sol +222 -69
- package/contracts/instance/InstanceServiceManager.sol +6 -5
- package/contracts/instance/ObjectManager.sol +101 -0
- package/contracts/instance/base/ComponentServiceBase.sol +45 -12
- package/contracts/instance/module/IAccess.sol +27 -17
- package/contracts/instance/module/IBundle.sol +1 -0
- package/contracts/instance/module/ISetup.sol +3 -0
- package/contracts/instance/service/BundleService.sol +260 -0
- package/contracts/instance/service/BundleServiceManager.sol +54 -0
- package/contracts/instance/service/DistributionService.sol +43 -21
- package/contracts/instance/service/DistributionServiceManager.sol +6 -5
- package/contracts/instance/service/IBundleService.sol +45 -0
- package/contracts/instance/service/IPolicyService.sol +87 -0
- package/contracts/instance/service/IPoolService.sol +6 -23
- package/contracts/instance/service/IProductService.sol +6 -73
- package/contracts/instance/service/PolicyService.sol +508 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +124 -0
- package/contracts/instance/service/PoolServiceManager.sol +54 -0
- package/contracts/instance/service/ProductService.sol +173 -0
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/IRegistry.sol +5 -18
- package/contracts/registry/IRegistryService.sol +28 -11
- package/contracts/registry/Registry.sol +4 -45
- package/contracts/registry/RegistryService.sol +30 -71
- package/contracts/shared/NftOwnable.sol +2 -4
- package/contracts/shared/Service.sol +1 -0
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/RoleId.sol +7 -2
- package/package.json +1 -1
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1132
- package/contracts/instance/AccessManagedSimple.sol +0 -115
- package/contracts/instance/AccessManagerSimple.sol +0 -692
@@ -20,6 +20,8 @@ interface ISetup {
|
|
20
20
|
Fee poolFee; // pool fee on net premium
|
21
21
|
Fee stakingFee; // pool fee on staked capital from investor
|
22
22
|
Fee performanceFee; // pool fee on profits from capital investors
|
23
|
+
bool isIntercepting; // intercepts nft transfers (for products)
|
24
|
+
address wallet;
|
23
25
|
}
|
24
26
|
|
25
27
|
struct DistributionSetupInfo {
|
@@ -38,6 +40,7 @@ interface ISetup {
|
|
38
40
|
Fee stakingFee; // pool fee on staked capital from investor
|
39
41
|
Fee performanceFee; // pool fee on profits from capital investors
|
40
42
|
bool isIntercepting; // intercepts nft transfers (for bundles)
|
43
|
+
bool isConfirmingApplication; // confirms applications before they are underwritten
|
41
44
|
address wallet;
|
42
45
|
}
|
43
46
|
}
|
@@ -0,0 +1,260 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {Pool} from "../../components/Pool.sol";
|
5
|
+
import {IRegistry} from "../../registry/IRegistry.sol";
|
6
|
+
import {IInstance} from "../../instance/IInstance.sol";
|
7
|
+
import {IBundle} from "../../instance/module/IBundle.sol";
|
8
|
+
import {TokenHandler} from "../../instance/module/ITreasury.sol";
|
9
|
+
import {ISetup} from "../module/ISetup.sol";
|
10
|
+
import {IPolicy} from "../module/IPolicy.sol";
|
11
|
+
|
12
|
+
import {IVersionable} from "../../shared/IVersionable.sol";
|
13
|
+
import {Versionable} from "../../shared/Versionable.sol";
|
14
|
+
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
15
|
+
|
16
|
+
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
17
|
+
import {POOL, BUNDLE} from "../../types/ObjectType.sol";
|
18
|
+
import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
|
19
|
+
import {Fee, FeeLib} from "../../types/Fee.sol";
|
20
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
21
|
+
import {KEEP_STATE, StateId} from "../../types/StateId.sol";
|
22
|
+
import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
23
|
+
|
24
|
+
import {IService} from "../../shared/IService.sol";
|
25
|
+
import {Service} from "../../shared/Service.sol";
|
26
|
+
import {BundleManager} from "../BundleManager.sol";
|
27
|
+
import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
|
28
|
+
import {IBundleService} from "./IBundleService.sol";
|
29
|
+
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
30
|
+
import {InstanceService} from "../InstanceService.sol";
|
31
|
+
import {InstanceReader} from "../InstanceReader.sol";
|
32
|
+
import {IBaseComponent} from "../../components/IBaseComponent.sol";
|
33
|
+
|
34
|
+
string constant BUNDLE_SERVICE_NAME = "BundleService";
|
35
|
+
|
36
|
+
contract BundleService is
|
37
|
+
ComponentServiceBase,
|
38
|
+
IBundleService
|
39
|
+
{
|
40
|
+
using NftIdLib for NftId;
|
41
|
+
|
42
|
+
string public constant NAME = "BundleService";
|
43
|
+
|
44
|
+
address internal _registryAddress;
|
45
|
+
|
46
|
+
function _initialize(
|
47
|
+
address owner,
|
48
|
+
bytes memory data
|
49
|
+
)
|
50
|
+
internal
|
51
|
+
initializer
|
52
|
+
virtual override
|
53
|
+
{
|
54
|
+
address registryAddress;
|
55
|
+
address initialOwner;
|
56
|
+
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
57
|
+
// TODO while PoolService is not deployed in PoolServiceManager constructor
|
58
|
+
// owner is PoolServiceManager deployer
|
59
|
+
_initializeService(registryAddress, owner);
|
60
|
+
|
61
|
+
_registerInterface(type(IBundleService).interfaceId);
|
62
|
+
}
|
63
|
+
|
64
|
+
function getName() public pure override(Service, IService) returns(string memory name) {
|
65
|
+
return NAME;
|
66
|
+
}
|
67
|
+
|
68
|
+
function createBundle(
|
69
|
+
address owner,
|
70
|
+
Fee memory fee,
|
71
|
+
uint256 stakingAmount,
|
72
|
+
uint256 lifetime,
|
73
|
+
bytes calldata filter
|
74
|
+
)
|
75
|
+
external
|
76
|
+
override
|
77
|
+
returns(NftId bundleNftId)
|
78
|
+
{
|
79
|
+
(IRegistry.ObjectInfo memory info, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
80
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
81
|
+
NftId poolNftId = info.nftId;
|
82
|
+
|
83
|
+
IBundle.BundleInfo memory bundleInfo = IBundle.BundleInfo(
|
84
|
+
poolNftId,
|
85
|
+
fee,
|
86
|
+
filter,
|
87
|
+
stakingAmount,
|
88
|
+
0,
|
89
|
+
stakingAmount,
|
90
|
+
lifetime,
|
91
|
+
zeroTimestamp(),
|
92
|
+
zeroTimestamp()
|
93
|
+
);
|
94
|
+
|
95
|
+
// register bundle with registry
|
96
|
+
bundleNftId = getRegistryService().registerBundle(
|
97
|
+
IRegistry.ObjectInfo(
|
98
|
+
zeroNftId(),
|
99
|
+
poolNftId,
|
100
|
+
BUNDLE(),
|
101
|
+
false, // intercepting property for bundles is defined on pool
|
102
|
+
address(0),
|
103
|
+
owner,
|
104
|
+
abi.encode(bundleInfo)
|
105
|
+
)
|
106
|
+
);
|
107
|
+
|
108
|
+
// create bundle info in instance
|
109
|
+
instance.createBundle(bundleNftId, bundleInfo);
|
110
|
+
|
111
|
+
BundleManager bundleManager = instance.getBundleManager();
|
112
|
+
bundleManager.add(bundleNftId);
|
113
|
+
|
114
|
+
_processStakingByTreasury(
|
115
|
+
instanceReader,
|
116
|
+
poolNftId,
|
117
|
+
bundleNftId,
|
118
|
+
stakingAmount);
|
119
|
+
|
120
|
+
// TODO add logging
|
121
|
+
}
|
122
|
+
|
123
|
+
function setBundleFee(
|
124
|
+
NftId bundleNftId,
|
125
|
+
Fee memory fee
|
126
|
+
)
|
127
|
+
external
|
128
|
+
override
|
129
|
+
{
|
130
|
+
(IRegistry.ObjectInfo memory info , IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
131
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
132
|
+
NftId poolNftId = info.nftId;
|
133
|
+
|
134
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
135
|
+
require(bundleInfo.poolNftId.gtz(), "ERROR:PLS-010:BUNDLE_UNKNOWN");
|
136
|
+
require(poolNftId == bundleInfo.poolNftId, "ERROR:PLS-011:BUNDLE_POOL_MISMATCH");
|
137
|
+
|
138
|
+
bundleInfo.fee = fee;
|
139
|
+
|
140
|
+
instance.updateBundle(bundleNftId, bundleInfo, KEEP_STATE());
|
141
|
+
}
|
142
|
+
|
143
|
+
function updateBundle(NftId instanceNftId, NftId bundleNftId, IBundle.BundleInfo memory bundleInfo, StateId state)
|
144
|
+
external
|
145
|
+
onlyService
|
146
|
+
{
|
147
|
+
IRegistry.ObjectInfo memory instanceInfo = getRegistry().getObjectInfo(instanceNftId);
|
148
|
+
IInstance instance = IInstance(instanceInfo.objectAddress);
|
149
|
+
instance.updateBundle(bundleNftId, bundleInfo, state);
|
150
|
+
}
|
151
|
+
|
152
|
+
function lockBundle(NftId bundleNftId)
|
153
|
+
external
|
154
|
+
{
|
155
|
+
(, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
156
|
+
BundleManager bundleManager = instance.getBundleManager();
|
157
|
+
bundleManager.lock(bundleNftId);
|
158
|
+
}
|
159
|
+
|
160
|
+
function unlockBundle(NftId bundleNftId)
|
161
|
+
external
|
162
|
+
{
|
163
|
+
(, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
164
|
+
BundleManager bundleManager = instance.getBundleManager();
|
165
|
+
bundleManager.unlock(bundleNftId);
|
166
|
+
}
|
167
|
+
|
168
|
+
function underwritePolicy(IInstance instance,
|
169
|
+
NftId policyNftId,
|
170
|
+
NftId bundleNftId,
|
171
|
+
uint256 collateralAmount,
|
172
|
+
uint256 netPremiumAmount
|
173
|
+
)
|
174
|
+
external
|
175
|
+
onlyService
|
176
|
+
{
|
177
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
178
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
179
|
+
|
180
|
+
// lock collateral
|
181
|
+
bundleInfo.lockedAmount += collateralAmount;
|
182
|
+
bundleInfo.balanceAmount += netPremiumAmount;
|
183
|
+
|
184
|
+
instance.updateBundle(bundleNftId, bundleInfo, KEEP_STATE());
|
185
|
+
|
186
|
+
linkPolicy(instance, policyNftId);
|
187
|
+
}
|
188
|
+
|
189
|
+
/// @dev links policy to bundle
|
190
|
+
function linkPolicy(IInstance instance, NftId policyNftId)
|
191
|
+
internal
|
192
|
+
onlyService
|
193
|
+
{
|
194
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
195
|
+
IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
196
|
+
|
197
|
+
// ensure policy has not yet been activated
|
198
|
+
if (policyInfo.activatedAt.gtz()) {
|
199
|
+
revert BundleManager.ErrorBundleManagerErrorPolicyAlreadyActivated(policyNftId);
|
200
|
+
}
|
201
|
+
|
202
|
+
BundleManager bundleManager = instance.getBundleManager();
|
203
|
+
bundleManager.linkPolicy(policyNftId);
|
204
|
+
}
|
205
|
+
|
206
|
+
/// @dev unlinks policy from bundle
|
207
|
+
function unlinkPolicy(IInstance instance, NftId policyNftId)
|
208
|
+
internal
|
209
|
+
onlyService
|
210
|
+
{
|
211
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
212
|
+
IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
213
|
+
|
214
|
+
// ensure policy has no open claims
|
215
|
+
if (policyInfo.openClaimsCount > 0) {
|
216
|
+
revert BundleManager.ErrorBundleManagerPolicyWithOpenClaims(
|
217
|
+
policyNftId,
|
218
|
+
policyInfo.openClaimsCount);
|
219
|
+
}
|
220
|
+
|
221
|
+
// ensure policy is closeable
|
222
|
+
if (policyInfo.expiredAt < TimestampLib.blockTimestamp()
|
223
|
+
|| policyInfo.payoutAmount < policyInfo.sumInsuredAmount)
|
224
|
+
{
|
225
|
+
revert BundleManager.ErrorBundleManagerPolicyNotCloseable(policyNftId);
|
226
|
+
}
|
227
|
+
|
228
|
+
BundleManager bundleManager = instance.getBundleManager();
|
229
|
+
bundleManager.unlinkPolicy(policyNftId);
|
230
|
+
}
|
231
|
+
|
232
|
+
function _processStakingByTreasury(
|
233
|
+
InstanceReader instanceReader,
|
234
|
+
NftId poolNftId,
|
235
|
+
NftId bundleNftId,
|
236
|
+
uint256 stakingAmount
|
237
|
+
)
|
238
|
+
internal
|
239
|
+
{
|
240
|
+
// process token transfer(s)
|
241
|
+
if(stakingAmount > 0) {
|
242
|
+
ISetup.PoolSetupInfo memory poolInfo = instanceReader.getPoolSetupInfo(poolNftId);
|
243
|
+
TokenHandler tokenHandler = poolInfo.tokenHandler;
|
244
|
+
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
245
|
+
Fee memory stakingFee = poolInfo.stakingFee;
|
246
|
+
|
247
|
+
tokenHandler.transfer(
|
248
|
+
bundleOwner,
|
249
|
+
poolInfo.wallet,
|
250
|
+
stakingAmount
|
251
|
+
);
|
252
|
+
|
253
|
+
|
254
|
+
if (! FeeLib.feeIsZero(stakingFee)) {
|
255
|
+
(uint256 stakingFeeAmount, uint256 netAmount) = FeeLib.calculateFee(stakingFee, stakingAmount);
|
256
|
+
// TODO: track staking fees in pool's state (issue #177)
|
257
|
+
}
|
258
|
+
}
|
259
|
+
}
|
260
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IVersionable} from "../../shared/IVersionable.sol";
|
5
|
+
import {ProxyManager} from "../../shared/ProxyManager.sol";
|
6
|
+
import {BundleService} from "./BundleService.sol";
|
7
|
+
import {Registry} from "../../registry/Registry.sol";
|
8
|
+
import {RegistryService} from "../../registry/RegistryService.sol";
|
9
|
+
import {VersionLib} from "../../types/Version.sol";
|
10
|
+
|
11
|
+
contract BundleServiceManager is ProxyManager {
|
12
|
+
|
13
|
+
BundleService private _bundleService;
|
14
|
+
|
15
|
+
/// @dev initializes proxy manager with pool service implementation
|
16
|
+
constructor(
|
17
|
+
address registryAddress
|
18
|
+
)
|
19
|
+
ProxyManager()
|
20
|
+
{
|
21
|
+
BundleService bundleSrv = new BundleService();
|
22
|
+
bytes memory data = abi.encode(registryAddress, address(this));
|
23
|
+
IVersionable versionable = deploy(
|
24
|
+
address(bundleSrv),
|
25
|
+
data);
|
26
|
+
|
27
|
+
_bundleService = BundleService(address(versionable));
|
28
|
+
|
29
|
+
Registry registry = Registry(registryAddress);
|
30
|
+
address registryServiceAddress = registry.getServiceAddress("RegistryService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
31
|
+
RegistryService registryService = RegistryService(registryServiceAddress);
|
32
|
+
// TODO this must have a role or own nft to register service
|
33
|
+
//registryService.registerService(_poolService);
|
34
|
+
|
35
|
+
// TODO no nft to link yet
|
36
|
+
// link ownership of instance service manager ot nft owner of instance service
|
37
|
+
//_linkToNftOwnable(
|
38
|
+
// address(registryAddress),
|
39
|
+
// address(_poolService));
|
40
|
+
|
41
|
+
// implies that after this constructor call only upgrade functionality is available
|
42
|
+
_isDeployed = true;
|
43
|
+
}
|
44
|
+
|
45
|
+
//--- view functions ----------------------------------------------------//
|
46
|
+
function getBundleService()
|
47
|
+
external
|
48
|
+
view
|
49
|
+
returns (BundleService)
|
50
|
+
{
|
51
|
+
return _bundleService;
|
52
|
+
}
|
53
|
+
|
54
|
+
}
|
@@ -10,6 +10,7 @@ import {ITreasury} from "../../instance/module/ITreasury.sol";
|
|
10
10
|
|
11
11
|
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
12
12
|
import {Fee} from "../../types/Fee.sol";
|
13
|
+
import {DISTRIBUTION_OWNER_ROLE} from "../../types/RoleId.sol";
|
13
14
|
import {KEEP_STATE} from "../../types/StateId.sol";
|
14
15
|
import {DISTRIBUTION} from "../../types/ObjectType.sol";
|
15
16
|
import {Version, VersionLib} from "../../types/Version.sol";
|
@@ -22,6 +23,10 @@ import {Service} from "../../shared/Service.sol";
|
|
22
23
|
import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
|
23
24
|
import {IDistributionService} from "./IDistributionService.sol";
|
24
25
|
import {Distribution} from "../../components/Distribution.sol";
|
26
|
+
import {InstanceService} from "../InstanceService.sol";
|
27
|
+
import {Instance} from "../Instance.sol";
|
28
|
+
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
29
|
+
import {IBaseComponent} from "../../components/IBaseComponent.sol";
|
25
30
|
|
26
31
|
string constant DISTRIBUTION_SERVICE_NAME = "DistributionService";
|
27
32
|
|
@@ -43,14 +48,13 @@ contract DistributionService is
|
|
43
48
|
initializer
|
44
49
|
virtual override
|
45
50
|
{
|
46
|
-
address initialOwner
|
47
|
-
|
51
|
+
address initialOwner;
|
52
|
+
address registryAddress;
|
53
|
+
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
54
|
+
// TODO while DistributionService is not deployed in DistributionServiceManager constructor
|
55
|
+
// owner is DistributionServiceManager deployer
|
56
|
+
_initializeService(registryAddress, owner);
|
48
57
|
|
49
|
-
// IRegistry registry = IRegistry(_registryAddress);
|
50
|
-
|
51
|
-
_initializeService(_registryAddress, initialOwner);
|
52
|
-
|
53
|
-
_registerInterface(type(IService).interfaceId);
|
54
58
|
_registerInterface(type(IDistributionService).interfaceId);
|
55
59
|
}
|
56
60
|
|
@@ -59,25 +63,43 @@ contract DistributionService is
|
|
59
63
|
return NAME;
|
60
64
|
}
|
61
65
|
|
62
|
-
function register(address
|
63
|
-
external
|
64
|
-
|
65
|
-
returns (NftId distributionNftId)
|
66
|
+
function register(address distributionAddress)
|
67
|
+
external
|
68
|
+
returns(NftId distributionNftId)
|
66
69
|
{
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
address distributionOwner = msg.sender;
|
71
|
+
IBaseComponent distribution = IBaseComponent(distributionAddress);
|
72
|
+
|
73
|
+
IRegistry.ObjectInfo memory info;
|
74
|
+
bytes memory data;
|
75
|
+
(info, data) = getRegistryService().registerDistribution(distribution, distributionOwner);
|
76
|
+
|
77
|
+
IInstance instance = _getInstance(info);
|
78
|
+
|
79
|
+
bool hasRole = getInstanceService().hasRole(
|
80
|
+
distributionOwner,
|
81
|
+
DISTRIBUTION_OWNER_ROLE(),
|
82
|
+
address(instance));
|
75
83
|
|
76
|
-
|
77
|
-
|
84
|
+
if(!hasRole) {
|
85
|
+
revert ExpectedRoleMissing(DISTRIBUTION_OWNER_ROLE(), distributionOwner);
|
86
|
+
}
|
87
|
+
|
88
|
+
distributionNftId = info.nftId;
|
89
|
+
ISetup.DistributionSetupInfo memory initialSetup = _decodeAndVerifyDistributionSetup(data);
|
78
90
|
instance.createDistributionSetup(distributionNftId, initialSetup);
|
79
91
|
}
|
80
92
|
|
93
|
+
function _decodeAndVerifyDistributionSetup(bytes memory data) internal returns(ISetup.DistributionSetupInfo memory setup)
|
94
|
+
{
|
95
|
+
setup = abi.decode(
|
96
|
+
data,
|
97
|
+
(ISetup.DistributionSetupInfo)
|
98
|
+
);
|
99
|
+
|
100
|
+
// TODO add checks if applicable
|
101
|
+
}
|
102
|
+
|
81
103
|
function setFees(
|
82
104
|
Fee memory distributionFee
|
83
105
|
)
|
@@ -29,13 +29,14 @@ contract DistributionServiceManager is ProxyManager {
|
|
29
29
|
Registry registry = Registry(registryAddress);
|
30
30
|
address registryServiceAddress = registry.getServiceAddress("RegistryService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
31
31
|
RegistryService registryService = RegistryService(registryServiceAddress);
|
32
|
+
// TODO this must have a role or own nft to register service
|
33
|
+
//registryService.registerService(_distributionService);
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
+
// TODO no nft to link yet
|
35
36
|
// link ownership of instance service manager ot nft owner of instance service
|
36
|
-
_linkToNftOwnable(
|
37
|
-
|
38
|
-
|
37
|
+
//_linkToNftOwnable(
|
38
|
+
// address(registryAddress),
|
39
|
+
// address(_distributionService));
|
39
40
|
|
40
41
|
// implies that after this constructor call only upgrade functionality is available
|
41
42
|
_isDeployed = true;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {NftId} from "../../types/NftId.sol";
|
5
|
+
import {Fee} from "../../types/Fee.sol";
|
6
|
+
import {StateId} from "../../types/StateId.sol";
|
7
|
+
import {IService} from "../../shared/IService.sol";
|
8
|
+
import {IBundle} from "../module/IBundle.sol";
|
9
|
+
import {IInstance} from "../../instance/IInstance.sol";
|
10
|
+
|
11
|
+
interface IBundleService is IService {
|
12
|
+
error ErrorIBundleServiceInsufficientAllowance(address bundleOwner, address tokenHandlerAddress, uint256 amount);
|
13
|
+
|
14
|
+
function createBundle(
|
15
|
+
address owner,
|
16
|
+
Fee memory fee,
|
17
|
+
uint256 amount,
|
18
|
+
uint256 lifetime,
|
19
|
+
bytes calldata filter
|
20
|
+
) external returns(NftId bundleNftId);
|
21
|
+
|
22
|
+
function setBundleFee(
|
23
|
+
NftId bundleNftId,
|
24
|
+
Fee memory fee
|
25
|
+
) external;
|
26
|
+
|
27
|
+
function updateBundle(NftId instanceNftId, NftId bundleNftId, IBundle.BundleInfo memory bundleInfo, StateId state) external;
|
28
|
+
|
29
|
+
function underwritePolicy(IInstance instanceNftId,
|
30
|
+
NftId policyNftId,
|
31
|
+
NftId bundleNftId,
|
32
|
+
uint256 collateralAmount,
|
33
|
+
uint256 netPremium
|
34
|
+
) external;
|
35
|
+
|
36
|
+
// function fundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
37
|
+
|
38
|
+
// function defundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
39
|
+
|
40
|
+
function lockBundle(NftId bundleNftId) external;
|
41
|
+
|
42
|
+
function unlockBundle(NftId bundleNftId) external;
|
43
|
+
|
44
|
+
// function closeBundle(NftId bundleNftId) external;
|
45
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {IRisk} from "../module/IRisk.sol";
|
5
|
+
import {IService} from "../../shared/IService.sol";
|
6
|
+
|
7
|
+
import {NftId} from "../../types/NftId.sol";
|
8
|
+
import {ReferralId} from "../../types/Referral.sol";
|
9
|
+
import {RiskId} from "../../types/RiskId.sol";
|
10
|
+
import {StateId} from "../../types/StateId.sol";
|
11
|
+
import {Timestamp} from "../../types/Timestamp.sol";
|
12
|
+
import {UFixed} from "../../types/UFixed.sol";
|
13
|
+
import {Fee} from "../../types/Fee.sol";
|
14
|
+
|
15
|
+
interface IPolicyService is IService {
|
16
|
+
|
17
|
+
error ErrorIPolicyServiceInsufficientAllowance(address customer, address tokenHandlerAddress, uint256 amount);
|
18
|
+
|
19
|
+
function calculatePremium(
|
20
|
+
RiskId riskId,
|
21
|
+
uint256 sumInsuredAmount,
|
22
|
+
uint256 lifetime,
|
23
|
+
bytes memory applicationData,
|
24
|
+
NftId bundleNftId,
|
25
|
+
ReferralId referralId
|
26
|
+
)
|
27
|
+
external
|
28
|
+
view
|
29
|
+
returns (
|
30
|
+
uint256 premiumAmount,
|
31
|
+
uint256 productFeeAmount,
|
32
|
+
uint256 poolFeeAmount,
|
33
|
+
uint256 bundleFeeAmount,
|
34
|
+
uint256 distributionFeeAmount
|
35
|
+
);
|
36
|
+
|
37
|
+
|
38
|
+
function createApplication(
|
39
|
+
address applicationOwner,
|
40
|
+
RiskId riskId,
|
41
|
+
uint256 sumInsuredAmount,
|
42
|
+
uint256 lifetime,
|
43
|
+
bytes memory applicationData,
|
44
|
+
NftId bundleNftId,
|
45
|
+
ReferralId referralId
|
46
|
+
) external returns (NftId nftId);
|
47
|
+
|
48
|
+
/**
|
49
|
+
* @dev revokes the application represented by {policyNftId}.
|
50
|
+
* an application can only be revoked in applied state.
|
51
|
+
* only the application holder may revoke an application.
|
52
|
+
*/
|
53
|
+
function revoke(NftId policyNftId) external;
|
54
|
+
|
55
|
+
/**
|
56
|
+
* @dev underwrites the policy represented by {policyNftId}.
|
57
|
+
* optionally collects premiums and activates the policy.
|
58
|
+
* - premium payment is only attempted if requirePremiumPayment is set to true
|
59
|
+
* - activation is only done if activateAt is a non-zero timestamp
|
60
|
+
*/
|
61
|
+
function underwrite(
|
62
|
+
NftId policyNftId,
|
63
|
+
bool requirePremiumPayment,
|
64
|
+
Timestamp activateAt
|
65
|
+
) external;
|
66
|
+
|
67
|
+
// function decline(uint256 nftId) external;
|
68
|
+
// function expire(uint256 nftId) external;
|
69
|
+
|
70
|
+
function collectPremium(NftId policyNftId, Timestamp activateAt) external;
|
71
|
+
|
72
|
+
function activate(NftId policyNftId, Timestamp activateAt) external;
|
73
|
+
|
74
|
+
|
75
|
+
function close(NftId nftId) external;
|
76
|
+
|
77
|
+
// function createClaim(uint256 nftId, uint256 claimAmount) external;
|
78
|
+
// function confirmClaim(uint256 nftId, uint256 claimId, uint256 claimAmount) external;
|
79
|
+
// function declineClaim(uint256 nftId, uint256 claimId) external;
|
80
|
+
// function closeClaim(uint256 nftId, uint256 claimId) external; // TODO payoutClaim() -> implicit close when payed out in full
|
81
|
+
|
82
|
+
function calculateRequiredCollateral(
|
83
|
+
UFixed collateralizationLevel,
|
84
|
+
uint256 sumInsuredAmount
|
85
|
+
) external pure returns(uint256 collateralAmount);
|
86
|
+
|
87
|
+
}
|
@@ -3,35 +3,18 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {NftId} from "../../types/NftId.sol";
|
5
5
|
import {Fee} from "../../types/Fee.sol";
|
6
|
+
import {StateId} from "../../types/StateId.sol";
|
6
7
|
import {IService} from "../../shared/IService.sol";
|
8
|
+
import {IBundle} from "../module/IBundle.sol";
|
9
|
+
import {IInstance} from "../../instance/IInstance.sol";
|
7
10
|
|
8
11
|
interface IPoolService is IService {
|
12
|
+
|
13
|
+
function register(address poolAddress) external returns(NftId);
|
14
|
+
|
9
15
|
function setFees(
|
10
16
|
Fee memory poolFee,
|
11
17
|
Fee memory stakingFee,
|
12
18
|
Fee memory performanceFee
|
13
19
|
) external;
|
14
|
-
|
15
|
-
function createBundle(
|
16
|
-
address owner,
|
17
|
-
Fee memory fee,
|
18
|
-
uint256 amount,
|
19
|
-
uint256 lifetime,
|
20
|
-
bytes calldata filter
|
21
|
-
) external returns(NftId bundleNftId);
|
22
|
-
|
23
|
-
function setBundleFee(
|
24
|
-
NftId bundleNftId,
|
25
|
-
Fee memory fee
|
26
|
-
) external;
|
27
|
-
|
28
|
-
// function fundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
29
|
-
|
30
|
-
// function defundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
31
|
-
|
32
|
-
// function lockBundle(NftId bundleNftId) external;
|
33
|
-
|
34
|
-
// function unlockBundle(NftId bundleNftId) external;
|
35
|
-
|
36
|
-
// function closeBundle(NftId bundleNftId) external;
|
37
20
|
}
|