@etherisc/gif-next 0.0.2-9b7f7f5-445 → 0.0.2-9bed517-659
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 +58 -248
- 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 -222
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +150 -286
- 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 -62
- 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 +48 -238
- 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 -222
- 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 -223
- 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 +148 -222
- 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 -31
- 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 +208 -138
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +45 -223
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +283 -355
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +96 -120
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +52 -162
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +73 -89
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +44 -248
- 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 +279 -181
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +120 -100
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +21 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +163 -6
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +247 -140
- 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 +329 -345
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +108 -104
- 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 -248
- 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 -211
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +105 -212
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +112 -114
- 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 -222
- 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 +330 -11
- 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 -262
- 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 -88
- 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 +72 -61
- package/contracts/distribution/DistributionServiceManager.sol +6 -6
- package/contracts/distribution/IDistributionService.sol +9 -5
- 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 +107 -25
- package/contracts/instance/InstanceService.sol +63 -41
- package/contracts/instance/InstanceServiceManager.sol +6 -7
- package/contracts/instance/InstanceStore.sol +11 -1
- package/contracts/instance/base/ObjectLifecycle.sol +9 -4
- package/contracts/instance/module/IComponents.sol +4 -2
- package/contracts/instance/module/IPolicy.sol +24 -24
- 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 +42 -32
- package/contracts/pool/BundleServiceManager.sol +6 -6
- package/contracts/pool/IBundleService.sol +11 -3
- package/contracts/pool/IPoolComponent.sol +18 -8
- package/contracts/pool/IPoolService.sol +50 -28
- package/contracts/pool/Pool.sol +61 -32
- package/contracts/pool/PoolService.sol +122 -121
- package/contracts/pool/PoolServiceManager.sol +4 -4
- package/contracts/product/ApplicationService.sol +50 -29
- package/contracts/product/ApplicationServiceManager.sol +4 -4
- package/contracts/product/BasicProduct.sol +1 -0
- package/contracts/product/ClaimService.sol +251 -87
- package/contracts/product/ClaimServiceManager.sol +4 -4
- package/contracts/product/IApplicationService.sol +1 -0
- package/contracts/product/IClaimService.sol +31 -7
- package/contracts/product/IPolicyService.sol +31 -35
- 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 +359 -202
- package/contracts/product/PolicyServiceManager.sol +4 -4
- package/contracts/product/PricingService.sol +47 -47
- package/contracts/product/PricingServiceManager.sol +3 -3
- package/contracts/product/Product.sol +76 -53
- 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 +17 -36
- package/contracts/shared/ComponentService.sol +20 -30
- 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 +4 -4
- package/contracts/shared/IInstanceLinkedComponent.sol +8 -15
- 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 +100 -19
- 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 +11 -29
- 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/contracts/product/ProductServiceManager.sol +0 -39
- package/contracts/shared/InitializableCustom.sol +0 -177
@@ -1,6 +1,8 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
|
4
6
|
import {IRegistry} from "../registry/IRegistry.sol";
|
5
7
|
import {Product} from "./Product.sol";
|
6
8
|
import {IComponents} from "../instance/module/IComponents.sol";
|
@@ -12,13 +14,14 @@ import {TokenHandler} from "../shared/TokenHandler.sol";
|
|
12
14
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
13
15
|
import {Timestamp, TimestampLib, zeroTimestamp} from "../type/Timestamp.sol";
|
14
16
|
import {ObjectType, APPLICATION, COMPONENT, DISTRIBUTION, PRODUCT, POOL, POLICY, BUNDLE, CLAIM, PRICE} from "../type/ObjectType.sol";
|
15
|
-
import {APPLIED, COLLATERALIZED,
|
17
|
+
import {APPLIED, COLLATERALIZED, KEEP_STATE, CLOSED, DECLINED, PAID} from "../type/StateId.sol";
|
16
18
|
import {NftId, NftIdLib} from "../type/NftId.sol";
|
17
19
|
import {ReferralId} from "../type/Referral.sol";
|
18
20
|
import {StateId} from "../type/StateId.sol";
|
19
21
|
import {VersionPart} from "../type/Version.sol";
|
20
22
|
|
21
23
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
24
|
+
import {ContractLib} from "../shared/ContractLib.sol";
|
22
25
|
import {IApplicationService} from "./IApplicationService.sol";
|
23
26
|
import {IBundleService} from "../pool/IBundleService.sol";
|
24
27
|
import {IClaimService} from "./IClaimService.sol";
|
@@ -26,6 +29,7 @@ import {IComponentService} from "../shared/IComponentService.sol";
|
|
26
29
|
import {IDistributionService} from "../distribution/IDistributionService.sol";
|
27
30
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
28
31
|
import {InstanceStore} from "../instance/InstanceStore.sol";
|
32
|
+
import {IPolicyHolder} from "../shared/IPolicyHolder.sol";
|
29
33
|
import {IPolicyService} from "./IPolicyService.sol";
|
30
34
|
import {IPoolService} from "../pool/IPoolService.sol";
|
31
35
|
import {IPricingService} from "./IPricingService.sol";
|
@@ -45,8 +49,6 @@ contract PolicyService is
|
|
45
49
|
IPoolService internal _poolService;
|
46
50
|
IPricingService internal _pricingService;
|
47
51
|
|
48
|
-
event LogProductServiceSender(address sender);
|
49
|
-
|
50
52
|
function _initialize(
|
51
53
|
address owner,
|
52
54
|
bytes memory data
|
@@ -56,12 +58,11 @@ contract PolicyService is
|
|
56
58
|
initializer
|
57
59
|
{
|
58
60
|
(
|
59
|
-
address registryAddress
|
60
|
-
//address managerAddress
|
61
|
+
address registryAddress,
|
61
62
|
address authority
|
62
|
-
) = abi.decode(data, (address, address
|
63
|
+
) = abi.decode(data, (address, address));
|
63
64
|
|
64
|
-
|
65
|
+
_initializeService(registryAddress, authority, owner);
|
65
66
|
|
66
67
|
VersionPart majorVersion = getVersion().toMajorPart();
|
67
68
|
_applicationService = IApplicationService(getRegistry().getServiceAddress(APPLICATION(), majorVersion));
|
@@ -72,22 +73,16 @@ contract PolicyService is
|
|
72
73
|
_distributionService = IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), majorVersion));
|
73
74
|
_pricingService = IPricingService(getRegistry().getServiceAddress(PRICE(), majorVersion));
|
74
75
|
|
75
|
-
|
76
|
+
_registerInterface(type(IPolicyService).interfaceId);
|
76
77
|
}
|
77
78
|
|
78
79
|
|
79
|
-
function _getAndVerifyInstanceAndProduct() internal view returns (Product product) {
|
80
|
-
IRegistry.ObjectInfo memory productInfo;
|
81
|
-
(, productInfo,) = _getAndVerifyActiveComponent(PRODUCT());
|
82
|
-
product = Product(productInfo.objectAddress);
|
83
|
-
}
|
84
|
-
|
85
|
-
|
86
80
|
function decline(
|
87
81
|
NftId applicationNftId // = policyNftId
|
88
82
|
)
|
89
83
|
external
|
90
|
-
virtual
|
84
|
+
virtual
|
85
|
+
nonReentrant()
|
91
86
|
{
|
92
87
|
(NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
93
88
|
InstanceReader instanceReader = instance.getInstanceReader();
|
@@ -115,16 +110,15 @@ contract PolicyService is
|
|
115
110
|
emit LogPolicyServicePolicyDeclined(applicationNftId);
|
116
111
|
}
|
117
112
|
|
118
|
-
event LogDebug(uint idx, string message);
|
119
113
|
|
120
|
-
/// @
|
121
|
-
function
|
114
|
+
/// @inheritdoc IPolicyService
|
115
|
+
function createPolicy(
|
122
116
|
NftId applicationNftId, // = policyNftId
|
123
|
-
bool requirePremiumPayment,
|
124
117
|
Timestamp activateAt
|
125
118
|
)
|
126
119
|
external
|
127
|
-
virtual
|
120
|
+
virtual
|
121
|
+
nonReentrant()
|
128
122
|
{
|
129
123
|
// check caller is registered product
|
130
124
|
(NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
@@ -144,13 +138,8 @@ contract PolicyService is
|
|
144
138
|
productNftId);
|
145
139
|
}
|
146
140
|
|
147
|
-
StateId newPolicyState = COLLATERALIZED();
|
148
|
-
|
149
141
|
// actual collateralizaion
|
150
|
-
(
|
151
|
-
Amount localCollateralAmount,
|
152
|
-
Amount totalCollateralAmount
|
153
|
-
) = _poolService.lockCollateral(
|
142
|
+
_poolService.lockCollateral(
|
154
143
|
instance,
|
155
144
|
address(instanceReader.getComponentInfo(productNftId).token),
|
156
145
|
productNftId,
|
@@ -160,39 +149,61 @@ contract PolicyService is
|
|
160
149
|
|
161
150
|
// optional activation of policy
|
162
151
|
if(activateAt > zeroTimestamp()) {
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
// optional collection of premium
|
169
|
-
if(requirePremiumPayment) {
|
170
|
-
Amount premiumPaidAmount = _calculateAndCollectPremium(
|
171
|
-
instance,
|
172
|
-
applicationNftId,
|
173
|
-
applicationInfo);
|
174
|
-
|
175
|
-
applicationInfo.premiumPaidAmount = premiumPaidAmount;
|
152
|
+
applicationInfo = _activate(
|
153
|
+
applicationNftId,
|
154
|
+
applicationInfo,
|
155
|
+
activateAt);
|
176
156
|
}
|
177
157
|
|
178
|
-
//
|
158
|
+
// update policy and set state to collateralized
|
179
159
|
instance.getInstanceStore().updatePolicy(
|
180
160
|
applicationNftId,
|
181
161
|
applicationInfo,
|
182
|
-
|
162
|
+
COLLATERALIZED());
|
163
|
+
|
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);
|
173
|
+
|
174
|
+
instance.getInstanceStore().createPremium(
|
175
|
+
applicationNftId,
|
176
|
+
premium);
|
177
|
+
|
178
|
+
// update referral counter
|
179
|
+
{
|
180
|
+
IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
|
181
|
+
|
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
|
+
}
|
188
|
+
|
189
|
+
// log policy creation before interactions with token and policy holder
|
190
|
+
emit LogPolicyServicePolicyCreated(applicationNftId, premium.premiumAmount, activateAt);
|
183
191
|
|
184
192
|
// TODO add calling pool contract if it needs to validate application
|
185
193
|
|
186
|
-
//
|
194
|
+
// callback to policy holder if applicable
|
195
|
+
_policyHolderPolicyActivated(applicationNftId, activateAt);
|
187
196
|
}
|
188
197
|
|
189
198
|
|
199
|
+
/// @inheritdoc IPolicyService
|
190
200
|
function collectPremium(
|
191
201
|
NftId policyNftId,
|
192
202
|
Timestamp activateAt
|
193
203
|
)
|
194
204
|
external
|
195
205
|
virtual
|
206
|
+
nonReentrant()
|
196
207
|
{
|
197
208
|
// check caller is registered product
|
198
209
|
(,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
@@ -200,70 +211,75 @@ contract PolicyService is
|
|
200
211
|
StateId stateId = instanceReader.getPolicyState(policyNftId);
|
201
212
|
|
202
213
|
// check policy is in state collateralized or active
|
203
|
-
if (!(stateId == COLLATERALIZED()
|
204
|
-
revert
|
214
|
+
if (!(stateId == COLLATERALIZED())) {
|
215
|
+
revert ErrorPolicyServicePolicyStateNotCollateralized(policyNftId);
|
205
216
|
}
|
206
217
|
|
207
|
-
IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
208
|
-
|
209
218
|
// check if premium is already collected
|
210
|
-
if (
|
211
|
-
revert ErrorPolicyServicePremiumAlreadyPaid(policyNftId
|
219
|
+
if (instanceReader.getPremiumInfoState(policyNftId) == PAID()) {
|
220
|
+
revert ErrorPolicyServicePremiumAlreadyPaid(policyNftId);
|
212
221
|
}
|
213
222
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
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);
|
231
|
+
|
232
|
+
// optionally activate policy
|
233
|
+
if(activateAt.gtz()) {
|
234
|
+
policyInfo = _activate(policyNftId, policyInfo, activateAt);
|
235
|
+
}
|
218
236
|
|
219
237
|
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, KEEP_STATE());
|
238
|
+
instance.getInstanceStore().updatePremiumState(policyNftId, PAID());
|
220
239
|
|
221
|
-
|
222
|
-
|
223
|
-
}
|
240
|
+
// log premium collection before interactions with token
|
241
|
+
emit LogPolicyServicePolicyPremiumCollected(policyNftId, premium.premiumAmount);
|
224
242
|
|
225
|
-
|
243
|
+
_transferFunds(instanceReader, policyNftId, policyInfo.productNftId, premium);
|
226
244
|
}
|
227
245
|
|
228
|
-
|
246
|
+
/// @inheritdoc IPolicyService
|
247
|
+
function activate(NftId policyNftId, Timestamp activateAt)
|
248
|
+
external
|
249
|
+
virtual
|
250
|
+
nonReentrant()
|
251
|
+
{
|
229
252
|
// check caller is registered product
|
230
253
|
(,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
231
254
|
InstanceReader instanceReader = instance.getInstanceReader();
|
232
255
|
|
233
256
|
IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
257
|
+
policyInfo = _activate(policyNftId, policyInfo, activateAt);
|
234
258
|
|
235
|
-
|
236
|
-
policyInfo.activatedAt.eqz(),
|
237
|
-
"ERROR:PRS-020:ALREADY_ACTIVATED");
|
238
|
-
|
239
|
-
policyInfo.activatedAt = activateAt;
|
240
|
-
policyInfo.expiredAt = activateAt.addSeconds(policyInfo.lifetime);
|
259
|
+
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, KEEP_STATE());
|
241
260
|
|
242
|
-
|
261
|
+
// log policy activation before interactions with policy holder
|
262
|
+
emit LogPolicyServicePolicyActivated(policyNftId, activateAt);
|
243
263
|
|
244
|
-
//
|
264
|
+
// callback to policy holder if applicable
|
265
|
+
_policyHolderPolicyActivated(policyNftId, activateAt);
|
245
266
|
}
|
246
267
|
|
268
|
+
|
247
269
|
/// @inheritdoc IPolicyService
|
248
270
|
function expire(
|
249
271
|
NftId policyNftId,
|
250
272
|
Timestamp expireAt
|
251
273
|
)
|
252
274
|
external
|
253
|
-
override
|
254
275
|
virtual
|
255
|
-
|
276
|
+
nonReentrant()
|
277
|
+
returns (Timestamp expiredAt)
|
256
278
|
{
|
257
279
|
(NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
258
|
-
|
259
|
-
|
260
|
-
// check policy is in state applied
|
261
|
-
if (instanceReader.getPolicyState(policyNftId) != ACTIVE()) {
|
262
|
-
revert ErrorIPolicyServicePolicyNotActive(policyNftId, instanceReader.getPolicyState(policyNftId));
|
263
|
-
}
|
264
|
-
|
280
|
+
|
265
281
|
// check policy matches with calling product
|
266
|
-
IPolicy.PolicyInfo memory policyInfo =
|
282
|
+
IPolicy.PolicyInfo memory policyInfo = instance.getInstanceReader().getPolicyInfo(policyNftId);
|
267
283
|
if(policyInfo.productNftId != productNftId) {
|
268
284
|
revert ErrorPolicyServicePolicyProductMismatch(
|
269
285
|
policyNftId,
|
@@ -271,195 +287,200 @@ contract PolicyService is
|
|
271
287
|
productNftId);
|
272
288
|
}
|
273
289
|
|
274
|
-
|
275
|
-
|
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
|
+
|
325
|
+
// check policy is active
|
326
|
+
StateId policyState = instanceReader.getPolicyState(policyNftId);
|
327
|
+
IPolicy.PolicyInfo memory policyInfo = instance.getInstanceReader().getPolicyInfo(policyNftId);
|
328
|
+
if (!_policyHasBeenActivated(policyState, policyInfo)) {
|
329
|
+
revert ErrorPolicyServicePolicyNotActive(policyNftId, policyState);
|
276
330
|
}
|
277
331
|
|
278
|
-
//
|
279
|
-
|
280
|
-
|
332
|
+
// set return value to provided timestamp
|
333
|
+
expiredAt = expireAt;
|
334
|
+
|
335
|
+
// update expiredAt to current block timestamp if not set
|
336
|
+
if (expiredAt.eqz()) {
|
337
|
+
expiredAt = TimestampLib.blockTimestamp();
|
281
338
|
}
|
282
|
-
|
283
|
-
|
339
|
+
|
340
|
+
// check expiredAt represents a valid expiry time
|
341
|
+
if (expiredAt >= policyInfo.expiredAt) {
|
342
|
+
revert ErrorPolicyServicePolicyExpirationTooLate(policyNftId, policyInfo.expiredAt, expireAt);
|
284
343
|
}
|
285
|
-
if (
|
286
|
-
revert
|
344
|
+
if (expiredAt < TimestampLib.blockTimestamp()) {
|
345
|
+
revert ErrorPolicyServicePolicyExpirationTooEarly(policyNftId, TimestampLib.blockTimestamp(), expireAt);
|
287
346
|
}
|
288
347
|
|
289
|
-
policyInfo
|
348
|
+
// update policyInfo with new expiredAt timestamp
|
349
|
+
Timestamp originalExpiredAt = policyInfo.expiredAt;
|
350
|
+
policyInfo.expiredAt = expiredAt;
|
290
351
|
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, KEEP_STATE());
|
291
352
|
|
292
|
-
emit LogPolicyServicePolicyExpirationUpdated(policyNftId,
|
353
|
+
emit LogPolicyServicePolicyExpirationUpdated(policyNftId, originalExpiredAt, expiredAt);
|
293
354
|
|
294
|
-
|
355
|
+
// callback to policy holder if applicable
|
356
|
+
_policyHolderPolicyExpired(policyNftId, expiredAt);
|
295
357
|
}
|
296
358
|
|
359
|
+
|
297
360
|
function close(
|
298
361
|
NftId policyNftId
|
299
362
|
)
|
300
363
|
external
|
301
|
-
|
364
|
+
virtual
|
365
|
+
nonReentrant()
|
302
366
|
{
|
303
367
|
(,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
304
368
|
InstanceReader instanceReader = instance.getInstanceReader();
|
305
369
|
|
370
|
+
// check that policy has been activated
|
306
371
|
IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
307
|
-
|
308
|
-
if (policyInfo
|
309
|
-
revert
|
310
|
-
}
|
311
|
-
|
312
|
-
StateId state = instanceReader.getPolicyState(policyNftId);
|
313
|
-
if (state != ACTIVE()) {
|
314
|
-
revert ErrorIPolicyServicePolicyNotActive(policyNftId, state);
|
372
|
+
StateId policyState = instanceReader.getPolicyState(policyNftId);
|
373
|
+
if (!_policyHasBeenActivated(policyState, policyInfo)) {
|
374
|
+
revert ErrorPolicyServicePolicyNotActive(policyNftId, policyState);
|
315
375
|
}
|
316
376
|
|
377
|
+
// check that policy has not already been closed
|
317
378
|
if (policyInfo.closedAt.gtz()) {
|
318
|
-
revert
|
319
|
-
}
|
320
|
-
|
321
|
-
// TODO consider to allow for underpaid premiums (with the effects of reducing max payouts accordingly)
|
322
|
-
if (!(policyInfo.premiumAmount == policyInfo.premiumPaidAmount)) {
|
323
|
-
revert ErrorPolicyServicePremiumNotFullyPaid(policyNftId, policyInfo.premiumAmount, policyInfo.premiumPaidAmount);
|
379
|
+
revert ErrorPolicyServicePolicyAlreadyClosed(policyNftId);
|
324
380
|
}
|
325
381
|
|
382
|
+
// check that policy does not have any open claims
|
326
383
|
if (policyInfo.openClaimsCount > 0) {
|
327
|
-
revert
|
384
|
+
revert ErrorPolicyServiceOpenClaims(policyNftId, policyInfo.openClaimsCount);
|
328
385
|
}
|
329
386
|
|
330
|
-
|
387
|
+
// TODO consider to allow for underpaid premiums (with the effects of reducing max payouts accordingly)
|
388
|
+
// TODO consider to remove requirement for fully paid premiums altogether
|
389
|
+
if (! instanceReader.getPremiumInfoState(policyNftId).eq(PAID())) {
|
390
|
+
revert ErrorPolicyServicePremiumNotPaid(policyNftId, policyInfo.premiumAmount);
|
391
|
+
}
|
331
392
|
|
393
|
+
// release (remaining) collateral that was blocked by policy
|
332
394
|
_poolService.releaseCollateral(
|
333
395
|
instance,
|
334
396
|
address(instanceReader.getComponentInfo(policyInfo.productNftId).token),
|
335
397
|
policyNftId,
|
336
398
|
policyInfo);
|
337
399
|
|
400
|
+
// TODO consider to also set expiredAt to current block timestamp if that timestamp is still in the futue
|
401
|
+
|
402
|
+
// update policy state to closed
|
403
|
+
policyInfo.closedAt = TimestampLib.blockTimestamp();
|
338
404
|
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, CLOSED());
|
405
|
+
|
406
|
+
emit LogPolicyServicePolicyClosed(policyNftId);
|
339
407
|
}
|
340
408
|
|
341
409
|
|
342
|
-
|
410
|
+
/// @dev calculates the premium and updates all counters in the other services
|
411
|
+
function _processPremium(
|
343
412
|
IInstance instance,
|
344
413
|
NftId applicationNftId,
|
345
|
-
IPolicy.PolicyInfo memory applicationInfo
|
414
|
+
IPolicy.PolicyInfo memory applicationInfo,
|
415
|
+
IPolicy.PremiumInfo memory premium
|
346
416
|
)
|
347
417
|
internal
|
348
418
|
virtual
|
349
|
-
returns (
|
350
|
-
Amount premiumPaidAmount
|
351
|
-
)
|
352
419
|
{
|
353
420
|
NftId productNftId = applicationInfo.productNftId;
|
354
|
-
|
355
|
-
// calculate premium details
|
356
|
-
IPolicy.Premium memory premium = _pricingService.calculatePremium(
|
357
|
-
productNftId,
|
358
|
-
applicationInfo.riskId,
|
359
|
-
applicationInfo.sumInsuredAmount,
|
360
|
-
applicationInfo.lifetime,
|
361
|
-
applicationInfo.applicationData,
|
362
|
-
applicationInfo.bundleNftId,
|
363
|
-
applicationInfo.referralId);
|
364
|
-
|
365
|
-
|
366
|
-
// update financials and transfer premium tokens
|
367
|
-
premiumPaidAmount = _processAndCollect(
|
368
|
-
instance,
|
369
|
-
productNftId,
|
370
|
-
applicationNftId,
|
371
|
-
applicationInfo.premiumAmount,
|
372
|
-
applicationInfo.bundleNftId,
|
373
|
-
applicationInfo.referralId,
|
374
|
-
premium);
|
375
|
-
}
|
376
|
-
|
377
|
-
|
378
|
-
function _processAndCollect(
|
379
|
-
IInstance instance,
|
380
|
-
NftId productNftId,
|
381
|
-
NftId policyNftId,
|
382
|
-
Amount premiumExpectedAmount,
|
383
|
-
NftId bundleNftId,
|
384
|
-
ReferralId referralId,
|
385
|
-
IPolicy.Premium memory premium
|
386
|
-
)
|
387
|
-
internal
|
388
|
-
virtual
|
389
|
-
returns (Amount premiumPaidAmount)
|
390
|
-
{
|
391
421
|
InstanceReader instanceReader = instance.getInstanceReader();
|
392
|
-
TokenHandler tokenHandler = instanceReader.getComponentInfo(productNftId).tokenHandler;
|
393
|
-
address policyHolder = getRegistry().ownerOf(policyNftId);
|
394
|
-
premiumPaidAmount = AmountLib.toAmount(premium.premiumAmount);
|
395
422
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
423
|
+
// check if premium balance and allowance of policy holder is sufficient
|
424
|
+
{
|
425
|
+
TokenHandler tokenHandler = _getTokenHandler(instanceReader, productNftId);
|
426
|
+
address policyHolder = getRegistry().ownerOf(applicationNftId);
|
427
|
+
|
428
|
+
_checkPremiumBalanceAndAllowance(
|
429
|
+
tokenHandler.getToken(),
|
430
|
+
address(tokenHandler),
|
431
|
+
policyHolder,
|
432
|
+
premium.premiumAmount);
|
433
|
+
}
|
401
434
|
|
402
|
-
|
435
|
+
// update the counters
|
436
|
+
_processSale(
|
403
437
|
instanceReader,
|
404
438
|
instance.getInstanceStore(),
|
405
|
-
tokenHandler,
|
406
|
-
policyHolder,
|
407
439
|
productNftId,
|
408
|
-
bundleNftId,
|
409
|
-
referralId,
|
440
|
+
applicationInfo.bundleNftId,
|
441
|
+
applicationInfo.referralId,
|
410
442
|
premium);
|
411
443
|
}
|
412
444
|
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
Amount premiumExpectedAmount,
|
418
|
-
Amount premiumPaidAmount
|
445
|
+
function _activate(
|
446
|
+
NftId policyNftId,
|
447
|
+
IPolicy.PolicyInfo memory policyInfo,
|
448
|
+
Timestamp activateAt
|
419
449
|
)
|
420
450
|
internal
|
421
451
|
virtual
|
422
|
-
view
|
452
|
+
view
|
453
|
+
returns (IPolicy.PolicyInfo memory)
|
423
454
|
{
|
424
|
-
//
|
425
|
-
|
426
|
-
|
427
|
-
revert ErrorPolicyServicePremiumHigherThanExpected(premiumExpectedAmount, premiumPaidAmount);
|
455
|
+
// fail if policy has already been activated and activateAt is different
|
456
|
+
if(! policyInfo.activatedAt.eqz() && activateAt != policyInfo.activatedAt) {
|
457
|
+
revert ErrorPolicyServicePolicyAlreadyActivated(policyNftId);
|
428
458
|
}
|
429
459
|
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
if (balance < premiumAmount) {
|
435
|
-
revert ErrorPolicyServiceBalanceInsufficient(policyHolder, premiumAmount, balance);
|
460
|
+
// ignore if policy has already been activated and activateAt is the same
|
461
|
+
if (policyInfo.activatedAt == activateAt) {
|
462
|
+
return policyInfo;
|
436
463
|
}
|
437
464
|
|
438
|
-
|
439
|
-
|
440
|
-
}
|
441
|
-
}
|
465
|
+
policyInfo.activatedAt = activateAt;
|
466
|
+
policyInfo.expiredAt = activateAt.addSeconds(policyInfo.lifetime);
|
442
467
|
|
468
|
+
return policyInfo;
|
469
|
+
}
|
443
470
|
|
444
|
-
|
471
|
+
/// @dev update counters by calling the involved services
|
472
|
+
function _processSale(
|
445
473
|
InstanceReader instanceReader,
|
446
474
|
InstanceStore instanceStore,
|
447
|
-
TokenHandler tokenHandler,
|
448
|
-
address policyHolder,
|
449
475
|
NftId productNftId,
|
450
476
|
NftId bundleNftId,
|
451
477
|
ReferralId referralId,
|
452
|
-
IPolicy.
|
478
|
+
IPolicy.PremiumInfo memory premium
|
453
479
|
)
|
454
480
|
internal
|
455
481
|
virtual
|
456
482
|
{
|
457
|
-
(
|
458
|
-
NftId distributionNftId,
|
459
|
-
address distributionWallet,
|
460
|
-
address poolWallet,
|
461
|
-
address productWallet
|
462
|
-
) = _getDistributionNftAndWallets(
|
483
|
+
(NftId distributionNftId, , , ) = _getDistributionNftAndWallets(
|
463
484
|
instanceReader,
|
464
485
|
productNftId);
|
465
486
|
|
@@ -467,28 +488,156 @@ contract PolicyService is
|
|
467
488
|
_componentService.increaseProductFees(
|
468
489
|
instanceStore,
|
469
490
|
productNftId,
|
470
|
-
|
491
|
+
premium.productFeeVarAmount + premium.productFeeFixAmount);
|
471
492
|
|
472
493
|
// update distribution fees and distributor commission and pool fees
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
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
|
+
}
|
477
500
|
|
478
501
|
// update pool and bundle fees
|
479
502
|
_poolService.processSale(
|
480
503
|
bundleNftId,
|
481
504
|
premium);
|
505
|
+
}
|
506
|
+
|
507
|
+
|
508
|
+
/// @dev transfer the premium to the wallets the premium is distributed to
|
509
|
+
function _transferFunds(
|
510
|
+
InstanceReader instanceReader,
|
511
|
+
NftId policyNftId,
|
512
|
+
NftId productNftId,
|
513
|
+
IPolicy.PremiumInfo memory premium
|
514
|
+
)
|
515
|
+
internal
|
516
|
+
virtual
|
517
|
+
{
|
518
|
+
TokenHandler tokenHandler = _getTokenHandler(instanceReader, productNftId);
|
519
|
+
address policyHolder = getRegistry().ownerOf(policyNftId);
|
520
|
+
|
521
|
+
(
|
522
|
+
,
|
523
|
+
address distributionWallet,
|
524
|
+
address poolWallet,
|
525
|
+
address productWallet
|
526
|
+
) = _getDistributionNftAndWallets(
|
527
|
+
instanceReader,
|
528
|
+
productNftId);
|
529
|
+
|
530
|
+
tokenHandler.collectTokensToThreeRecipients(
|
531
|
+
policyHolder,
|
532
|
+
productWallet,
|
533
|
+
premium.productFeeAmount,
|
534
|
+
distributionWallet,
|
535
|
+
premium.distributionFeeAndCommissionAmount,
|
536
|
+
poolWallet,
|
537
|
+
premium.poolPremiumAndFeeAmount);
|
538
|
+
}
|
539
|
+
|
482
540
|
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
541
|
+
/// @dev checks that policy has been collateralized and has been activated.
|
542
|
+
/// does not check if policy has been expired or closed.
|
543
|
+
function _policyHasBeenActivated(
|
544
|
+
StateId policyState,
|
545
|
+
IPolicy.PolicyInfo memory policyInfo
|
546
|
+
)
|
547
|
+
internal
|
548
|
+
view
|
549
|
+
returns (bool)
|
550
|
+
{
|
551
|
+
if (policyState != COLLATERALIZED()) { return false; }
|
552
|
+
if (TimestampLib.blockTimestamp() < policyInfo.activatedAt) { return false; }
|
553
|
+
return true;
|
554
|
+
}
|
555
|
+
|
556
|
+
|
557
|
+
/// @dev checks the balance and allowance of the policy holder
|
558
|
+
function _checkPremiumBalanceAndAllowance(
|
559
|
+
IERC20Metadata token,
|
560
|
+
address tokenHandlerAddress,
|
561
|
+
address policyHolder,
|
562
|
+
Amount premiumAmount
|
563
|
+
)
|
564
|
+
internal
|
565
|
+
virtual
|
566
|
+
view
|
567
|
+
{
|
568
|
+
uint256 premium = premiumAmount.toInt();
|
569
|
+
uint256 balance = token.balanceOf(policyHolder);
|
570
|
+
uint256 allowance = token.allowance(policyHolder, tokenHandlerAddress);
|
571
|
+
|
572
|
+
if (balance < premium) {
|
573
|
+
revert ErrorPolicyServiceBalanceInsufficient(policyHolder, premium, balance);
|
574
|
+
}
|
575
|
+
|
576
|
+
if (allowance < premium) {
|
577
|
+
revert ErrorPolicyServiceAllowanceInsufficient(policyHolder, tokenHandlerAddress, premium, allowance);
|
578
|
+
}
|
488
579
|
}
|
489
580
|
|
490
581
|
|
491
|
-
function
|
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
|
+
|
640
|
+
function _getTokenHandler(
|
492
641
|
InstanceReader instanceReader,
|
493
642
|
NftId productNftId
|
494
643
|
)
|
@@ -502,6 +651,7 @@ contract PolicyService is
|
|
502
651
|
tokenHandler = instanceReader.getComponentInfo(productNftId).tokenHandler;
|
503
652
|
}
|
504
653
|
|
654
|
+
|
505
655
|
function _getDistributionNftAndWallets(
|
506
656
|
InstanceReader instanceReader,
|
507
657
|
NftId productNftId
|
@@ -523,6 +673,13 @@ contract PolicyService is
|
|
523
673
|
}
|
524
674
|
|
525
675
|
|
676
|
+
function _getAndVerifyInstanceAndProduct() internal view returns (Product product) {
|
677
|
+
IRegistry.ObjectInfo memory productInfo;
|
678
|
+
(, productInfo,) = _getAndVerifyActiveComponent(PRODUCT());
|
679
|
+
product = Product(productInfo.objectAddress);
|
680
|
+
}
|
681
|
+
|
682
|
+
|
526
683
|
function _getDomain() internal pure override returns(ObjectType) {
|
527
684
|
return POLICY();
|
528
685
|
}
|