@etherisc/gif-next 0.0.2-bdcb44f-543 → 0.0.2-be8b3db-650
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/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +40 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +41 -19
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +40 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +41 -19
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +57 -150
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +40 -0
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +76 -189
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +40 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +30 -11
- 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 +32 -174
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +103 -238
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +2 -2
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +73 -144
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +32 -32
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +17 -17
- 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/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/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 +14 -14
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +8 -8
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +132 -135
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +12 -12
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +2 -2
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +2 -2
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +234 -63
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +40 -32
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +89 -92
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +156 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +21 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +81 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +31 -10
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +6 -6
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +105 -16
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +13 -9
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +2 -2
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +2 -2
- 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/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- 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 +4 -4
- 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 +12 -12
- 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 +3 -3
- 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/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 +2 -2
- 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/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 +2 -2
- 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 +2 -2
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/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/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 +2 -2
- 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/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 +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 +2 -2
- 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 +20 -0
- package/contracts/components/Distribution.sol +0 -13
- package/contracts/components/IComponent.sol +6 -0
- package/contracts/components/IDistributionComponent.sol +0 -8
- package/contracts/components/IPoolComponent.sol +5 -43
- package/contracts/components/Pool.sol +38 -117
- package/contracts/components/Product.sol +4 -0
- package/contracts/instance/BundleManager.sol +6 -4
- package/contracts/instance/IInstance.sol +3 -2
- package/contracts/instance/IInstanceService.sol +2 -1
- package/contracts/instance/Instance.sol +8 -4
- package/contracts/instance/InstanceReader.sol +4 -3
- package/contracts/instance/InstanceService.sol +5 -6
- package/contracts/instance/base/KeyValueStore.sol +5 -2
- package/contracts/instance/base/Lifecycle.sol +11 -2
- package/contracts/instance/module/IComponents.sol +35 -0
- package/contracts/instance/module/ISetup.sol +4 -17
- package/contracts/instance/service/ApplicationService.sol +6 -5
- package/contracts/instance/service/BundleService.sol +72 -35
- package/contracts/instance/service/DistributionService.sol +75 -19
- package/contracts/instance/service/IBundleService.sol +16 -9
- package/contracts/instance/service/IDistributionService.sol +13 -1
- package/contracts/instance/service/IPolicyService.sol +2 -0
- package/contracts/instance/service/IPoolService.sol +17 -2
- package/contracts/instance/service/PolicyService.sol +46 -45
- package/contracts/instance/service/PoolService.sol +72 -18
- package/contracts/registry/ChainNft.sol +4 -0
- package/contracts/registry/Registry.sol +10 -12
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/Fee.sol +1 -0
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +1 -0
- package/contracts/types/Referral.sol +4 -0
- package/contracts/types/StateId.sol +1 -0
- package/contracts/types/Timestamp.sol +1 -0
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
@@ -7,13 +7,13 @@ import {IBundleService} from "../instance/service/IBundleService.sol";
|
|
7
7
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
8
8
|
import {IPoolComponent} from "./IPoolComponent.sol";
|
9
9
|
import {IPoolService} from "../instance/service/IPoolService.sol";
|
10
|
-
import {
|
10
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
11
11
|
import {NftId, NftIdLib} from "../types/NftId.sol";
|
12
12
|
import {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
|
-
import {UFixed} from "../types/UFixed.sol";
|
16
|
+
import {UFixed, UFixedLib} from "../types/UFixed.sol";
|
17
17
|
|
18
18
|
|
19
19
|
abstract contract Pool is
|
@@ -24,23 +24,6 @@ abstract contract Pool is
|
|
24
24
|
bytes32 public constant POOL_STORAGE_LOCATION_V1 = 0x25e3e51823fbfffb988e0a2744bb93722d9f3e906c07cc0a9e77884c46c58300;
|
25
25
|
|
26
26
|
struct PoolStorage {
|
27
|
-
UFixed _collateralizationLevel;
|
28
|
-
UFixed _retentionLevel;
|
29
|
-
uint256 _maxCapitalAmount;
|
30
|
-
|
31
|
-
bool _isExternallyManaged;
|
32
|
-
bool _isVerifyingApplications;
|
33
|
-
|
34
|
-
RoleId _bundleOwnerRole;
|
35
|
-
bool _isInterceptingBundleTransfers;
|
36
|
-
|
37
|
-
Fee _initialPoolFee;
|
38
|
-
Fee _initialStakingFee;
|
39
|
-
Fee _initialPerformanceFee;
|
40
|
-
|
41
|
-
TokenHandler _tokenHandler;
|
42
|
-
|
43
|
-
// may be used to interact with instance by derived contracts
|
44
27
|
IPoolService _poolService;
|
45
28
|
IBundleService _bundleService;
|
46
29
|
}
|
@@ -68,10 +51,6 @@ abstract contract Pool is
|
|
68
51
|
string memory name,
|
69
52
|
address token,
|
70
53
|
bool isInterceptingNftTransfers,
|
71
|
-
bool isExternallyManaging,
|
72
|
-
bool isVerifying,
|
73
|
-
UFixed collateralizationLevel,
|
74
|
-
UFixed retentionLevel,
|
75
54
|
address initialOwner,
|
76
55
|
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
77
56
|
)
|
@@ -82,17 +61,6 @@ abstract contract Pool is
|
|
82
61
|
initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner, registryData);
|
83
62
|
|
84
63
|
PoolStorage storage $ = _getPoolStorage();
|
85
|
-
// TODO add validation
|
86
|
-
$._tokenHandler = new TokenHandler(token);
|
87
|
-
$._maxCapitalAmount = type(uint256).max;
|
88
|
-
$._isExternallyManaged = isExternallyManaging;
|
89
|
-
$._isVerifyingApplications = isVerifying;
|
90
|
-
$._bundleOwnerRole = PUBLIC_ROLE();
|
91
|
-
$._collateralizationLevel = collateralizationLevel;
|
92
|
-
$._retentionLevel = retentionLevel;
|
93
|
-
$._initialPoolFee = FeeLib.zeroFee();
|
94
|
-
$._initialStakingFee = FeeLib.zeroFee();
|
95
|
-
$._initialPerformanceFee = FeeLib.zeroFee();
|
96
64
|
$._poolService = getInstance().getPoolService();
|
97
65
|
$._bundleService = getInstance().getBundleService();
|
98
66
|
|
@@ -145,7 +113,7 @@ abstract contract Pool is
|
|
145
113
|
restricted()
|
146
114
|
onlyBundleOwner(bundleNftId)
|
147
115
|
{
|
148
|
-
_getPoolStorage()._bundleService.
|
116
|
+
_getPoolStorage()._bundleService.lock(bundleNftId);
|
149
117
|
}
|
150
118
|
|
151
119
|
|
@@ -155,7 +123,7 @@ abstract contract Pool is
|
|
155
123
|
restricted()
|
156
124
|
onlyBundleOwner(bundleNftId)
|
157
125
|
{
|
158
|
-
_getPoolStorage()._bundleService.
|
126
|
+
_getPoolStorage()._bundleService.unlock(bundleNftId);
|
159
127
|
}
|
160
128
|
|
161
129
|
|
@@ -165,7 +133,7 @@ abstract contract Pool is
|
|
165
133
|
restricted()
|
166
134
|
onlyBundleOwner(bundleNftId)
|
167
135
|
{
|
168
|
-
|
136
|
+
_getPoolStorage()._bundleService.close(bundleNftId);
|
169
137
|
}
|
170
138
|
|
171
139
|
|
@@ -178,7 +146,7 @@ abstract contract Pool is
|
|
178
146
|
restricted()
|
179
147
|
onlyBundleOwner(bundleNftId)
|
180
148
|
{
|
181
|
-
_getPoolStorage()._bundleService.
|
149
|
+
_getPoolStorage()._bundleService.setFee(bundleNftId, fee);
|
182
150
|
}
|
183
151
|
|
184
152
|
|
@@ -188,13 +156,7 @@ abstract contract Pool is
|
|
188
156
|
restricted()
|
189
157
|
onlyOwner()
|
190
158
|
{
|
191
|
-
|
192
|
-
// _getPoolStorage()._poolService.setMaxCapitalAmount(...);
|
193
|
-
|
194
|
-
uint256 previousMaxCapitalAmount = _getPoolStorage()._maxCapitalAmount;
|
195
|
-
_getPoolStorage()._maxCapitalAmount = maxCapitalAmount;
|
196
|
-
|
197
|
-
emit LogPoolBundleMaxCapitalAmountUpdated(previousMaxCapitalAmount, maxCapitalAmount);
|
159
|
+
_getPoolStorage()._poolService.setMaxCapitalAmount(maxCapitalAmount);
|
198
160
|
}
|
199
161
|
|
200
162
|
|
@@ -204,16 +166,7 @@ abstract contract Pool is
|
|
204
166
|
restricted()
|
205
167
|
onlyOwner()
|
206
168
|
{
|
207
|
-
|
208
|
-
// _getPoolStorage()._poolService.setBundleOwnerRole(...);
|
209
|
-
|
210
|
-
if(_getPoolStorage()._bundleOwnerRole != PUBLIC_ROLE()) {
|
211
|
-
revert ErrorPoolBundleOwnerRoleAlreadySet();
|
212
|
-
}
|
213
|
-
|
214
|
-
_getPoolStorage()._bundleOwnerRole = bundleOwnerRole;
|
215
|
-
|
216
|
-
emit LogPoolBundleOwnerRoleSet(bundleOwnerRole);
|
169
|
+
_getPoolStorage()._poolService.setBundleOwnerRole(bundleOwnerRole);
|
217
170
|
}
|
218
171
|
|
219
172
|
|
@@ -243,7 +196,6 @@ abstract contract Pool is
|
|
243
196
|
virtual
|
244
197
|
restricted()
|
245
198
|
{
|
246
|
-
// validate application data against bundle filter
|
247
199
|
if(!applicationMatchesBundle(
|
248
200
|
applicationNftId,
|
249
201
|
applicationData,
|
@@ -259,41 +211,6 @@ abstract contract Pool is
|
|
259
211
|
}
|
260
212
|
|
261
213
|
|
262
|
-
function getCollateralizationLevel() public view virtual returns (UFixed collateralizationLevel) {
|
263
|
-
return _getPoolStorage()._collateralizationLevel;
|
264
|
-
}
|
265
|
-
|
266
|
-
|
267
|
-
function getRetentionLevel() public view virtual returns (UFixed retentionLevel) {
|
268
|
-
return _getPoolStorage()._retentionLevel;
|
269
|
-
}
|
270
|
-
|
271
|
-
|
272
|
-
function isExternallyManaged() public view virtual returns (bool) {
|
273
|
-
return _getPoolStorage()._isExternallyManaged;
|
274
|
-
}
|
275
|
-
|
276
|
-
|
277
|
-
function isVerifyingApplications() public view virtual returns (bool isConfirmingApplication) {
|
278
|
-
return _getPoolStorage()._isVerifyingApplications;
|
279
|
-
}
|
280
|
-
|
281
|
-
|
282
|
-
function getMaxCapitalAmount() public view virtual returns (uint256 maxCapitalAmount) {
|
283
|
-
return _getPoolStorage()._maxCapitalAmount;
|
284
|
-
}
|
285
|
-
|
286
|
-
|
287
|
-
function isInterceptingBundleTransfers() public view virtual returns (bool) {
|
288
|
-
return isNftInterceptor();
|
289
|
-
}
|
290
|
-
|
291
|
-
|
292
|
-
function getBundleOwnerRole() public view returns (RoleId bundleOwnerRole) {
|
293
|
-
return _getPoolStorage()._bundleOwnerRole;
|
294
|
-
}
|
295
|
-
|
296
|
-
|
297
214
|
/// @dev see {IPoolComponent.applicationMatchesBundle}
|
298
215
|
/// Override this function to implement any custom application verification
|
299
216
|
/// Default implementation always returns true
|
@@ -313,14 +230,8 @@ abstract contract Pool is
|
|
313
230
|
}
|
314
231
|
|
315
232
|
|
316
|
-
function
|
317
|
-
|
318
|
-
setupInfo = reader.getPoolSetupInfo(getNftId());
|
319
|
-
|
320
|
-
// fallback to initial setup info (wallet is always != address(0))
|
321
|
-
if(setupInfo.wallet == address(0)) {
|
322
|
-
setupInfo = _getInitialSetupInfo();
|
323
|
-
}
|
233
|
+
function getPoolInfo() external view returns (IComponents.PoolInfo memory poolInfo) {
|
234
|
+
poolInfo = abi.decode(getComponentInfo().data, (IComponents.PoolInfo));
|
324
235
|
}
|
325
236
|
|
326
237
|
// Internals
|
@@ -335,7 +246,7 @@ abstract contract Pool is
|
|
335
246
|
internal
|
336
247
|
returns(NftId bundleNftId)
|
337
248
|
{
|
338
|
-
bundleNftId = _getPoolStorage()._bundleService.
|
249
|
+
bundleNftId = _getPoolStorage()._bundleService.create(
|
339
250
|
bundleOwner,
|
340
251
|
fee,
|
341
252
|
amount,
|
@@ -350,23 +261,33 @@ abstract contract Pool is
|
|
350
261
|
return keccak256(abi.encode(uint256(keccak256(name)) - 1)) & ~bytes32(uint256(0xff));
|
351
262
|
}
|
352
263
|
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
264
|
+
/// @dev defines initial pool specification
|
265
|
+
/// overwrite this function according to your use case
|
266
|
+
function _getInitialInfo()
|
267
|
+
internal
|
268
|
+
view
|
269
|
+
virtual override
|
270
|
+
returns (IComponents.ComponentInfo memory info)
|
271
|
+
{
|
272
|
+
return IComponents.ComponentInfo(
|
273
|
+
getName(),
|
274
|
+
getToken(),
|
275
|
+
TokenHandler(address(0)), // will be created by GIF service during registration
|
276
|
+
address(this), // contract is its own wallet
|
277
|
+
abi.encode(
|
278
|
+
IComponents.PoolInfo(
|
279
|
+
NftIdLib.zero(), // will be set when GIF registers the related product
|
280
|
+
PUBLIC_ROLE(), // bundleOwnerRole
|
281
|
+
type(uint256).max, // maxCapitalAmount,
|
282
|
+
isNftInterceptor(), // isInterceptingBundleTransfers
|
283
|
+
false, // isExternallyManaged,
|
284
|
+
false, // isVerifyingApplications,
|
285
|
+
UFixedLib.toUFixed(1), // collateralizationLevel,
|
286
|
+
UFixedLib.toUFixed(1), // retentionLevel,
|
287
|
+
FeeLib.zeroFee(), // initialPoolFee,
|
288
|
+
FeeLib.zeroFee(), // initialStakingFee,
|
289
|
+
FeeLib.zeroFee() // initialPerformanceFee,
|
290
|
+
)));
|
370
291
|
}
|
371
292
|
|
372
293
|
|
@@ -24,6 +24,7 @@ import {TokenHandler} from "../shared/TokenHandler.sol";
|
|
24
24
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
25
25
|
import {IPolicy} from "../instance/module/IPolicy.sol";
|
26
26
|
import {ISetup} from "../instance/module/ISetup.sol";
|
27
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
27
28
|
import {Pool} from "../components/Pool.sol";
|
28
29
|
import {Distribution} from "../components/Distribution.sol";
|
29
30
|
|
@@ -265,6 +266,9 @@ abstract contract Product is
|
|
265
266
|
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
266
267
|
ProductStorage storage $ = _getProductStorage();
|
267
268
|
|
269
|
+
ISetup.DistributionSetupInfo memory distributionSetupInfo = $._distribution.getSetupInfo();
|
270
|
+
IComponents.PoolInfo memory poolInfo = $._pool.getPoolInfo();
|
271
|
+
|
268
272
|
return ISetup.ProductSetupInfo(
|
269
273
|
getToken(),
|
270
274
|
$._tokenHandler,
|
@@ -22,9 +22,10 @@ contract BundleManager is
|
|
22
22
|
event LogBundleManagerBundleAdded(NftId poolNftId, NftId bundleNftId);
|
23
23
|
event LogBundleManagerBundleUnlocked(NftId poolNftId, NftId bundleNftId);
|
24
24
|
event LogBundleManagerBundleLocked(NftId poolNftId, NftId bundleNftId);
|
25
|
+
event LogBundleManagerBundleClosed(NftId poolNftId, NftId bundleNftId);
|
25
26
|
|
26
|
-
error
|
27
|
-
error
|
27
|
+
error ErrorBundleManagerPolicyAlreadyActivated(NftId policyNftId);
|
28
|
+
error ErrorBundleManagerBundleLocked(NftId bundleNftId, NftId policyNftId);
|
28
29
|
error ErrorBundleManagerPolicyWithOpenClaims(NftId policyNftId, uint256 openClaimsCount);
|
29
30
|
error ErrorBundleManagerPolicyNotCloseable(NftId policyNftId);
|
30
31
|
error ErrorBundleManagerBundleUnknown(NftId bundleNftId);
|
@@ -32,7 +33,7 @@ contract BundleManager is
|
|
32
33
|
|
33
34
|
mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
|
34
35
|
|
35
|
-
/// @dev links a policy
|
36
|
+
/// @dev links a policy to its bundle
|
36
37
|
// to link a policy it MUST NOT yet have been activated
|
37
38
|
// the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
|
38
39
|
function linkPolicy(NftId policyNftId) external restricted() {
|
@@ -42,7 +43,7 @@ contract BundleManager is
|
|
42
43
|
|
43
44
|
// ensure bundle is unlocked (in active set) and registered with this instance
|
44
45
|
if (!_isActive(poolNftId, bundleNftId)) {
|
45
|
-
revert
|
46
|
+
revert ErrorBundleManagerBundleLocked(bundleNftId, policyNftId);
|
46
47
|
}
|
47
48
|
|
48
49
|
LibNftIdSet.add(_activePolicies[bundleNftId], policyNftId);
|
@@ -85,6 +86,7 @@ contract BundleManager is
|
|
85
86
|
emit LogBundleManagerBundleAdded(poolNftId, bundleNftId);
|
86
87
|
}
|
87
88
|
|
89
|
+
|
88
90
|
/// @dev unlocked (active) bundles are available to underwrite new policies
|
89
91
|
function unlock(NftId bundleNftId) external restricted() {
|
90
92
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
@@ -15,6 +15,7 @@ import {InstanceReader} from "./InstanceReader.sol";
|
|
15
15
|
|
16
16
|
import {IBundle} from "./module/IBundle.sol";
|
17
17
|
import {IBundleService} from "./service/IBundleService.sol";
|
18
|
+
import {IComponents} from "./module/IComponents.sol";
|
18
19
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
19
20
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
20
21
|
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
@@ -48,8 +49,8 @@ interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
|
|
48
49
|
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
|
49
50
|
function updateDistributionSetupState(NftId distributionNftId, StateId newState) external;
|
50
51
|
|
51
|
-
function createPoolSetup(NftId poolNftId,
|
52
|
-
function updatePoolSetup(NftId poolNftId,
|
52
|
+
function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external;
|
53
|
+
function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external;
|
53
54
|
function updatePoolSetupState(NftId poolNftId, StateId newState) external;
|
54
55
|
|
55
56
|
function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external;
|
@@ -52,8 +52,9 @@ interface IInstanceService is IService {
|
|
52
52
|
BundleManager clonedBundleManager
|
53
53
|
);
|
54
54
|
|
55
|
-
function hasRole(address account, RoleId role, address instanceAddress) external returns (bool);
|
56
55
|
function setTargetLocked(string memory targetName, bool locked) external;
|
57
56
|
|
57
|
+
function hasRole(address account, RoleId role, address instanceAddress) external returns (bool);
|
58
|
+
|
58
59
|
}
|
59
60
|
|
@@ -26,6 +26,7 @@ import {KeyValueStore} from "./base/KeyValueStore.sol";
|
|
26
26
|
|
27
27
|
import {IAccess} from "./module/IAccess.sol";
|
28
28
|
import {IBundle} from "./module/IBundle.sol";
|
29
|
+
import {IComponents} from "./module/IComponents.sol";
|
29
30
|
import {IDistribution} from "./module/IDistribution.sol";
|
30
31
|
import {IPolicy} from "./module/IPolicy.sol";
|
31
32
|
import {IRisk} from "./module/IRisk.sol";
|
@@ -36,6 +37,7 @@ import {IPoolService} from "./service/IPoolService.sol";
|
|
36
37
|
import {IProductService} from "./service/IProductService.sol";
|
37
38
|
import {IPolicyService} from "./service/IPolicyService.sol";
|
38
39
|
import {IBundleService} from "./service/IBundleService.sol";
|
40
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
39
41
|
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
40
42
|
|
41
43
|
contract Instance is
|
@@ -66,6 +68,8 @@ contract Instance is
|
|
66
68
|
__AccessManaged_init(accessManagerAddress);
|
67
69
|
|
68
70
|
initializeRegisterable(registryAddress, registryNftId, INSTANCE(), false, initialOwner, "");
|
71
|
+
initializeLifecycle();
|
72
|
+
|
69
73
|
registerInterface(type(IInstance).interfaceId);
|
70
74
|
}
|
71
75
|
|
@@ -96,12 +100,12 @@ contract Instance is
|
|
96
100
|
}
|
97
101
|
|
98
102
|
//--- PoolSetup ------------------------------------------------------//
|
99
|
-
function createPoolSetup(NftId poolNftId,
|
100
|
-
create(_toNftKey32(poolNftId, POOL()), abi.encode(
|
103
|
+
function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external restricted() {
|
104
|
+
create(_toNftKey32(poolNftId, POOL()), abi.encode(info));
|
101
105
|
}
|
102
106
|
|
103
|
-
function updatePoolSetup(NftId poolNftId,
|
104
|
-
update(_toNftKey32(poolNftId, POOL()), abi.encode(
|
107
|
+
function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external restricted() {
|
108
|
+
update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
|
105
109
|
}
|
106
110
|
|
107
111
|
function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
|
@@ -17,6 +17,7 @@ import {StateId} from "../types/StateId.sol";
|
|
17
17
|
|
18
18
|
import {IRegistry} from "../registry/IRegistry.sol";
|
19
19
|
import {IBundle} from "../instance/module/IBundle.sol";
|
20
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
20
21
|
import {IDistribution} from "../instance/module/IDistribution.sol";
|
21
22
|
import {IInstance} from "./IInstance.sol";
|
22
23
|
import {IKeyValueStore} from "../instance/base/IKeyValueStore.sol";
|
@@ -151,14 +152,14 @@ contract InstanceReader {
|
|
151
152
|
}
|
152
153
|
}
|
153
154
|
|
154
|
-
function
|
155
|
+
function getComponentInfo(NftId poolNftId)
|
155
156
|
public
|
156
157
|
view
|
157
|
-
returns (
|
158
|
+
returns (IComponents.ComponentInfo memory info)
|
158
159
|
{
|
159
160
|
bytes memory data = _store.getData(toPoolKey(poolNftId));
|
160
161
|
if (data.length > 0) {
|
161
|
-
return abi.decode(data, (
|
162
|
+
return abi.decode(data, (IComponents.ComponentInfo));
|
162
163
|
}
|
163
164
|
}
|
164
165
|
|
@@ -234,9 +234,10 @@ contract InstanceService is
|
|
234
234
|
// configure authorization for bundle service on instance
|
235
235
|
address bundleServiceAddress = getRegistry().getServiceAddress(BUNDLE(), getMajorVersion());
|
236
236
|
clonedAccessManager.grantRole(BUNDLE_SERVICE_ROLE(), address(bundleServiceAddress));
|
237
|
-
bytes4[] memory instanceBundleServiceSelectors = new bytes4[](
|
237
|
+
bytes4[] memory instanceBundleServiceSelectors = new bytes4[](3);
|
238
238
|
instanceBundleServiceSelectors[0] = clonedInstance.createBundle.selector;
|
239
239
|
instanceBundleServiceSelectors[1] = clonedInstance.updateBundle.selector;
|
240
|
+
instanceBundleServiceSelectors[2] = clonedInstance.updateBundleState.selector;
|
240
241
|
clonedAccessManager.setTargetFunctionRole(
|
241
242
|
"Instance",
|
242
243
|
instanceBundleServiceSelectors,
|
@@ -410,9 +411,8 @@ contract InstanceService is
|
|
410
411
|
fctSelectors[0] = IDistributionComponent.setFees.selector;
|
411
412
|
instanceAccessManager.setTargetFunctionRole(distributionName, fctSelectors, DISTRIBUTION_OWNER_ROLE());
|
412
413
|
|
413
|
-
bytes4[] memory fctSelectors2 = new bytes4[](
|
414
|
-
fctSelectors2[0] = IDistributionComponent.
|
415
|
-
fctSelectors2[1] = IDistributionComponent.processRenewal.selector;
|
414
|
+
bytes4[] memory fctSelectors2 = new bytes4[](1);
|
415
|
+
fctSelectors2[0] = IDistributionComponent.processRenewal.selector;
|
416
416
|
instanceAccessManager.setTargetFunctionRole(distributionName, fctSelectors2, PRODUCT_SERVICE_ROLE());
|
417
417
|
}
|
418
418
|
|
@@ -448,7 +448,7 @@ contract InstanceService is
|
|
448
448
|
instanceAccessManager.setTargetFunctionRole(
|
449
449
|
poolName,
|
450
450
|
fctSelectors3,
|
451
|
-
IPoolComponent(poolAddress).
|
451
|
+
IPoolComponent(poolAddress).getPoolInfo().bundleOwnerRole);
|
452
452
|
}
|
453
453
|
|
454
454
|
function grantProductDefaultPermissions(NftId instanceNftId, address productAddress, string memory productName) external onlyRegisteredService {
|
@@ -485,6 +485,5 @@ contract InstanceService is
|
|
485
485
|
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
486
486
|
accessManager.setTargetClosed(targetName, locked);
|
487
487
|
}
|
488
|
-
|
489
488
|
}
|
490
489
|
|
@@ -88,7 +88,7 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
|
|
88
88
|
|
89
89
|
// create log entries
|
90
90
|
// solhint-disable avoid-tx-origin
|
91
|
-
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(),
|
91
|
+
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(), stateOld, state, updatedBy, tx.origin, lastUpdatedIn);
|
92
92
|
emit LogInfoUpdated(key32.toObjectType(), key32.toKeyId(), state, updatedBy, tx.origin, lastUpdatedIn);
|
93
93
|
// solhing-enable
|
94
94
|
}
|
@@ -134,6 +134,9 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
|
|
134
134
|
StateId stateOld = metadata.state;
|
135
135
|
require(stateOld.gtz(), "ERROR:KVS-041:NOT_EXISTING");
|
136
136
|
|
137
|
+
// ensure state transistion is valid
|
138
|
+
checkTransition(metadata.objectType, stateOld, state);
|
139
|
+
|
137
140
|
// update metadata (and state)
|
138
141
|
address updatedBy = msg.sender;
|
139
142
|
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
@@ -143,7 +146,7 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
|
|
143
146
|
|
144
147
|
// create log entry
|
145
148
|
// solhint-disable-next-line avoid-tx-origin
|
146
|
-
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(),
|
149
|
+
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(), stateOld, state, updatedBy, tx.origin, lastUpdatedIn);
|
147
150
|
}
|
148
151
|
|
149
152
|
function exists(Key32 key32) public view returns (bool) {
|
@@ -1,19 +1,27 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
5
|
+
|
4
6
|
import {NftId} from "../../types/NftId.sol";
|
5
7
|
import {ObjectType, COMPONENT, BUNDLE, POLICY, RISK} from "../../types/ObjectType.sol";
|
6
8
|
import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, UNDERWRITTEN, REVOKED, DECLINED} from "../../types/StateId.sol";
|
7
9
|
import {ILifecycle} from "./ILifecycle.sol";
|
8
10
|
|
9
|
-
contract Lifecycle is
|
11
|
+
contract Lifecycle is
|
12
|
+
Initializable,
|
13
|
+
ILifecycle
|
14
|
+
{
|
10
15
|
mapping(ObjectType objectType => StateId initialState)
|
11
16
|
private _initialState;
|
12
17
|
|
13
18
|
mapping(ObjectType objectType => mapping(StateId stateFrom => mapping(StateId stateTo => bool isValid)))
|
14
19
|
private _isValidTransition;
|
15
20
|
|
16
|
-
|
21
|
+
function initializeLifecycle()
|
22
|
+
public
|
23
|
+
onlyInitializing
|
24
|
+
{
|
17
25
|
_setupBundleLifecycle();
|
18
26
|
_setupComponentLifecycle();
|
19
27
|
_setupPolicyLifecycle();
|
@@ -78,6 +86,7 @@ contract Lifecycle is ILifecycle {
|
|
78
86
|
function _setupBundleLifecycle() internal {
|
79
87
|
_initialState[BUNDLE()] = ACTIVE();
|
80
88
|
_isValidTransition[BUNDLE()][ACTIVE()][PAUSED()] = true;
|
89
|
+
_isValidTransition[BUNDLE()][ACTIVE()][CLOSED()] = true;
|
81
90
|
_isValidTransition[BUNDLE()][PAUSED()][ACTIVE()] = true;
|
82
91
|
_isValidTransition[BUNDLE()][PAUSED()][CLOSED()] = true;
|
83
92
|
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
|
6
|
+
import {Fee} from "../../types/Fee.sol";
|
7
|
+
import {NftId} from "../../types/NftId.sol";
|
8
|
+
import {RoleId} from "../../types/RoleId.sol";
|
9
|
+
import {TokenHandler} from "../../shared/TokenHandler.sol";
|
10
|
+
import {UFixed} from "../../types/UFixed.sol";
|
11
|
+
|
12
|
+
interface IComponents {
|
13
|
+
|
14
|
+
struct ComponentInfo {
|
15
|
+
string name; // component name (needs to be unique per instance)
|
16
|
+
IERC20Metadata token;
|
17
|
+
TokenHandler tokenHandler;
|
18
|
+
address wallet;
|
19
|
+
bytes data; // will hold component type specific additional info (eg encoded pool info)
|
20
|
+
}
|
21
|
+
|
22
|
+
struct PoolInfo {
|
23
|
+
NftId productNftId; // the nft of the product this pool is linked to
|
24
|
+
RoleId bundleOwnerRole; // the required role for bundle owners
|
25
|
+
uint256 maxCapitalAmount; // max capital amount allowed for pool
|
26
|
+
bool isInterceptingBundleTransfers; // intercepts nft transfers for bundles
|
27
|
+
bool isExternallyManaged; // funding bundles is restricted to book keeping, actual funds may be provided as needed to support payouts
|
28
|
+
bool isVerifyingApplications; // underwriting requires the pool component checks/confirms the applications
|
29
|
+
UFixed collateralizationLevel; // factor to calculate collateral for sum insurance (default 100%)
|
30
|
+
UFixed retentionLevel; // amount of collateral held in pool (default 100%)
|
31
|
+
Fee poolFee; // pool fee on net premium
|
32
|
+
Fee stakingFee; // pool fee on staked capital from investor
|
33
|
+
Fee performanceFee; // pool fee on profits from capital investors
|
34
|
+
}
|
35
|
+
}
|
@@ -5,10 +5,12 @@ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IER
|
|
5
5
|
|
6
6
|
import {Fee} from "../../types/Fee.sol";
|
7
7
|
import {NftId} from "../../types/NftId.sol";
|
8
|
-
import {
|
8
|
+
import {RoleId} from "../../types/RoleId.sol";
|
9
9
|
import {TokenHandler} from "../../shared/TokenHandler.sol";
|
10
|
+
import {UFixed} from "../../types/UFixed.sol";
|
10
11
|
|
11
12
|
interface ISetup {
|
13
|
+
|
12
14
|
struct ProductSetupInfo {
|
13
15
|
IERC20Metadata token;
|
14
16
|
TokenHandler tokenHandler;
|
@@ -26,21 +28,6 @@ interface ISetup {
|
|
26
28
|
Fee minDistributionOwnerFee;
|
27
29
|
Fee distributionFee; // recalculated whenever any fee on the product/pool/dist/disttype is changed
|
28
30
|
address wallet;
|
29
|
-
uint256
|
30
|
-
}
|
31
|
-
|
32
|
-
struct PoolSetupInfo {
|
33
|
-
NftId productNftId;
|
34
|
-
TokenHandler tokenHandler;
|
35
|
-
uint256 maxCapitalAmount; // max capital amount allowed for pool
|
36
|
-
bool isInterceptingBundleTransfers; // intercepts nft transfers for bundles
|
37
|
-
bool isExternallyManaged; // funding bundles is restricted to book keeping, actual funds may be provided as needed to support payouts
|
38
|
-
bool isVerifyingApplications; // underwriting requires the pool component checks/confirms the applications
|
39
|
-
UFixed collateralizationLevel; // factor to calculate collateral for sum insurance (default 100%)
|
40
|
-
UFixed retentionLevel; // amount of collateral held in pool (default 100%)
|
41
|
-
Fee poolFee; // pool fee on net premium
|
42
|
-
Fee stakingFee; // pool fee on staked capital from investor
|
43
|
-
Fee performanceFee; // pool fee on profits from capital investors
|
44
|
-
address wallet;
|
31
|
+
uint256 sumDistributionOwnerFees;
|
45
32
|
}
|
46
33
|
}
|
@@ -10,6 +10,7 @@ import {Product} from "../../components/Product.sol";
|
|
10
10
|
import {IPoolComponent} from "../../components/IPoolComponent.sol";
|
11
11
|
import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
|
12
12
|
import {IInstance} from "../IInstance.sol";
|
13
|
+
import {IComponents} from "../module/IComponents.sol";
|
13
14
|
import {IPolicy} from "../module/IPolicy.sol";
|
14
15
|
import {IRisk} from "../module/IRisk.sol";
|
15
16
|
import {IBundle} from "../module/IBundle.sol";
|
@@ -135,7 +136,6 @@ contract ApplicationService is
|
|
135
136
|
);
|
136
137
|
|
137
138
|
instance.createApplication(applicationNftId, policyInfo);
|
138
|
-
instance.updateApplicationState(applicationNftId, APPLIED());
|
139
139
|
|
140
140
|
// TODO: add logging
|
141
141
|
}
|
@@ -254,8 +254,8 @@ contract ApplicationService is
|
|
254
254
|
premium.fullPremiumAmount += t;
|
255
255
|
}
|
256
256
|
{
|
257
|
-
|
258
|
-
uint256 t =
|
257
|
+
bytes memory componentData = instanceReader.getComponentInfo(poolNftId).data;
|
258
|
+
uint256 t = abi.decode(componentData, (IComponents.PoolInfo)).poolFee.fixedFee;
|
259
259
|
premium.poolFeeFixAmount = t;
|
260
260
|
premium.fullPremiumAmount += t;
|
261
261
|
}
|
@@ -307,8 +307,9 @@ contract ApplicationService is
|
|
307
307
|
premium.fullPremiumAmount += t;
|
308
308
|
}
|
309
309
|
{
|
310
|
-
|
311
|
-
|
310
|
+
bytes memory componentData = instanceReader.getComponentInfo(poolNftId).data;
|
311
|
+
UFixed poolFractionalFee = abi.decode(componentData, (IComponents.PoolInfo)).poolFee.fractionalFee;
|
312
|
+
uint256 t = (UFixedLib.toUFixed(netPremiumAmount) * poolFractionalFee).toInt();
|
312
313
|
premium.poolFeeVarAmount = t;
|
313
314
|
premium.fullPremiumAmount += t;
|
314
315
|
}
|