@etherisc/gif-next 0.0.2-7b65ccc-404 → 0.0.2-7bdd29a-841
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -2
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +2 -2
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +2 -2
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +2 -2
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +30 -60
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +2 -2
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +0 -38
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +2 -2
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +2 -2
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- 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 +2 -2
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +2 -2
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +2 -2
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +78 -115
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +16 -16
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +9 -9
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +16 -128
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
- 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 +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/mock/Dip.sol/Dip.dbg.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.json +2 -2
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +18 -48
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +2 -2
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +0 -38
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +2 -2
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +2 -2
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +4 -98
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +16 -16
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +111 -103
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +48 -52
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +17 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +1 -57
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +12 -66
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +1 -95
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +112 -118
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +51 -27
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +21 -32
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +9 -17
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +0 -38
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +2 -2
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +82 -58
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +34 -30
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +5 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +16 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +188 -108
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +260 -167
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +42 -26
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +2 -2
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +2 -2
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +0 -38
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +2 -2
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +2 -2
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +2 -2
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +2 -2
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +2 -2
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +2 -2
- 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/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +0 -38
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +74 -58
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +38 -30
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.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/InitializableCustom.sol/InitializableCustom.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +0 -38
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.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/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 +53 -6
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +2 -2
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +56 -70
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +29 -17
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +22 -22
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +12 -12
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2 -2
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +2 -2
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +23 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +2 -2
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/distribution/DistributionService.sol +1 -2
- package/contracts/instance/InstanceReader.sol +10 -7
- package/contracts/instance/InstanceService.sol +51 -27
- package/contracts/instance/base/ObjectLifecycle.sol +2 -3
- package/contracts/instance/module/IComponents.sol +1 -7
- package/contracts/instance/module/IPolicy.sol +1 -1
- package/contracts/mock/Dip.sol +1 -1
- package/contracts/pool/BasicPool.sol +4 -4
- package/contracts/pool/BasicPoolAuthorization.sol +2 -2
- package/contracts/pool/BundleService.sol +35 -19
- package/contracts/pool/IBundleService.sol +6 -3
- package/contracts/pool/IPoolService.sol +5 -14
- package/contracts/pool/Pool.sol +7 -11
- package/contracts/pool/PoolService.sol +64 -67
- package/contracts/product/ApplicationService.sol +37 -17
- package/contracts/product/BasicProduct.sol +3 -33
- package/contracts/product/ClaimService.sol +16 -9
- package/contracts/product/IApplicationService.sol +1 -0
- package/contracts/product/IClaimService.sol +1 -0
- package/contracts/product/IPolicyService.sol +23 -17
- package/contracts/product/PolicyService.sol +229 -127
- package/contracts/product/PricingService.sol +5 -1
- package/contracts/product/Product.sol +26 -5
- package/contracts/shared/Component.sol +8 -7
- package/contracts/shared/ComponentService.sol +3 -4
- package/contracts/shared/IComponent.sol +4 -3
- package/contracts/shared/IInstanceLinkedComponent.sol +8 -8
- package/contracts/shared/TokenHandler.sol +4 -0
- package/contracts/staking/StakingService.sol +8 -12
- package/contracts/type/Blocknumber.sol +7 -1
- package/contracts/type/Timestamp.sol +11 -1
- package/package.json +1 -1
@@ -22,7 +22,7 @@ interface IPolicy {
|
|
22
22
|
uint256 netPremiumAmount;
|
23
23
|
// fullPremium = netPremium + all fixed amounts + all variable amounts (excl commission and minDistribtuionOwnerFee variable part)
|
24
24
|
uint256 fullPremiumAmount;
|
25
|
-
// premium = fullPremium - discount
|
25
|
+
// effective premium = fullPremium - discount
|
26
26
|
uint256 premiumAmount;
|
27
27
|
uint256 productFeeFixAmount;
|
28
28
|
uint256 poolFeeFixAmount;
|
package/contracts/mock/Dip.sol
CHANGED
@@ -108,13 +108,13 @@ abstract contract BasicPool is
|
|
108
108
|
}
|
109
109
|
|
110
110
|
|
111
|
-
function
|
111
|
+
function closeBundle(NftId bundleNftId)
|
112
112
|
public
|
113
113
|
virtual
|
114
114
|
restricted()
|
115
115
|
onlyBundleOwner(bundleNftId)
|
116
116
|
{
|
117
|
-
|
117
|
+
_closeBundle(bundleNftId);
|
118
118
|
}
|
119
119
|
|
120
120
|
|
@@ -131,13 +131,13 @@ abstract contract BasicPool is
|
|
131
131
|
}
|
132
132
|
|
133
133
|
|
134
|
-
function
|
134
|
+
function setMaxBalanceAmount(Amount maxBalanceAmount)
|
135
135
|
public
|
136
136
|
virtual
|
137
137
|
restricted()
|
138
138
|
onlyOwner()
|
139
139
|
{
|
140
|
-
|
140
|
+
_setMaxBalanceAmount(maxBalanceAmount);
|
141
141
|
}
|
142
142
|
|
143
143
|
|
@@ -40,10 +40,10 @@ contract BasicPoolAuthorization
|
|
40
40
|
_authorize(functions, BasicPool.extend.selector, "extend");
|
41
41
|
_authorize(functions, BasicPool.lockBundle.selector, "lockBundle");
|
42
42
|
_authorize(functions, BasicPool.unlockBundle.selector, "unlockBundle");
|
43
|
-
_authorize(functions, BasicPool.
|
43
|
+
_authorize(functions, BasicPool.closeBundle.selector, "closeBundle");
|
44
44
|
_authorize(functions, BasicPool.setBundleFee.selector, "setBundleFee");
|
45
45
|
|
46
|
-
_authorize(functions, BasicPool.
|
46
|
+
_authorize(functions, BasicPool.setMaxBalanceAmount.selector, "setMaxBalanceAmount");
|
47
47
|
_authorize(functions, BasicPool.setBundleOwnerRole.selector, "setBundleOwnerRole");
|
48
48
|
_authorize(functions, BasicPool.setFees.selector, "setFees");
|
49
49
|
_authorize(functions, BasicPool.stake.selector, "stake");
|
@@ -16,7 +16,7 @@ import {IPolicy} from "../instance/module/IPolicy.sol";
|
|
16
16
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
17
17
|
import {BundleSet} from "../instance/BundleSet.sol";
|
18
18
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
19
|
-
import {Fee
|
19
|
+
import {Fee} from "../type/Fee.sol";
|
20
20
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
21
21
|
import {NftId, NftIdLib} from "../type/NftId.sol";
|
22
22
|
import {ObjectType, COMPONENT, POOL, BUNDLE, REGISTRY} from "../type/ObjectType.sol";
|
@@ -113,13 +113,15 @@ contract BundleService is
|
|
113
113
|
InstanceStore instanceStore = instance.getInstanceStore();
|
114
114
|
instanceStore.createBundle(
|
115
115
|
bundleNftId,
|
116
|
-
IBundle.BundleInfo(
|
117
|
-
poolNftId,
|
118
|
-
bundleFee,
|
119
|
-
filter,
|
120
|
-
TimestampLib.blockTimestamp(),
|
121
|
-
TimestampLib.blockTimestamp().addSeconds(lifetime),
|
122
|
-
zeroTimestamp()
|
116
|
+
IBundle.BundleInfo({
|
117
|
+
poolNftId: poolNftId,
|
118
|
+
fee: bundleFee,
|
119
|
+
filter: filter,
|
120
|
+
activatedAt: TimestampLib.blockTimestamp(),
|
121
|
+
expiredAt: TimestampLib.blockTimestamp().addSeconds(lifetime),
|
122
|
+
closedAt: zeroTimestamp()
|
123
|
+
})
|
124
|
+
);
|
123
125
|
|
124
126
|
// bundle book keeping
|
125
127
|
_componentService.increaseBundleBalance(
|
@@ -131,7 +133,6 @@ contract BundleService is
|
|
131
133
|
// put bundle under bundle managemet
|
132
134
|
BundleSet bundleManager = instance.getBundleSet();
|
133
135
|
bundleManager.add(bundleNftId);
|
134
|
-
|
135
136
|
// TODO add logging
|
136
137
|
}
|
137
138
|
|
@@ -148,7 +149,7 @@ contract BundleService is
|
|
148
149
|
restricted()
|
149
150
|
{
|
150
151
|
InstanceReader instanceReader = instance.getInstanceReader();
|
151
|
-
StateId bundleState =
|
152
|
+
StateId bundleState = instance.getInstanceReader().getBundleState(bundleNftId);
|
152
153
|
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
153
154
|
|
154
155
|
// ensure bundle is active and not yet expired
|
@@ -218,9 +219,9 @@ contract BundleService is
|
|
218
219
|
external
|
219
220
|
virtual
|
220
221
|
restricted
|
222
|
+
returns (Amount unstakedAmount, Amount feeAmount)
|
221
223
|
{
|
222
|
-
|
223
|
-
instance.getInstanceStore().updateBundleState(bundleNftId, CLOSED());
|
224
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
224
225
|
|
225
226
|
// ensure no open policies attached to bundle
|
226
227
|
BundleSet bundleManager = instance.getBundleSet();
|
@@ -229,8 +230,18 @@ contract BundleService is
|
|
229
230
|
revert ErrorBundleServiceBundleWithOpenPolicies(bundleNftId, openPolicies);
|
230
231
|
}
|
231
232
|
|
232
|
-
|
233
|
-
|
233
|
+
{
|
234
|
+
// update bundle state
|
235
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
236
|
+
instanceStore.updateBundleState(bundleNftId, CLOSED());
|
237
|
+
bundleManager.lock(bundleNftId);
|
238
|
+
|
239
|
+
// decrease bundle counters
|
240
|
+
Amount balanceAmountWithFees = instanceReader.getBalanceAmount(bundleNftId);
|
241
|
+
feeAmount = instanceReader.getFeeAmount(bundleNftId);
|
242
|
+
unstakedAmount = balanceAmountWithFees - feeAmount;
|
243
|
+
_componentService.decreaseBundleBalance(instanceStore, bundleNftId, unstakedAmount, feeAmount);
|
244
|
+
}
|
234
245
|
}
|
235
246
|
|
236
247
|
/// @inheritdoc IBundleService
|
@@ -244,9 +255,11 @@ contract BundleService is
|
|
244
255
|
// TODO: restricted() (once #462 is done)
|
245
256
|
{
|
246
257
|
IBundle.BundleInfo memory bundleInfo = instance.getInstanceReader().getBundleInfo(bundleNftId);
|
247
|
-
StateId bundleState = instance.getInstanceReader().
|
258
|
+
StateId bundleState = instance.getInstanceReader().getBundleState(bundleNftId);
|
248
259
|
|
249
|
-
if(bundleState != ACTIVE()
|
260
|
+
if( (bundleState != ACTIVE() && bundleState != PAUSED()) // locked bundles can be staked
|
261
|
+
|| bundleInfo.expiredAt < TimestampLib.blockTimestamp()
|
262
|
+
|| bundleInfo.closedAt.gtz()) {
|
250
263
|
revert ErrorBundleServiceBundleNotOpen(bundleNftId, bundleState, bundleInfo.expiredAt);
|
251
264
|
}
|
252
265
|
|
@@ -306,7 +319,7 @@ contract BundleService is
|
|
306
319
|
{
|
307
320
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
308
321
|
IBundle.BundleInfo memory bundleInfo = instance.getInstanceReader().getBundleInfo(bundleNftId);
|
309
|
-
StateId bundleState = instance.getInstanceReader().
|
322
|
+
StateId bundleState = instance.getInstanceReader().getBundleState(bundleNftId);
|
310
323
|
|
311
324
|
// ensure bundle belongs to the pool
|
312
325
|
if (bundleInfo.poolNftId != poolNftId) {
|
@@ -318,6 +331,10 @@ contract BundleService is
|
|
318
331
|
revert ErrorBundleServiceBundleNotOpen(bundleNftId, bundleState, bundleInfo.expiredAt);
|
319
332
|
}
|
320
333
|
|
334
|
+
if (lifetimeExtension.eqz()) {
|
335
|
+
revert ErrorBundleServiceExtensionLifetimeIsZero();
|
336
|
+
}
|
337
|
+
|
321
338
|
bundleInfo.expiredAt = bundleInfo.expiredAt.addSeconds(lifetimeExtension);
|
322
339
|
instance.getInstanceStore().updateBundle(bundleNftId, bundleInfo, KEEP_STATE());
|
323
340
|
|
@@ -405,10 +422,9 @@ contract BundleService is
|
|
405
422
|
// transfer amount to bundle owner
|
406
423
|
{
|
407
424
|
address owner = getRegistry().ownerOf(bundleNftId);
|
425
|
+
emit LogBundleServiceFeesWithdrawn(bundleNftId, owner, address(token), withdrawnAmount);
|
408
426
|
// TODO: centralize token handling (issue #471)
|
409
427
|
poolInfo.tokenHandler.transfer(poolWallet, owner, withdrawnAmount);
|
410
|
-
|
411
|
-
emit LogBundleServiceFeesWithdrawn(bundleNftId, owner, address(token), withdrawnAmount);
|
412
428
|
}
|
413
429
|
}
|
414
430
|
|
@@ -26,13 +26,14 @@ interface IBundleService is IService {
|
|
26
26
|
|
27
27
|
error ErrorBundleServicePolicyNotCloseable(NftId policyNftId);
|
28
28
|
|
29
|
-
// error ErrorBundleServiceBundleNotActive(NftId distributorNftId);
|
30
29
|
error ErrorBundleServiceFeesWithdrawAmountExceedsLimit(Amount amount, Amount limit);
|
31
30
|
error ErrorBundleServiceFeesWithdrawAmountIsZero();
|
32
31
|
error ErrorBundleServiceWalletAllowanceTooSmall(address wallet, address tokenHandler, uint256 allowance, uint256 amount);
|
33
32
|
|
34
33
|
error ErrorBundleServiceUnstakeAmountExceedsLimit(Amount amount, Amount limit);
|
35
34
|
|
35
|
+
error ErrorBundleServiceExtensionLifetimeIsZero();
|
36
|
+
|
36
37
|
event LogBundleServiceFeesWithdrawn(NftId bundleNftId, address recipient, address tokenAddress, Amount amount);
|
37
38
|
event LogBundleServiceBundleExtended(NftId bundleNftId, Seconds lifetimeExtension, Timestamp extendedExpiredAt);
|
38
39
|
|
@@ -51,7 +52,7 @@ interface IBundleService is IService {
|
|
51
52
|
returns(NftId bundleNftId); // the nft id of the newly created bundle
|
52
53
|
|
53
54
|
|
54
|
-
/// @dev increase bundle stakes by the specified amount
|
55
|
+
/// @dev increase bundle stakes by the specified amount. bundle must not be expired or closed
|
55
56
|
/// may only be called by the pool service
|
56
57
|
function stake(IInstance instance, NftId bundleNftId, Amount amount) external;
|
57
58
|
|
@@ -80,10 +81,12 @@ interface IBundleService is IService {
|
|
80
81
|
/// only open bundles (active or locked) may be closed
|
81
82
|
/// to close a bundle it may not have any non-closed polices attached to it
|
82
83
|
/// may only be called by registered and unlocked pool components
|
84
|
+
/// @return balanceAmount the unstaked amount that was remaining in the bundle
|
85
|
+
/// @return feeAmount the fee amount that was remaining for the bundle
|
83
86
|
function close(
|
84
87
|
IInstance instance,
|
85
88
|
NftId bundleNftId
|
86
|
-
) external;
|
89
|
+
) external returns (Amount balanceAmount, Amount feeAmount);
|
87
90
|
|
88
91
|
/// @dev set bundle fee to provided value
|
89
92
|
/// may only be called by registered and unlocked pool components
|
@@ -17,7 +17,7 @@ import {UFixed} from "../type/UFixed.sol";
|
|
17
17
|
|
18
18
|
interface IPoolService is IService {
|
19
19
|
|
20
|
-
event
|
20
|
+
event LogPoolServiceMaxBalanceAmountUpdated(NftId poolNftId, Amount previousMaxCapitalAmount, Amount currentMaxCapitalAmount);
|
21
21
|
event LogPoolServiceBundleOwnerRoleSet(NftId poolNftId, RoleId bundleOwnerRole);
|
22
22
|
|
23
23
|
event LogPoolServiceBundleCreated(NftId instanceNftId, NftId poolNftId, NftId bundleNftId);
|
@@ -29,7 +29,7 @@ interface IPoolService is IService {
|
|
29
29
|
error ErrorPoolServiceBundleOwnerRoleAlreadySet(NftId poolNftId);
|
30
30
|
error ErrorPoolServiceInvalidTransferAmount(Amount expectedAmount, Amount actualAmount);
|
31
31
|
error ErrorPoolServiceBundlePoolMismatch(NftId bundleNftId, NftId poolNftId);
|
32
|
-
error
|
32
|
+
error ErrorPoolServiceMaxBalanceAmountExceeded(NftId poolNftId, Amount maxBalanceAmount, Amount currentBalanceAmount, Amount transferAmount);
|
33
33
|
error ErrorPoolServiceWalletAllowanceTooSmall(address wallet, address spender, uint256 allowance, uint256 amount);
|
34
34
|
error ErrorPoolServiceAmountIsZero();
|
35
35
|
|
@@ -37,16 +37,8 @@ interface IPoolService is IService {
|
|
37
37
|
/// default implementation returns PUBLIC ROLE
|
38
38
|
function setBundleOwnerRole(RoleId bundleOwnerRole) external;
|
39
39
|
|
40
|
-
/// @dev sets the max
|
41
|
-
function
|
42
|
-
|
43
|
-
/// @dev set pool sepecific fees
|
44
|
-
function setFees(
|
45
|
-
Fee memory poolFee,
|
46
|
-
Fee memory stakingFee,
|
47
|
-
Fee memory performanceFee
|
48
|
-
) external;
|
49
|
-
|
40
|
+
/// @dev sets the max balance amount for the calling pool
|
41
|
+
function setMaxBalanceAmount(Amount maxBalanceAmount) external;
|
50
42
|
|
51
43
|
/// @dev locks required collateral to cover the specified application (and turn it into a policy)
|
52
44
|
/// - retention level == 1: the full collateral amount will be locked by the specified bundle
|
@@ -102,8 +94,7 @@ interface IPoolService is IService {
|
|
102
94
|
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
103
95
|
)
|
104
96
|
external
|
105
|
-
returns(NftId bundleNftId); // the nft id of the newly created bundle
|
106
|
-
// TODO: return netAmount
|
97
|
+
returns(NftId bundleNftId, Amount netStakedAmount); // the nft id of the newly created bundle
|
107
98
|
|
108
99
|
|
109
100
|
/// @dev closes the specified bundle
|
package/contracts/pool/Pool.sol
CHANGED
@@ -114,17 +114,13 @@ abstract contract Pool is
|
|
114
114
|
returns (IComponents.PoolInfo memory poolInfo)
|
115
115
|
{
|
116
116
|
return IComponents.PoolInfo(
|
117
|
-
NftIdLib.zero(), // will be set when GIF registers the related product
|
118
117
|
PUBLIC_ROLE(), // bundleOwnerRole
|
119
118
|
AmountLib.max(), // maxCapitalAmount,
|
120
119
|
isNftInterceptor(), // isInterceptingBundleTransfers
|
121
120
|
false, // isExternallyManaged,
|
122
121
|
false, // isVerifyingApplications,
|
123
122
|
UFixedLib.toUFixed(1), // collateralizationLevel,
|
124
|
-
UFixedLib.toUFixed(1)
|
125
|
-
FeeLib.zero(), // initialPoolFee,
|
126
|
-
FeeLib.zero(), // initialStakingFee,
|
127
|
-
FeeLib.zero() // initialPerformanceFee,
|
123
|
+
UFixedLib.toUFixed(1) // retentionLevel,
|
128
124
|
);
|
129
125
|
}
|
130
126
|
|
@@ -233,7 +229,7 @@ abstract contract Pool is
|
|
233
229
|
/// To close a bundle all all linked policies MUST be in closed state as well.
|
234
230
|
/// Closing a bundle finalizes the bundle bookkeeping including overall profit calculation.
|
235
231
|
/// Once a bundle is closed this action cannot be reversed.
|
236
|
-
function
|
232
|
+
function _closeBundle(NftId bundleNftId)
|
237
233
|
internal
|
238
234
|
virtual
|
239
235
|
{
|
@@ -255,13 +251,13 @@ abstract contract Pool is
|
|
255
251
|
}
|
256
252
|
|
257
253
|
|
258
|
-
/// @dev Sets the maximum
|
254
|
+
/// @dev Sets the maximum balance amound held by this pool.
|
259
255
|
/// Function may only be called by pool owner.
|
260
|
-
function
|
256
|
+
function _setMaxBalanceAmount(Amount maxBalanceAmount)
|
261
257
|
internal
|
262
258
|
virtual
|
263
259
|
{
|
264
|
-
_getPoolStorage()._poolService.
|
260
|
+
_getPoolStorage()._poolService.setMaxBalanceAmount(maxBalanceAmount);
|
265
261
|
}
|
266
262
|
|
267
263
|
/// @dev Sets the required role to create/own bundles.
|
@@ -300,9 +296,9 @@ abstract contract Pool is
|
|
300
296
|
bytes memory filter
|
301
297
|
)
|
302
298
|
internal
|
303
|
-
returns(NftId bundleNftId)
|
299
|
+
returns(NftId bundleNftId, Amount netStakedAmount)
|
304
300
|
{
|
305
|
-
bundleNftId = _getPoolStorage()._poolService.createBundle(
|
301
|
+
(bundleNftId, netStakedAmount) = _getPoolStorage()._poolService.createBundle(
|
306
302
|
bundleOwner,
|
307
303
|
fee,
|
308
304
|
amount,
|
@@ -17,7 +17,7 @@ import {IStaking} from "../staking/IStaking.sol";
|
|
17
17
|
|
18
18
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
19
19
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
20
|
-
import {NftId
|
20
|
+
import {NftId} from "../type/NftId.sol";
|
21
21
|
import {ObjectType, POOL, BUNDLE, COMPONENT, INSTANCE, REGISTRY} from "../type/ObjectType.sol";
|
22
22
|
import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
|
23
23
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
@@ -68,24 +68,20 @@ contract PoolService is
|
|
68
68
|
registerInterface(type(IPoolService).interfaceId);
|
69
69
|
}
|
70
70
|
|
71
|
-
|
72
|
-
function
|
71
|
+
/// @inheritdoc IPoolService
|
72
|
+
function setMaxBalanceAmount(Amount maxBalanceAmount)
|
73
73
|
external
|
74
74
|
virtual
|
75
75
|
{
|
76
|
-
/*
|
77
76
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
78
77
|
InstanceReader instanceReader = instance.getInstanceReader();
|
78
|
+
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
Amount previousMaxCapitalAmount = poolInfo.maxCapitalAmount;
|
83
|
-
|
84
|
-
poolInfo.maxCapitalAmount = maxCapitalAmount;
|
80
|
+
Amount previousMaxBalanceAmount = poolInfo.maxBalanceAmount;
|
81
|
+
poolInfo.maxBalanceAmount = maxBalanceAmount;
|
85
82
|
instance.getInstanceStore().updatePool(poolNftId, poolInfo, KEEP_STATE());
|
86
83
|
|
87
|
-
emit
|
88
|
-
*/
|
84
|
+
emit LogPoolServiceMaxBalanceAmountUpdated(poolNftId, previousMaxBalanceAmount, maxBalanceAmount);
|
89
85
|
}
|
90
86
|
|
91
87
|
function setBundleOwnerRole(RoleId bundleOwnerRole)
|
@@ -109,27 +105,6 @@ contract PoolService is
|
|
109
105
|
emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
|
110
106
|
}
|
111
107
|
|
112
|
-
|
113
|
-
function setFees(
|
114
|
-
Fee memory poolFee,
|
115
|
-
Fee memory stakingFee,
|
116
|
-
Fee memory performanceFee
|
117
|
-
)
|
118
|
-
external
|
119
|
-
virtual
|
120
|
-
{
|
121
|
-
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
122
|
-
|
123
|
-
IComponents.PoolInfo memory poolInfo = instance.getInstanceReader().getPoolInfo(poolNftId);
|
124
|
-
poolInfo.poolFee = poolFee;
|
125
|
-
poolInfo.stakingFee = stakingFee;
|
126
|
-
poolInfo.performanceFee = performanceFee;
|
127
|
-
|
128
|
-
instance.getInstanceStore().updatePool(poolNftId, poolInfo, KEEP_STATE());
|
129
|
-
|
130
|
-
// TODO add logging
|
131
|
-
}
|
132
|
-
|
133
108
|
/// @inheritdoc IPoolService
|
134
109
|
function createBundle(
|
135
110
|
address bundleOwner, // initial bundle owner
|
@@ -140,26 +115,32 @@ contract PoolService is
|
|
140
115
|
)
|
141
116
|
external
|
142
117
|
virtual
|
143
|
-
returns(NftId bundleNftId)
|
118
|
+
returns(NftId bundleNftId, Amount netStakedAmount)
|
144
119
|
{
|
145
120
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
146
|
-
InstanceReader instanceReader = instance.getInstanceReader();
|
147
121
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
122
|
+
{
|
123
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
124
|
+
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
125
|
+
Amount currentPoolBalance = instanceReader.getBalanceAmount(poolNftId);
|
126
|
+
if (currentPoolBalance + stakingAmount > poolInfo.maxBalanceAmount) {
|
127
|
+
revert ErrorPoolServiceMaxBalanceAmountExceeded(poolNftId, poolInfo.maxBalanceAmount, currentPoolBalance, stakingAmount);
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
|
132
|
+
Amount stakingFeeAmount;
|
133
|
+
(stakingFeeAmount, netStakedAmount) = FeeLib.calculateFee(
|
134
|
+
_getStakingFee(instance.getInstanceReader(), poolNftId),
|
153
135
|
stakingAmount);
|
154
136
|
|
155
|
-
// TODO: staking amount must be be > maxCapitalAmount
|
156
137
|
|
157
138
|
bundleNftId = _bundleService.create(
|
158
139
|
instance,
|
159
140
|
poolNftId,
|
160
141
|
bundleOwner,
|
161
142
|
fee,
|
162
|
-
|
143
|
+
netStakedAmount,
|
163
144
|
lifetime,
|
164
145
|
filter);
|
165
146
|
|
@@ -167,12 +148,12 @@ contract PoolService is
|
|
167
148
|
_componentService.increasePoolBalance(
|
168
149
|
instance.getInstanceStore(),
|
169
150
|
poolNftId,
|
170
|
-
|
151
|
+
netStakedAmount,
|
171
152
|
stakingFeeAmount);
|
172
153
|
|
173
154
|
// pool bookkeeping and collect tokens from bundle owner
|
174
155
|
_collectStakingAmount(
|
175
|
-
|
156
|
+
instance.getInstanceReader(),
|
176
157
|
poolNftId,
|
177
158
|
bundleOwner,
|
178
159
|
stakingAmount);
|
@@ -196,14 +177,40 @@ contract PoolService is
|
|
196
177
|
{
|
197
178
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
198
179
|
|
199
|
-
// TODO
|
180
|
+
// TODO get performance fee for pool (#477)
|
200
181
|
|
201
182
|
// releasing collateral in bundle
|
202
|
-
_bundleService.close(instance, bundleNftId);
|
203
|
-
|
204
|
-
// TODO get performance fee for pool, transfer of remaining funds + bundle fees to bundle owner
|
183
|
+
(Amount unstakedAmount, Amount feeAmount) = _bundleService.close(instance, bundleNftId);
|
205
184
|
|
185
|
+
_componentService.decreasePoolBalance(
|
186
|
+
instance.getInstanceStore(),
|
187
|
+
poolNftId,
|
188
|
+
unstakedAmount + feeAmount,
|
189
|
+
AmountLib.zero());
|
190
|
+
|
206
191
|
emit LogPoolServiceBundleClosed(instance.getNftId(), poolNftId, bundleNftId);
|
192
|
+
|
193
|
+
if ((unstakedAmount + feeAmount).gtz()){
|
194
|
+
IComponents.ComponentInfo memory poolComponentInfo = instance.getInstanceReader().getComponentInfo(poolNftId);
|
195
|
+
TokenHandler tokenHandler = poolComponentInfo.tokenHandler;
|
196
|
+
IERC20Metadata token = IERC20Metadata(poolComponentInfo.token);
|
197
|
+
|
198
|
+
// TODO: centralize token handling (issue #471)
|
199
|
+
|
200
|
+
// check allowance
|
201
|
+
uint256 tokenAllowance = token.allowance(poolComponentInfo.wallet, address(tokenHandler));
|
202
|
+
if (tokenAllowance < (unstakedAmount.toInt() + feeAmount.toInt())) {
|
203
|
+
revert ErrorPoolServiceWalletAllowanceTooSmall(
|
204
|
+
poolComponentInfo.wallet,
|
205
|
+
address(tokenHandler),
|
206
|
+
tokenAllowance,
|
207
|
+
unstakedAmount.toInt() + feeAmount.toInt());
|
208
|
+
}
|
209
|
+
|
210
|
+
// transfer amount to bundle owner
|
211
|
+
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
212
|
+
tokenHandler.transfer(poolComponentInfo.wallet, bundleOwner, unstakedAmount + feeAmount);
|
213
|
+
}
|
207
214
|
}
|
208
215
|
|
209
216
|
/// @inheritdoc IPoolService
|
@@ -222,15 +229,18 @@ contract PoolService is
|
|
222
229
|
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
223
230
|
}
|
224
231
|
|
225
|
-
|
226
|
-
|
227
|
-
|
232
|
+
{
|
233
|
+
Amount currentPoolBalance = instanceReader.getBalanceAmount(poolNftId);
|
234
|
+
if (currentPoolBalance + amount > poolInfo.maxBalanceAmount) {
|
235
|
+
revert ErrorPoolServiceMaxBalanceAmountExceeded(poolNftId, poolInfo.maxBalanceAmount, currentPoolBalance, amount);
|
236
|
+
}
|
228
237
|
}
|
229
238
|
|
230
239
|
// calculate fees
|
240
|
+
Amount feeAmount;
|
231
241
|
(
|
232
|
-
|
233
|
-
|
242
|
+
feeAmount,
|
243
|
+
netAmount
|
234
244
|
) = FeeLib.calculateFee(
|
235
245
|
_getStakingFee(instanceReader, poolNftId),
|
236
246
|
amount);
|
@@ -246,13 +256,12 @@ contract PoolService is
|
|
246
256
|
|
247
257
|
// collect tokens from bundle owner
|
248
258
|
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
259
|
+
emit LogPoolServiceBundleStaked(instance.getNftId(), poolNftId, bundleNftId, amount, netAmount);
|
249
260
|
_collectStakingAmount(
|
250
261
|
instanceReader,
|
251
262
|
poolNftId,
|
252
263
|
bundleOwner,
|
253
264
|
amount);
|
254
|
-
|
255
|
-
emit LogPoolServiceBundleStaked(instance.getNftId(), poolNftId, bundleNftId, amount, netAmount);
|
256
265
|
}
|
257
266
|
|
258
267
|
/// @inheritdoc IPoolService
|
@@ -304,24 +313,12 @@ contract PoolService is
|
|
304
313
|
|
305
314
|
// transfer amount to bundle owner
|
306
315
|
address owner = getRegistry().ownerOf(bundleNftId);
|
316
|
+
emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount);
|
307
317
|
// TODO: centralize token handling (issue #471)
|
308
318
|
poolComponentInfo.tokenHandler.transfer(poolWallet, owner, unstakedAmount);
|
309
|
-
|
310
|
-
emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount);
|
311
|
-
|
312
319
|
return unstakedAmount;
|
313
320
|
}
|
314
321
|
|
315
|
-
function _getPerformanceFee(InstanceReader instanceReader, NftId poolNftId)
|
316
|
-
internal
|
317
|
-
virtual
|
318
|
-
view
|
319
|
-
returns (Fee memory performanceFee)
|
320
|
-
{
|
321
|
-
NftId productNftId = instanceReader.getPoolInfo(poolNftId).productNftId;
|
322
|
-
return instanceReader.getPoolInfo(productNftId).performanceFee;
|
323
|
-
}
|
324
|
-
|
325
322
|
function processSale(
|
326
323
|
NftId bundleNftId,
|
327
324
|
IPolicy.Premium memory premium
|
@@ -128,6 +128,7 @@ contract ApplicationService is
|
|
128
128
|
address applicationOwner,
|
129
129
|
RiskId riskId,
|
130
130
|
Amount sumInsuredAmount,
|
131
|
+
Amount premiumAmount,
|
131
132
|
Seconds lifetime,
|
132
133
|
NftId bundleNftId,
|
133
134
|
ReferralId referralId,
|
@@ -152,13 +153,45 @@ contract ApplicationService is
|
|
152
153
|
applicationNftId = _registerApplication(productNftId, applicationOwner);
|
153
154
|
|
154
155
|
// create policy info for application
|
155
|
-
IPolicy.PolicyInfo memory applicationInfo =
|
156
|
+
IPolicy.PolicyInfo memory applicationInfo = _createApplicationInfo(
|
157
|
+
productNftId,
|
158
|
+
riskId,
|
159
|
+
sumInsuredAmount,
|
160
|
+
premiumAmount,
|
161
|
+
lifetime,
|
162
|
+
bundleNftId,
|
163
|
+
referralId,
|
164
|
+
applicationData);
|
165
|
+
|
166
|
+
// register application with instance
|
167
|
+
instance.getInstanceStore().createApplication(
|
168
|
+
applicationNftId,
|
169
|
+
applicationInfo);
|
170
|
+
|
171
|
+
// TODO: add logging
|
172
|
+
}
|
173
|
+
|
174
|
+
function _createApplicationInfo(
|
175
|
+
NftId productNftId,
|
176
|
+
RiskId riskId,
|
177
|
+
Amount sumInsuredAmount,
|
178
|
+
Amount premiumAmount,
|
179
|
+
Seconds lifetime,
|
180
|
+
NftId bundleNftId,
|
181
|
+
ReferralId referralId,
|
182
|
+
bytes memory applicationData
|
183
|
+
)
|
184
|
+
internal
|
185
|
+
virtual
|
186
|
+
returns (IPolicy.PolicyInfo memory applicationInfo)
|
187
|
+
{
|
188
|
+
return IPolicy.PolicyInfo({
|
156
189
|
productNftId: productNftId,
|
157
190
|
bundleNftId: bundleNftId,
|
158
191
|
referralId: referralId,
|
159
192
|
riskId: riskId,
|
160
193
|
sumInsuredAmount: sumInsuredAmount,
|
161
|
-
premiumAmount:
|
194
|
+
premiumAmount: premiumAmount,
|
162
195
|
premiumPaidAmount: AmountLib.zero(),
|
163
196
|
lifetime: lifetime,
|
164
197
|
applicationData: applicationData,
|
@@ -171,21 +204,8 @@ contract ApplicationService is
|
|
171
204
|
expiredAt: zeroTimestamp(),
|
172
205
|
closedAt: zeroTimestamp()
|
173
206
|
});
|
174
|
-
|
175
|
-
// TODO consider to provide this amount externally
|
176
|
-
// actual calculation is done 2nd time anyway for premium collection
|
177
|
-
// calculate premium amount
|
178
|
-
applicationInfo.premiumAmount = _calculatePremiumAmount(applicationInfo);
|
179
|
-
|
180
|
-
// register application with instance
|
181
|
-
instance.getInstanceStore().createApplication(
|
182
|
-
applicationNftId,
|
183
|
-
applicationInfo);
|
184
|
-
|
185
|
-
// TODO: add logging
|
186
207
|
}
|
187
208
|
|
188
|
-
|
189
209
|
function renew(
|
190
210
|
NftId policyNftId, // policy to be renewd (renewal inherits policy attributes)
|
191
211
|
NftId bundleNftId // will likely need a newer bundle for underwriting
|
@@ -194,7 +214,7 @@ contract ApplicationService is
|
|
194
214
|
virtual override
|
195
215
|
returns (NftId applicationNftId)
|
196
216
|
{
|
197
|
-
|
217
|
+
// TODO implement
|
198
218
|
}
|
199
219
|
|
200
220
|
|
@@ -210,7 +230,7 @@ contract ApplicationService is
|
|
210
230
|
external
|
211
231
|
virtual override
|
212
232
|
{
|
213
|
-
|
233
|
+
// TODO implement
|
214
234
|
}
|
215
235
|
|
216
236
|
function revoke(NftId applicationNftId)
|