@etherisc/gif-next 0.0.2-b9366f5-670 → 0.0.2-b98b2b0-875
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- 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 +51 -177
- 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 +21 -147
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +85 -192
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +84 -104
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +21 -0
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- 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 +1512 -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 +1999 -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 +1432 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1192 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1566 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2001 -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/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +10 -99
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +95 -98
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +2 -2
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +260 -67
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +39 -146
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +61 -81
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +71 -51
- 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 +41 -167
- 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 +21 -0
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +21 -147
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +37 -144
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +60 -80
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +46 -144
- 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 +138 -181
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +102 -102
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +24 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +49 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +171 -102
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +46 -144
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +276 -245
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +95 -83
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +31 -138
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +57 -77
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +46 -170
- 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 +154 -194
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +101 -101
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +35 -8
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +111 -0
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +49 -26
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +212 -160
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +92 -88
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +55 -162
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +68 -88
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +46 -170
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +25 -132
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +54 -74
- 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 +239 -20
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +437 -81
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +244 -132
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +23 -313
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +52 -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 +21 -147
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +75 -182
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +89 -99
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +5 -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 +21 -0
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +21 -0
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +15 -47
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/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 +21 -147
- 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 +6 -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 +8 -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 +5 -112
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +21 -0
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +2 -2
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +65 -191
- 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 +70 -85
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +7 -12
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +31 -138
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +56 -76
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2 -2
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +2 -2
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/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/Selector.sol/SelectorLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/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 +39 -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 -1
- package/contracts/authorization/IAccessAdmin.sol +0 -1
- package/contracts/distribution/Distribution.sol +1 -1
- package/contracts/distribution/DistributionService.sol +9 -9
- package/contracts/distribution/DistributionServiceManager.sol +6 -6
- 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 +413 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
- package/contracts/examples/fire/FireUSD.sol +26 -0
- package/contracts/instance/Instance.sol +2 -2
- package/contracts/instance/InstanceAdmin.sol +6 -3
- package/contracts/instance/InstanceReader.sol +83 -18
- package/contracts/instance/InstanceService.sol +6 -8
- package/contracts/instance/InstanceServiceManager.sol +6 -7
- package/contracts/instance/module/IComponents.sol +3 -1
- package/contracts/instance/module/IPolicy.sol +2 -2
- package/contracts/oracle/Oracle.sol +1 -1
- package/contracts/oracle/OracleService.sol +10 -8
- package/contracts/oracle/OracleServiceManager.sol +6 -6
- package/contracts/pool/BundleService.sol +32 -9
- package/contracts/pool/BundleServiceManager.sol +6 -6
- package/contracts/pool/IBundleService.sol +9 -0
- package/contracts/pool/IPoolComponent.sol +18 -8
- package/contracts/pool/IPoolService.sol +21 -10
- package/contracts/pool/Pool.sol +38 -11
- package/contracts/pool/PoolService.sol +81 -27
- package/contracts/pool/PoolServiceManager.sol +4 -4
- package/contracts/product/ApplicationService.sol +11 -8
- package/contracts/product/ApplicationServiceManager.sol +4 -4
- package/contracts/product/ClaimService.sol +164 -70
- package/contracts/product/ClaimServiceManager.sol +4 -4
- package/contracts/product/IClaimService.sol +3 -2
- package/contracts/product/IPolicyService.sol +10 -3
- package/contracts/product/IProductComponent.sol +17 -3
- package/contracts/product/PolicyService.sol +145 -32
- package/contracts/product/PolicyServiceManager.sol +4 -4
- package/contracts/product/PricingService.sol +4 -5
- package/contracts/product/PricingServiceManager.sol +3 -3
- package/contracts/product/Product.sol +26 -19
- package/contracts/product/RiskService.sol +4 -5
- package/contracts/product/RiskServiceManager.sol +4 -4
- package/contracts/registry/ChainNft.sol +65 -32
- package/contracts/registry/IRegistry.sol +50 -14
- package/contracts/registry/IRegistryService.sol +0 -9
- package/contracts/registry/Registry.sol +327 -196
- package/contracts/registry/RegistryAdmin.sol +140 -50
- package/contracts/registry/RegistryService.sol +55 -48
- package/contracts/registry/RegistryServiceManager.sol +2 -2
- package/contracts/registry/ReleaseRegistry.sol +11 -5
- package/contracts/registry/ServiceAuthorizationV3.sol +4 -5
- package/contracts/shared/Component.sol +13 -5
- package/contracts/shared/ComponentService.sol +6 -6
- package/contracts/shared/ComponentServiceManager.sol +8 -5
- package/contracts/shared/ComponentVerifyingService.sol +1 -2
- package/contracts/shared/ContractLib.sol +38 -0
- package/contracts/shared/IComponent.sol +3 -0
- package/contracts/shared/IPolicyHolder.sol +12 -22
- package/contracts/shared/InitializableERC165.sol +2 -2
- package/contracts/shared/InstanceLinkedComponent.sol +4 -5
- package/contracts/shared/NftOwnable.sol +4 -4
- 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/staking/Staking.sol +3 -3
- package/contracts/staking/StakingManager.sol +8 -6
- package/contracts/staking/StakingReader.sol +12 -5
- package/contracts/staking/StakingService.sol +2 -2
- package/contracts/staking/StakingServiceManager.sol +2 -2
- 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 +1 -0
- package/contracts/type/PayoutId.sol +10 -10
- package/contracts/type/RiskId.sol +15 -1
- package/contracts/type/UFixed.sol +4 -0
- package/contracts/upgradeability/ProxyManager.sol +67 -34
- package/contracts/upgradeability/Versionable.sol +2 -2
- package/package.json +1 -1
- package/artifacts/contracts/example_components/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +0 -4
- package/artifacts/contracts/example_components/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +0 -1558
- package/artifacts/contracts/example_components/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +0 -4
- package/artifacts/contracts/example_components/unpermissioned/SimpleOracle.sol/SimpleOracle.json +0 -1318
- package/artifacts/contracts/example_components/unpermissioned/SimplePool.sol/SimplePool.dbg.json +0 -4
- package/artifacts/contracts/example_components/unpermissioned/SimplePool.sol/SimplePool.json +0 -1664
- package/artifacts/contracts/example_components/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +0 -4
- package/artifacts/contracts/example_components/unpermissioned/SimpleProduct.sol/SimpleProduct.json +0 -2125
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
- package/contracts/shared/InitializableCustom.sol +0 -177
- /package/contracts/{example_components → examples}/unpermissioned/SimpleDistribution.sol +0 -0
- /package/contracts/{example_components → examples}/unpermissioned/SimpleOracle.sol +0 -0
- /package/contracts/{example_components → examples}/unpermissioned/SimplePool.sol +0 -0
- /package/contracts/{example_components → examples}/unpermissioned/SimpleProduct.sol +0 -0
@@ -21,6 +21,7 @@ import {StateId} from "../type/StateId.sol";
|
|
21
21
|
import {VersionPart} from "../type/Version.sol";
|
22
22
|
|
23
23
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
24
|
+
import {ContractLib} from "../shared/ContractLib.sol";
|
24
25
|
import {IApplicationService} from "./IApplicationService.sol";
|
25
26
|
import {IBundleService} from "../pool/IBundleService.sol";
|
26
27
|
import {IClaimService} from "./IClaimService.sol";
|
@@ -28,6 +29,7 @@ import {IComponentService} from "../shared/IComponentService.sol";
|
|
28
29
|
import {IDistributionService} from "../distribution/IDistributionService.sol";
|
29
30
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
30
31
|
import {InstanceStore} from "../instance/InstanceStore.sol";
|
32
|
+
import {IPolicyHolder} from "../shared/IPolicyHolder.sol";
|
31
33
|
import {IPolicyService} from "./IPolicyService.sol";
|
32
34
|
import {IPoolService} from "../pool/IPoolService.sol";
|
33
35
|
import {IPricingService} from "./IPricingService.sol";
|
@@ -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,7 +73,7 @@ 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
|
|
@@ -80,7 +81,8 @@ contract PolicyService is
|
|
80
81
|
NftId applicationNftId // = policyNftId
|
81
82
|
)
|
82
83
|
external
|
83
|
-
virtual
|
84
|
+
virtual
|
85
|
+
nonReentrant()
|
84
86
|
{
|
85
87
|
(NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
86
88
|
InstanceReader instanceReader = instance.getInstanceReader();
|
@@ -115,7 +117,8 @@ contract PolicyService is
|
|
115
117
|
Timestamp activateAt
|
116
118
|
)
|
117
119
|
external
|
118
|
-
virtual
|
120
|
+
virtual
|
121
|
+
nonReentrant()
|
119
122
|
{
|
120
123
|
// check caller is registered product
|
121
124
|
(NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
@@ -175,16 +178,21 @@ contract PolicyService is
|
|
175
178
|
// update referral counter
|
176
179
|
{
|
177
180
|
IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
|
178
|
-
|
179
|
-
|
180
|
-
|
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
|
+
}
|
181
187
|
}
|
182
|
-
|
183
|
-
// TODO add calling pool contract if it needs to validate application
|
184
188
|
|
185
|
-
//
|
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
|
186
193
|
|
187
|
-
//
|
194
|
+
// callback to policy holder if applicable
|
195
|
+
_policyHolderPolicyActivated(applicationNftId, activateAt);
|
188
196
|
}
|
189
197
|
|
190
198
|
|
@@ -195,6 +203,7 @@ contract PolicyService is
|
|
195
203
|
)
|
196
204
|
external
|
197
205
|
virtual
|
206
|
+
nonReentrant()
|
198
207
|
{
|
199
208
|
// check caller is registered product
|
200
209
|
(,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
@@ -228,15 +237,18 @@ contract PolicyService is
|
|
228
237
|
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, KEEP_STATE());
|
229
238
|
instance.getInstanceStore().updatePremiumState(policyNftId, PAID());
|
230
239
|
|
231
|
-
//
|
240
|
+
// log premium collection before interactions with token
|
241
|
+
emit LogPolicyServicePolicyPremiumCollected(policyNftId, premium.premiumAmount);
|
232
242
|
|
233
243
|
_transferFunds(instanceReader, policyNftId, policyInfo.productNftId, premium);
|
234
|
-
|
235
|
-
// TODO: add callback IPolicyHolder.policyActivated() if applicable
|
236
244
|
}
|
237
245
|
|
238
246
|
/// @inheritdoc IPolicyService
|
239
|
-
function activate(NftId policyNftId, Timestamp activateAt)
|
247
|
+
function activate(NftId policyNftId, Timestamp activateAt)
|
248
|
+
external
|
249
|
+
virtual
|
250
|
+
nonReentrant()
|
251
|
+
{
|
240
252
|
// check caller is registered product
|
241
253
|
(,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
242
254
|
InstanceReader instanceReader = instance.getInstanceReader();
|
@@ -246,9 +258,11 @@ contract PolicyService is
|
|
246
258
|
|
247
259
|
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, KEEP_STATE());
|
248
260
|
|
249
|
-
//
|
261
|
+
// log policy activation before interactions with policy holder
|
262
|
+
emit LogPolicyServicePolicyActivated(policyNftId, activateAt);
|
250
263
|
|
251
|
-
//
|
264
|
+
// callback to policy holder if applicable
|
265
|
+
_policyHolderPolicyActivated(policyNftId, activateAt);
|
252
266
|
}
|
253
267
|
|
254
268
|
|
@@ -258,15 +272,14 @@ contract PolicyService is
|
|
258
272
|
Timestamp expireAt
|
259
273
|
)
|
260
274
|
external
|
261
|
-
override
|
262
275
|
virtual
|
276
|
+
nonReentrant()
|
263
277
|
returns (Timestamp expiredAt)
|
264
278
|
{
|
265
279
|
(NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
266
|
-
|
267
|
-
|
280
|
+
|
268
281
|
// check policy matches with calling product
|
269
|
-
IPolicy.PolicyInfo memory policyInfo =
|
282
|
+
IPolicy.PolicyInfo memory policyInfo = instance.getInstanceReader().getPolicyInfo(policyNftId);
|
270
283
|
if(policyInfo.productNftId != productNftId) {
|
271
284
|
revert ErrorPolicyServicePolicyProductMismatch(
|
272
285
|
policyNftId,
|
@@ -274,8 +287,44 @@ contract PolicyService is
|
|
274
287
|
productNftId);
|
275
288
|
}
|
276
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
|
+
|
277
325
|
// check policy is active
|
278
326
|
StateId policyState = instanceReader.getPolicyState(policyNftId);
|
327
|
+
IPolicy.PolicyInfo memory policyInfo = instance.getInstanceReader().getPolicyInfo(policyNftId);
|
279
328
|
if (!_policyHasBeenActivated(policyState, policyInfo)) {
|
280
329
|
revert ErrorPolicyServicePolicyNotActive(policyNftId, policyState);
|
281
330
|
}
|
@@ -297,12 +346,14 @@ contract PolicyService is
|
|
297
346
|
}
|
298
347
|
|
299
348
|
// update policyInfo with new expiredAt timestamp
|
349
|
+
Timestamp originalExpiredAt = policyInfo.expiredAt;
|
300
350
|
policyInfo.expiredAt = expiredAt;
|
301
351
|
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, KEEP_STATE());
|
302
352
|
|
303
|
-
emit LogPolicyServicePolicyExpirationUpdated(policyNftId, expiredAt);
|
353
|
+
emit LogPolicyServicePolicyExpirationUpdated(policyNftId, originalExpiredAt, expiredAt);
|
304
354
|
|
305
|
-
//
|
355
|
+
// callback to policy holder if applicable
|
356
|
+
_policyHolderPolicyExpired(policyNftId, expiredAt);
|
306
357
|
}
|
307
358
|
|
308
359
|
|
@@ -310,7 +361,8 @@ contract PolicyService is
|
|
310
361
|
NftId policyNftId
|
311
362
|
)
|
312
363
|
external
|
313
|
-
|
364
|
+
virtual
|
365
|
+
nonReentrant()
|
314
366
|
{
|
315
367
|
(,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
316
368
|
InstanceReader instanceReader = instance.getInstanceReader();
|
@@ -351,7 +403,7 @@ contract PolicyService is
|
|
351
403
|
policyInfo.closedAt = TimestampLib.blockTimestamp();
|
352
404
|
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, CLOSED());
|
353
405
|
|
354
|
-
|
406
|
+
emit LogPolicyServicePolicyClosed(policyNftId);
|
355
407
|
}
|
356
408
|
|
357
409
|
|
@@ -439,10 +491,12 @@ contract PolicyService is
|
|
439
491
|
premium.productFeeVarAmount + premium.productFeeFixAmount);
|
440
492
|
|
441
493
|
// update distribution fees and distributor commission and pool fees
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
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
|
+
}
|
446
500
|
|
447
501
|
// update pool and bundle fees
|
448
502
|
_poolService.processSale(
|
@@ -525,6 +579,64 @@ contract PolicyService is
|
|
525
579
|
}
|
526
580
|
|
527
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
|
+
|
528
640
|
function _getTokenHandler(
|
529
641
|
InstanceReader instanceReader,
|
530
642
|
NftId productNftId
|
@@ -539,6 +651,7 @@ contract PolicyService is
|
|
539
651
|
tokenHandler = instanceReader.getComponentInfo(productNftId).tokenHandler;
|
540
652
|
}
|
541
653
|
|
654
|
+
|
542
655
|
function _getDistributionNftAndWallets(
|
543
656
|
InstanceReader instanceReader,
|
544
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);
|
@@ -45,13 +45,12 @@ contract PricingService is
|
|
45
45
|
initializer()
|
46
46
|
{
|
47
47
|
(
|
48
|
-
address registryAddress
|
49
|
-
//address managerAddress
|
48
|
+
address registryAddress,
|
50
49
|
address authority
|
51
|
-
) = abi.decode(data, (address, address
|
50
|
+
) = abi.decode(data, (address, address));
|
52
51
|
|
53
|
-
|
54
|
-
|
52
|
+
_initializeService(registryAddress, authority, owner);
|
53
|
+
_registerInterface(type(IPricingService).interfaceId);
|
55
54
|
|
56
55
|
_distributionService = IDistributionService(_getServiceAddress(DISTRIBUTION()));
|
57
56
|
}
|
@@ -15,11 +15,11 @@ contract PricingServiceManager is ProxyManager {
|
|
15
15
|
address registryAddress,
|
16
16
|
bytes32 salt
|
17
17
|
)
|
18
|
-
ProxyManager(registryAddress)
|
19
18
|
{
|
20
19
|
PricingService pricingSrv = new PricingService{salt: salt}();
|
21
|
-
bytes memory data = abi.encode(registryAddress,
|
22
|
-
IVersionable versionable =
|
20
|
+
bytes memory data = abi.encode(registryAddress, authority);
|
21
|
+
IVersionable versionable = initialize(
|
22
|
+
registryAddress,
|
23
23
|
address(pricingSrv),
|
24
24
|
data,
|
25
25
|
salt);
|
@@ -49,6 +49,29 @@ abstract contract Product is
|
|
49
49
|
}
|
50
50
|
|
51
51
|
|
52
|
+
function register()
|
53
|
+
external
|
54
|
+
virtual
|
55
|
+
onlyOwner()
|
56
|
+
{
|
57
|
+
_getProductStorage()._componentService.registerProduct();
|
58
|
+
_approveTokenHandler(type(uint256).max);
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
function processFundedClaim(
|
63
|
+
NftId policyNftId,
|
64
|
+
ClaimId claimId,
|
65
|
+
Amount availableAmount
|
66
|
+
)
|
67
|
+
external
|
68
|
+
virtual
|
69
|
+
restricted() // pool service role
|
70
|
+
{
|
71
|
+
// default implementation does nothing
|
72
|
+
}
|
73
|
+
|
74
|
+
|
52
75
|
function calculatePremium(
|
53
76
|
Amount sumInsuredAmount,
|
54
77
|
RiskId riskId,
|
@@ -91,16 +114,6 @@ abstract contract Product is
|
|
91
114
|
}
|
92
115
|
|
93
116
|
|
94
|
-
function register()
|
95
|
-
external
|
96
|
-
virtual
|
97
|
-
onlyOwner()
|
98
|
-
{
|
99
|
-
_getProductStorage()._componentService.registerProduct();
|
100
|
-
_approveTokenHandler(type(uint256).max);
|
101
|
-
}
|
102
|
-
|
103
|
-
|
104
117
|
function getInitialProductInfo()
|
105
118
|
public
|
106
119
|
virtual
|
@@ -112,6 +125,7 @@ abstract contract Product is
|
|
112
125
|
return IComponents.ProductInfo({
|
113
126
|
distributionNftId: $._distributionNftId,
|
114
127
|
poolNftId: $._poolNftId,
|
128
|
+
isProcessingFundedClaims: false,
|
115
129
|
productFee: FeeLib.zero(),
|
116
130
|
processingFee: FeeLib.zero(),
|
117
131
|
distributionFee: FeeLib.zero(),
|
@@ -122,13 +136,6 @@ abstract contract Product is
|
|
122
136
|
});
|
123
137
|
}
|
124
138
|
|
125
|
-
function getPoolNftId() external view override returns (NftId poolNftId) {
|
126
|
-
return getRegistry().getNftIdForAddress(address(_getProductStorage()._pool));
|
127
|
-
}
|
128
|
-
|
129
|
-
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
130
|
-
return getRegistry().getNftIdForAddress(address(_getProductStorage()._distribution));
|
131
|
-
}
|
132
139
|
|
133
140
|
function _initializeProduct(
|
134
141
|
address registry,
|
@@ -174,7 +181,7 @@ abstract contract Product is
|
|
174
181
|
$._poolNftId = getRegistry().getNftIdForAddress(pool);
|
175
182
|
$._distributionNftId = getRegistry().getNftIdForAddress(distribution);
|
176
183
|
|
177
|
-
|
184
|
+
_registerInterface(type(IProductComponent).interfaceId);
|
178
185
|
}
|
179
186
|
|
180
187
|
|
@@ -413,7 +420,7 @@ abstract contract Product is
|
|
413
420
|
return RiskIdLib.toRiskId(riskName);
|
414
421
|
}
|
415
422
|
|
416
|
-
function _getProductStorage()
|
423
|
+
function _getProductStorage() internal pure returns (ProductStorage storage $) {
|
417
424
|
assembly {
|
418
425
|
$.slot := PRODUCT_STORAGE_LOCATION_V1
|
419
426
|
}
|
@@ -33,18 +33,17 @@ contract RiskService is
|
|
33
33
|
virtual override
|
34
34
|
{
|
35
35
|
(
|
36
|
-
address registryAddress
|
37
|
-
//address managerAddress
|
36
|
+
address registryAddress,
|
38
37
|
address authority
|
39
|
-
) = abi.decode(data, (address, address
|
38
|
+
) = abi.decode(data, (address, address));
|
40
39
|
|
41
|
-
|
40
|
+
_initializeService(registryAddress, authority, owner);
|
42
41
|
|
43
42
|
_instanceService = IInstanceService(_getServiceAddress(INSTANCE()));
|
44
43
|
_poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getVersion().toMajorPart()));
|
45
44
|
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
|
46
45
|
|
47
|
-
|
46
|
+
_registerInterface(type(IRiskService).interfaceId);
|
48
47
|
}
|
49
48
|
|
50
49
|
|
@@ -12,14 +12,14 @@ contract RiskServiceManager 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
|
RiskService svc = new RiskService{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);
|
@@ -8,6 +8,8 @@ import {ITransferInterceptor} from "./ITransferInterceptor.sol";
|
|
8
8
|
|
9
9
|
contract ChainNft is ERC721Enumerable {
|
10
10
|
|
11
|
+
event LogTokenInterceptorAddress(uint256 tokenId, address interceptor);
|
12
|
+
|
11
13
|
// constants
|
12
14
|
string public constant NAME = "Dezentralized Insurance Protocol NFT";
|
13
15
|
string public constant SYMBOL = "DIPNFT";
|
@@ -15,12 +17,11 @@ contract ChainNft is ERC721Enumerable {
|
|
15
17
|
uint256 public constant PROTOCOL_NFT_ID = 1101;
|
16
18
|
uint256 public constant GLOBAL_REGISTRY_ID = 2101;
|
17
19
|
|
18
|
-
// TODO rename errors to error pattern: CallerNotRegistry -> ErrorCallerNotRegistry etc.
|
19
20
|
// custom errors
|
20
|
-
error
|
21
|
-
error
|
22
|
-
error
|
23
|
-
error
|
21
|
+
error ErrorChainNftCallerNotRegistry(address caller);
|
22
|
+
error ErrorChainNftRegistryAddressZero();
|
23
|
+
error ErrorChainNftUriEmpty();
|
24
|
+
error ErrorChainNftUriAlreadySet();
|
24
25
|
|
25
26
|
// contract state
|
26
27
|
|
@@ -34,31 +35,25 @@ contract ChainNft is ERC721Enumerable {
|
|
34
35
|
address private _registry;
|
35
36
|
|
36
37
|
// only used for _getNextTokenId
|
37
|
-
uint256 internal _chainIdInt;
|
38
38
|
uint256 internal _chainIdDigits;
|
39
39
|
uint256 internal _chainIdMultiplier;
|
40
40
|
uint256 internal _idNext;
|
41
41
|
uint256 internal _totalMinted;
|
42
42
|
|
43
43
|
modifier onlyRegistry() {
|
44
|
-
if (msg.sender != _registry) { revert
|
44
|
+
if (msg.sender != _registry) { revert ErrorChainNftCallerNotRegistry(msg.sender); }
|
45
45
|
_;
|
46
46
|
}
|
47
47
|
|
48
|
-
constructor(address registry)
|
49
|
-
|
48
|
+
constructor(address registry)
|
49
|
+
ERC721(NAME, SYMBOL)
|
50
|
+
{
|
51
|
+
if (registry == address(0)) { revert ErrorChainNftRegistryAddressZero(); }
|
50
52
|
|
53
|
+
// NFT contract is deployed by the registry
|
51
54
|
_registry = registry;
|
52
|
-
_chainIdInt = block.chainid;
|
53
|
-
_chainIdDigits = 0;
|
54
|
-
|
55
|
-
// count digis
|
56
|
-
uint256 num = _chainIdInt;
|
57
|
-
while (num != 0) {
|
58
|
-
_chainIdDigits++;
|
59
|
-
num /= 10;
|
60
|
-
}
|
61
55
|
|
56
|
+
_chainIdDigits = _calculateChainIdDigits(block.chainid);
|
62
57
|
_chainIdMultiplier = 10 ** _chainIdDigits;
|
63
58
|
|
64
59
|
// the first object registered through normal registration starts with id 4
|
@@ -74,12 +69,16 @@ contract ChainNft is ERC721Enumerable {
|
|
74
69
|
* not part of the IRegistry interface only needed for
|
75
70
|
* initial registry setup (protocol and global registry objects)
|
76
71
|
*/
|
77
|
-
function mint(
|
78
|
-
|
79
|
-
|
72
|
+
function mint(
|
73
|
+
address to,
|
74
|
+
uint256 tokenId
|
75
|
+
)
|
76
|
+
external
|
77
|
+
onlyRegistry()
|
78
|
+
{
|
79
|
+
_safeMintWithInterceptorAddress(to, tokenId, address(0));
|
80
80
|
}
|
81
81
|
|
82
|
-
|
83
82
|
/**
|
84
83
|
* @dev mints the next token to register new objects
|
85
84
|
* non-zero transferInterceptors are recorded and called during nft token transfers.
|
@@ -89,7 +88,11 @@ contract ChainNft is ERC721Enumerable {
|
|
89
88
|
address to,
|
90
89
|
address interceptor,
|
91
90
|
string memory uri
|
92
|
-
)
|
91
|
+
)
|
92
|
+
public
|
93
|
+
onlyRegistry()
|
94
|
+
returns (uint256 tokenId)
|
95
|
+
{
|
93
96
|
tokenId = _getNextTokenId();
|
94
97
|
|
95
98
|
if (interceptor != address(0)) {
|
@@ -100,8 +103,7 @@ contract ChainNft is ERC721Enumerable {
|
|
100
103
|
_uri[tokenId] = uri;
|
101
104
|
}
|
102
105
|
|
103
|
-
|
104
|
-
_safeMint(to, tokenId);
|
106
|
+
_safeMintWithInterceptorAddress(to, tokenId, interceptor);
|
105
107
|
|
106
108
|
if(interceptor != address(0)) {
|
107
109
|
ITransferInterceptor(interceptor).nftMint(to, tokenId);
|
@@ -132,8 +134,8 @@ contract ChainNft is ERC721Enumerable {
|
|
132
134
|
uint256 tokenId,
|
133
135
|
string memory uri
|
134
136
|
) external onlyRegistry {
|
135
|
-
if (bytes(uri).length == 0) { revert
|
136
|
-
if (bytes(_uri[tokenId]).length > 0) { revert
|
137
|
+
if (bytes(uri).length == 0) { revert ErrorChainNftUriEmpty(); }
|
138
|
+
if (bytes(_uri[tokenId]).length > 0) { revert ErrorChainNftUriAlreadySet(); }
|
137
139
|
|
138
140
|
_requireOwned(tokenId);
|
139
141
|
_uri[tokenId] = uri;
|
@@ -199,19 +201,50 @@ contract ChainNft is ERC721Enumerable {
|
|
199
201
|
* (42 * 10 ** 10 + 9876543210) * 100 + 10
|
200
202
|
* (index * 10 ** digits + chainid) * 100 + digits (1 < digits < 100)
|
201
203
|
*/
|
202
|
-
function calculateTokenId(uint256 idIndex) public view returns (uint256 id) {
|
203
|
-
|
204
|
-
(idIndex * _chainIdMultiplier +
|
205
|
-
|
206
|
-
|
204
|
+
function calculateTokenId(uint256 idIndex, uint256 chainId) public view returns (uint256 id) {
|
205
|
+
if(chainId == block.chainid) {
|
206
|
+
return 100 * (idIndex * _chainIdMultiplier + chainId) + _chainIdDigits;
|
207
|
+
} else {
|
208
|
+
uint256 chainIdDigits = _calculateChainIdDigits(chainId);
|
209
|
+
return 100 * (idIndex * (10 ** chainIdDigits) + chainId) + chainIdDigits;
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
function calculateTokenId(uint256 idIndex) public view returns (uint256) {
|
214
|
+
return 100 * (idIndex * _chainIdMultiplier + block.chainid) + _chainIdDigits;
|
207
215
|
}
|
208
216
|
|
209
217
|
function getNextTokenId() external view returns (uint256) {
|
210
218
|
return calculateTokenId(_idNext);
|
211
219
|
}
|
212
220
|
|
221
|
+
// ---------------- private functions ----------------- //
|
222
|
+
|
213
223
|
function _getNextTokenId() private returns (uint256 id) {
|
214
224
|
id = calculateTokenId(_idNext);
|
215
225
|
_idNext++;
|
216
226
|
}
|
227
|
+
|
228
|
+
function _calculateChainIdDigits(uint256 chainId) private pure returns (uint256) {
|
229
|
+
uint256 num = chainId;
|
230
|
+
uint256 digits = 0;
|
231
|
+
while (num != 0) {
|
232
|
+
digits++;
|
233
|
+
num /= 10;
|
234
|
+
}
|
235
|
+
return digits;
|
236
|
+
}
|
237
|
+
|
238
|
+
function _safeMintWithInterceptorAddress(
|
239
|
+
address to,
|
240
|
+
uint256 tokenId,
|
241
|
+
address interceptor
|
242
|
+
)
|
243
|
+
private
|
244
|
+
{
|
245
|
+
emit LogTokenInterceptorAddress(tokenId, interceptor);
|
246
|
+
|
247
|
+
_totalMinted++;
|
248
|
+
_safeMint(to, tokenId);
|
249
|
+
}
|
217
250
|
}
|