@etherisc/gif-next 0.0.2-d696c44-627 → 0.0.2-d6a50e7-658
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +46 -8
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +4 -0
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +1007 -0
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +744 -0
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +4 -0
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +791 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +158 -70
- package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.json +24 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +233 -5
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +67 -11
- 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/IAccessAdmin.sol/IAccessAdmin.json +97 -37
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +40 -3
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +19 -0
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +68 -5
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +173 -375
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +82 -22
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +123 -317
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +336 -229
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +143 -109
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +135 -139
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +198 -33
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.json +22 -0
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1475 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +502 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2040 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +470 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1479 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +470 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1195 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1655 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +502 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2408 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +470 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +193 -45
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +130 -61
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +105 -103
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +165 -157
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +317 -143
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +57 -84
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +919 -315
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +131 -266
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +102 -92
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +619 -492
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +4 -0
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +853 -0
- 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 +46 -5
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +16 -5
- package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +168 -0
- 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 +139 -335
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +84 -24
- 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/IOracleComponent.sol/IOracleComponent.json +128 -126
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +69 -11
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +115 -303
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +153 -190
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +122 -88
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +162 -387
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +114 -22
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +434 -201
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +163 -97
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +270 -27
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +143 -195
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +448 -217
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +128 -370
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +569 -396
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +141 -91
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +134 -184
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +91 -93
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +258 -396
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +82 -22
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +435 -212
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +145 -107
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +94 -9
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +318 -8
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +361 -113
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +136 -83
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +250 -198
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
- package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +57 -4
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +455 -318
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +141 -99
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +230 -312
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +120 -122
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +256 -394
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +637 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +724 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +59 -16
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +315 -34
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +144 -41
- package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +4 -0
- package/artifacts/contracts/registry/IRelease.sol/IRelease.json +24 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +5 -18
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +521 -95
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +275 -160
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +109 -292
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +94 -80
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +1795 -0
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +47 -6
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +412 -246
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +66 -8
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +4 -4
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +76 -265
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +559 -558
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +137 -121
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +57 -111
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +541 -0
- package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.json +24 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.json +30 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.json +40 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +89 -88
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +492 -212
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +117 -126
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +36 -0
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +36 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +16 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +15 -47
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +148 -0
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +55 -2
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +4 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +53 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +104 -303
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +42 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +42 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +22 -57
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +19 -141
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +122 -97
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +57 -111
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +697 -25
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +395 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +172 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +134 -125
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +55 -23
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +73 -93
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +210 -366
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +46 -5
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +122 -95
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +6 -11
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +100 -171
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +98 -84
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +153 -107
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +59 -23
- 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/Amount.sol/AmountLib.json +61 -8
- 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/ClaimId.sol/ClaimIdLib.json +28 -4
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/type/Fee.sol/FeeLib.json +7 -2
- package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +4 -0
- package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +33 -0
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +23 -4
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +19 -19
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +118 -5
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +3 -3
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +50 -2
- 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/StateId.sol/StateIdLib.json +15 -2
- 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/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +52 -2
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -21
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.json +47 -2
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +4 -0
- package/artifacts/contracts/{shared → upgradeability}/IVersionable.sol/IVersionable.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +618 -0
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +3 -3
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +4 -0
- package/artifacts/contracts/{shared → upgradeability}/Versionable.sol/Versionable.json +1 -1
- package/contracts/accounting/AccountingService.sol +262 -0
- package/contracts/accounting/AccountingServiceManager.sol +38 -0
- package/contracts/accounting/IAccountingService.sol +45 -0
- package/contracts/authorization/AccessAdmin.sol +192 -124
- package/contracts/authorization/AccessManagerCloneable.sol +136 -3
- package/contracts/authorization/Authorization.sol +111 -40
- package/contracts/authorization/IAccess.sol +1 -0
- package/contracts/authorization/IAccessAdmin.sol +10 -6
- package/contracts/authorization/IAuthorization.sol +13 -7
- package/contracts/authorization/IServiceAuthorization.sol +3 -1
- package/contracts/authorization/ServiceAuthorization.sol +26 -10
- package/contracts/distribution/BasicDistribution.sol +12 -22
- package/contracts/distribution/BasicDistributionAuthorization.sol +6 -2
- package/contracts/distribution/Distribution.sol +37 -50
- package/contracts/distribution/DistributionService.sol +152 -97
- package/contracts/distribution/DistributionServiceManager.sol +8 -11
- package/contracts/distribution/IDistributionComponent.sol +6 -3
- package/contracts/distribution/IDistributionService.sol +23 -8
- package/contracts/examples/fire/DamageLevel.sol +59 -0
- package/contracts/examples/fire/FirePool.sol +90 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +35 -0
- package/contracts/examples/fire/FireProduct.sol +438 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
- package/contracts/examples/fire/FireUSD.sol +26 -0
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +57 -0
- package/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
- package/contracts/examples/unpermissioned/SimplePool.sol +107 -0
- package/contracts/examples/unpermissioned/SimplePoolAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleProduct.sol +370 -0
- package/contracts/examples/unpermissioned/SimpleProductAuthorization.sol +28 -0
- package/contracts/instance/BundleSet.sol +42 -38
- package/contracts/instance/IInstance.sol +16 -36
- package/contracts/instance/IInstanceService.sol +9 -29
- package/contracts/instance/Instance.sol +47 -66
- package/contracts/instance/InstanceAdmin.sol +133 -73
- package/contracts/instance/InstanceAuthorizationV3.sol +55 -32
- package/contracts/instance/InstanceReader.sol +218 -27
- package/contracts/instance/InstanceService.sol +125 -164
- package/contracts/instance/InstanceServiceManager.sol +8 -13
- package/contracts/instance/InstanceStore.sol +24 -2
- package/contracts/instance/RiskSet.sol +118 -0
- package/contracts/instance/base/ObjectCounter.sol +1 -2
- package/contracts/instance/base/ObjectLifecycle.sol +11 -4
- package/contracts/instance/base/ObjectSet.sol +31 -33
- package/contracts/instance/base/ObjectSetHelperLib.sol +30 -0
- package/contracts/instance/module/IBundle.sol +1 -1
- package/contracts/instance/module/IComponents.sol +14 -15
- package/contracts/instance/module/IDistribution.sol +0 -1
- package/contracts/instance/module/IPolicy.sol +26 -25
- package/contracts/instance/module/IRisk.sol +3 -0
- package/contracts/mock/Dip.sol +1 -1
- package/contracts/oracle/BasicOracle.sol +0 -1
- package/contracts/oracle/IOracleComponent.sol +2 -1
- package/contracts/oracle/IOracleService.sol +2 -1
- package/contracts/oracle/Oracle.sol +21 -22
- package/contracts/oracle/OracleService.sol +113 -81
- package/contracts/oracle/OracleServiceManager.sol +8 -11
- package/contracts/pool/BasicPool.sol +38 -27
- package/contracts/pool/BasicPoolAuthorization.sol +22 -3
- package/contracts/pool/BundleService.sol +226 -97
- package/contracts/pool/BundleServiceManager.sol +8 -11
- package/contracts/pool/IBundleService.sol +33 -18
- package/contracts/pool/IPoolComponent.sol +20 -10
- package/contracts/pool/IPoolService.sol +53 -50
- package/contracts/pool/Pool.sol +150 -116
- package/contracts/pool/PoolService.sol +343 -179
- package/contracts/pool/PoolServiceManager.sol +6 -9
- package/contracts/product/ApplicationService.sol +83 -78
- package/contracts/product/ApplicationServiceManager.sol +6 -6
- package/contracts/product/BasicProduct.sol +13 -44
- package/contracts/product/BasicProductAuthorization.sol +3 -2
- package/contracts/product/ClaimService.sol +425 -159
- package/contracts/product/ClaimServiceManager.sol +6 -6
- package/contracts/product/IApplicationService.sol +6 -2
- package/contracts/product/IClaimService.sol +44 -7
- package/contracts/product/IPolicyService.sol +46 -34
- package/contracts/product/IPricingService.sol +10 -10
- package/contracts/product/IProductComponent.sol +28 -5
- package/contracts/product/{IProductService.sol → IRiskService.sol} +1 -1
- package/contracts/product/PolicyService.sol +520 -259
- package/contracts/product/PolicyServiceManager.sol +6 -9
- package/contracts/product/PricingService.sol +66 -62
- package/contracts/product/PricingServiceManager.sol +6 -9
- package/contracts/product/Product.sol +160 -89
- package/contracts/product/RiskService.sol +151 -0
- package/contracts/product/RiskServiceManager.sol +39 -0
- package/contracts/registry/ChainNft.sol +72 -40
- package/contracts/registry/IRegistry.sol +58 -28
- package/contracts/registry/IRegistryService.sol +5 -12
- package/contracts/registry/IRelease.sol +26 -0
- package/contracts/registry/ITransferInterceptor.sol +1 -2
- package/contracts/registry/Registry.sol +353 -203
- package/contracts/registry/RegistryAdmin.sol +161 -182
- package/contracts/registry/RegistryService.sol +41 -66
- package/contracts/registry/RegistryServiceManager.sol +5 -5
- package/contracts/registry/ReleaseAdmin.sol +245 -0
- package/contracts/registry/ReleaseLifecycle.sol +8 -3
- package/contracts/registry/ReleaseRegistry.sol +258 -234
- package/contracts/registry/ServiceAuthorizationV3.sol +94 -52
- package/contracts/registry/TokenRegistry.sol +6 -8
- package/contracts/shared/Component.sol +71 -126
- package/contracts/shared/ComponentService.sol +441 -358
- package/contracts/shared/ComponentServiceManager.sol +10 -7
- package/contracts/shared/ComponentVerifyingService.sol +28 -17
- package/contracts/shared/ContractLib.sol +252 -0
- package/contracts/shared/IComponent.sol +8 -17
- package/contracts/shared/IComponentService.sol +47 -39
- package/contracts/shared/IInstanceLinkedComponent.sol +7 -27
- package/contracts/shared/ILifecycle.sol +3 -1
- package/contracts/shared/INftOwnable.sol +2 -0
- package/contracts/shared/IPolicyHolder.sol +12 -22
- package/contracts/shared/IRegisterable.sol +23 -1
- package/contracts/shared/IService.sol +4 -6
- package/contracts/shared/{ERC165.sol → InitializableERC165.sol} +3 -3
- package/contracts/shared/InstanceLinkedComponent.sol +80 -34
- package/contracts/shared/KeyValueStore.sol +1 -1
- package/contracts/shared/Lifecycle.sol +15 -4
- package/contracts/shared/NftOwnable.sol +31 -11
- package/contracts/shared/PolicyHolder.sol +17 -57
- package/contracts/shared/Registerable.sol +55 -21
- package/contracts/shared/RegistryLinked.sol +9 -14
- package/contracts/shared/Service.sol +18 -36
- package/contracts/shared/TokenHandler.sol +357 -26
- package/contracts/shared/TokenHandlerDeployerLib.sol +20 -0
- package/contracts/staking/IStaking.sol +12 -6
- package/contracts/staking/IStakingService.sol +0 -3
- package/contracts/staking/StakeManagerLib.sol +18 -25
- package/contracts/staking/Staking.sol +85 -70
- package/contracts/staking/StakingManager.sol +10 -11
- package/contracts/staking/StakingReader.sol +17 -13
- package/contracts/staking/StakingService.sol +64 -36
- package/contracts/staking/StakingServiceManager.sol +4 -4
- package/contracts/staking/StakingStore.sol +5 -15
- package/contracts/staking/TargetManagerLib.sol +7 -3
- package/contracts/type/Amount.sol +27 -5
- package/contracts/type/Blocknumber.sol +7 -1
- package/contracts/type/ClaimId.sol +6 -1
- package/contracts/type/Key32.sol +2 -2
- package/contracts/type/Key32Set.sol +62 -0
- package/contracts/type/NftId.sol +7 -0
- package/contracts/type/ObjectType.sol +36 -17
- package/contracts/type/PayoutId.sol +10 -10
- package/contracts/type/Referral.sol +1 -0
- package/contracts/type/RiskId.sol +35 -4
- package/contracts/type/RoleId.sol +4 -13
- package/contracts/type/Seconds.sol +21 -1
- package/contracts/type/StateId.sol +15 -1
- package/contracts/type/Timestamp.sol +10 -5
- package/contracts/type/UFixed.sol +35 -122
- package/contracts/type/Version.sol +15 -5
- package/contracts/{shared → upgradeability}/ProxyManager.sol +71 -37
- package/contracts/{shared → upgradeability}/Versionable.sol +2 -2
- package/package.json +4 -3
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +0 -4
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.json +0 -290
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +0 -4
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +0 -390
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +0 -708
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +0 -702
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +0 -73
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +0 -4
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +0 -4
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +0 -617
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +0 -4
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +0 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +0 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.json +0 -10
- package/contracts/authorization/IModuleAuthorization.sol +0 -21
- package/contracts/authorization/ModuleAuthorization.sol +0 -78
- package/contracts/product/ProductService.sol +0 -124
- package/contracts/product/ProductServiceManager.sol +0 -42
- package/contracts/shared/InitializableCustom.sol +0 -177
- /package/contracts/{shared → upgradeability}/IVersionable.sol +0 -0
- /package/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol +0 -0
@@ -1,60 +1,41 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
5
|
-
import {IRegistry} from "../registry/IRegistry.sol";
|
6
|
-
import {IInstance} from "../instance/IInstance.sol";
|
4
|
+
import {IAccountingService} from "../accounting/IAccountingService.sol";
|
7
5
|
import {IBundle} from "../instance/module/IBundle.sol";
|
6
|
+
import {IBundleService} from "./IBundleService.sol";
|
8
7
|
import {IComponents} from "../instance/module/IComponents.sol";
|
8
|
+
import {IComponentService} from "../shared/IComponentService.sol";
|
9
|
+
import {IInstance} from "../instance/IInstance.sol";
|
9
10
|
import {IPolicy} from "../instance/module/IPolicy.sol";
|
10
|
-
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
11
|
+
import {IPoolComponent} from "../pool/IPoolComponent.sol";
|
12
|
+
import {IPoolService} from "./IPoolService.sol";
|
13
|
+
import {IProductComponent} from "../product/IProductComponent.sol";
|
14
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
15
|
+
import {IStaking} from "../staking/IStaking.sol";
|
14
16
|
|
15
17
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
18
|
+
import {ClaimId} from "../type/ClaimId.sol";
|
19
|
+
import {ContractLib} from "../shared/ContractLib.sol";
|
16
20
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
17
|
-
import {NftId
|
18
|
-
import {ObjectType, POOL, BUNDLE,
|
19
|
-
import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
|
21
|
+
import {NftId} from "../type/NftId.sol";
|
22
|
+
import {ObjectType, ACCOUNTING, POOL, BUNDLE, PRODUCT, POLICY, COMPONENT} from "../type/ObjectType.sol";
|
20
23
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
21
|
-
import {
|
22
|
-
import {KEEP_STATE, StateId} from "../type/StateId.sol";
|
23
|
-
import {Seconds} from "../type/Seconds.sol";
|
24
|
-
import {TimestampLib, zeroTimestamp} from "../type/Timestamp.sol";
|
25
|
-
import {TokenHandler} from "../shared/TokenHandler.sol";
|
24
|
+
import {KEEP_STATE} from "../type/StateId.sol";
|
26
25
|
import {UFixed} from "../type/UFixed.sol";
|
27
|
-
import {Version, VersionLib} from "../type/Version.sol";
|
28
|
-
|
29
|
-
import {IService} from "../shared/IService.sol";
|
30
26
|
import {Service} from "../shared/Service.sol";
|
31
|
-
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
32
|
-
import {IBundleService} from "./IBundleService.sol";
|
33
|
-
import {IComponentService} from "../shared/IComponentService.sol";
|
34
|
-
import {IInstanceService} from "../instance/IInstanceService.sol";
|
35
|
-
import {IPoolService} from "./IPoolService.sol";
|
36
|
-
import {IRegistryService} from "../registry/IRegistryService.sol";
|
37
|
-
import {IStaking} from "../staking/IStaking.sol";
|
38
|
-
import {InstanceService} from "../instance/InstanceService.sol";
|
39
27
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
40
28
|
import {InstanceStore} from "../instance/InstanceStore.sol";
|
41
|
-
import {IComponent} from "../shared/IComponent.sol";
|
42
|
-
import {IPoolComponent} from "./IPoolComponent.sol";
|
43
29
|
|
44
30
|
string constant POOL_SERVICE_NAME = "PoolService";
|
45
31
|
|
46
32
|
contract PoolService is
|
47
|
-
|
33
|
+
Service,
|
48
34
|
IPoolService
|
49
35
|
{
|
50
|
-
|
51
|
-
using AmountLib for Amount;
|
52
|
-
|
36
|
+
IAccountingService private _accountingService;
|
53
37
|
IBundleService internal _bundleService;
|
54
38
|
IComponentService internal _componentService;
|
55
|
-
IInstanceService private _instanceService;
|
56
|
-
IRegistryService private _registryService;
|
57
|
-
|
58
39
|
IStaking private _staking;
|
59
40
|
|
60
41
|
function _initialize(
|
@@ -62,191 +43,306 @@ contract PoolService is
|
|
62
43
|
bytes memory data
|
63
44
|
)
|
64
45
|
internal
|
65
|
-
initializer
|
66
46
|
virtual override
|
47
|
+
initializer()
|
67
48
|
{
|
68
49
|
(
|
69
|
-
address
|
70
|
-
|
71
|
-
|
72
|
-
) = abi.decode(data, (address, address, address));
|
50
|
+
address authority,
|
51
|
+
address registry
|
52
|
+
) = abi.decode(data, (address, address));
|
73
53
|
|
74
|
-
|
54
|
+
__Service_init(authority, registry, owner);
|
75
55
|
|
76
|
-
|
56
|
+
_accountingService = IAccountingService(_getServiceAddress(ACCOUNTING()));
|
77
57
|
_bundleService = IBundleService(_getServiceAddress(BUNDLE()));
|
78
|
-
_instanceService = IInstanceService(_getServiceAddress(INSTANCE()));
|
79
58
|
_componentService = IComponentService(_getServiceAddress(COMPONENT()));
|
80
|
-
|
81
59
|
_staking = IStaking(getRegistry().getStakingAddress());
|
82
60
|
|
83
|
-
|
61
|
+
_registerInterface(type(IPoolService).interfaceId);
|
84
62
|
}
|
85
63
|
|
86
64
|
|
87
|
-
|
65
|
+
/// @inheritdoc IPoolService
|
66
|
+
function setMaxBalanceAmount(Amount maxBalanceAmount)
|
88
67
|
external
|
89
68
|
virtual
|
90
69
|
{
|
91
|
-
|
92
|
-
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
70
|
+
(NftId poolNftId, IInstance instance) = _getAndVerifyActivePool();
|
93
71
|
InstanceReader instanceReader = instance.getInstanceReader();
|
72
|
+
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
94
73
|
|
95
|
-
|
96
|
-
|
97
|
-
Amount previousMaxCapitalAmount = poolInfo.maxCapitalAmount;
|
98
|
-
|
99
|
-
poolInfo.maxCapitalAmount = maxCapitalAmount;
|
74
|
+
Amount previousMaxBalanceAmount = poolInfo.maxBalanceAmount;
|
75
|
+
poolInfo.maxBalanceAmount = maxBalanceAmount;
|
100
76
|
instance.getInstanceStore().updatePool(poolNftId, poolInfo, KEEP_STATE());
|
101
77
|
|
102
|
-
emit
|
103
|
-
*/
|
78
|
+
emit LogPoolServiceMaxBalanceAmountUpdated(poolNftId, previousMaxBalanceAmount, maxBalanceAmount);
|
104
79
|
}
|
105
80
|
|
106
|
-
|
81
|
+
|
82
|
+
function closeBundle(NftId bundleNftId)
|
107
83
|
external
|
108
84
|
virtual
|
109
85
|
{
|
110
|
-
(
|
111
|
-
InstanceReader instanceReader = instance.getInstanceReader();
|
86
|
+
_checkNftType(bundleNftId, BUNDLE());
|
112
87
|
|
113
|
-
|
114
|
-
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
88
|
+
(NftId poolNftId, IInstance instance) = _getAndVerifyActivePool();
|
115
89
|
|
116
|
-
//
|
117
|
-
if(poolInfo.bundleOwnerRole != PUBLIC_ROLE()) {
|
118
|
-
revert ErrorPoolServiceBundleOwnerRoleAlreadySet(poolNftId);
|
119
|
-
}
|
90
|
+
// TODO get performance fee for pool (#477)
|
120
91
|
|
121
|
-
|
122
|
-
|
92
|
+
// releasing collateral in bundle
|
93
|
+
(Amount unstakedAmount, Amount feeAmount) = _bundleService.close(instance, bundleNftId);
|
123
94
|
|
124
|
-
|
95
|
+
_accountingService.decreasePoolBalance(
|
96
|
+
instance.getInstanceStore(),
|
97
|
+
poolNftId,
|
98
|
+
unstakedAmount + feeAmount,
|
99
|
+
AmountLib.zero());
|
100
|
+
|
101
|
+
emit LogPoolServiceBundleClosed(instance.getNftId(), poolNftId, bundleNftId);
|
102
|
+
|
103
|
+
if ((unstakedAmount + feeAmount).gtz()){
|
104
|
+
IComponents.ComponentInfo memory poolComponentInfo = instance.getInstanceReader().getComponentInfo(poolNftId);
|
105
|
+
poolComponentInfo.tokenHandler.distributeTokens(
|
106
|
+
poolComponentInfo.tokenHandler.getWallet(),
|
107
|
+
getRegistry().ownerOf(bundleNftId),
|
108
|
+
unstakedAmount + feeAmount);
|
109
|
+
}
|
125
110
|
}
|
126
111
|
|
127
112
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
113
|
+
/// @inheritdoc IPoolService
|
114
|
+
function processFundedClaim(
|
115
|
+
NftId policyNftId,
|
116
|
+
ClaimId claimId,
|
117
|
+
Amount availableAmount
|
118
|
+
)
|
133
119
|
external
|
134
120
|
virtual
|
135
121
|
{
|
136
|
-
(
|
122
|
+
_checkNftType(policyNftId, POLICY());
|
137
123
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
124
|
+
(NftId poolNftId, IInstance instance) = _getAndVerifyActivePool();
|
125
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
126
|
+
NftId productNftId = getRegistry().getObjectInfo(poolNftId).parentNftId;
|
127
|
+
|
128
|
+
// check policy matches with calling pool
|
129
|
+
IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
130
|
+
if(policyInfo.productNftId != productNftId) {
|
131
|
+
revert ErrorPoolServicePolicyPoolMismatch(
|
132
|
+
policyNftId,
|
133
|
+
policyInfo.productNftId,
|
134
|
+
productNftId);
|
135
|
+
}
|
142
136
|
|
143
|
-
|
137
|
+
emit LogPoolServiceProcessFundedClaim(policyNftId, claimId, availableAmount);
|
144
138
|
|
145
|
-
//
|
139
|
+
// callback to product component if applicable
|
140
|
+
if (instanceReader.getProductInfo(productNftId).isProcessingFundedClaims) {
|
141
|
+
address productAddress = getRegistry().getObjectAddress(productNftId);
|
142
|
+
IProductComponent(productAddress).processFundedClaim(policyNftId, claimId, availableAmount);
|
143
|
+
}
|
146
144
|
}
|
147
145
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
|
152
|
-
Seconds lifetime, // initial duration for which new policies are covered
|
153
|
-
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
154
|
-
)
|
146
|
+
|
147
|
+
/// @inheritdoc IPoolService
|
148
|
+
function stake(NftId bundleNftId, Amount amount)
|
155
149
|
external
|
156
150
|
virtual
|
157
|
-
|
151
|
+
// TODO: restricted() (once #462 is done)
|
152
|
+
returns(Amount netAmount)
|
158
153
|
{
|
159
|
-
(
|
154
|
+
_checkNftType(bundleNftId, BUNDLE());
|
155
|
+
|
156
|
+
(NftId poolNftId, IInstance instance) = _getAndVerifyActivePool();
|
160
157
|
InstanceReader instanceReader = instance.getInstanceReader();
|
158
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
159
|
+
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
161
160
|
|
162
|
-
(
|
163
|
-
|
164
|
-
|
165
|
-
) = FeeLib.calculateFee(
|
166
|
-
_getStakingFee(instanceReader, poolNftId),
|
167
|
-
stakingAmount);
|
161
|
+
if (bundleInfo.poolNftId != poolNftId) {
|
162
|
+
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
163
|
+
}
|
168
164
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
165
|
+
{
|
166
|
+
Amount currentPoolBalance = instanceReader.getBalanceAmount(poolNftId);
|
167
|
+
if (currentPoolBalance + amount > poolInfo.maxBalanceAmount) {
|
168
|
+
revert ErrorPoolServiceMaxBalanceAmountExceeded(poolNftId, poolInfo.maxBalanceAmount, currentPoolBalance, amount);
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
// calculate fees
|
173
|
+
IRegistry registry = getRegistry();
|
174
|
+
Amount feeAmount;
|
175
|
+
|
176
|
+
{
|
177
|
+
NftId productNftId = registry.getObjectInfo(poolNftId).parentNftId;
|
178
|
+
Fee memory stakingFee = instanceReader.getFeeInfo(productNftId).stakingFee;
|
179
|
+
(
|
180
|
+
feeAmount,
|
181
|
+
netAmount
|
182
|
+
) = FeeLib.calculateFee(
|
183
|
+
stakingFee,
|
184
|
+
amount);
|
185
|
+
}
|
186
|
+
|
187
|
+
// do all the book keeping
|
188
|
+
_accountingService.increasePoolBalance(
|
180
189
|
instance.getInstanceStore(),
|
181
190
|
poolNftId,
|
182
|
-
|
183
|
-
|
191
|
+
netAmount,
|
192
|
+
feeAmount);
|
184
193
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
poolNftId,
|
189
|
-
bundleOwner,
|
190
|
-
stakingAmount);
|
194
|
+
_bundleService.stake(instance, bundleNftId, netAmount);
|
195
|
+
|
196
|
+
emit LogPoolServiceBundleStaked(instance.getNftId(), poolNftId, bundleNftId, amount, netAmount);
|
191
197
|
|
192
|
-
|
198
|
+
// only collect staking amount when pool is not externally managed
|
199
|
+
if (!poolInfo.isExternallyManaged) {
|
200
|
+
|
201
|
+
// collect tokens from bundle owner
|
202
|
+
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
203
|
+
_collectStakingAmount(
|
204
|
+
instanceReader,
|
205
|
+
poolNftId,
|
206
|
+
bundleOwner,
|
207
|
+
amount);
|
208
|
+
}
|
193
209
|
}
|
194
210
|
|
195
|
-
|
196
|
-
|
211
|
+
|
212
|
+
/// @inheritdoc IPoolService
|
213
|
+
function unstake(NftId bundleNftId, Amount amount)
|
214
|
+
external
|
197
215
|
virtual
|
198
|
-
|
199
|
-
returns
|
216
|
+
// TODO: restricted() (once #462 is done)
|
217
|
+
returns(Amount netAmount)
|
200
218
|
{
|
201
|
-
|
202
|
-
|
219
|
+
_checkNftType(bundleNftId, BUNDLE());
|
220
|
+
|
221
|
+
(NftId poolNftId, IInstance instance) = _getAndVerifyActivePool();
|
222
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
223
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
224
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
225
|
+
|
226
|
+
if (bundleInfo.poolNftId != poolNftId) {
|
227
|
+
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
228
|
+
}
|
229
|
+
|
230
|
+
// call bundle service for bookkeeping and additional checks
|
231
|
+
Amount unstakedAmount = _bundleService.unstake(instance, bundleNftId, amount);
|
232
|
+
|
233
|
+
// Important: from now on work only with unstakedAmount as it is the only reliable amount.
|
234
|
+
// if amount was max, this was set to the available amount
|
235
|
+
|
236
|
+
// TODO: handle performance fees (issue #477)
|
237
|
+
netAmount = unstakedAmount;
|
238
|
+
|
239
|
+
// update pool bookkeeping - performance fees stay in the pool, but as fees
|
240
|
+
_accountingService.decreasePoolBalance(
|
241
|
+
instanceStore,
|
242
|
+
poolNftId,
|
243
|
+
unstakedAmount,
|
244
|
+
AmountLib.zero());
|
245
|
+
|
246
|
+
|
247
|
+
emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount, netAmount);
|
248
|
+
|
249
|
+
// only distribute staking amount when pool is not externally managed
|
250
|
+
if (!instanceReader.getPoolInfo(poolNftId).isExternallyManaged) {
|
251
|
+
|
252
|
+
// transfer amount to bundle owner
|
253
|
+
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
254
|
+
_distributeUnstakingAmount(
|
255
|
+
instanceReader,
|
256
|
+
poolNftId,
|
257
|
+
bundleOwner,
|
258
|
+
netAmount);
|
259
|
+
}
|
203
260
|
}
|
204
261
|
|
205
|
-
|
262
|
+
|
263
|
+
function fundPoolWallet(Amount amount)
|
206
264
|
external
|
207
265
|
virtual
|
266
|
+
// restricted()
|
208
267
|
{
|
209
|
-
(
|
268
|
+
(
|
269
|
+
NftId poolNftId,
|
270
|
+
IInstance instance
|
271
|
+
) = _getAndVerifyActivePool();
|
272
|
+
|
273
|
+
// check that pool is externally managed
|
274
|
+
InstanceReader reader = instance.getInstanceReader();
|
275
|
+
if (!reader.getPoolInfo(poolNftId).isExternallyManaged) {
|
276
|
+
revert ErrorPoolServicePoolNotExternallyManaged(poolNftId);
|
277
|
+
}
|
210
278
|
|
211
|
-
|
279
|
+
address poolOwner = getRegistry().ownerOf(poolNftId);
|
280
|
+
emit LogPoolServiceWalletFunded(poolNftId, poolOwner, amount);
|
212
281
|
|
213
|
-
|
214
|
-
|
282
|
+
_collectStakingAmount(
|
283
|
+
reader,
|
284
|
+
poolNftId,
|
285
|
+
poolOwner,
|
286
|
+
amount);
|
287
|
+
}
|
215
288
|
|
216
|
-
// TODO get performance fee for pool, transfer of remaining funds + bundle fees to bundle owner
|
217
289
|
|
218
|
-
|
290
|
+
function defundPoolWallet(Amount amount)
|
291
|
+
external
|
292
|
+
virtual
|
293
|
+
// restricted()
|
294
|
+
{
|
295
|
+
(
|
296
|
+
NftId poolNftId,
|
297
|
+
IInstance instance
|
298
|
+
) = _getAndVerifyActivePool();
|
299
|
+
|
300
|
+
// check that pool is externally managed
|
301
|
+
InstanceReader reader = instance.getInstanceReader();
|
302
|
+
if (!reader.getPoolInfo(poolNftId).isExternallyManaged) {
|
303
|
+
revert ErrorPoolServicePoolNotExternallyManaged(poolNftId);
|
304
|
+
}
|
305
|
+
|
306
|
+
address poolOwner = getRegistry().ownerOf(poolNftId);
|
307
|
+
emit LogPoolServiceWalletDefunded(poolNftId, poolOwner, amount);
|
308
|
+
|
309
|
+
_distributeUnstakingAmount(
|
310
|
+
reader,
|
311
|
+
poolNftId,
|
312
|
+
poolOwner,
|
313
|
+
amount);
|
219
314
|
}
|
220
315
|
|
221
316
|
|
222
317
|
function processSale(
|
223
318
|
NftId bundleNftId,
|
224
|
-
IPolicy.
|
319
|
+
IPolicy.PremiumInfo memory premium
|
225
320
|
)
|
226
321
|
external
|
227
322
|
virtual
|
228
323
|
restricted()
|
229
324
|
{
|
325
|
+
_checkNftType(bundleNftId, BUNDLE());
|
326
|
+
|
230
327
|
IRegistry registry = getRegistry();
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
IInstance instance = IInstance(instanceObjectInfo.objectAddress);
|
328
|
+
NftId poolNftId = registry.getObjectInfo(bundleNftId).parentNftId;
|
329
|
+
(, address instanceAddress) = ContractLib.getInfoAndInstance(registry, poolNftId, true);
|
330
|
+
IInstance instance = IInstance(instanceAddress);
|
235
331
|
|
236
|
-
Amount poolFeeAmount =
|
237
|
-
Amount bundleFeeAmount =
|
238
|
-
Amount bundleNetAmount =
|
332
|
+
Amount poolFeeAmount = premium.poolFeeFixAmount + premium.poolFeeVarAmount;
|
333
|
+
Amount bundleFeeAmount = premium.bundleFeeFixAmount + premium.bundleFeeVarAmount;
|
334
|
+
Amount bundleNetAmount = premium.netPremiumAmount;
|
239
335
|
|
240
336
|
InstanceStore instanceStore = instance.getInstanceStore();
|
241
|
-
|
337
|
+
_accountingService.increasePoolBalance(
|
242
338
|
instanceStore,
|
243
|
-
|
339
|
+
poolNftId,
|
244
340
|
bundleNetAmount + bundleFeeAmount,
|
245
341
|
poolFeeAmount);
|
246
342
|
|
247
|
-
|
343
|
+
_accountingService.increaseBundleBalanceForPool(
|
248
344
|
instanceStore,
|
249
|
-
|
345
|
+
bundleNftId,
|
250
346
|
bundleNetAmount,
|
251
347
|
bundleFeeAmount);
|
252
348
|
}
|
@@ -264,13 +360,21 @@ contract PoolService is
|
|
264
360
|
virtual
|
265
361
|
restricted()
|
266
362
|
returns (
|
267
|
-
Amount
|
268
|
-
Amount
|
363
|
+
Amount totalCollateralAmount,
|
364
|
+
Amount localCollateralAmount
|
269
365
|
)
|
270
366
|
{
|
367
|
+
_checkNftType(productNftId, PRODUCT());
|
368
|
+
_checkNftType(applicationNftId, POLICY());
|
369
|
+
_checkNftType(bundleNftId, BUNDLE());
|
370
|
+
|
371
|
+
NftId poolNftId;
|
372
|
+
bool poolIsVerifyingApplications;
|
271
373
|
(
|
374
|
+
poolNftId,
|
375
|
+
totalCollateralAmount,
|
272
376
|
localCollateralAmount,
|
273
|
-
|
377
|
+
poolIsVerifyingApplications
|
274
378
|
) = calculateRequiredCollateral(
|
275
379
|
instance.getInstanceReader(),
|
276
380
|
productNftId,
|
@@ -289,15 +393,23 @@ contract PoolService is
|
|
289
393
|
token,
|
290
394
|
totalCollateralAmount);
|
291
395
|
|
292
|
-
//
|
293
|
-
|
294
|
-
|
396
|
+
// pool callback when required
|
397
|
+
if (poolIsVerifyingApplications) {
|
398
|
+
IPoolComponent pool = IPoolComponent(
|
399
|
+
getRegistry().getObjectAddress(poolNftId));
|
295
400
|
|
401
|
+
pool.verifyApplication(
|
402
|
+
applicationNftId,
|
403
|
+
bundleNftId,
|
404
|
+
totalCollateralAmount);
|
405
|
+
|
406
|
+
// TODO add logging
|
296
407
|
}
|
297
|
-
}
|
298
408
|
|
409
|
+
// TODO add logging
|
410
|
+
}
|
299
411
|
|
300
|
-
function
|
412
|
+
function processPayout(
|
301
413
|
IInstance instance,
|
302
414
|
address token,
|
303
415
|
NftId policyNftId,
|
@@ -308,6 +420,24 @@ contract PoolService is
|
|
308
420
|
virtual
|
309
421
|
restricted()
|
310
422
|
{
|
423
|
+
_checkNftType(policyNftId, POLICY());
|
424
|
+
|
425
|
+
NftId bundleNftId = policyInfo.bundleNftId;
|
426
|
+
NftId poolNftId = getRegistry().getObjectInfo(bundleNftId).parentNftId;
|
427
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
428
|
+
|
429
|
+
_accountingService.decreasePoolBalance(
|
430
|
+
instanceStore,
|
431
|
+
poolNftId,
|
432
|
+
payoutAmount,
|
433
|
+
AmountLib.zero());
|
434
|
+
|
435
|
+
_accountingService.decreaseBundleBalanceForPool(
|
436
|
+
instanceStore,
|
437
|
+
bundleNftId,
|
438
|
+
payoutAmount,
|
439
|
+
AmountLib.zero());
|
440
|
+
|
311
441
|
_bundleService.releaseCollateral(
|
312
442
|
instance,
|
313
443
|
policyNftId,
|
@@ -334,6 +464,8 @@ contract PoolService is
|
|
334
464
|
virtual
|
335
465
|
restricted()
|
336
466
|
{
|
467
|
+
_checkNftType(policyNftId, POLICY());
|
468
|
+
|
337
469
|
Amount remainingCollateralAmount = policyInfo.sumInsuredAmount - policyInfo.claimAmount;
|
338
470
|
|
339
471
|
_bundleService.releaseCollateral(
|
@@ -342,10 +474,6 @@ contract PoolService is
|
|
342
474
|
policyInfo.bundleNftId,
|
343
475
|
remainingCollateralAmount);
|
344
476
|
|
345
|
-
_bundleService.unlinkPolicy(
|
346
|
-
instance,
|
347
|
-
policyNftId);
|
348
|
-
|
349
477
|
// update value locked with staking service
|
350
478
|
_staking.decreaseTotalValueLocked(
|
351
479
|
instance.getNftId(),
|
@@ -362,16 +490,21 @@ contract PoolService is
|
|
362
490
|
public
|
363
491
|
view
|
364
492
|
returns(
|
493
|
+
NftId poolNftId,
|
494
|
+
Amount totalCollateralAmount,
|
365
495
|
Amount localCollateralAmount,
|
366
|
-
|
496
|
+
bool poolIsVerifyingApplications
|
367
497
|
)
|
368
498
|
{
|
369
|
-
|
499
|
+
_checkNftType(productNftId, PRODUCT());
|
500
|
+
|
501
|
+
poolNftId = instanceReader.getProductInfo(productNftId).poolNftId;
|
370
502
|
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
503
|
+
poolIsVerifyingApplications = poolInfo.isVerifyingApplications;
|
371
504
|
|
372
505
|
(
|
373
|
-
|
374
|
-
|
506
|
+
totalCollateralAmount,
|
507
|
+
localCollateralAmount
|
375
508
|
) = calculateRequiredCollateral(
|
376
509
|
poolInfo.collateralizationLevel,
|
377
510
|
poolInfo.retentionLevel,
|
@@ -387,18 +520,17 @@ contract PoolService is
|
|
387
520
|
public
|
388
521
|
pure
|
389
522
|
returns(
|
390
|
-
Amount
|
391
|
-
Amount
|
523
|
+
Amount totalCollateralAmount,
|
524
|
+
Amount localCollateralAmount
|
392
525
|
)
|
393
526
|
{
|
394
|
-
//
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
//
|
399
|
-
|
400
|
-
|
401
|
-
totalCollateralAmount = localCollateralAmount;
|
527
|
+
// collateralization is applied to sum insured
|
528
|
+
UFixed totalUFixed = collateralizationLevel * sumInsuredAmount.toUFixed();
|
529
|
+
totalCollateralAmount = AmountLib.toAmount(totalUFixed.toInt());
|
530
|
+
|
531
|
+
// retention level defines how much capital is required locally
|
532
|
+
localCollateralAmount = AmountLib.toAmount(
|
533
|
+
(retentionLevel * totalUFixed).toInt());
|
402
534
|
}
|
403
535
|
|
404
536
|
|
@@ -407,6 +539,7 @@ contract PoolService is
|
|
407
539
|
Amount stakingAmount
|
408
540
|
)
|
409
541
|
internal
|
542
|
+
pure
|
410
543
|
returns (Amount stakingNetAmount)
|
411
544
|
{
|
412
545
|
stakingNetAmount = stakingAmount;
|
@@ -421,30 +554,61 @@ contract PoolService is
|
|
421
554
|
}
|
422
555
|
|
423
556
|
|
424
|
-
|
425
|
-
/// @dev transfers the specified amount from the bundle owner to the pool's wallet
|
557
|
+
/// @dev transfers the specified amount from the "from account" to the pool's wallet
|
426
558
|
function _collectStakingAmount(
|
427
|
-
InstanceReader
|
559
|
+
InstanceReader reader,
|
560
|
+
NftId poolNftId,
|
561
|
+
address from,
|
562
|
+
Amount amount
|
563
|
+
)
|
564
|
+
internal
|
565
|
+
{
|
566
|
+
IComponents.ComponentInfo memory info = reader.getComponentInfo(poolNftId);
|
567
|
+
info.tokenHandler.collectTokens(
|
568
|
+
from,
|
569
|
+
amount);
|
570
|
+
}
|
571
|
+
|
572
|
+
/// @dev distributes the specified amount from the pool's wallet to the "to account"
|
573
|
+
function _distributeUnstakingAmount(
|
574
|
+
InstanceReader reader,
|
428
575
|
NftId poolNftId,
|
429
|
-
address
|
576
|
+
address to,
|
430
577
|
Amount amount
|
431
578
|
)
|
432
579
|
internal
|
433
580
|
{
|
581
|
+
IComponents.ComponentInfo memory info = reader.getComponentInfo(poolNftId);
|
582
|
+
info.tokenHandler.distributeTokens(
|
583
|
+
info.tokenHandler.getWallet(),
|
584
|
+
to,
|
585
|
+
amount);
|
586
|
+
}
|
434
587
|
|
435
|
-
// collecting investor token
|
436
|
-
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
437
|
-
TokenHandler tokenHandler = componentInfo.tokenHandler;
|
438
|
-
address poolWallet = componentInfo.wallet;
|
439
588
|
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
589
|
+
function _getAndVerifyActivePool()
|
590
|
+
internal
|
591
|
+
virtual
|
592
|
+
view
|
593
|
+
returns (
|
594
|
+
NftId poolNftId,
|
595
|
+
IInstance instance
|
596
|
+
)
|
597
|
+
{
|
598
|
+
(
|
599
|
+
IRegistry.ObjectInfo memory info,
|
600
|
+
address instanceAddress
|
601
|
+
) = ContractLib.getAndVerifyComponent(
|
602
|
+
getRegistry(),
|
603
|
+
msg.sender,
|
604
|
+
POOL(),
|
605
|
+
true); // only active pools
|
606
|
+
|
607
|
+
poolNftId = info.nftId;
|
608
|
+
instance = IInstance(instanceAddress);
|
446
609
|
}
|
447
610
|
|
611
|
+
|
448
612
|
function _getDomain() internal pure override returns(ObjectType) {
|
449
613
|
return POOL();
|
450
614
|
}
|