@etherisc/gif-next 0.0.2-b3a9c97-695 → 0.0.2-b3e9a44-364
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +33 -52
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +2 -2
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +0 -19
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +2 -2
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +52 -212
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +16 -16
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +16 -184
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +148 -284
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +100 -120
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +16 -37
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +65 -31
- 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 +1507 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +410 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +1978 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +414 -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 +1427 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1187 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1561 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +1996 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +16 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +16 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +26 -99
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +97 -100
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +14 -14
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +424 -74
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +55 -146
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +77 -81
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +249 -111
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +42 -202
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +18 -18
- 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 +16 -37
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +16 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +16 -184
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +53 -144
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +76 -80
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +45 -185
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +16 -16
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +146 -220
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +115 -107
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +40 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +48 -41
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +219 -118
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +45 -185
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +284 -300
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +96 -92
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +47 -146
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +73 -81
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +44 -210
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +16 -16
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +256 -229
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +117 -109
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +16 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +148 -7
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +128 -16
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +59 -43
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +44 -63
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
- package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +18 -2
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +218 -289
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +108 -128
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +133 -261
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +97 -117
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +44 -210
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +604 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +698 -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 +288 -21
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +16 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +494 -82
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +243 -131
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +39 -313
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +68 -72
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +24 -14
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +16 -173
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +103 -265
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +112 -126
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +21 -112
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +92 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +16 -26
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +16 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +16 -37
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/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 +16 -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 +16 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -22
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +16 -184
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
- package/artifacts/contracts/shared/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 +24 -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 +21 -112
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +288 -16
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +108 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +43 -27
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +16 -21
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +63 -93
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +101 -248
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +93 -100
- 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 +47 -159
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +72 -76
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +84 -84
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +54 -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 +32 -8
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- 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 +2 -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/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
- 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 +60 -4
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +26 -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 +2 -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 +2 -2
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +15 -2
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +55 -70
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/authorization/AccessAdmin.sol +25 -24
- package/contracts/authorization/Authorization.sol +5 -2
- package/contracts/authorization/IAccessAdmin.sol +0 -1
- package/contracts/distribution/BasicDistribution.sol +2 -0
- package/contracts/distribution/Distribution.sol +3 -2
- package/contracts/distribution/DistributionService.sol +70 -45
- package/contracts/distribution/DistributionServiceManager.sol +6 -6
- package/contracts/distribution/IDistributionService.sol +8 -2
- package/contracts/examples/fire/DamageLevel.sol +59 -0
- package/contracts/examples/fire/FirePool.sol +75 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
- package/contracts/examples/fire/FireProduct.sol +411 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
- package/contracts/examples/fire/FireUSD.sol +26 -0
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +50 -0
- package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
- package/contracts/examples/unpermissioned/SimplePool.sol +76 -0
- package/contracts/examples/unpermissioned/SimpleProduct.sol +351 -0
- package/contracts/instance/IInstance.sol +7 -30
- package/contracts/instance/Instance.sol +10 -35
- package/contracts/instance/InstanceAdmin.sol +29 -7
- package/contracts/instance/InstanceAuthorizationV3.sol +3 -3
- package/contracts/instance/InstanceReader.sol +106 -19
- package/contracts/instance/InstanceService.sol +12 -14
- package/contracts/instance/InstanceServiceManager.sol +6 -7
- package/contracts/instance/InstanceStore.sol +11 -1
- package/contracts/instance/base/ObjectLifecycle.sol +7 -1
- package/contracts/instance/module/IComponents.sol +4 -2
- package/contracts/instance/module/IPolicy.sol +23 -23
- package/contracts/oracle/Oracle.sol +2 -1
- package/contracts/oracle/OracleService.sol +41 -33
- package/contracts/oracle/OracleServiceManager.sol +6 -6
- package/contracts/pool/BasicPool.sol +12 -13
- package/contracts/pool/BundleService.sol +41 -17
- package/contracts/pool/BundleServiceManager.sol +6 -6
- package/contracts/pool/IBundleService.sol +10 -0
- package/contracts/pool/IPoolComponent.sol +18 -8
- package/contracts/pool/IPoolService.sol +49 -25
- package/contracts/pool/Pool.sol +61 -32
- package/contracts/pool/PoolService.sol +116 -77
- package/contracts/pool/PoolServiceManager.sol +4 -4
- package/contracts/product/ApplicationService.sol +13 -12
- package/contracts/product/ApplicationServiceManager.sol +4 -4
- package/contracts/product/BasicProduct.sol +1 -0
- package/contracts/product/ClaimService.sol +245 -81
- package/contracts/product/ClaimServiceManager.sol +4 -4
- package/contracts/product/IClaimService.sol +30 -7
- package/contracts/product/IPolicyService.sol +16 -20
- package/contracts/product/IPricingService.sol +7 -7
- package/contracts/product/IProductComponent.sol +17 -4
- package/contracts/product/{IProductService.sol → IRiskService.sol} +1 -1
- package/contracts/product/PolicyService.sol +209 -118
- package/contracts/product/PolicyServiceManager.sol +4 -4
- package/contracts/product/PricingService.sol +42 -46
- package/contracts/product/PricingServiceManager.sol +3 -3
- package/contracts/product/Product.sol +67 -46
- package/contracts/product/{ProductService.sol → RiskService.sol} +7 -10
- package/contracts/product/RiskServiceManager.sol +39 -0
- package/contracts/registry/ChainNft.sol +65 -32
- package/contracts/registry/IRegistry.sol +55 -15
- package/contracts/registry/IRegistryService.sol +0 -9
- package/contracts/registry/Registry.sol +336 -197
- package/contracts/registry/RegistryAdmin.sol +150 -51
- package/contracts/registry/RegistryService.sol +55 -48
- package/contracts/registry/RegistryServiceManager.sol +2 -2
- package/contracts/registry/ReleaseRegistry.sol +12 -6
- package/contracts/registry/ServiceAuthorizationV3.sol +6 -8
- package/contracts/shared/Component.sol +12 -32
- package/contracts/shared/ComponentService.sol +17 -16
- package/contracts/shared/ComponentServiceManager.sol +8 -5
- package/contracts/shared/ComponentVerifyingService.sol +2 -3
- package/contracts/shared/ContractLib.sol +38 -0
- package/contracts/shared/IComponent.sol +0 -1
- package/contracts/shared/IInstanceLinkedComponent.sol +0 -7
- package/contracts/shared/INftOwnable.sol +2 -0
- package/contracts/shared/IPolicyHolder.sol +12 -22
- package/contracts/shared/InitializableERC165.sol +2 -2
- package/contracts/shared/InstanceLinkedComponent.sol +5 -6
- package/contracts/shared/NftOwnable.sol +21 -5
- package/contracts/shared/PolicyHolder.sol +15 -52
- package/contracts/shared/Registerable.sol +4 -4
- package/contracts/shared/RegistryLinked.sol +3 -2
- package/contracts/shared/Service.sol +16 -11
- package/contracts/shared/TokenHandler.sol +99 -22
- package/contracts/shared/TokenHandlerDeployerLib.sol +12 -0
- package/contracts/staking/IStaking.sol +2 -1
- package/contracts/staking/IStakingService.sol +0 -3
- package/contracts/staking/StakeManagerLib.sol +18 -25
- package/contracts/staking/Staking.sol +11 -29
- package/contracts/staking/StakingManager.sol +8 -6
- package/contracts/staking/StakingReader.sol +12 -5
- package/contracts/staking/StakingService.sol +3 -17
- package/contracts/staking/StakingServiceManager.sol +2 -2
- package/contracts/staking/TargetManagerLib.sol +7 -3
- package/contracts/type/Amount.sol +15 -0
- package/contracts/type/ClaimId.sol +6 -1
- package/contracts/type/NftId.sol +1 -0
- package/contracts/type/ObjectType.sol +16 -11
- package/contracts/type/PayoutId.sol +10 -10
- package/contracts/type/RiskId.sol +15 -1
- package/contracts/type/Seconds.sol +8 -0
- package/contracts/type/StateId.sol +1 -0
- package/contracts/type/UFixed.sol +4 -0
- package/contracts/upgradeability/ProxyManager.sol +67 -34
- package/contracts/upgradeability/Versionable.sol +2 -2
- package/package.json +2 -1
- 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/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
- package/artifacts/contracts/shared/TokenTransferLib.sol/TokenTransferLib.dbg.json +0 -4
- package/artifacts/contracts/shared/TokenTransferLib.sol/TokenTransferLib.json +0 -42
- package/contracts/product/ProductServiceManager.sol +0 -39
- package/contracts/shared/InitializableCustom.sol +0 -177
- package/contracts/shared/TokenTransferLib.sol +0 -60
@@ -10,18 +10,18 @@ import {IInstance} from "../instance/IInstance.sol";
|
|
10
10
|
import {IPolicy} from "../instance/module/IPolicy.sol";
|
11
11
|
|
12
12
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
13
|
-
import {TokenTransferLib} from "../shared/TokenTransferLib.sol";
|
14
13
|
|
15
14
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
16
15
|
import {Timestamp, TimestampLib, zeroTimestamp} from "../type/Timestamp.sol";
|
17
16
|
import {ObjectType, APPLICATION, COMPONENT, DISTRIBUTION, PRODUCT, POOL, POLICY, BUNDLE, CLAIM, PRICE} from "../type/ObjectType.sol";
|
18
|
-
import {APPLIED, COLLATERALIZED, KEEP_STATE, CLOSED, DECLINED} from "../type/StateId.sol";
|
17
|
+
import {APPLIED, COLLATERALIZED, KEEP_STATE, CLOSED, DECLINED, PAID} from "../type/StateId.sol";
|
19
18
|
import {NftId, NftIdLib} from "../type/NftId.sol";
|
20
19
|
import {ReferralId} from "../type/Referral.sol";
|
21
20
|
import {StateId} from "../type/StateId.sol";
|
22
21
|
import {VersionPart} from "../type/Version.sol";
|
23
22
|
|
24
23
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
24
|
+
import {ContractLib} from "../shared/ContractLib.sol";
|
25
25
|
import {IApplicationService} from "./IApplicationService.sol";
|
26
26
|
import {IBundleService} from "../pool/IBundleService.sol";
|
27
27
|
import {IClaimService} from "./IClaimService.sol";
|
@@ -29,6 +29,7 @@ import {IComponentService} from "../shared/IComponentService.sol";
|
|
29
29
|
import {IDistributionService} from "../distribution/IDistributionService.sol";
|
30
30
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
31
31
|
import {InstanceStore} from "../instance/InstanceStore.sol";
|
32
|
+
import {IPolicyHolder} from "../shared/IPolicyHolder.sol";
|
32
33
|
import {IPolicyService} from "./IPolicyService.sol";
|
33
34
|
import {IPoolService} from "../pool/IPoolService.sol";
|
34
35
|
import {IPricingService} from "./IPricingService.sol";
|
@@ -48,8 +49,6 @@ contract PolicyService is
|
|
48
49
|
IPoolService internal _poolService;
|
49
50
|
IPricingService internal _pricingService;
|
50
51
|
|
51
|
-
event LogProductServiceSender(address sender);
|
52
|
-
|
53
52
|
function _initialize(
|
54
53
|
address owner,
|
55
54
|
bytes memory data
|
@@ -59,12 +58,11 @@ contract PolicyService is
|
|
59
58
|
initializer
|
60
59
|
{
|
61
60
|
(
|
62
|
-
address registryAddress
|
63
|
-
//address managerAddress
|
61
|
+
address registryAddress,
|
64
62
|
address authority
|
65
|
-
) = abi.decode(data, (address, address
|
63
|
+
) = abi.decode(data, (address, address));
|
66
64
|
|
67
|
-
|
65
|
+
_initializeService(registryAddress, authority, owner);
|
68
66
|
|
69
67
|
VersionPart majorVersion = getVersion().toMajorPart();
|
70
68
|
_applicationService = IApplicationService(getRegistry().getServiceAddress(APPLICATION(), majorVersion));
|
@@ -75,7 +73,7 @@ contract PolicyService is
|
|
75
73
|
_distributionService = IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), majorVersion));
|
76
74
|
_pricingService = IPricingService(getRegistry().getServiceAddress(PRICE(), majorVersion));
|
77
75
|
|
78
|
-
|
76
|
+
_registerInterface(type(IPolicyService).interfaceId);
|
79
77
|
}
|
80
78
|
|
81
79
|
|
@@ -83,7 +81,8 @@ contract PolicyService is
|
|
83
81
|
NftId applicationNftId // = policyNftId
|
84
82
|
)
|
85
83
|
external
|
86
|
-
virtual
|
84
|
+
virtual
|
85
|
+
nonReentrant()
|
87
86
|
{
|
88
87
|
(NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
89
88
|
InstanceReader instanceReader = instance.getInstanceReader();
|
@@ -115,11 +114,11 @@ contract PolicyService is
|
|
115
114
|
/// @inheritdoc IPolicyService
|
116
115
|
function createPolicy(
|
117
116
|
NftId applicationNftId, // = policyNftId
|
118
|
-
bool requirePremiumPayment,
|
119
117
|
Timestamp activateAt
|
120
118
|
)
|
121
119
|
external
|
122
|
-
virtual
|
120
|
+
virtual
|
121
|
+
nonReentrant()
|
123
122
|
{
|
124
123
|
// check caller is registered product
|
125
124
|
(NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
@@ -139,13 +138,8 @@ contract PolicyService is
|
|
139
138
|
productNftId);
|
140
139
|
}
|
141
140
|
|
142
|
-
StateId newPolicyState = COLLATERALIZED();
|
143
|
-
|
144
141
|
// actual collateralizaion
|
145
|
-
(
|
146
|
-
Amount localCollateralAmount,
|
147
|
-
Amount totalCollateralAmount
|
148
|
-
) = _poolService.lockCollateral(
|
142
|
+
_poolService.lockCollateral(
|
149
143
|
instance,
|
150
144
|
address(instanceReader.getComponentInfo(productNftId).token),
|
151
145
|
productNftId,
|
@@ -155,38 +149,50 @@ contract PolicyService is
|
|
155
149
|
|
156
150
|
// optional activation of policy
|
157
151
|
if(activateAt > zeroTimestamp()) {
|
158
|
-
applicationInfo
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
IPolicy.Premium memory premium;
|
163
|
-
|
164
|
-
// optional: calculate the premium and update counters for collection at the end of this function
|
165
|
-
if(requirePremiumPayment) {
|
166
|
-
premium = _calculateAndProcessPremium(
|
167
|
-
instance,
|
168
|
-
applicationNftId,
|
169
|
-
applicationInfo);
|
170
|
-
|
171
|
-
applicationInfo.premiumPaidAmount = AmountLib.toAmount(premium.premiumAmount);
|
152
|
+
applicationInfo = _activate(
|
153
|
+
applicationNftId,
|
154
|
+
applicationInfo,
|
155
|
+
activateAt);
|
172
156
|
}
|
173
157
|
|
174
|
-
//
|
158
|
+
// update policy and set state to collateralized
|
175
159
|
instance.getInstanceStore().updatePolicy(
|
176
160
|
applicationNftId,
|
177
161
|
applicationInfo,
|
178
|
-
|
162
|
+
COLLATERALIZED());
|
179
163
|
|
180
|
-
//
|
164
|
+
// calculate and store premium
|
165
|
+
IPolicy.PremiumInfo memory premium = _pricingService.calculatePremium(
|
166
|
+
productNftId,
|
167
|
+
applicationInfo.riskId,
|
168
|
+
applicationInfo.sumInsuredAmount,
|
169
|
+
applicationInfo.lifetime,
|
170
|
+
applicationInfo.applicationData,
|
171
|
+
applicationInfo.bundleNftId,
|
172
|
+
applicationInfo.referralId);
|
181
173
|
|
182
|
-
|
174
|
+
instance.getInstanceStore().createPremium(
|
175
|
+
applicationNftId,
|
176
|
+
premium);
|
177
|
+
|
178
|
+
// update referral counter
|
179
|
+
{
|
180
|
+
IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
|
183
181
|
|
184
|
-
|
185
|
-
|
186
|
-
|
182
|
+
if (! productInfo.distributionNftId.eqz()) { // only call distribution service if a distribution component is connected to the product
|
183
|
+
_distributionService.processReferral(
|
184
|
+
productInfo.distributionNftId,
|
185
|
+
applicationInfo.referralId);
|
186
|
+
}
|
187
187
|
}
|
188
188
|
|
189
|
-
//
|
189
|
+
// log policy creation before interactions with token and policy holder
|
190
|
+
emit LogPolicyServicePolicyCreated(applicationNftId, premium.premiumAmount, activateAt);
|
191
|
+
|
192
|
+
// TODO add calling pool contract if it needs to validate application
|
193
|
+
|
194
|
+
// callback to policy holder if applicable
|
195
|
+
_policyHolderPolicyActivated(applicationNftId, activateAt);
|
190
196
|
}
|
191
197
|
|
192
198
|
|
@@ -197,6 +203,7 @@ contract PolicyService is
|
|
197
203
|
)
|
198
204
|
external
|
199
205
|
virtual
|
206
|
+
nonReentrant()
|
200
207
|
{
|
201
208
|
// check caller is registered product
|
202
209
|
(,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
@@ -208,20 +215,19 @@ contract PolicyService is
|
|
208
215
|
revert ErrorPolicyServicePolicyStateNotCollateralized(policyNftId);
|
209
216
|
}
|
210
217
|
|
211
|
-
IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
212
|
-
|
213
218
|
// check if premium is already collected
|
214
|
-
if (
|
215
|
-
revert ErrorPolicyServicePremiumAlreadyPaid(policyNftId
|
219
|
+
if (instanceReader.getPremiumInfoState(policyNftId) == PAID()) {
|
220
|
+
revert ErrorPolicyServicePremiumAlreadyPaid(policyNftId);
|
216
221
|
}
|
217
222
|
|
218
|
-
|
219
|
-
IPolicy.
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
223
|
+
IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
224
|
+
IPolicy.PremiumInfo memory premium = instanceReader.getPremiumInfo(policyNftId);
|
225
|
+
|
226
|
+
_processPremium(
|
227
|
+
instance,
|
228
|
+
policyNftId,
|
229
|
+
policyInfo,
|
230
|
+
premium);
|
225
231
|
|
226
232
|
// optionally activate policy
|
227
233
|
if(activateAt.gtz()) {
|
@@ -229,16 +235,20 @@ contract PolicyService is
|
|
229
235
|
}
|
230
236
|
|
231
237
|
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, KEEP_STATE());
|
238
|
+
instance.getInstanceStore().updatePremiumState(policyNftId, PAID());
|
232
239
|
|
233
|
-
//
|
240
|
+
// log premium collection before interactions with token
|
241
|
+
emit LogPolicyServicePolicyPremiumCollected(policyNftId, premium.premiumAmount);
|
234
242
|
|
235
243
|
_transferFunds(instanceReader, policyNftId, policyInfo.productNftId, premium);
|
236
|
-
|
237
|
-
// TODO: add callback IPolicyHolder.policyActivated() if applicable
|
238
244
|
}
|
239
245
|
|
240
246
|
/// @inheritdoc IPolicyService
|
241
|
-
function activate(NftId policyNftId, Timestamp activateAt)
|
247
|
+
function activate(NftId policyNftId, Timestamp activateAt)
|
248
|
+
external
|
249
|
+
virtual
|
250
|
+
nonReentrant()
|
251
|
+
{
|
242
252
|
// check caller is registered product
|
243
253
|
(,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
244
254
|
InstanceReader instanceReader = instance.getInstanceReader();
|
@@ -248,9 +258,11 @@ contract PolicyService is
|
|
248
258
|
|
249
259
|
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, KEEP_STATE());
|
250
260
|
|
251
|
-
//
|
261
|
+
// log policy activation before interactions with policy holder
|
262
|
+
emit LogPolicyServicePolicyActivated(policyNftId, activateAt);
|
252
263
|
|
253
|
-
//
|
264
|
+
// callback to policy holder if applicable
|
265
|
+
_policyHolderPolicyActivated(policyNftId, activateAt);
|
254
266
|
}
|
255
267
|
|
256
268
|
|
@@ -260,15 +272,14 @@ contract PolicyService is
|
|
260
272
|
Timestamp expireAt
|
261
273
|
)
|
262
274
|
external
|
263
|
-
override
|
264
275
|
virtual
|
276
|
+
nonReentrant()
|
265
277
|
returns (Timestamp expiredAt)
|
266
278
|
{
|
267
279
|
(NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
268
|
-
|
269
|
-
|
280
|
+
|
270
281
|
// check policy matches with calling product
|
271
|
-
IPolicy.PolicyInfo memory policyInfo =
|
282
|
+
IPolicy.PolicyInfo memory policyInfo = instance.getInstanceReader().getPolicyInfo(policyNftId);
|
272
283
|
if(policyInfo.productNftId != productNftId) {
|
273
284
|
revert ErrorPolicyServicePolicyProductMismatch(
|
274
285
|
policyNftId,
|
@@ -276,8 +287,44 @@ contract PolicyService is
|
|
276
287
|
productNftId);
|
277
288
|
}
|
278
289
|
|
290
|
+
return _expire(
|
291
|
+
instance,
|
292
|
+
policyNftId,
|
293
|
+
expireAt
|
294
|
+
);
|
295
|
+
}
|
296
|
+
|
297
|
+
/// @inheritdoc IPolicyService
|
298
|
+
function expirePolicy(
|
299
|
+
IInstance instance,
|
300
|
+
NftId policyNftId,
|
301
|
+
Timestamp expireAt
|
302
|
+
)
|
303
|
+
external
|
304
|
+
virtual
|
305
|
+
nonReentrant()
|
306
|
+
returns (Timestamp expiredAt)
|
307
|
+
{
|
308
|
+
return _expire(
|
309
|
+
instance,
|
310
|
+
policyNftId,
|
311
|
+
expireAt
|
312
|
+
);
|
313
|
+
}
|
314
|
+
|
315
|
+
function _expire(
|
316
|
+
IInstance instance,
|
317
|
+
NftId policyNftId,
|
318
|
+
Timestamp expireAt
|
319
|
+
)
|
320
|
+
internal
|
321
|
+
returns (Timestamp expiredAt)
|
322
|
+
{
|
323
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
324
|
+
|
279
325
|
// check policy is active
|
280
326
|
StateId policyState = instanceReader.getPolicyState(policyNftId);
|
327
|
+
IPolicy.PolicyInfo memory policyInfo = instance.getInstanceReader().getPolicyInfo(policyNftId);
|
281
328
|
if (!_policyHasBeenActivated(policyState, policyInfo)) {
|
282
329
|
revert ErrorPolicyServicePolicyNotActive(policyNftId, policyState);
|
283
330
|
}
|
@@ -299,12 +346,14 @@ contract PolicyService is
|
|
299
346
|
}
|
300
347
|
|
301
348
|
// update policyInfo with new expiredAt timestamp
|
349
|
+
Timestamp originalExpiredAt = policyInfo.expiredAt;
|
302
350
|
policyInfo.expiredAt = expiredAt;
|
303
351
|
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, KEEP_STATE());
|
304
352
|
|
305
|
-
emit LogPolicyServicePolicyExpirationUpdated(policyNftId, expiredAt);
|
353
|
+
emit LogPolicyServicePolicyExpirationUpdated(policyNftId, originalExpiredAt, expiredAt);
|
306
354
|
|
307
|
-
//
|
355
|
+
// callback to policy holder if applicable
|
356
|
+
_policyHolderPolicyExpired(policyNftId, expiredAt);
|
308
357
|
}
|
309
358
|
|
310
359
|
|
@@ -312,7 +361,8 @@ contract PolicyService is
|
|
312
361
|
NftId policyNftId
|
313
362
|
)
|
314
363
|
external
|
315
|
-
|
364
|
+
virtual
|
365
|
+
nonReentrant()
|
316
366
|
{
|
317
367
|
(,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
318
368
|
InstanceReader instanceReader = instance.getInstanceReader();
|
@@ -335,8 +385,9 @@ contract PolicyService is
|
|
335
385
|
}
|
336
386
|
|
337
387
|
// TODO consider to allow for underpaid premiums (with the effects of reducing max payouts accordingly)
|
338
|
-
|
339
|
-
|
388
|
+
// TODO consider to remove requirement for fully paid premiums altogether
|
389
|
+
if (! instanceReader.getPremiumInfoState(policyNftId).eq(PAID())) {
|
390
|
+
revert ErrorPolicyServicePremiumNotPaid(policyNftId, policyInfo.premiumAmount);
|
340
391
|
}
|
341
392
|
|
342
393
|
// release (remaining) collateral that was blocked by policy
|
@@ -346,37 +397,29 @@ contract PolicyService is
|
|
346
397
|
policyNftId,
|
347
398
|
policyInfo);
|
348
399
|
|
400
|
+
// TODO consider to also set expiredAt to current block timestamp if that timestamp is still in the futue
|
401
|
+
|
349
402
|
// update policy state to closed
|
350
403
|
policyInfo.closedAt = TimestampLib.blockTimestamp();
|
351
404
|
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, CLOSED());
|
405
|
+
|
406
|
+
emit LogPolicyServicePolicyClosed(policyNftId);
|
352
407
|
}
|
353
408
|
|
354
409
|
|
355
410
|
/// @dev calculates the premium and updates all counters in the other services
|
356
|
-
function
|
411
|
+
function _processPremium(
|
357
412
|
IInstance instance,
|
358
413
|
NftId applicationNftId,
|
359
|
-
IPolicy.PolicyInfo memory applicationInfo
|
414
|
+
IPolicy.PolicyInfo memory applicationInfo,
|
415
|
+
IPolicy.PremiumInfo memory premium
|
360
416
|
)
|
361
417
|
internal
|
362
418
|
virtual
|
363
|
-
returns (
|
364
|
-
IPolicy.Premium memory premium
|
365
|
-
)
|
366
419
|
{
|
367
420
|
NftId productNftId = applicationInfo.productNftId;
|
368
421
|
InstanceReader instanceReader = instance.getInstanceReader();
|
369
422
|
|
370
|
-
// calculate premium details
|
371
|
-
premium = _pricingService.calculatePremium(
|
372
|
-
productNftId,
|
373
|
-
applicationInfo.riskId,
|
374
|
-
applicationInfo.sumInsuredAmount,
|
375
|
-
applicationInfo.lifetime,
|
376
|
-
applicationInfo.applicationData,
|
377
|
-
applicationInfo.bundleNftId,
|
378
|
-
applicationInfo.referralId);
|
379
|
-
|
380
423
|
// check if premium balance and allowance of policy holder is sufficient
|
381
424
|
{
|
382
425
|
TokenHandler tokenHandler = _getTokenHandler(instanceReader, productNftId);
|
@@ -386,7 +429,7 @@ contract PolicyService is
|
|
386
429
|
tokenHandler.getToken(),
|
387
430
|
address(tokenHandler),
|
388
431
|
policyHolder,
|
389
|
-
|
432
|
+
premium.premiumAmount);
|
390
433
|
}
|
391
434
|
|
392
435
|
// update the counters
|
@@ -399,7 +442,6 @@ contract PolicyService is
|
|
399
442
|
premium);
|
400
443
|
}
|
401
444
|
|
402
|
-
|
403
445
|
function _activate(
|
404
446
|
NftId policyNftId,
|
405
447
|
IPolicy.PolicyInfo memory policyInfo,
|
@@ -410,10 +452,16 @@ contract PolicyService is
|
|
410
452
|
view
|
411
453
|
returns (IPolicy.PolicyInfo memory)
|
412
454
|
{
|
413
|
-
if
|
455
|
+
// fail if policy has already been activated and activateAt is different
|
456
|
+
if(! policyInfo.activatedAt.eqz() && activateAt != policyInfo.activatedAt) {
|
414
457
|
revert ErrorPolicyServicePolicyAlreadyActivated(policyNftId);
|
415
458
|
}
|
416
459
|
|
460
|
+
// ignore if policy has already been activated and activateAt is the same
|
461
|
+
if (policyInfo.activatedAt == activateAt) {
|
462
|
+
return policyInfo;
|
463
|
+
}
|
464
|
+
|
417
465
|
policyInfo.activatedAt = activateAt;
|
418
466
|
policyInfo.expiredAt = activateAt.addSeconds(policyInfo.lifetime);
|
419
467
|
|
@@ -427,17 +475,12 @@ contract PolicyService is
|
|
427
475
|
NftId productNftId,
|
428
476
|
NftId bundleNftId,
|
429
477
|
ReferralId referralId,
|
430
|
-
IPolicy.
|
478
|
+
IPolicy.PremiumInfo memory premium
|
431
479
|
)
|
432
480
|
internal
|
433
481
|
virtual
|
434
482
|
{
|
435
|
-
(
|
436
|
-
NftId distributionNftId,
|
437
|
-
address distributionWallet,
|
438
|
-
address poolWallet,
|
439
|
-
address productWallet
|
440
|
-
) = _getDistributionNftAndWallets(
|
483
|
+
(NftId distributionNftId, , , ) = _getDistributionNftAndWallets(
|
441
484
|
instanceReader,
|
442
485
|
productNftId);
|
443
486
|
|
@@ -445,13 +488,15 @@ contract PolicyService is
|
|
445
488
|
_componentService.increaseProductFees(
|
446
489
|
instanceStore,
|
447
490
|
productNftId,
|
448
|
-
|
491
|
+
premium.productFeeVarAmount + premium.productFeeFixAmount);
|
449
492
|
|
450
493
|
// update distribution fees and distributor commission and pool fees
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
494
|
+
if (!distributionNftId.eqz()) { // only call distribution service if a distribution component is connected to the product
|
495
|
+
_distributionService.processSale(
|
496
|
+
distributionNftId,
|
497
|
+
referralId,
|
498
|
+
premium);
|
499
|
+
}
|
455
500
|
|
456
501
|
// update pool and bundle fees
|
457
502
|
_poolService.processSale(
|
@@ -465,7 +510,7 @@ contract PolicyService is
|
|
465
510
|
InstanceReader instanceReader,
|
466
511
|
NftId policyNftId,
|
467
512
|
NftId productNftId,
|
468
|
-
IPolicy.
|
513
|
+
IPolicy.PremiumInfo memory premium
|
469
514
|
)
|
470
515
|
internal
|
471
516
|
virtual
|
@@ -482,27 +527,14 @@ contract PolicyService is
|
|
482
527
|
instanceReader,
|
483
528
|
productNftId);
|
484
529
|
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
TokenTransferLib.collectTokens(
|
494
|
-
policyHolder,
|
495
|
-
distributionWallet,
|
496
|
-
premium.distributionFeeAndCommissionAmount,
|
497
|
-
tokenHandler);
|
498
|
-
}
|
499
|
-
if (premium.poolPremiumAndFeeAmount.gtz()) {
|
500
|
-
TokenTransferLib.collectTokens(
|
501
|
-
policyHolder,
|
502
|
-
poolWallet,
|
503
|
-
premium.poolPremiumAndFeeAmount,
|
504
|
-
tokenHandler);
|
505
|
-
}
|
530
|
+
tokenHandler.collectTokensToThreeRecipients(
|
531
|
+
policyHolder,
|
532
|
+
productWallet,
|
533
|
+
premium.productFeeAmount,
|
534
|
+
distributionWallet,
|
535
|
+
premium.distributionFeeAndCommissionAmount,
|
536
|
+
poolWallet,
|
537
|
+
premium.poolPremiumAndFeeAmount);
|
506
538
|
}
|
507
539
|
|
508
540
|
|
@@ -547,6 +579,64 @@ contract PolicyService is
|
|
547
579
|
}
|
548
580
|
|
549
581
|
|
582
|
+
function _policyHolderPolicyActivated(
|
583
|
+
NftId policyNftId,
|
584
|
+
Timestamp activateAt
|
585
|
+
)
|
586
|
+
internal
|
587
|
+
virtual
|
588
|
+
{
|
589
|
+
// immediately return if policy is not activated
|
590
|
+
if (activateAt.eqz()) {
|
591
|
+
return;
|
592
|
+
}
|
593
|
+
|
594
|
+
// get policy holder address
|
595
|
+
IPolicyHolder policyHolder = _getPolicyHolder(policyNftId);
|
596
|
+
|
597
|
+
// execute callback if policy holder implements IPolicyHolder
|
598
|
+
if (address(policyHolder) != address(0)) {
|
599
|
+
policyHolder.policyActivated(policyNftId, activateAt);
|
600
|
+
}
|
601
|
+
}
|
602
|
+
|
603
|
+
|
604
|
+
function _policyHolderPolicyExpired(
|
605
|
+
NftId policyNftId,
|
606
|
+
Timestamp expiredAt
|
607
|
+
)
|
608
|
+
internal
|
609
|
+
virtual
|
610
|
+
{
|
611
|
+
// immediately return if policy is not activated
|
612
|
+
if (expiredAt.eqz()) {
|
613
|
+
return;
|
614
|
+
}
|
615
|
+
|
616
|
+
// get policy holder address
|
617
|
+
IPolicyHolder policyHolder = _getPolicyHolder(policyNftId);
|
618
|
+
|
619
|
+
// execute callback if policy holder implements IPolicyHolder
|
620
|
+
if (address(policyHolder) != address(0)) {
|
621
|
+
policyHolder.policyExpired(policyNftId, expiredAt);
|
622
|
+
}
|
623
|
+
}
|
624
|
+
|
625
|
+
|
626
|
+
function _getPolicyHolder(NftId policyNftId)
|
627
|
+
internal
|
628
|
+
view
|
629
|
+
returns (IPolicyHolder policyHolder)
|
630
|
+
{
|
631
|
+
address policyHolderAddress = getRegistry().ownerOf(policyNftId);
|
632
|
+
policyHolder = IPolicyHolder(policyHolderAddress);
|
633
|
+
|
634
|
+
if (!ContractLib.isPolicyHolder(policyHolderAddress)) {
|
635
|
+
policyHolder = IPolicyHolder(address(0));
|
636
|
+
}
|
637
|
+
}
|
638
|
+
|
639
|
+
|
550
640
|
function _getTokenHandler(
|
551
641
|
InstanceReader instanceReader,
|
552
642
|
NftId productNftId
|
@@ -561,6 +651,7 @@ contract PolicyService is
|
|
561
651
|
tokenHandler = instanceReader.getComponentInfo(productNftId).tokenHandler;
|
562
652
|
}
|
563
653
|
|
654
|
+
|
564
655
|
function _getDistributionNftAndWallets(
|
565
656
|
InstanceReader instanceReader,
|
566
657
|
NftId productNftId
|
@@ -12,14 +12,14 @@ contract PolicyServiceManager is ProxyManager {
|
|
12
12
|
/// @dev initializes proxy manager with product service implementation
|
13
13
|
constructor(
|
14
14
|
address authority,
|
15
|
-
address
|
15
|
+
address registry,
|
16
16
|
bytes32 salt
|
17
17
|
)
|
18
|
-
ProxyManager(registryAddress)
|
19
18
|
{
|
20
19
|
PolicyService svc = new PolicyService{salt: salt}();
|
21
|
-
bytes memory data = abi.encode(
|
22
|
-
IVersionable versionable =
|
20
|
+
bytes memory data = abi.encode(registry, authority);
|
21
|
+
IVersionable versionable = initialize(
|
22
|
+
registry,
|
23
23
|
address(svc),
|
24
24
|
data,
|
25
25
|
salt);
|