@etherisc/gif-next 0.0.2-c8c9cfc-245 → 0.0.2-c9577b6-545
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +5 -2
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +105 -65
- 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 +13 -8
- 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 +60 -32
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +5 -0
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.json +5 -0
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +19 -0
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +13 -8
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +68 -5
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +52 -212
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +28 -19
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +16 -184
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +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 +419 -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 +423 -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 +177 -113
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +38 -29
- 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 +291 -112
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +46 -5
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +42 -202
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +30 -21
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +16 -37
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +16 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +16 -184
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +53 -144
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +76 -80
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +45 -185
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +28 -19
- 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 -185
- 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 -210
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +28 -19
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +258 -184
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +117 -101
- 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 +148 -7
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +241 -145
- 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 +317 -384
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +108 -124
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +133 -261
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +97 -117
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +44 -210
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +604 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +698 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +59 -16
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +286 -34
- 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 +492 -95
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +283 -143
- 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 +47 -6
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +129 -221
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +66 -8
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +16 -173
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +105 -228
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +112 -122
- 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/IKeyValueStore.sol/IKeyValueStore.json +36 -0
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +36 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +16 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +15 -47
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +16 -0
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +16 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -22
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +16 -184
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +42 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +42 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +22 -57
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +19 -141
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +24 -97
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +21 -112
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +288 -16
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +108 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +43 -27
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +16 -21
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +63 -93
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +101 -248
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +46 -5
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +93 -100
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +6 -11
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +47 -159
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +72 -76
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +169 -128
- 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 +15 -2
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +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 +63 -59
- package/contracts/authorization/Authorization.sol +7 -3
- package/contracts/authorization/IAccess.sol +1 -0
- package/contracts/authorization/IAccessAdmin.sol +4 -3
- package/contracts/authorization/IServiceAuthorization.sol +3 -1
- package/contracts/authorization/ServiceAuthorization.sol +26 -10
- package/contracts/distribution/BasicDistribution.sol +2 -0
- package/contracts/distribution/Distribution.sol +3 -2
- package/contracts/distribution/DistributionService.sol +72 -60
- 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 +8 -1
- package/contracts/instance/module/IComponents.sol +4 -2
- package/contracts/instance/module/IPolicy.sol +23 -23
- package/contracts/oracle/Oracle.sol +2 -1
- package/contracts/oracle/OracleService.sol +41 -33
- package/contracts/oracle/OracleServiceManager.sol +6 -6
- package/contracts/pool/BasicPool.sol +12 -13
- package/contracts/pool/BundleService.sol +42 -31
- 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 +121 -117
- 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 +245 -88
- package/contracts/product/ClaimServiceManager.sol +4 -4
- package/contracts/product/IApplicationService.sol +1 -0
- package/contracts/product/IClaimService.sol +30 -7
- package/contracts/product/IPolicyService.sol +29 -34
- 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 +313 -172
- package/contracts/product/PolicyServiceManager.sol +4 -4
- package/contracts/product/PricingService.sol +47 -50
- 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 -18
- package/contracts/registry/IRegistryService.sol +0 -9
- package/contracts/registry/Registry.sol +336 -197
- package/contracts/registry/RegistryAdmin.sol +134 -51
- package/contracts/registry/RegistryService.sol +55 -50
- package/contracts/registry/RegistryServiceManager.sol +2 -2
- package/contracts/registry/ReleaseLifecycle.sol +6 -3
- package/contracts/registry/ReleaseRegistry.sol +204 -188
- package/contracts/registry/ServiceAuthorizationV3.sol +7 -9
- package/contracts/shared/Component.sol +12 -32
- package/contracts/shared/ComponentService.sol +20 -29
- package/contracts/shared/ComponentServiceManager.sol +8 -5
- package/contracts/shared/ComponentVerifyingService.sol +2 -3
- package/contracts/shared/ContractLib.sol +38 -0
- package/contracts/shared/IComponent.sol +0 -1
- package/contracts/shared/IInstanceLinkedComponent.sol +8 -15
- package/contracts/shared/ILifecycle.sol +3 -1
- 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/KeyValueStore.sol +1 -1
- package/contracts/shared/Lifecycle.sol +15 -4
- package/contracts/shared/NftOwnable.sol +21 -5
- package/contracts/shared/PolicyHolder.sol +15 -52
- package/contracts/shared/Registerable.sol +4 -4
- package/contracts/shared/RegistryLinked.sol +3 -2
- package/contracts/shared/Service.sol +16 -11
- package/contracts/shared/TokenHandler.sol +99 -22
- package/contracts/shared/TokenHandlerDeployerLib.sol +12 -0
- package/contracts/staking/IStaking.sol +2 -1
- package/contracts/staking/IStakingService.sol +0 -3
- package/contracts/staking/StakeManagerLib.sol +18 -25
- package/contracts/staking/Staking.sol +11 -29
- package/contracts/staking/StakingManager.sol +8 -6
- package/contracts/staking/StakingReader.sol +12 -5
- package/contracts/staking/StakingService.sol +3 -17
- package/contracts/staking/StakingServiceManager.sol +2 -2
- package/contracts/staking/TargetManagerLib.sol +7 -3
- package/contracts/type/Amount.sol +15 -0
- package/contracts/type/ClaimId.sol +6 -1
- package/contracts/type/NftId.sol +1 -0
- package/contracts/type/ObjectType.sol +16 -11
- package/contracts/type/PayoutId.sol +10 -10
- package/contracts/type/RiskId.sol +15 -1
- package/contracts/type/Seconds.sol +8 -0
- package/contracts/type/StateId.sol +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 +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
package/contracts/pool/Pool.sol
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
5
|
-
import {BUNDLE, COMPONENT, POOL} from "../type/ObjectType.sol";
|
5
|
+
import {BUNDLE, COMPONENT, POLICY, POOL} from "../type/ObjectType.sol";
|
6
|
+
import {ClaimId} from "../type/ClaimId.sol";
|
6
7
|
import {IBundleService} from "./IBundleService.sol";
|
7
8
|
import {IAuthorization} from "../authorization/IAuthorization.sol";
|
8
9
|
import {IPoolComponent} from "./IPoolComponent.sol";
|
@@ -10,13 +11,12 @@ import {IPoolService} from "./IPoolService.sol";
|
|
10
11
|
import {IComponents} from "../instance/module/IComponents.sol";
|
11
12
|
import {IComponentService} from "../shared/IComponentService.sol";
|
12
13
|
import {InstanceLinkedComponent} from "../shared/InstanceLinkedComponent.sol";
|
13
|
-
import {Fee
|
14
|
-
import {NftId
|
14
|
+
import {Fee} from "../type/Fee.sol";
|
15
|
+
import {NftId} from "../type/NftId.sol";
|
15
16
|
import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
|
16
17
|
import {Seconds} from "../type/Seconds.sol";
|
17
18
|
import {Timestamp} from "../type/Timestamp.sol";
|
18
|
-
import {
|
19
|
-
import {UFixed, UFixedLib} from "../type/UFixed.sol";
|
19
|
+
import {UFixedLib} from "../type/UFixed.sol";
|
20
20
|
|
21
21
|
abstract contract Pool is
|
22
22
|
InstanceLinkedComponent,
|
@@ -40,6 +40,16 @@ abstract contract Pool is
|
|
40
40
|
}
|
41
41
|
|
42
42
|
|
43
|
+
function register()
|
44
|
+
external
|
45
|
+
virtual
|
46
|
+
onlyOwner()
|
47
|
+
{
|
48
|
+
_getPoolStorage()._componentService.registerPool();
|
49
|
+
_approveTokenHandler(type(uint256).max);
|
50
|
+
}
|
51
|
+
|
52
|
+
|
43
53
|
/// @dev see {IPoolComponent.verifyApplication}
|
44
54
|
function verifyApplication(
|
45
55
|
NftId applicationNftId,
|
@@ -51,6 +61,7 @@ abstract contract Pool is
|
|
51
61
|
public
|
52
62
|
virtual
|
53
63
|
restricted()
|
64
|
+
onlyNftOfType(applicationNftId, POLICY())
|
54
65
|
{
|
55
66
|
if(!applicationMatchesBundle(
|
56
67
|
applicationNftId,
|
@@ -67,6 +78,21 @@ abstract contract Pool is
|
|
67
78
|
}
|
68
79
|
|
69
80
|
|
81
|
+
/// @dev see {IPoolComponent.processConfirmedClaim}
|
82
|
+
function processConfirmedClaim(
|
83
|
+
NftId policyNftId,
|
84
|
+
ClaimId claimId,
|
85
|
+
Amount amount
|
86
|
+
)
|
87
|
+
public
|
88
|
+
virtual
|
89
|
+
restricted()
|
90
|
+
onlyNftOfType(policyNftId, POLICY())
|
91
|
+
{
|
92
|
+
// default implementation is empty
|
93
|
+
}
|
94
|
+
|
95
|
+
|
70
96
|
/// @dev see {IPoolComponent.applicationMatchesBundle}
|
71
97
|
/// Override this function to implement any custom application verification
|
72
98
|
/// Default implementation always returns true
|
@@ -80,27 +106,20 @@ abstract contract Pool is
|
|
80
106
|
public
|
81
107
|
virtual
|
82
108
|
view
|
109
|
+
onlyNftOfType(applicationNftId, POLICY())
|
110
|
+
onlyNftOfType(bundleNftId, BUNDLE())
|
83
111
|
returns (bool isMatching)
|
84
112
|
{
|
85
113
|
return true;
|
86
114
|
}
|
87
115
|
|
88
|
-
|
89
|
-
function register()
|
90
|
-
external
|
91
|
-
virtual
|
92
|
-
onlyOwner()
|
93
|
-
{
|
94
|
-
_getPoolStorage()._componentService.registerPool();
|
95
|
-
_approveTokenHandler(type(uint256).max);
|
96
|
-
}
|
97
|
-
|
98
116
|
/// @inheritdoc IPoolComponent
|
99
117
|
function withdrawBundleFees(NftId bundleNftId, Amount amount)
|
100
118
|
external
|
101
119
|
virtual
|
102
120
|
restricted()
|
103
121
|
onlyBundleOwner(bundleNftId)
|
122
|
+
onlyNftOfType(bundleNftId, BUNDLE())
|
104
123
|
returns (Amount withdrawnAmount)
|
105
124
|
{
|
106
125
|
return _withdrawBundleFees(bundleNftId, amount);
|
@@ -113,15 +132,16 @@ abstract contract Pool is
|
|
113
132
|
view
|
114
133
|
returns (IComponents.PoolInfo memory poolInfo)
|
115
134
|
{
|
116
|
-
return IComponents.PoolInfo(
|
117
|
-
|
118
|
-
|
119
|
-
isNftInterceptor(),
|
120
|
-
false,
|
121
|
-
false,
|
122
|
-
|
123
|
-
UFixedLib.toUFixed(1)
|
124
|
-
|
135
|
+
return IComponents.PoolInfo({
|
136
|
+
maxBalanceAmount: AmountLib.max(),
|
137
|
+
bundleOwnerRole: PUBLIC_ROLE(),
|
138
|
+
isInterceptingBundleTransfers: isNftInterceptor(),
|
139
|
+
isProcessingConfirmedClaims: false,
|
140
|
+
isExternallyManaged: false,
|
141
|
+
isVerifyingApplications: false,
|
142
|
+
collateralizationLevel: UFixedLib.toUFixed(1),
|
143
|
+
retentionLevel: UFixedLib.toUFixed(1)
|
144
|
+
});
|
125
145
|
}
|
126
146
|
|
127
147
|
// Internals
|
@@ -158,7 +178,7 @@ abstract contract Pool is
|
|
158
178
|
$._bundleService = IBundleService(_getServiceAddress(BUNDLE()));
|
159
179
|
$._componentService = IComponentService(_getServiceAddress(COMPONENT()));
|
160
180
|
|
161
|
-
|
181
|
+
_registerInterface(type(IPoolComponent).interfaceId);
|
162
182
|
}
|
163
183
|
|
164
184
|
/// @dev increases the staked tokens by the specified amount
|
@@ -169,9 +189,9 @@ abstract contract Pool is
|
|
169
189
|
)
|
170
190
|
internal
|
171
191
|
virtual
|
172
|
-
returns(Amount
|
192
|
+
returns(Amount)
|
173
193
|
{
|
174
|
-
_getPoolStorage()._poolService.stake(bundleNftId, amount);
|
194
|
+
return _getPoolStorage()._poolService.stake(bundleNftId, amount);
|
175
195
|
}
|
176
196
|
|
177
197
|
|
@@ -287,21 +307,19 @@ abstract contract Pool is
|
|
287
307
|
_getPoolStorage()._componentService.setPoolFees(poolFee, stakingFee, performanceFee);
|
288
308
|
}
|
289
309
|
|
290
|
-
/// @dev Creates a new bundle using the provided parameter values.
|
310
|
+
/// @dev Creates a new empty bundle using the provided parameter values.
|
291
311
|
function _createBundle(
|
292
312
|
address bundleOwner,
|
293
313
|
Fee memory fee,
|
294
|
-
Amount amount,
|
295
314
|
Seconds lifetime,
|
296
315
|
bytes memory filter
|
297
316
|
)
|
298
317
|
internal
|
299
|
-
returns(NftId bundleNftId
|
318
|
+
returns(NftId bundleNftId)
|
300
319
|
{
|
301
|
-
|
320
|
+
bundleNftId = _getPoolStorage()._poolService.createBundle(
|
302
321
|
bundleOwner,
|
303
322
|
fee,
|
304
|
-
amount,
|
305
323
|
lifetime,
|
306
324
|
filter);
|
307
325
|
|
@@ -320,6 +338,17 @@ abstract contract Pool is
|
|
320
338
|
return _getPoolStorage()._bundleService.withdrawBundleFees(bundleNftId, amount);
|
321
339
|
}
|
322
340
|
|
341
|
+
function _processFundedClaim(
|
342
|
+
NftId policyNftId,
|
343
|
+
ClaimId claimId,
|
344
|
+
Amount availableAmount
|
345
|
+
)
|
346
|
+
internal
|
347
|
+
{
|
348
|
+
_getPoolStorage()._poolService.processFundedClaim(
|
349
|
+
policyNftId, claimId, availableAmount);
|
350
|
+
}
|
351
|
+
|
323
352
|
function _getPoolStorage() private pure returns (PoolStorage storage $) {
|
324
353
|
assembly {
|
325
354
|
$.slot := POOL_STORAGE_LOCATION_V1
|
@@ -1,8 +1,6 @@
|
|
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
|
-
|
6
4
|
import {IBundle} from "../instance/module/IBundle.sol";
|
7
5
|
import {IBundleService} from "./IBundleService.sol";
|
8
6
|
import {IComponents} from "../instance/module/IComponents.sol";
|
@@ -10,12 +8,14 @@ import {IComponentService} from "../shared/IComponentService.sol";
|
|
10
8
|
import {IInstance} from "../instance/IInstance.sol";
|
11
9
|
import {IInstanceService} from "../instance/IInstanceService.sol";
|
12
10
|
import {IPolicy} from "../instance/module/IPolicy.sol";
|
11
|
+
import {IProductComponent} from "../product/IProductComponent.sol";
|
13
12
|
import {IPoolService} from "./IPoolService.sol";
|
14
13
|
import {IRegistry} from "../registry/IRegistry.sol";
|
15
14
|
import {IRegistryService} from "../registry/IRegistryService.sol";
|
16
15
|
import {IStaking} from "../staking/IStaking.sol";
|
17
16
|
|
18
17
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
18
|
+
import {ClaimId} from "../type/ClaimId.sol";
|
19
19
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
20
20
|
import {NftId} from "../type/NftId.sol";
|
21
21
|
import {ObjectType, POOL, BUNDLE, COMPONENT, INSTANCE, REGISTRY} from "../type/ObjectType.sol";
|
@@ -23,8 +23,7 @@ import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
|
|
23
23
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
24
24
|
import {KEEP_STATE} from "../type/StateId.sol";
|
25
25
|
import {Seconds} from "../type/Seconds.sol";
|
26
|
-
import {
|
27
|
-
import {UFixed} from "../type/UFixed.sol";
|
26
|
+
import {UFixed, UFixedLib} from "../type/UFixed.sol";
|
28
27
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
29
28
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
30
29
|
import {InstanceStore} from "../instance/InstanceStore.sol";
|
@@ -47,16 +46,15 @@ contract PoolService is
|
|
47
46
|
bytes memory data
|
48
47
|
)
|
49
48
|
internal
|
50
|
-
initializer
|
51
49
|
virtual override
|
50
|
+
initializer()
|
52
51
|
{
|
53
52
|
(
|
54
|
-
address registryAddress
|
55
|
-
//address managerAddress
|
53
|
+
address registryAddress,
|
56
54
|
address authority
|
57
|
-
) = abi.decode(data, (address, address
|
55
|
+
) = abi.decode(data, (address, address));
|
58
56
|
|
59
|
-
|
57
|
+
_initializeService(registryAddress, authority, owner);
|
60
58
|
|
61
59
|
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
|
62
60
|
_bundleService = IBundleService(_getServiceAddress(BUNDLE()));
|
@@ -65,9 +63,10 @@ contract PoolService is
|
|
65
63
|
|
66
64
|
_staking = IStaking(getRegistry().getStakingAddress());
|
67
65
|
|
68
|
-
|
66
|
+
_registerInterface(type(IPoolService).interfaceId);
|
69
67
|
}
|
70
68
|
|
69
|
+
|
71
70
|
/// @inheritdoc IPoolService
|
72
71
|
function setMaxBalanceAmount(Amount maxBalanceAmount)
|
73
72
|
external
|
@@ -84,6 +83,7 @@ contract PoolService is
|
|
84
83
|
emit LogPoolServiceMaxBalanceAmountUpdated(poolNftId, previousMaxBalanceAmount, maxBalanceAmount);
|
85
84
|
}
|
86
85
|
|
86
|
+
|
87
87
|
function setBundleOwnerRole(RoleId bundleOwnerRole)
|
88
88
|
external
|
89
89
|
virtual
|
@@ -105,62 +105,34 @@ contract PoolService is
|
|
105
105
|
emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
|
106
106
|
}
|
107
107
|
|
108
|
+
|
108
109
|
/// @inheritdoc IPoolService
|
109
110
|
function createBundle(
|
110
111
|
address bundleOwner, // initial bundle owner
|
111
112
|
Fee memory fee, // fees deducted from premium that go to bundle owner
|
112
|
-
Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
|
113
113
|
Seconds lifetime, // initial duration for which new policies are covered
|
114
114
|
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
115
115
|
)
|
116
116
|
external
|
117
117
|
virtual
|
118
|
-
returns(NftId bundleNftId
|
118
|
+
returns(NftId bundleNftId)
|
119
119
|
{
|
120
120
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
121
121
|
|
122
|
-
|
123
|
-
InstanceReader instanceReader = instance.getInstanceReader();
|
124
|
-
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
125
|
-
Amount currentPoolBalance = instanceReader.getBalanceAmount(poolNftId);
|
126
|
-
if (currentPoolBalance + stakingAmount > poolInfo.maxBalanceAmount) {
|
127
|
-
revert ErrorPoolServiceMaxBalanceAmountExceeded(poolNftId, poolInfo.maxBalanceAmount, currentPoolBalance, stakingAmount);
|
128
|
-
}
|
129
|
-
}
|
130
|
-
|
131
|
-
|
132
|
-
Amount stakingFeeAmount;
|
133
|
-
(stakingFeeAmount, netStakedAmount) = FeeLib.calculateFee(
|
134
|
-
_getStakingFee(instance.getInstanceReader(), poolNftId),
|
135
|
-
stakingAmount);
|
136
|
-
|
137
|
-
|
122
|
+
// create the empty bundle
|
138
123
|
bundleNftId = _bundleService.create(
|
139
124
|
instance,
|
140
125
|
poolNftId,
|
141
126
|
bundleOwner,
|
142
127
|
fee,
|
143
|
-
|
128
|
+
AmountLib.zero(),
|
144
129
|
lifetime,
|
145
130
|
filter);
|
146
131
|
|
147
|
-
// pool book keeping
|
148
|
-
_componentService.increasePoolBalance(
|
149
|
-
instance.getInstanceStore(),
|
150
|
-
poolNftId,
|
151
|
-
netStakedAmount,
|
152
|
-
stakingFeeAmount);
|
153
|
-
|
154
|
-
// pool bookkeeping and collect tokens from bundle owner
|
155
|
-
_collectStakingAmount(
|
156
|
-
instance.getInstanceReader(),
|
157
|
-
poolNftId,
|
158
|
-
bundleOwner,
|
159
|
-
stakingAmount);
|
160
|
-
|
161
132
|
emit LogPoolServiceBundleCreated(instance.getNftId(), poolNftId, bundleNftId);
|
162
133
|
}
|
163
134
|
|
135
|
+
|
164
136
|
function _getStakingFee(InstanceReader instanceReader, NftId poolNftId)
|
165
137
|
internal
|
166
138
|
virtual
|
@@ -171,6 +143,7 @@ contract PoolService is
|
|
171
143
|
return instanceReader.getProductInfo(productNftId).stakingFee;
|
172
144
|
}
|
173
145
|
|
146
|
+
|
174
147
|
function closeBundle(NftId bundleNftId)
|
175
148
|
external
|
176
149
|
virtual
|
@@ -192,27 +165,46 @@ contract PoolService is
|
|
192
165
|
|
193
166
|
if ((unstakedAmount + feeAmount).gtz()){
|
194
167
|
IComponents.ComponentInfo memory poolComponentInfo = instance.getInstanceReader().getComponentInfo(poolNftId);
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
168
|
+
poolComponentInfo.tokenHandler.distributeTokens(
|
169
|
+
poolComponentInfo.wallet,
|
170
|
+
getRegistry().ownerOf(bundleNftId),
|
171
|
+
unstakedAmount + feeAmount);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
|
176
|
+
/// @inheritdoc IPoolService
|
177
|
+
function processFundedClaim(
|
178
|
+
NftId policyNftId,
|
179
|
+
ClaimId claimId,
|
180
|
+
Amount availableAmount
|
181
|
+
)
|
182
|
+
external
|
183
|
+
virtual
|
184
|
+
{
|
185
|
+
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
186
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
187
|
+
NftId productNftId = instanceReader.getComponentInfo(poolNftId).productNftId;
|
209
188
|
|
210
|
-
|
211
|
-
|
212
|
-
|
189
|
+
// check policy matches with calling pool
|
190
|
+
IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
191
|
+
if(policyInfo.productNftId != productNftId) {
|
192
|
+
revert ErrorPoolServicePolicyPoolMismatch(
|
193
|
+
policyNftId,
|
194
|
+
policyInfo.productNftId,
|
195
|
+
productNftId);
|
196
|
+
}
|
197
|
+
|
198
|
+
emit LogPoolServiceProcessFundedClaim(policyNftId, claimId, availableAmount);
|
199
|
+
|
200
|
+
// callback to product component if applicable
|
201
|
+
if (instanceReader.getProductInfo(productNftId).isProcessingFundedClaims) {
|
202
|
+
address productAddress = getRegistry().getObjectAddress(productNftId);
|
203
|
+
IProductComponent(productAddress).processFundedClaim(policyNftId, claimId, availableAmount);
|
213
204
|
}
|
214
205
|
}
|
215
206
|
|
207
|
+
|
216
208
|
/// @inheritdoc IPoolService
|
217
209
|
function stake(NftId bundleNftId, Amount amount)
|
218
210
|
external
|
@@ -236,6 +228,7 @@ contract PoolService is
|
|
236
228
|
}
|
237
229
|
}
|
238
230
|
|
231
|
+
|
239
232
|
// calculate fees
|
240
233
|
Amount feeAmount;
|
241
234
|
(
|
@@ -257,6 +250,8 @@ contract PoolService is
|
|
257
250
|
// collect tokens from bundle owner
|
258
251
|
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
259
252
|
emit LogPoolServiceBundleStaked(instance.getNftId(), poolNftId, bundleNftId, amount, netAmount);
|
253
|
+
|
254
|
+
// TODO only collect staking token when pool is not externally managed
|
260
255
|
_collectStakingAmount(
|
261
256
|
instanceReader,
|
262
257
|
poolNftId,
|
@@ -280,10 +275,6 @@ contract PoolService is
|
|
280
275
|
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
281
276
|
}
|
282
277
|
|
283
|
-
if (amount.eqz()) {
|
284
|
-
revert ErrorPoolServiceAmountIsZero();
|
285
|
-
}
|
286
|
-
|
287
278
|
// call bundle service for bookkeeping and additional checks
|
288
279
|
Amount unstakedAmount = _bundleService.unstake(instance, bundleNftId, amount);
|
289
280
|
|
@@ -301,27 +292,39 @@ contract PoolService is
|
|
301
292
|
|
302
293
|
IComponents.ComponentInfo memory poolComponentInfo = instanceReader.getComponentInfo(poolNftId);
|
303
294
|
address poolWallet = poolComponentInfo.wallet;
|
304
|
-
|
305
|
-
// check allowance
|
306
|
-
{
|
307
|
-
IERC20Metadata token = IERC20Metadata(poolComponentInfo.token);
|
308
|
-
uint256 tokenAllowance = token.allowance(poolWallet, address(poolComponentInfo.tokenHandler));
|
309
|
-
if (tokenAllowance < unstakedAmount.toInt()) {
|
310
|
-
revert ErrorPoolServiceWalletAllowanceTooSmall(poolWallet, address(poolComponentInfo.tokenHandler), tokenAllowance, amount.toInt());
|
311
|
-
}
|
312
|
-
}
|
313
|
-
|
314
295
|
// transfer amount to bundle owner
|
315
296
|
address owner = getRegistry().ownerOf(bundleNftId);
|
316
297
|
emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount);
|
317
|
-
|
318
|
-
|
298
|
+
poolComponentInfo.tokenHandler.distributeTokens(
|
299
|
+
poolWallet,
|
300
|
+
owner,
|
301
|
+
unstakedAmount);
|
319
302
|
return unstakedAmount;
|
320
303
|
}
|
321
304
|
|
305
|
+
|
306
|
+
function fundPoolWallet(NftId poolNftId, Amount amount)
|
307
|
+
external
|
308
|
+
virtual
|
309
|
+
restricted()
|
310
|
+
{
|
311
|
+
// TODO check that poolNftId is externally managed
|
312
|
+
// TODO implement
|
313
|
+
}
|
314
|
+
|
315
|
+
|
316
|
+
function defundPoolWallet(NftId poolNftId, Amount amount)
|
317
|
+
external
|
318
|
+
virtual
|
319
|
+
restricted()
|
320
|
+
{
|
321
|
+
// TODO check that poolNftId is externally managed
|
322
|
+
// TODO implement
|
323
|
+
}
|
324
|
+
|
322
325
|
function processSale(
|
323
326
|
NftId bundleNftId,
|
324
|
-
IPolicy.
|
327
|
+
IPolicy.PremiumInfo memory premium
|
325
328
|
)
|
326
329
|
external
|
327
330
|
virtual
|
@@ -333,9 +336,9 @@ contract PoolService is
|
|
333
336
|
IRegistry.ObjectInfo memory instanceObjectInfo = registry.getObjectInfo(poolObjectInfo.parentNftId);
|
334
337
|
IInstance instance = IInstance(instanceObjectInfo.objectAddress);
|
335
338
|
|
336
|
-
Amount poolFeeAmount =
|
337
|
-
Amount bundleFeeAmount =
|
338
|
-
Amount bundleNetAmount =
|
339
|
+
Amount poolFeeAmount = premium.poolFeeFixAmount + premium.poolFeeVarAmount;
|
340
|
+
Amount bundleFeeAmount = premium.bundleFeeFixAmount + premium.bundleFeeVarAmount;
|
341
|
+
Amount bundleNetAmount = premium.netPremiumAmount;
|
339
342
|
|
340
343
|
InstanceStore instanceStore = instance.getInstanceStore();
|
341
344
|
_componentService.increasePoolBalance(
|
@@ -364,13 +367,13 @@ contract PoolService is
|
|
364
367
|
virtual
|
365
368
|
restricted()
|
366
369
|
returns (
|
367
|
-
Amount
|
368
|
-
Amount
|
370
|
+
Amount totalCollateralAmount,
|
371
|
+
Amount localCollateralAmount
|
369
372
|
)
|
370
373
|
{
|
371
374
|
(
|
372
|
-
|
373
|
-
|
375
|
+
totalCollateralAmount,
|
376
|
+
localCollateralAmount
|
374
377
|
) = calculateRequiredCollateral(
|
375
378
|
instance.getInstanceReader(),
|
376
379
|
productNftId,
|
@@ -396,8 +399,7 @@ contract PoolService is
|
|
396
399
|
}
|
397
400
|
}
|
398
401
|
|
399
|
-
|
400
|
-
function reduceCollateral(
|
402
|
+
function processPayout(
|
401
403
|
IInstance instance,
|
402
404
|
address token,
|
403
405
|
NftId policyNftId,
|
@@ -408,6 +410,22 @@ contract PoolService is
|
|
408
410
|
virtual
|
409
411
|
restricted()
|
410
412
|
{
|
413
|
+
NftId bundleNftId = policyInfo.bundleNftId;
|
414
|
+
NftId poolNftId = getRegistry().getObjectInfo(bundleNftId).parentNftId;
|
415
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
416
|
+
|
417
|
+
_componentService.decreasePoolBalance(
|
418
|
+
instanceStore,
|
419
|
+
poolNftId,
|
420
|
+
payoutAmount,
|
421
|
+
AmountLib.zero());
|
422
|
+
|
423
|
+
_componentService.decreaseBundleBalance(
|
424
|
+
instanceStore,
|
425
|
+
bundleNftId,
|
426
|
+
payoutAmount,
|
427
|
+
AmountLib.zero());
|
428
|
+
|
411
429
|
_bundleService.releaseCollateral(
|
412
430
|
instance,
|
413
431
|
policyNftId,
|
@@ -462,16 +480,16 @@ contract PoolService is
|
|
462
480
|
public
|
463
481
|
view
|
464
482
|
returns(
|
465
|
-
Amount
|
466
|
-
Amount
|
483
|
+
Amount totalCollateralAmount,
|
484
|
+
Amount localCollateralAmount
|
467
485
|
)
|
468
486
|
{
|
469
487
|
NftId poolNftId = instanceReader.getProductInfo(productNftId).poolNftId;
|
470
488
|
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
471
489
|
|
472
490
|
(
|
473
|
-
|
474
|
-
|
491
|
+
totalCollateralAmount,
|
492
|
+
localCollateralAmount
|
475
493
|
) = calculateRequiredCollateral(
|
476
494
|
poolInfo.collateralizationLevel,
|
477
495
|
poolInfo.retentionLevel,
|
@@ -487,18 +505,17 @@ contract PoolService is
|
|
487
505
|
public
|
488
506
|
pure
|
489
507
|
returns(
|
490
|
-
Amount
|
491
|
-
Amount
|
508
|
+
Amount totalCollateralAmount,
|
509
|
+
Amount localCollateralAmount
|
492
510
|
)
|
493
511
|
{
|
494
|
-
//
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
//
|
499
|
-
|
500
|
-
|
501
|
-
totalCollateralAmount = localCollateralAmount;
|
512
|
+
// collateralization is applied to sum insured
|
513
|
+
UFixed totalUFixed = collateralizationLevel * sumInsuredAmount.toUFixed();
|
514
|
+
totalCollateralAmount = AmountLib.toAmount(totalUFixed.toInt());
|
515
|
+
|
516
|
+
// retention level defines how much capital is required locally
|
517
|
+
localCollateralAmount = AmountLib.toAmount(
|
518
|
+
(retentionLevel * totalUFixed).toInt());
|
502
519
|
}
|
503
520
|
|
504
521
|
|
@@ -521,7 +538,6 @@ contract PoolService is
|
|
521
538
|
}
|
522
539
|
|
523
540
|
|
524
|
-
// TODO create (I)TreasuryService that deals with all gif related token transfers
|
525
541
|
/// @dev transfers the specified amount from the bundle owner to the pool's wallet
|
526
542
|
function _collectStakingAmount(
|
527
543
|
InstanceReader instanceReader,
|
@@ -534,23 +550,11 @@ contract PoolService is
|
|
534
550
|
|
535
551
|
// collecting investor token
|
536
552
|
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
537
|
-
TokenHandler tokenHandler = componentInfo.tokenHandler;
|
538
553
|
address poolWallet = componentInfo.wallet;
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
revert ErrorPoolServiceWalletAllowanceTooSmall(bundleOwner, address(tokenHandler), allowance, amount.toInt());
|
544
|
-
}
|
545
|
-
|
546
|
-
// TODO: centralize token handling (issue #471)
|
547
|
-
tokenHandler.transfer(
|
548
|
-
bundleOwner,
|
549
|
-
poolWallet,
|
550
|
-
amount);
|
551
|
-
} else {
|
552
|
-
revert ErrorPoolServiceAmountIsZero();
|
553
|
-
}
|
554
|
+
componentInfo.tokenHandler.collectTokens(
|
555
|
+
bundleOwner,
|
556
|
+
poolWallet,
|
557
|
+
amount);
|
554
558
|
}
|
555
559
|
|
556
560
|
function _getDomain() internal pure override returns(ObjectType) {
|
@@ -12,14 +12,14 @@ contract PoolServiceManager is ProxyManager {
|
|
12
12
|
/// @dev initializes proxy manager with pool 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
|
PoolService poolSrv = new PoolService{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(poolSrv),
|
24
24
|
data,
|
25
25
|
salt);
|