@etherisc/gif-next 0.0.2-c04bff4-304 → 0.0.2-c0923b6-664
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +142 -331
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +4 -0
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +1075 -0
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +810 -0
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +4 -0
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +843 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +760 -278
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +2008 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +202 -5
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +485 -26
- 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 +588 -220
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +227 -20
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +275 -16
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +479 -17
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +204 -312
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +475 -41
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +123 -196
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +634 -225
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +247 -84
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +102 -170
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +429 -77
- 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 +1474 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +844 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2043 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +844 -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 +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +293 -275
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +844 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +175 -185
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +363 -243
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +844 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +986 -389
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +844 -0
- package/artifacts/contracts/instance/BaseStore.sol/BaseStore.dbg.json +4 -0
- package/artifacts/contracts/{shared/IKeyValueStore.sol/IKeyValueStore.json → instance/BaseStore.sol/BaseStore.json} +55 -197
- 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/IBaseStore.sol/IBaseStore.dbg.json +4 -0
- package/artifacts/contracts/{shared/KeyValueStore.sol/KeyValueStore.json → instance/IBaseStore.sol/IBaseStore.json} +34 -227
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +587 -64
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +405 -60
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +651 -119
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +1154 -380
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +363 -92
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1613 -937
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +431 -131
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +170 -61
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +1272 -1820
- package/artifacts/contracts/instance/ProductStore.sol/ProductStore.dbg.json +4 -0
- package/artifacts/contracts/instance/ProductStore.sol/ProductStore.json +3427 -0
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +4 -0
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +866 -0
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +8 -8
- 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/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/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +161 -193
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +473 -42
- 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 +116 -119
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +98 -11
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +137 -145
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +201 -81
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +205 -54
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +185 -201
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +474 -40
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +355 -279
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +199 -84
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +247 -121
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +152 -166
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +478 -227
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +165 -184
- package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +522 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +743 -379
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +253 -62
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +361 -57
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +194 -51
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +297 -244
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +474 -40
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +370 -159
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +211 -80
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +296 -9
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +242 -24
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +299 -48
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +140 -37
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +270 -212
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +286 -21
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +451 -151
- package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +783 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +231 -72
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +201 -129
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +184 -65
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +287 -234
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +372 -82
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +194 -51
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +144 -33
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +169 -37
- 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 +188 -69
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +872 -478
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +1137 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +139 -181
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +169 -46
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +2271 -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 +490 -258
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +511 -20
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +120 -60
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +113 -103
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +502 -519
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +215 -86
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +632 -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 +93 -78
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +432 -290
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +116 -119
- 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 +35 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +16 -6
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +167 -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 +84 -2
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -2
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +136 -144
- 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 +37 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +18 -8
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +171 -38
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +89 -2
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +327 -73
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +484 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +88 -24
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +1492 -183
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +235 -123
- package/artifacts/contracts/staking/ITargetLimitHandler.sol/ITargetLimitHandler.dbg.json +4 -0
- package/artifacts/contracts/staking/ITargetLimitHandler.sol/ITargetLimitHandler.json +50 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +1651 -304
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +470 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +221 -68
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +295 -183
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +286 -173
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +172 -53
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +1645 -790
- package/artifacts/contracts/staking/TargetHandler.sol/TargetHandler.dbg.json +4 -0
- package/artifacts/contracts/staking/TargetHandler.sol/TargetHandler.json +309 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +160 -88
- 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 +35 -11
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +64 -19
- package/artifacts/contracts/type/ChainId.sol/ChainIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/ChainId.sol/ChainIdLib.json +193 -0
- 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 +94 -38
- 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 +33 -31
- 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 +125 -7
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +42 -157
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +45 -2
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorLib.json +21 -2
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +2 -2
- 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/String.sol/StrLib.json +50 -2
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +3 -3
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +73 -36
- 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 +101 -2
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.json +10 -0
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +144 -38
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +15 -2
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.json +10 -0
- package/contracts/accounting/AccountingService.sol +274 -0
- package/contracts/accounting/AccountingServiceManager.sol +38 -0
- package/contracts/accounting/IAccountingService.sol +47 -0
- package/contracts/authorization/AccessAdmin.sol +400 -310
- package/contracts/authorization/AccessAdminLib.sol +678 -0
- package/contracts/authorization/AccessManagerCloneable.sol +128 -4
- package/contracts/authorization/Authorization.sol +179 -206
- package/contracts/authorization/IAccess.sol +29 -11
- package/contracts/authorization/IAccessAdmin.sol +89 -83
- package/contracts/authorization/IAuthorization.sol +9 -37
- package/contracts/authorization/IServiceAuthorization.sol +57 -17
- package/contracts/authorization/ServiceAuthorization.sol +235 -25
- package/contracts/distribution/BasicDistribution.sol +21 -19
- package/contracts/distribution/BasicDistributionAuthorization.sol +30 -10
- package/contracts/distribution/Distribution.sol +45 -95
- package/contracts/distribution/DistributionService.sol +224 -112
- package/contracts/distribution/DistributionServiceManager.sol +6 -6
- package/contracts/distribution/IDistributionComponent.sol +4 -11
- package/contracts/distribution/IDistributionService.sol +38 -24
- package/contracts/examples/fire/DamageLevel.sol +59 -0
- package/contracts/examples/fire/FirePool.sol +86 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +35 -0
- package/contracts/examples/fire/FireProduct.sol +433 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
- package/contracts/examples/fire/FireUSD.sol +26 -0
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +43 -12
- package/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleOracle.sol +8 -12
- package/contracts/examples/unpermissioned/SimplePool.sol +36 -10
- package/contracts/examples/unpermissioned/SimplePoolAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleProduct.sol +134 -48
- package/contracts/examples/unpermissioned/SimpleProductAuthorization.sol +28 -0
- package/contracts/instance/BaseStore.sol +93 -0
- package/contracts/instance/BundleSet.sol +42 -38
- package/contracts/instance/IBaseStore.sol +37 -0
- package/contracts/instance/IInstance.sol +111 -18
- package/contracts/instance/IInstanceService.sol +61 -34
- package/contracts/instance/Instance.sol +196 -74
- package/contracts/instance/InstanceAdmin.sol +219 -197
- package/contracts/instance/InstanceAuthorizationV3.sol +154 -83
- package/contracts/instance/InstanceReader.sol +450 -274
- package/contracts/instance/InstanceService.sol +314 -267
- package/contracts/instance/InstanceServiceManager.sol +6 -7
- package/contracts/instance/InstanceStore.sol +152 -116
- package/contracts/instance/ProductStore.sol +290 -0
- package/contracts/instance/RiskSet.sol +126 -0
- package/contracts/instance/TargetNames.sol +10 -0
- package/contracts/instance/base/BalanceStore.sol +4 -6
- package/contracts/instance/base/ObjectCounter.sol +1 -2
- package/contracts/instance/base/ObjectLifecycle.sol +6 -8
- package/contracts/instance/base/ObjectSet.sol +31 -33
- package/contracts/instance/base/ObjectSetHelperLib.sol +30 -0
- package/contracts/instance/module/IBundle.sol +6 -5
- package/contracts/instance/module/IComponents.sol +28 -14
- package/contracts/instance/module/IDistribution.sol +21 -8
- package/contracts/instance/module/IPolicy.sol +30 -9
- package/contracts/instance/module/IRisk.sol +5 -0
- package/contracts/oracle/BasicOracle.sol +3 -7
- package/contracts/oracle/BasicOracleAuthorization.sol +15 -8
- package/contracts/oracle/IOracle.sol +9 -4
- package/contracts/oracle/IOracleService.sol +2 -1
- package/contracts/oracle/Oracle.sol +9 -24
- package/contracts/oracle/OracleService.sol +117 -86
- package/contracts/oracle/OracleServiceManager.sol +6 -6
- package/contracts/pool/BasicPool.sol +35 -40
- package/contracts/pool/BasicPoolAuthorization.sol +34 -11
- package/contracts/pool/BundleService.sol +115 -167
- package/contracts/pool/BundleServiceManager.sol +6 -6
- package/contracts/pool/IBundleService.sol +28 -46
- package/contracts/pool/IPoolComponent.sol +19 -15
- package/contracts/pool/IPoolService.sol +77 -67
- package/contracts/pool/Pool.sol +142 -137
- package/contracts/pool/PoolLib.sol +341 -0
- package/contracts/pool/PoolService.sol +355 -250
- package/contracts/pool/PoolServiceManager.sol +4 -4
- package/contracts/product/ApplicationService.sol +110 -31
- package/contracts/product/ApplicationServiceManager.sol +4 -4
- package/contracts/product/BasicProduct.sol +10 -15
- package/contracts/product/BasicProductAuthorization.sol +32 -12
- package/contracts/product/ClaimService.sol +328 -189
- package/contracts/product/ClaimServiceManager.sol +4 -4
- package/contracts/product/IApplicationService.sol +28 -3
- package/contracts/product/IClaimService.sol +21 -7
- package/contracts/product/IPolicyService.sol +41 -12
- package/contracts/product/IPricingService.sol +10 -9
- package/contracts/product/IProductComponent.sol +27 -4
- package/contracts/product/IRiskService.sol +25 -10
- package/contracts/product/PolicyService.sol +357 -285
- package/contracts/product/PolicyServiceLib.sol +139 -0
- package/contracts/product/PolicyServiceManager.sol +4 -4
- package/contracts/product/PricingService.sol +59 -54
- package/contracts/product/PricingServiceManager.sol +4 -4
- package/contracts/product/Product.sol +155 -89
- package/contracts/product/RiskService.sol +131 -39
- package/contracts/product/RiskServiceManager.sol +4 -4
- package/contracts/registry/ChainNft.sol +10 -11
- package/contracts/registry/IRegistry.sol +31 -27
- package/contracts/registry/IRegistryService.sol +5 -12
- package/contracts/registry/IRelease.sol +29 -0
- package/contracts/registry/ITransferInterceptor.sol +1 -2
- package/contracts/registry/Registry.sol +51 -17
- package/contracts/registry/RegistryAdmin.sol +94 -385
- package/contracts/registry/RegistryAuthorization.sol +337 -0
- package/contracts/registry/RegistryService.sol +37 -48
- package/contracts/registry/RegistryServiceManager.sol +3 -3
- package/contracts/registry/ReleaseAdmin.sol +199 -0
- package/contracts/registry/ReleaseLifecycle.sol +8 -3
- package/contracts/registry/ReleaseRegistry.sol +278 -244
- package/contracts/registry/ServiceAuthorizationV3.sol +204 -61
- package/contracts/registry/TokenRegistry.sol +61 -59
- package/contracts/shared/Component.sol +67 -125
- package/contracts/shared/ComponentService.sol +427 -377
- package/contracts/shared/ComponentServiceManager.sol +8 -5
- package/contracts/shared/ContractLib.sol +312 -0
- package/contracts/shared/IComponent.sol +6 -18
- package/contracts/shared/IComponentService.sol +43 -40
- package/contracts/shared/IInstanceLinkedComponent.sol +3 -22
- package/contracts/shared/ILifecycle.sol +3 -1
- package/contracts/shared/INftOwnable.sol +4 -0
- package/contracts/shared/IPolicyHolder.sol +12 -13
- package/contracts/shared/IRegisterable.sol +22 -1
- package/contracts/shared/IService.sol +3 -5
- package/contracts/shared/InitializableERC165.sol +9 -1
- package/contracts/shared/InstanceLinkedComponent.sol +72 -52
- package/contracts/shared/Lifecycle.sol +15 -4
- package/contracts/shared/NftOwnable.sol +29 -7
- package/contracts/shared/PolicyHolder.sol +15 -8
- package/contracts/shared/Registerable.sol +50 -19
- package/contracts/shared/RegistryLinked.sol +7 -13
- package/contracts/shared/Service.sol +18 -33
- package/contracts/shared/TokenHandler.sol +275 -72
- package/contracts/shared/TokenHandlerDeployerLib.sol +10 -2
- package/contracts/staking/IStaking.sol +270 -72
- package/contracts/staking/IStakingService.sol +45 -78
- package/contracts/staking/ITargetLimitHandler.sol +17 -0
- package/contracts/staking/Staking.sol +524 -225
- package/contracts/staking/{StakeManagerLib.sol → StakingLib.sol} +55 -84
- package/contracts/staking/StakingManager.sol +12 -9
- package/contracts/staking/StakingReader.sol +70 -82
- package/contracts/staking/StakingService.sol +62 -148
- package/contracts/staking/StakingServiceManager.sol +7 -5
- package/contracts/staking/StakingStore.sol +1093 -330
- package/contracts/staking/TargetHandler.sol +132 -0
- package/contracts/staking/TargetManagerLib.sol +69 -46
- package/contracts/type/Amount.sol +19 -0
- package/contracts/type/Blocknumber.sol +17 -22
- package/contracts/type/ChainId.sol +101 -0
- package/contracts/type/ClaimId.sol +6 -1
- package/contracts/type/Fee.sol +8 -8
- 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 +70 -38
- package/contracts/type/PayoutId.sol +10 -10
- package/contracts/type/RiskId.sol +38 -6
- package/contracts/type/RoleId.sol +61 -55
- package/contracts/type/Seconds.sol +19 -0
- package/contracts/type/Selector.sol +5 -0
- package/contracts/type/StateId.sol +14 -1
- package/contracts/type/String.sol +12 -0
- package/contracts/type/Timestamp.sol +4 -7
- package/contracts/type/UFixed.sol +38 -126
- package/contracts/type/Version.sol +54 -5
- package/contracts/upgradeability/IVersionable.sol +3 -0
- package/contracts/upgradeability/ProxyManager.sol +94 -46
- package/contracts/upgradeability/UpgradableProxyWithAdmin.sol +12 -2
- package/contracts/upgradeability/Versionable.sol +8 -5
- package/package.json +5 -4
- 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/instance/module/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +0 -129
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +0 -4
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +0 -427
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.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/KeyValueStore.sol/KeyValueStore.dbg.json +0 -4
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +0 -4
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +0 -440
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +0 -4
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +0 -164
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +0 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.json +0 -16
- package/contracts/authorization/IModuleAuthorization.sol +0 -21
- package/contracts/authorization/ModuleAuthorization.sol +0 -78
- package/contracts/instance/module/IAccess.sol +0 -46
- package/contracts/shared/ComponentVerifyingService.sol +0 -117
- package/contracts/shared/IKeyValueStore.sol +0 -54
- package/contracts/shared/InitializableCustom.sol +0 -177
- package/contracts/shared/KeyValueStore.sol +0 -131
- package/contracts/staking/StakingLifecycle.sol +0 -23
@@ -1,29 +1,36 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
4
|
+
import {IClaimService} from "./IClaimService.sol";
|
5
5
|
import {IInstance} from "../instance/IInstance.sol";
|
6
6
|
import {IPolicy} from "../instance/module/IPolicy.sol";
|
7
|
+
import {IPolicyHolder} from "../shared/IPolicyHolder.sol";
|
8
|
+
import {IPoolComponent} from "../pool/IPoolComponent.sol";
|
9
|
+
import {IPolicyService} from "../product/IPolicyService.sol";
|
10
|
+
import {IPoolService} from "../pool/IPoolService.sol";
|
11
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
12
|
+
|
7
13
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
8
|
-
import {TimestampLib} from "../type/Timestamp.sol";
|
9
|
-
import {ObjectType, CLAIM, PRODUCT, POOL} from "../type/ObjectType.sol";
|
10
|
-
import {SUBMITTED, KEEP_STATE, DECLINED, REVOKED, CONFIRMED, CLOSED, PAID} from "../type/StateId.sol";
|
11
|
-
import {NftId} from "../type/NftId.sol";
|
12
|
-
import {FeeLib} from "../type/Fee.sol";
|
13
|
-
import {StateId} from "../type/StateId.sol";
|
14
14
|
import {ClaimId, ClaimIdLib} from "../type/ClaimId.sol";
|
15
|
-
import {
|
16
|
-
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
15
|
+
import {ContractLib} from "../shared/ContractLib.sol";
|
17
16
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
18
|
-
import {
|
19
|
-
import {
|
17
|
+
import {InstanceStore} from "../instance/InstanceStore.sol";
|
18
|
+
import {NftId} from "../type/NftId.sol";
|
19
|
+
import {ObjectType, CLAIM, POLICY, POOL, PRODUCT} from "../type/ObjectType.sol";
|
20
|
+
import {PayoutId, PayoutIdLib} from "../type/PayoutId.sol";
|
21
|
+
import {ProductStore} from "../instance/ProductStore.sol";
|
22
|
+
import {Service} from "../shared/Service.sol";
|
23
|
+
import {StateId} from "../type/StateId.sol";
|
24
|
+
import {SUBMITTED, KEEP_STATE, DECLINED, REVOKED, CANCELLED, CONFIRMED, CLOSED, EXPECTED, PAID} from "../type/StateId.sol";
|
25
|
+
import {TimestampLib} from "../type/Timestamp.sol";
|
20
26
|
|
21
27
|
|
22
28
|
contract ClaimService is
|
23
|
-
|
29
|
+
Service,
|
24
30
|
IClaimService
|
25
31
|
{
|
26
32
|
|
33
|
+
IPolicyService internal _policyService;
|
27
34
|
IPoolService internal _poolService;
|
28
35
|
|
29
36
|
function _initialize(
|
@@ -35,13 +42,13 @@ contract ClaimService is
|
|
35
42
|
initializer()
|
36
43
|
{
|
37
44
|
(
|
38
|
-
address
|
39
|
-
|
40
|
-
|
41
|
-
) = abi.decode(data, (address, address, address));
|
45
|
+
address authority,
|
46
|
+
address registry
|
47
|
+
) = abi.decode(data, (address, address));
|
42
48
|
|
43
|
-
|
49
|
+
__Service_init(authority, registry, owner);
|
44
50
|
|
51
|
+
_policyService = IPolicyService(getRegistry().getServiceAddress(POLICY(), getVersion().toMajorPart()));
|
45
52
|
_poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getVersion().toMajorPart()));
|
46
53
|
|
47
54
|
_registerInterface(type(IClaimService).interfaceId);
|
@@ -54,31 +61,28 @@ contract ClaimService is
|
|
54
61
|
)
|
55
62
|
external
|
56
63
|
virtual
|
64
|
+
// nonReentrant() // prevents creating a reinsurance claim in a single tx
|
65
|
+
restricted()
|
57
66
|
returns (ClaimId claimId)
|
58
67
|
{
|
68
|
+
// checks
|
59
69
|
(
|
60
|
-
|
61
|
-
|
70
|
+
,,
|
71
|
+
IInstance.InstanceContracts memory instanceContracts,
|
62
72
|
IPolicy.PolicyInfo memory policyInfo
|
63
73
|
) = _verifyCallerWithPolicy(policyNftId);
|
64
74
|
|
65
75
|
// check policy is in its active period
|
66
|
-
if(policyInfo.activatedAt.eqz() || TimestampLib.
|
76
|
+
if(policyInfo.activatedAt.eqz() || TimestampLib.current() >= policyInfo.expiredAt) {
|
67
77
|
revert ErrorClaimServicePolicyNotOpen(policyNftId);
|
68
78
|
}
|
69
79
|
|
70
|
-
|
71
|
-
// check policy including this claim is still within sum insured
|
72
|
-
if(policyInfo.payoutAmount + claimAmount > policyInfo.sumInsuredAmount) {
|
73
|
-
revert ErrorClaimServiceClaimExceedsSumInsured(
|
74
|
-
policyNftId,
|
75
|
-
policyInfo.sumInsuredAmount,
|
76
|
-
AmountLib.toAmount(policyInfo.payoutAmount.toInt() + claimAmount.toInt()));
|
77
|
-
}
|
80
|
+
_checkClaimAmount(policyNftId, policyInfo, claimAmount);
|
78
81
|
|
82
|
+
// effects
|
79
83
|
// create new claim
|
80
84
|
claimId = ClaimIdLib.toClaimId(policyInfo.claimsCount + 1);
|
81
|
-
|
85
|
+
instanceContracts.productStore.createClaim(
|
82
86
|
policyNftId,
|
83
87
|
claimId,
|
84
88
|
IPolicy.ClaimInfo({
|
@@ -91,10 +95,10 @@ contract ClaimService is
|
|
91
95
|
closedAt: TimestampLib.zero()}));
|
92
96
|
|
93
97
|
// update and save policy info with instance
|
98
|
+
// policy claim amount is only updated when claim is confirmed
|
94
99
|
policyInfo.claimsCount += 1;
|
95
100
|
policyInfo.openClaimsCount += 1;
|
96
|
-
|
97
|
-
instance.getInstanceStore().updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
|
101
|
+
instanceContracts.productStore.updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
|
98
102
|
|
99
103
|
emit LogClaimServiceClaimSubmitted(policyNftId, claimId, claimAmount);
|
100
104
|
}
|
@@ -108,31 +112,48 @@ contract ClaimService is
|
|
108
112
|
)
|
109
113
|
external
|
110
114
|
virtual
|
115
|
+
restricted()
|
116
|
+
// nonReentrant() // prevents creating a reinsurance claim in a single tx
|
111
117
|
{
|
118
|
+
// checks
|
119
|
+
_checkNftType(policyNftId, POLICY());
|
120
|
+
|
112
121
|
(
|
122
|
+
NftId productNftId,
|
113
123
|
IInstance instance,
|
114
|
-
|
124
|
+
IInstance.InstanceContracts memory instanceContracts,
|
115
125
|
IPolicy.PolicyInfo memory policyInfo
|
116
126
|
) = _verifyCallerWithPolicy(policyNftId);
|
117
127
|
|
118
|
-
|
128
|
+
_checkClaimAmount(policyNftId, policyInfo, confirmedAmount);
|
119
129
|
|
130
|
+
// effects
|
120
131
|
// check/update claim info
|
121
|
-
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceReader, policyNftId, claimId, SUBMITTED());
|
132
|
+
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceContracts.instanceReader, policyNftId, claimId, SUBMITTED());
|
122
133
|
claimInfo.claimAmount = confirmedAmount;
|
123
134
|
claimInfo.processData = data;
|
124
|
-
|
125
|
-
|
126
|
-
// TODO test if claim results in total claim amount == sum insured amount
|
127
|
-
// should policy still be active it needs to automatically become expired
|
135
|
+
instanceContracts.productStore.updateClaim(policyNftId, claimId, claimInfo, CONFIRMED());
|
128
136
|
|
129
137
|
// update and save policy info with instance
|
130
138
|
policyInfo.claimAmount = policyInfo.claimAmount + confirmedAmount;
|
131
|
-
|
139
|
+
instanceContracts.productStore.updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
|
140
|
+
|
141
|
+
// should policy still be active it needs to become expired
|
142
|
+
if (policyInfo.claimAmount >= policyInfo.sumInsuredAmount) {
|
143
|
+
_policyService.expirePolicy(instance, policyNftId, TimestampLib.current());
|
144
|
+
}
|
132
145
|
|
133
146
|
emit LogClaimServiceClaimConfirmed(policyNftId, claimId, confirmedAmount);
|
147
|
+
|
148
|
+
// interactions
|
149
|
+
// callback to pool if applicable
|
150
|
+
_processConfirmedClaimByPool(instanceContracts.instanceReader, productNftId, policyNftId, claimId, confirmedAmount);
|
151
|
+
|
152
|
+
// callback to policy holder if applicable
|
153
|
+
_policyHolderClaimConfirmed(policyNftId, claimId, confirmedAmount);
|
134
154
|
}
|
135
155
|
|
156
|
+
|
136
157
|
function decline(
|
137
158
|
NftId policyNftId,
|
138
159
|
ClaimId claimId,
|
@@ -140,69 +161,77 @@ contract ClaimService is
|
|
140
161
|
)
|
141
162
|
external
|
142
163
|
virtual
|
164
|
+
restricted()
|
165
|
+
// nonReentrant() // prevents creating a reinsurance claim in a single tx
|
143
166
|
{
|
167
|
+
_checkNftType(policyNftId, POLICY());
|
168
|
+
|
144
169
|
(
|
145
|
-
|
146
|
-
|
170
|
+
,,
|
171
|
+
IInstance.InstanceContracts memory instanceContracts,
|
147
172
|
IPolicy.PolicyInfo memory policyInfo
|
148
173
|
) = _verifyCallerWithPolicy(policyNftId);
|
149
174
|
|
150
175
|
// check/update claim info
|
151
|
-
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceReader, policyNftId, claimId, SUBMITTED());
|
176
|
+
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceContracts.instanceReader, policyNftId, claimId, SUBMITTED());
|
152
177
|
claimInfo.processData = data;
|
153
|
-
claimInfo.closedAt = TimestampLib.
|
154
|
-
|
178
|
+
claimInfo.closedAt = TimestampLib.current();
|
179
|
+
instanceContracts.productStore.updateClaim(policyNftId, claimId, claimInfo, DECLINED());
|
155
180
|
|
156
181
|
// update and save policy info with instance
|
157
182
|
policyInfo.openClaimsCount -= 1;
|
158
|
-
|
183
|
+
instanceContracts.productStore.updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
|
159
184
|
|
160
185
|
emit LogClaimServiceClaimDeclined(policyNftId, claimId);
|
161
186
|
}
|
162
187
|
|
163
188
|
|
164
|
-
// TODO add test case
|
165
189
|
function revoke(
|
166
190
|
NftId policyNftId,
|
167
191
|
ClaimId claimId
|
168
192
|
)
|
169
193
|
external
|
170
194
|
virtual
|
171
|
-
|
195
|
+
restricted()
|
196
|
+
// nonReentrant() // prevents creating a reinsurance claim in a single tx
|
197
|
+
{
|
172
198
|
(
|
173
|
-
|
174
|
-
|
199
|
+
,,
|
200
|
+
IInstance.InstanceContracts memory instanceContracts,
|
175
201
|
IPolicy.PolicyInfo memory policyInfo
|
176
202
|
) = _verifyCallerWithPolicy(policyNftId);
|
177
203
|
|
178
204
|
// check/update claim info
|
179
|
-
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceReader, policyNftId, claimId, SUBMITTED());
|
180
|
-
claimInfo.closedAt = TimestampLib.
|
181
|
-
|
205
|
+
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceContracts.instanceReader, policyNftId, claimId, SUBMITTED());
|
206
|
+
claimInfo.closedAt = TimestampLib.current();
|
207
|
+
instanceContracts.productStore.updateClaim(policyNftId, claimId, claimInfo, REVOKED());
|
182
208
|
|
183
209
|
// update and save policy info with instance
|
184
210
|
policyInfo.openClaimsCount -= 1;
|
185
|
-
|
211
|
+
instanceContracts.productStore.updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
|
186
212
|
|
187
213
|
emit LogClaimServiceClaimRevoked(policyNftId, claimId);
|
188
214
|
}
|
189
215
|
|
190
216
|
|
191
|
-
function
|
217
|
+
function cancelConfirmedClaim(
|
192
218
|
NftId policyNftId,
|
193
219
|
ClaimId claimId
|
194
220
|
)
|
195
221
|
external
|
196
222
|
virtual
|
223
|
+
restricted()
|
224
|
+
// nonReentrant() // prevents creating a reinsurance claim in a single tx
|
197
225
|
{
|
226
|
+
_checkNftType(policyNftId, POLICY());
|
227
|
+
|
198
228
|
(
|
199
|
-
|
200
|
-
|
201
|
-
IPolicy.PolicyInfo memory policyInfo
|
229
|
+
,,
|
230
|
+
IInstance.InstanceContracts memory instanceContracts,
|
202
231
|
) = _verifyCallerWithPolicy(policyNftId);
|
203
232
|
|
204
233
|
// check/update claim info
|
205
|
-
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceReader, policyNftId, claimId, CONFIRMED());
|
234
|
+
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceContracts.instanceReader, policyNftId, claimId, CONFIRMED());
|
206
235
|
|
207
236
|
// check claim has no open payouts
|
208
237
|
if(claimInfo.openPayoutsCount > 0) {
|
@@ -212,20 +241,13 @@ contract ClaimService is
|
|
212
241
|
claimInfo.openPayoutsCount);
|
213
242
|
}
|
214
243
|
|
215
|
-
|
216
|
-
|
217
|
-
revert ErrorClaimServiceClaimWithMissingPayouts(
|
218
|
-
policyNftId,
|
219
|
-
claimId,
|
220
|
-
claimInfo.claimAmount,
|
221
|
-
claimInfo.paidAmount);
|
222
|
-
}
|
244
|
+
claimInfo.closedAt = TimestampLib.current();
|
245
|
+
instanceContracts.productStore.updateClaim(policyNftId, claimId, claimInfo, CANCELLED());
|
223
246
|
|
224
|
-
|
225
|
-
instance.getInstanceStore().updateClaim(policyNftId, claimId, claimInfo, CLOSED());
|
247
|
+
emit LogClaimServiceClaimCancelled(policyNftId, claimId);
|
226
248
|
}
|
227
249
|
|
228
|
-
|
250
|
+
|
229
251
|
function createPayoutForBeneficiary(
|
230
252
|
NftId policyNftId,
|
231
253
|
ClaimId claimId,
|
@@ -235,6 +257,8 @@ contract ClaimService is
|
|
235
257
|
)
|
236
258
|
external
|
237
259
|
virtual
|
260
|
+
restricted()
|
261
|
+
// nonReentrant() // prevents creating a reinsurance claim in a single tx
|
238
262
|
returns (PayoutId payoutId)
|
239
263
|
{
|
240
264
|
if (beneficiary == address(0)) {
|
@@ -258,8 +282,12 @@ contract ClaimService is
|
|
258
282
|
)
|
259
283
|
external
|
260
284
|
virtual
|
285
|
+
restricted()
|
286
|
+
// nonReentrant() // prevents creating a reinsurance payout in a single tx
|
261
287
|
returns (PayoutId payoutId)
|
262
288
|
{
|
289
|
+
_checkNftType(policyNftId, POLICY());
|
290
|
+
|
263
291
|
return _createPayout(
|
264
292
|
policyNftId,
|
265
293
|
claimId,
|
@@ -268,170 +296,212 @@ contract ClaimService is
|
|
268
296
|
data);
|
269
297
|
}
|
270
298
|
|
271
|
-
|
299
|
+
|
300
|
+
function processPayout(
|
272
301
|
NftId policyNftId,
|
273
|
-
|
274
|
-
Amount amount,
|
275
|
-
address beneficiary,
|
276
|
-
bytes memory data
|
302
|
+
PayoutId payoutId
|
277
303
|
)
|
278
|
-
|
304
|
+
external
|
279
305
|
virtual
|
280
|
-
|
306
|
+
restricted()
|
307
|
+
// nonReentrant() // prevents creating a reinsurance payout in a single tx
|
308
|
+
returns (Amount netPayoutAmount, Amount processingFeeAmount)
|
281
309
|
{
|
310
|
+
// checks
|
282
311
|
(
|
283
|
-
|
284
|
-
|
312
|
+
,,
|
313
|
+
IInstance.InstanceContracts memory instanceContracts,
|
285
314
|
IPolicy.PolicyInfo memory policyInfo
|
286
315
|
) = _verifyCallerWithPolicy(policyNftId);
|
287
316
|
|
288
|
-
IPolicy.ClaimInfo memory claimInfo
|
289
|
-
|
317
|
+
IPolicy.ClaimInfo memory claimInfo;
|
318
|
+
address payoutBeneficiary;
|
319
|
+
Amount payoutAmount;
|
320
|
+
|
321
|
+
{
|
322
|
+
// check that payout exists and is open
|
323
|
+
IPolicy.PayoutInfo memory payoutInfo = instanceContracts.instanceReader.getPayoutInfo(policyNftId, payoutId);
|
324
|
+
payoutBeneficiary = payoutInfo.beneficiary;
|
325
|
+
payoutAmount = payoutInfo.amount;
|
326
|
+
StateId payoutState = instanceContracts.instanceReader.getPayoutState(policyNftId, payoutId);
|
327
|
+
if(payoutState != EXPECTED()) {
|
328
|
+
revert ErrorClaimServicePayoutNotExpected(policyNftId, payoutId, payoutState);
|
329
|
+
}
|
290
330
|
|
291
|
-
|
292
|
-
|
293
|
-
|
331
|
+
// check that payout amount does not violate claim amount
|
332
|
+
claimInfo = instanceContracts.instanceReader.getClaimInfo(policyNftId, payoutId.toClaimId());
|
333
|
+
if(claimInfo.paidAmount + payoutInfo.amount > claimInfo.claimAmount) {
|
334
|
+
revert ErrorClaimServicePayoutExceedsClaimAmount(
|
335
|
+
policyNftId,
|
336
|
+
payoutId.toClaimId(),
|
337
|
+
claimInfo.claimAmount,
|
338
|
+
claimInfo.paidAmount + payoutInfo.amount);
|
339
|
+
}
|
294
340
|
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
policyNftId,
|
301
|
-
payoutId,
|
302
|
-
IPolicy.PayoutInfo({
|
303
|
-
claimId: payoutId.toClaimId(),
|
304
|
-
amount: amount,
|
305
|
-
beneficiary: beneficiary,
|
306
|
-
data: data,
|
307
|
-
paidAt: TimestampLib.zero()}));
|
341
|
+
// effects
|
342
|
+
// update and save payout info with instance
|
343
|
+
payoutInfo.paidAt = TimestampLib.current();
|
344
|
+
instanceContracts.productStore.updatePayout(policyNftId, payoutId, payoutInfo, PAID());
|
345
|
+
}
|
308
346
|
|
309
347
|
// update and save claim info with instance
|
310
|
-
|
311
|
-
|
312
|
-
|
348
|
+
{
|
349
|
+
ClaimId claimId = payoutId.toClaimId();
|
350
|
+
claimInfo.paidAmount = claimInfo.paidAmount.add(payoutAmount);
|
351
|
+
claimInfo.openPayoutsCount -= 1;
|
352
|
+
|
353
|
+
// check if this payout is closing the linked claim
|
354
|
+
// update claim and policy info accordingly
|
355
|
+
if(claimInfo.openPayoutsCount == 0 && claimInfo.paidAmount == claimInfo.claimAmount) {
|
356
|
+
claimInfo.closedAt = TimestampLib.current();
|
357
|
+
instanceContracts.productStore.updateClaim(policyNftId, claimId, claimInfo, CLOSED());
|
358
|
+
|
359
|
+
policyInfo.openClaimsCount -= 1;
|
360
|
+
} else {
|
361
|
+
instanceContracts.productStore.updateClaim(policyNftId, claimId, claimInfo, KEEP_STATE());
|
362
|
+
}
|
363
|
+
}
|
313
364
|
|
314
365
|
// update and save policy info with instance
|
315
|
-
policyInfo.payoutAmount.
|
316
|
-
|
366
|
+
policyInfo.payoutAmount = policyInfo.payoutAmount + payoutAmount;
|
367
|
+
instanceContracts.productStore.updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
|
317
368
|
|
318
|
-
emit
|
319
|
-
}
|
369
|
+
emit LogClaimServicePayoutProcessed(policyNftId, payoutId, payoutAmount);
|
320
370
|
|
371
|
+
// effects + interactions (push tokens to beneficiary, product)
|
372
|
+
// delegate to pool to update book keeping and moving tokens payout
|
373
|
+
(netPayoutAmount, processingFeeAmount) = _poolService.processPayout(
|
374
|
+
instanceContracts.instanceReader,
|
375
|
+
instanceContracts.instanceStore,
|
376
|
+
policyInfo.productNftId, // product nft id
|
377
|
+
policyNftId,
|
378
|
+
policyInfo.bundleNftId,
|
379
|
+
payoutId,
|
380
|
+
payoutAmount,
|
381
|
+
payoutBeneficiary);
|
382
|
+
}
|
321
383
|
|
322
|
-
function
|
384
|
+
function cancelPayout(
|
323
385
|
NftId policyNftId,
|
324
386
|
PayoutId payoutId
|
325
387
|
)
|
326
388
|
external
|
327
389
|
virtual
|
390
|
+
restricted()
|
328
391
|
{
|
392
|
+
// checks
|
329
393
|
(
|
330
|
-
|
331
|
-
|
332
|
-
IPolicy.PolicyInfo memory policyInfo
|
394
|
+
,,
|
395
|
+
IInstance.InstanceContracts memory instanceContracts,
|
333
396
|
) = _verifyCallerWithPolicy(policyNftId);
|
334
397
|
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
// update and save payout info with instance
|
339
|
-
payoutInfo.paidAt = TimestampLib.blockTimestamp();
|
340
|
-
instance.getInstanceStore().updatePayout(policyNftId, payoutId, payoutInfo, PAID());
|
341
|
-
|
342
|
-
// TODO update and save claim info with instance
|
343
|
-
ClaimId claimId = payoutId.toClaimId();
|
344
|
-
Amount payoutAmount = payoutInfo.amount;
|
345
|
-
IPolicy.ClaimInfo memory claimInfo = instanceReader.getClaimInfo(policyNftId, claimId);
|
346
|
-
claimInfo.paidAmount = claimInfo.paidAmount.add(payoutAmount);
|
347
|
-
claimInfo.openPayoutsCount -= 1;
|
348
|
-
|
349
|
-
// check if this payout is closing the linked claim
|
350
|
-
// update claim and policy info accordingly
|
351
|
-
if(claimInfo.openPayoutsCount == 0 && claimInfo.paidAmount == claimInfo.claimAmount) {
|
352
|
-
claimInfo.closedAt == TimestampLib.blockTimestamp();
|
353
|
-
instance.getInstanceStore().updateClaim(policyNftId, claimId, claimInfo, CLOSED());
|
354
|
-
|
355
|
-
policyInfo.openClaimsCount -= 1;
|
356
|
-
} else {
|
357
|
-
instance.getInstanceStore().updateClaim(policyNftId, claimId, claimInfo, KEEP_STATE());
|
398
|
+
StateId payoutState = instanceContracts.instanceReader.getPayoutState(policyNftId, payoutId);
|
399
|
+
if (payoutState != EXPECTED()) {
|
400
|
+
revert ErrorClaimServicePayoutNotExpected(policyNftId, payoutId, payoutState);
|
358
401
|
}
|
359
402
|
|
360
|
-
//
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
// inform pool about payout
|
365
|
-
_poolService.reduceCollateral(
|
366
|
-
instance,
|
367
|
-
address(instanceReader.getComponentInfo(policyInfo.productNftId).token),
|
368
|
-
policyNftId,
|
369
|
-
policyInfo,
|
370
|
-
payoutAmount);
|
371
|
-
|
372
|
-
// transfer payout token and fee
|
373
|
-
(
|
374
|
-
Amount netPayoutAmount,
|
375
|
-
Amount processingFeeAmount,
|
376
|
-
address beneficiary
|
377
|
-
) = _calculatePayoutAmount(
|
378
|
-
instanceReader,
|
379
|
-
policyNftId,
|
380
|
-
policyInfo,
|
381
|
-
payoutInfo);
|
382
|
-
|
383
|
-
emit LogClaimServicePayoutProcessed(policyNftId, payoutId, payoutAmount, beneficiary, netPayoutAmount, processingFeeAmount);
|
403
|
+
// effects
|
404
|
+
// update and save payout info with instance
|
405
|
+
instanceContracts.productStore.updatePayoutState(policyNftId, payoutId, CANCELLED());
|
384
406
|
|
385
407
|
{
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
// TODO add 2nd token tx if processingFeeAmount > 0
|
408
|
+
ClaimId claimId = payoutId.toClaimId();
|
409
|
+
IPolicy.ClaimInfo memory claimInfo = instanceContracts.instanceReader.getClaimInfo(policyNftId, claimId);
|
410
|
+
claimInfo.openPayoutsCount -= 1;
|
411
|
+
instanceContracts.productStore.updateClaim(policyNftId, claimId, claimInfo, KEEP_STATE());
|
391
412
|
}
|
392
413
|
|
393
|
-
|
414
|
+
emit LogClaimServicePayoutCancelled(policyNftId, payoutId);
|
394
415
|
}
|
395
416
|
|
396
|
-
|
397
|
-
|
417
|
+
// internal functions
|
418
|
+
|
419
|
+
function _checkClaimAmount(
|
398
420
|
NftId policyNftId,
|
399
421
|
IPolicy.PolicyInfo memory policyInfo,
|
400
|
-
|
422
|
+
Amount claimAmount
|
401
423
|
)
|
402
424
|
internal
|
403
|
-
|
404
|
-
Amount netPayoutAmount,
|
405
|
-
Amount processingFeeAmount,
|
406
|
-
address beneficiary
|
407
|
-
)
|
425
|
+
pure
|
408
426
|
{
|
409
|
-
|
427
|
+
// check claim amount > 0
|
428
|
+
if (claimAmount.eqz()) {
|
429
|
+
revert ErrorClaimServiceClaimAmountIsZero(policyNftId);
|
430
|
+
}
|
410
431
|
|
411
|
-
|
412
|
-
|
432
|
+
// check policy including this claim is still within sum insured
|
433
|
+
if(policyInfo.claimAmount + claimAmount > policyInfo.sumInsuredAmount) {
|
434
|
+
revert ErrorClaimServiceClaimExceedsSumInsured(
|
435
|
+
policyNftId,
|
436
|
+
policyInfo.sumInsuredAmount,
|
437
|
+
policyInfo.payoutAmount + claimAmount);
|
438
|
+
}
|
439
|
+
}
|
413
440
|
|
414
|
-
|
415
|
-
|
416
|
-
|
441
|
+
function _createPayout(
|
442
|
+
NftId policyNftId,
|
443
|
+
ClaimId claimId,
|
444
|
+
Amount amount,
|
445
|
+
address beneficiary,
|
446
|
+
bytes memory data
|
447
|
+
)
|
448
|
+
internal
|
449
|
+
virtual
|
450
|
+
returns (PayoutId payoutId)
|
451
|
+
{
|
452
|
+
// checks
|
453
|
+
(
|
454
|
+
,,
|
455
|
+
IInstance.InstanceContracts memory instanceContracts,
|
456
|
+
// IPolicy.PolicyInfo memory policyInfo
|
457
|
+
) = _verifyCallerWithPolicy(policyNftId);
|
417
458
|
|
418
|
-
|
459
|
+
IPolicy.ClaimInfo memory claimInfo = instanceContracts.instanceReader.getClaimInfo(policyNftId, claimId);
|
419
460
|
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
461
|
+
{
|
462
|
+
// check claim state
|
463
|
+
StateId claimState = instanceContracts.instanceReader.getClaimState(policyNftId, claimId);
|
464
|
+
if (claimState != CONFIRMED()) {
|
465
|
+
revert ErrorClaimServiceClaimNotConfirmed(policyNftId, claimId, claimState);
|
424
466
|
}
|
425
467
|
|
426
|
-
|
427
|
-
|
428
|
-
|
468
|
+
// check total payout amount remains within claim limit
|
469
|
+
Amount newPaidAmount = claimInfo.paidAmount + amount;
|
470
|
+
if (newPaidAmount > claimInfo.claimAmount) {
|
471
|
+
revert ErrorClaimServicePayoutExceedsClaimAmount(
|
472
|
+
policyNftId, claimId, claimInfo.claimAmount, newPaidAmount);
|
429
473
|
}
|
430
474
|
}
|
431
|
-
}
|
432
475
|
|
433
|
-
|
476
|
+
// effects
|
477
|
+
// create payout info with instance
|
478
|
+
uint24 payoutNo = claimInfo.payoutsCount + 1;
|
479
|
+
payoutId = PayoutIdLib.toPayoutId(claimId, payoutNo);
|
480
|
+
if (beneficiary == address(0)) {
|
481
|
+
beneficiary = getRegistry().ownerOf(policyNftId);
|
482
|
+
}
|
483
|
+
|
484
|
+
instanceContracts.productStore.createPayout(
|
485
|
+
policyNftId,
|
486
|
+
payoutId,
|
487
|
+
IPolicy.PayoutInfo({
|
488
|
+
claimId: payoutId.toClaimId(),
|
489
|
+
amount: amount,
|
490
|
+
beneficiary: beneficiary,
|
491
|
+
data: data,
|
492
|
+
paidAt: TimestampLib.zero()}));
|
493
|
+
|
494
|
+
// update and save claim info with instance
|
495
|
+
claimInfo.payoutsCount += 1;
|
496
|
+
claimInfo.openPayoutsCount += 1;
|
497
|
+
instanceContracts.productStore.updateClaim(policyNftId, claimId, claimInfo, KEEP_STATE());
|
498
|
+
|
499
|
+
emit LogClaimServicePayoutCreated(policyNftId, payoutId, amount, beneficiary);
|
500
|
+
}
|
434
501
|
|
502
|
+
/// @dev Verifies the caller is a product and the policy is active.
|
503
|
+
/// Returns the product nft id, instance, instance contracts and policy info.
|
504
|
+
/// in InstanceContracts only the contracts instanceReader, instanceStore and productStore are set.
|
435
505
|
function _verifyCallerWithPolicy(
|
436
506
|
NftId policyNftId
|
437
507
|
)
|
@@ -439,17 +509,19 @@ contract ClaimService is
|
|
439
509
|
view
|
440
510
|
virtual
|
441
511
|
returns (
|
512
|
+
NftId productNftId,
|
442
513
|
IInstance instance,
|
443
|
-
|
514
|
+
IInstance.InstanceContracts memory instanceContracts,
|
444
515
|
IPolicy.PolicyInfo memory policyInfo
|
445
516
|
)
|
446
517
|
{
|
447
|
-
|
448
|
-
|
449
|
-
|
518
|
+
(productNftId, instance) = _getAndVerifyActiveProduct();
|
519
|
+
instanceContracts.instanceReader = InstanceReader(instance.getInstanceReader());
|
520
|
+
instanceContracts.instanceStore = InstanceStore(instance.getInstanceStore());
|
521
|
+
instanceContracts.productStore = ProductStore(instance.getProductStore());
|
450
522
|
|
451
523
|
// check caller(product) policy match
|
452
|
-
policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
524
|
+
policyInfo = instanceContracts.instanceReader.getPolicyInfo(policyNftId);
|
453
525
|
if(policyInfo.productNftId != productNftId) {
|
454
526
|
revert ErrorClaimServicePolicyProductMismatch(policyNftId,
|
455
527
|
policyInfo.productNftId,
|
@@ -457,6 +529,29 @@ contract ClaimService is
|
|
457
529
|
}
|
458
530
|
}
|
459
531
|
|
532
|
+
|
533
|
+
function _getAndVerifyActiveProduct()
|
534
|
+
internal
|
535
|
+
view
|
536
|
+
returns (
|
537
|
+
NftId productNftId,
|
538
|
+
IInstance instance
|
539
|
+
)
|
540
|
+
{
|
541
|
+
(
|
542
|
+
IRegistry.ObjectInfo memory info,
|
543
|
+
address instanceAddress
|
544
|
+
) = ContractLib.getAndVerifyComponent(
|
545
|
+
getRegistry(),
|
546
|
+
msg.sender, // caller
|
547
|
+
PRODUCT(),
|
548
|
+
true); // isActive
|
549
|
+
|
550
|
+
// get component nft id and instance
|
551
|
+
productNftId = info.nftId;
|
552
|
+
instance = IInstance(instanceAddress);
|
553
|
+
}
|
554
|
+
|
460
555
|
function _verifyClaim(
|
461
556
|
InstanceReader instanceReader,
|
462
557
|
NftId policyNftId,
|
@@ -480,6 +575,50 @@ contract ClaimService is
|
|
480
575
|
claimInfo = instanceReader.getClaimInfo(policyNftId, claimId);
|
481
576
|
}
|
482
577
|
|
578
|
+
function _processConfirmedClaimByPool(
|
579
|
+
InstanceReader instanceReader,
|
580
|
+
NftId productNftId,
|
581
|
+
NftId policyNftId,
|
582
|
+
ClaimId claimId,
|
583
|
+
Amount amount
|
584
|
+
)
|
585
|
+
internal
|
586
|
+
{
|
587
|
+
NftId poolNftId = instanceReader.getProductInfo(productNftId).poolNftId;
|
588
|
+
if (instanceReader.getPoolInfo(poolNftId).isProcessingConfirmedClaims) {
|
589
|
+
address poolAddress = getRegistry().getObjectAddress(poolNftId);
|
590
|
+
IPoolComponent(poolAddress).processConfirmedClaim(policyNftId, claimId, amount);
|
591
|
+
}
|
592
|
+
}
|
593
|
+
|
594
|
+
|
595
|
+
function _policyHolderClaimConfirmed(
|
596
|
+
NftId policyNftId,
|
597
|
+
ClaimId claimId,
|
598
|
+
Amount confirmedAmount
|
599
|
+
)
|
600
|
+
internal
|
601
|
+
{
|
602
|
+
IPolicyHolder policyHolder = _getPolicyHolder(policyNftId);
|
603
|
+
if(address(policyHolder) != address(0)) {
|
604
|
+
policyHolder.claimConfirmed(policyNftId, claimId, confirmedAmount);
|
605
|
+
}
|
606
|
+
}
|
607
|
+
|
608
|
+
// TODO: move to policy helper lib or something
|
609
|
+
function _getPolicyHolder(NftId policyNftId)
|
610
|
+
internal
|
611
|
+
view
|
612
|
+
returns (IPolicyHolder policyHolder)
|
613
|
+
{
|
614
|
+
address policyHolderAddress = getRegistry().ownerOf(policyNftId);
|
615
|
+
policyHolder = IPolicyHolder(policyHolderAddress);
|
616
|
+
|
617
|
+
if (!ContractLib.isPolicyHolder(policyHolderAddress)) {
|
618
|
+
policyHolder = IPolicyHolder(address(0));
|
619
|
+
}
|
620
|
+
}
|
621
|
+
|
483
622
|
|
484
623
|
function _getDomain() internal pure override returns(ObjectType) {
|
485
624
|
return CLAIM();
|