@etherisc/gif-next 0.0.2-c0dadcd-773 → 0.0.2-c16a73d-798
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +49 -4
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +1293 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +1206 -0
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +414 -0
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.json +10 -0
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +4 -0
- package/artifacts/contracts/{shared → authorization}/IAccessAdmin.sol/IAccessAdmin.json +152 -281
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +295 -0
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +4 -0
- package/artifacts/contracts/{registry → authorization}/IServiceAuthorization.sol/IServiceAuthorization.json +48 -10
- package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +4 -0
- package/artifacts/contracts/{shared/AccessManagerCustom.sol/AccessManagerCustom.json → authorization/ReleaseAccessManager.sol/ReleaseAccessManager.json} +28 -25
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +253 -0
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +4 -0
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +1402 -0
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +4 -0
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +470 -0
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +133 -501
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +316 -239
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +116 -104
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +164 -210
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +181 -47
- 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 +1538 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +470 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2072 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +470 -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 +1471 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1231 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1592 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2095 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +703 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +59 -50
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +43 -110
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +74 -202
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +1211 -266
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +561 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +511 -154
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +91 -316
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +75 -111
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +340 -260
- 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 +4 -0
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +223 -0
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +181 -0
- 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/mock/Dip.sol/Dip.json +2 -2
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +1039 -0
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +4 -0
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +478 -0
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.json +43 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +109 -80
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +43 -9
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +119 -358
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +91 -159
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +75 -83
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +4 -0
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +1299 -0
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +470 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +498 -167
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +169 -89
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +258 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +125 -319
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +384 -179
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +165 -632
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +506 -334
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +111 -87
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +76 -168
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +72 -92
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +4 -0
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +1173 -0
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +470 -0
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +303 -187
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +119 -103
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +34 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +176 -6
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +323 -118
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +114 -85
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +154 -137
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
- package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +31 -2
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +444 -325
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +119 -103
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +202 -307
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +96 -120
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +168 -434
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +622 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +694 -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 +311 -55
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +42 -146
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +5 -18
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +537 -112
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +381 -396
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +78 -284
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +67 -75
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +205 -0
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +1067 -0
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +101 -16
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +4 -4
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +65 -236
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +518 -261
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +136 -118
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +47 -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 +55 -54
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +474 -19
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +98 -80
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +45 -3
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +34 -3
- 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 +29 -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 +29 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +4 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +53 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +111 -318
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +55 -88
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +42 -62
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +4 -0
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +306 -0
- 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 +58 -89
- 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 +47 -112
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +330 -11
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +108 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +82 -55
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +29 -21
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +85 -105
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +176 -293
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +205 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +106 -91
- 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 +71 -165
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +71 -79
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +186 -164
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +58 -22
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.json +2 -2
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +61 -8
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +2 -2
- 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 +4 -4
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/type/Fee.sol/FeeLib.json +17 -12
- 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 +4 -4
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +55 -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 +4 -4
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +4 -4
- 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 +117 -14
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +50 -2
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorLib.json +2 -2
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +2 -2
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.json +15 -2
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
- package/artifacts/contracts/type/String.sol/StrLib.json +2 -2
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +23 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/MathLib.json +9 -3
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +71 -2
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.json +21 -2
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +4 -0
- package/artifacts/contracts/{shared → upgradeability}/IVersionable.sol/IVersionable.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +602 -0
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +4 -0
- package/artifacts/contracts/{shared → upgradeability}/Versionable.sol/Versionable.json +1 -1
- package/contracts/{shared → authorization}/AccessAdmin.sol +190 -353
- package/contracts/authorization/AccessManagerCloneable.sol +16 -0
- package/contracts/authorization/Authorization.sol +289 -0
- package/contracts/authorization/IAccess.sol +49 -0
- package/contracts/{shared → authorization}/IAccessAdmin.sol +26 -57
- package/contracts/authorization/IAuthorization.sol +60 -0
- package/contracts/{registry → authorization}/IServiceAuthorization.sol +11 -6
- package/contracts/authorization/ReleaseAccessManager.sol +38 -0
- package/contracts/{registry → authorization}/ServiceAuthorization.sol +45 -25
- package/contracts/distribution/BasicDistribution.sol +139 -0
- package/contracts/distribution/BasicDistributionAuthorization.sol +47 -0
- package/contracts/distribution/Distribution.sol +140 -116
- package/contracts/distribution/DistributionService.sol +138 -80
- package/contracts/distribution/DistributionServiceManager.sol +8 -11
- package/contracts/distribution/IDistributionComponent.sol +26 -40
- package/contracts/distribution/IDistributionService.sol +23 -3
- package/contracts/examples/fire/DamageLevel.sol +59 -0
- package/contracts/examples/fire/FirePool.sol +73 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
- package/contracts/examples/fire/FireProduct.sol +415 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +44 -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/{BundleManager.sol → BundleSet.sol} +23 -23
- package/contracts/instance/IInstance.sol +17 -38
- package/contracts/instance/IInstanceService.sol +9 -34
- package/contracts/instance/Instance.sol +84 -115
- package/contracts/instance/InstanceAdmin.sol +216 -270
- package/contracts/instance/InstanceAuthorizationV3.sol +194 -0
- package/contracts/instance/InstanceReader.sol +137 -34
- package/contracts/instance/InstanceService.sol +98 -126
- package/contracts/instance/InstanceServiceManager.sol +8 -13
- package/contracts/instance/InstanceStore.sol +23 -5
- package/contracts/instance/base/ObjectLifecycle.sol +111 -0
- package/contracts/instance/base/{ObjectManager.sol → ObjectSet.sol} +11 -12
- package/contracts/instance/module/IBundle.sol +1 -1
- package/contracts/instance/module/IComponents.sol +10 -11
- package/contracts/instance/module/IDistribution.sol +0 -1
- package/contracts/instance/module/IPolicy.sol +24 -24
- package/contracts/mock/Dip.sol +1 -1
- package/contracts/oracle/BasicOracle.sol +47 -0
- package/contracts/oracle/BasicOracleAuthorization.sol +46 -0
- package/contracts/oracle/IOracle.sol +16 -0
- package/contracts/oracle/IOracleComponent.sol +2 -1
- package/contracts/oracle/IOracleService.sol +2 -1
- package/contracts/oracle/Oracle.sol +64 -53
- package/contracts/oracle/OracleService.sol +47 -34
- package/contracts/oracle/OracleServiceManager.sol +8 -11
- package/contracts/pool/BasicPool.sol +154 -0
- package/contracts/pool/BasicPoolAuthorization.sol +57 -0
- package/contracts/pool/BundleService.sol +267 -70
- package/contracts/pool/BundleServiceManager.sol +8 -11
- package/contracts/pool/IBundleService.sol +42 -5
- package/contracts/pool/IPoolComponent.sol +24 -68
- package/contracts/pool/IPoolService.sol +56 -39
- package/contracts/pool/Pool.sol +184 -148
- package/contracts/pool/PoolService.sol +256 -164
- package/contracts/pool/PoolServiceManager.sol +6 -9
- package/contracts/product/ApplicationService.sol +70 -65
- package/contracts/product/ApplicationServiceManager.sol +6 -6
- package/contracts/product/BasicProduct.sol +53 -0
- package/contracts/product/BasicProductAuthorization.sol +42 -0
- package/contracts/product/ClaimService.sol +316 -146
- package/contracts/product/ClaimServiceManager.sol +6 -6
- package/contracts/product/IApplicationService.sol +1 -0
- package/contracts/product/IClaimService.sol +31 -7
- package/contracts/product/IPolicyService.sol +34 -32
- package/contracts/product/IPricingService.sol +10 -10
- package/contracts/product/IProductComponent.sol +26 -9
- package/contracts/product/{IProductService.sol → IRiskService.sol} +1 -1
- package/contracts/product/PolicyService.sol +419 -203
- package/contracts/product/PolicyServiceManager.sol +6 -9
- package/contracts/product/PricingService.sol +54 -54
- package/contracts/product/PricingServiceManager.sol +5 -8
- package/contracts/product/Product.sol +211 -133
- package/contracts/product/{ProductService.sol → RiskService.sol} +13 -41
- package/contracts/product/RiskServiceManager.sol +39 -0
- package/contracts/registry/ChainNft.sol +68 -38
- package/contracts/registry/IRegistry.sol +69 -22
- package/contracts/registry/IRegistryService.sol +3 -10
- package/contracts/registry/ITransferInterceptor.sol +1 -2
- package/contracts/registry/Registry.sol +354 -219
- package/contracts/registry/RegistryAdmin.sol +244 -129
- package/contracts/registry/RegistryService.sol +39 -64
- package/contracts/registry/RegistryServiceManager.sol +4 -4
- package/contracts/registry/ReleaseLifecycle.sol +30 -0
- package/contracts/registry/ReleaseRegistry.sol +501 -0
- package/contracts/registry/ServiceAuthorizationV3.sol +23 -29
- package/contracts/registry/TokenRegistry.sol +2 -2
- package/contracts/shared/Component.sol +47 -63
- package/contracts/shared/ComponentService.sol +314 -186
- package/contracts/shared/ComponentServiceManager.sol +10 -7
- package/contracts/shared/ComponentVerifyingService.sol +24 -15
- package/contracts/shared/ContractLib.sol +38 -0
- package/contracts/shared/IComponent.sol +10 -6
- package/contracts/shared/IComponentService.sol +38 -20
- package/contracts/shared/IInstanceLinkedComponent.sol +11 -16
- package/contracts/shared/IKeyValueStore.sol +1 -0
- package/contracts/shared/ILifecycle.sol +3 -2
- package/contracts/shared/INftOwnable.sol +2 -0
- package/contracts/shared/IPolicyHolder.sol +12 -22
- package/contracts/shared/IRegisterable.sol +11 -0
- package/contracts/shared/IService.sol +1 -1
- package/contracts/shared/{ERC165.sol → InitializableERC165.sol} +3 -3
- package/contracts/shared/InstanceLinkedComponent.sol +106 -37
- package/contracts/shared/KeyValueStore.sol +7 -3
- package/contracts/shared/Lifecycle.sol +30 -72
- package/contracts/shared/{NftIdSetManager.sol → NftIdSet.sol} +1 -1
- package/contracts/shared/NftOwnable.sol +29 -9
- package/contracts/shared/PolicyHolder.sol +17 -57
- package/contracts/shared/Registerable.sol +19 -9
- package/contracts/shared/RegistryLinked.sol +3 -2
- package/contracts/shared/Service.sol +23 -22
- package/contracts/shared/TokenHandler.sol +100 -19
- package/contracts/shared/TokenHandlerDeployerLib.sol +12 -0
- package/contracts/staking/IStaking.sol +3 -3
- package/contracts/staking/IStakingService.sol +12 -8
- package/contracts/staking/StakeManagerLib.sol +18 -25
- package/contracts/staking/Staking.sol +29 -45
- package/contracts/staking/StakingLifecycle.sol +23 -0
- package/contracts/staking/StakingManager.sol +10 -12
- package/contracts/staking/StakingReader.sol +23 -20
- package/contracts/staking/StakingService.sol +25 -29
- package/contracts/staking/StakingServiceManager.sol +4 -4
- package/contracts/staking/StakingStore.sol +15 -23
- package/contracts/staking/TargetManagerLib.sol +7 -3
- package/contracts/type/Amount.sol +27 -5
- package/contracts/type/Blocknumber.sol +7 -1
- package/contracts/type/ClaimId.sol +6 -1
- package/contracts/type/NftId.sol +1 -0
- package/contracts/type/ObjectType.sol +53 -18
- package/contracts/type/PayoutId.sol +10 -10
- package/contracts/type/Referral.sol +1 -0
- package/contracts/type/RiskId.sol +15 -1
- package/contracts/type/RoleId.sol +55 -94
- package/contracts/type/Seconds.sol +21 -1
- package/contracts/type/StateId.sol +15 -1
- package/contracts/type/Timestamp.sol +11 -1
- package/contracts/type/UFixed.sol +38 -9
- package/contracts/type/Version.sol +3 -1
- package/contracts/{shared → upgradeability}/ProxyManager.sol +71 -38
- package/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol +1 -3
- package/contracts/{shared → upgradeability}/Versionable.sol +2 -2
- package/package.json +7 -3
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +0 -4
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +0 -709
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +0 -228
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +0 -187
- 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/registry/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +0 -4
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +0 -4
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +0 -1218
- package/artifacts/contracts/registry/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +0 -4
- package/artifacts/contracts/registry/ServiceAuthorization.sol/ServiceAuthorization.json +0 -171
- package/artifacts/contracts/shared/AccessAdmin.sol/AccessAdmin.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessAdmin.sol/AccessAdmin.json +0 -1559
- package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.json +0 -1747
- package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.json +0 -1760
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.json +0 -1838
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +0 -1856
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +0 -73
- package/artifacts/contracts/shared/IAccessAdmin.sol/IAccessAdmin.dbg.json +0 -4
- package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.dbg.json +0 -4
- package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.json +0 -1562
- package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.dbg.json +0 -4
- package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.json +0 -1600
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +0 -4
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
- package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.dbg.json +0 -4
- package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.json +0 -306
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +0 -4
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +0 -617
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +0 -4
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +0 -129
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +0 -4
- package/contracts/instance/InstanceAuthorizationsLib.sol +0 -377
- package/contracts/product/ProductServiceManager.sol +0 -42
- package/contracts/registry/ReleaseManager.sol +0 -527
- package/contracts/shared/AccessManagerCustom.sol +0 -741
- package/contracts/shared/AccessManagerExtended.sol +0 -481
- package/contracts/shared/AccessManagerExtendedInitializeable.sol +0 -13
- package/contracts/shared/AccessManagerExtendedWithDisable.sol +0 -137
- package/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol +0 -14
- package/contracts/shared/IAccessManagerExtended.sol +0 -74
- package/contracts/shared/IAccessManagerExtendedWithDisable.sol +0 -18
- package/contracts/shared/InitializableCustom.sol +0 -177
- /package/contracts/{shared → upgradeability}/IVersionable.sol +0 -0
@@ -1,46 +1,29 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {Pool} from "./Pool.sol";
|
5
|
-
import {IRegistry} from "../registry/IRegistry.sol";
|
6
|
-
import {IInstance} from "../instance/IInstance.sol";
|
7
4
|
import {IBundle} from "../instance/module/IBundle.sol";
|
5
|
+
import {IBundleService} from "./IBundleService.sol";
|
8
6
|
import {IComponents} from "../instance/module/IComponents.sol";
|
7
|
+
import {IComponentService} from "../shared/IComponentService.sol";
|
8
|
+
import {IInstance} from "../instance/IInstance.sol";
|
9
9
|
import {IPolicy} from "../instance/module/IPolicy.sol";
|
10
|
-
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
10
|
+
import {IProductComponent} from "../product/IProductComponent.sol";
|
11
|
+
import {IPoolService} from "./IPoolService.sol";
|
12
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
13
|
+
import {IStaking} from "../staking/IStaking.sol";
|
14
14
|
|
15
15
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
16
|
+
import {ClaimId} from "../type/ClaimId.sol";
|
16
17
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
17
|
-
import {NftId
|
18
|
-
import {ObjectType, POOL, BUNDLE,
|
19
|
-
import {PUBLIC_ROLE, POOL_OWNER_ROLE, POLICY_SERVICE_ROLE, RoleId} from "../type/RoleId.sol";
|
18
|
+
import {NftId} from "../type/NftId.sol";
|
19
|
+
import {ObjectType, POOL, BUNDLE, PRODUCT, POLICY, COMPONENT} from "../type/ObjectType.sol";
|
20
20
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
21
|
-
import {
|
22
|
-
import {KEEP_STATE, StateId} from "../type/StateId.sol";
|
21
|
+
import {KEEP_STATE} from "../type/StateId.sol";
|
23
22
|
import {Seconds} from "../type/Seconds.sol";
|
24
|
-
import {TimestampLib, zeroTimestamp} from "../type/Timestamp.sol";
|
25
|
-
import {TokenHandler} from "../shared/TokenHandler.sol";
|
26
23
|
import {UFixed} from "../type/UFixed.sol";
|
27
|
-
import {Version, VersionLib} from "../type/Version.sol";
|
28
|
-
|
29
|
-
import {IService} from "../shared/IService.sol";
|
30
|
-
import {Service} from "../shared/Service.sol";
|
31
|
-
import {BundleManager} from "../instance/BundleManager.sol";
|
32
24
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
33
|
-
import {IBundleService} from "./IBundleService.sol";
|
34
|
-
import {IComponentService} from "../shared/IComponentService.sol";
|
35
|
-
import {IInstanceService} from "../instance/IInstanceService.sol";
|
36
|
-
import {IPoolService} from "./IPoolService.sol";
|
37
|
-
import {IRegistryService} from "../registry/IRegistryService.sol";
|
38
|
-
import {IStaking} from "../staking/IStaking.sol";
|
39
|
-
import {InstanceService} from "../instance/InstanceService.sol";
|
40
25
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
41
26
|
import {InstanceStore} from "../instance/InstanceStore.sol";
|
42
|
-
import {IComponent} from "../shared/IComponent.sol";
|
43
|
-
import {IPoolComponent} from "./IPoolComponent.sol";
|
44
27
|
|
45
28
|
string constant POOL_SERVICE_NAME = "PoolService";
|
46
29
|
|
@@ -48,14 +31,8 @@ contract PoolService is
|
|
48
31
|
ComponentVerifyingService,
|
49
32
|
IPoolService
|
50
33
|
{
|
51
|
-
using NftIdLib for NftId;
|
52
|
-
using AmountLib for Amount;
|
53
|
-
|
54
34
|
IBundleService internal _bundleService;
|
55
35
|
IComponentService internal _componentService;
|
56
|
-
IInstanceService private _instanceService;
|
57
|
-
IRegistryService private _registryService;
|
58
|
-
|
59
36
|
IStaking private _staking;
|
60
37
|
|
61
38
|
function _initialize(
|
@@ -63,191 +40,292 @@ contract PoolService is
|
|
63
40
|
bytes memory data
|
64
41
|
)
|
65
42
|
internal
|
66
|
-
initializer
|
67
43
|
virtual override
|
44
|
+
initializer()
|
68
45
|
{
|
69
46
|
(
|
70
|
-
address registryAddress
|
71
|
-
//address managerAddress
|
47
|
+
address registryAddress,
|
72
48
|
address authority
|
73
|
-
) = abi.decode(data, (address, address
|
49
|
+
) = abi.decode(data, (address, address));
|
74
50
|
|
75
|
-
|
51
|
+
_initializeService(registryAddress, authority, owner);
|
76
52
|
|
77
|
-
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
|
78
53
|
_bundleService = IBundleService(_getServiceAddress(BUNDLE()));
|
79
|
-
_instanceService = IInstanceService(_getServiceAddress(INSTANCE()));
|
80
54
|
_componentService = IComponentService(_getServiceAddress(COMPONENT()));
|
81
|
-
|
82
55
|
_staking = IStaking(getRegistry().getStakingAddress());
|
83
56
|
|
84
|
-
|
57
|
+
_registerInterface(type(IPoolService).interfaceId);
|
85
58
|
}
|
86
59
|
|
87
60
|
|
88
|
-
|
61
|
+
/// @inheritdoc IPoolService
|
62
|
+
function setMaxBalanceAmount(Amount maxBalanceAmount)
|
89
63
|
external
|
90
64
|
virtual
|
91
65
|
{
|
92
|
-
/*
|
93
66
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
94
67
|
InstanceReader instanceReader = instance.getInstanceReader();
|
68
|
+
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
95
69
|
|
96
|
-
|
97
|
-
|
98
|
-
Amount previousMaxCapitalAmount = poolInfo.maxCapitalAmount;
|
99
|
-
|
100
|
-
poolInfo.maxCapitalAmount = maxCapitalAmount;
|
70
|
+
Amount previousMaxBalanceAmount = poolInfo.maxBalanceAmount;
|
71
|
+
poolInfo.maxBalanceAmount = maxBalanceAmount;
|
101
72
|
instance.getInstanceStore().updatePool(poolNftId, poolInfo, KEEP_STATE());
|
102
73
|
|
103
|
-
emit
|
104
|
-
*/
|
74
|
+
emit LogPoolServiceMaxBalanceAmountUpdated(poolNftId, previousMaxBalanceAmount, maxBalanceAmount);
|
105
75
|
}
|
106
76
|
|
107
|
-
|
77
|
+
|
78
|
+
/// @inheritdoc IPoolService
|
79
|
+
function createBundle(
|
80
|
+
address bundleOwner, // initial bundle owner
|
81
|
+
Fee memory fee, // fees deducted from premium that go to bundle owner
|
82
|
+
Seconds lifetime, // initial duration for which new policies are covered
|
83
|
+
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
84
|
+
)
|
85
|
+
external
|
86
|
+
virtual
|
87
|
+
returns(NftId bundleNftId)
|
88
|
+
{
|
89
|
+
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
90
|
+
|
91
|
+
// create the empty bundle
|
92
|
+
bundleNftId = _bundleService.create(
|
93
|
+
instance,
|
94
|
+
poolNftId,
|
95
|
+
bundleOwner,
|
96
|
+
fee,
|
97
|
+
AmountLib.zero(),
|
98
|
+
lifetime,
|
99
|
+
filter);
|
100
|
+
|
101
|
+
emit LogPoolServiceBundleCreated(instance.getNftId(), poolNftId, bundleNftId);
|
102
|
+
}
|
103
|
+
|
104
|
+
|
105
|
+
function closeBundle(NftId bundleNftId)
|
108
106
|
external
|
109
107
|
virtual
|
110
108
|
{
|
109
|
+
_checkNftType(bundleNftId, BUNDLE());
|
110
|
+
|
111
111
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
112
|
-
InstanceReader instanceReader = instance.getInstanceReader();
|
113
112
|
|
114
|
-
|
115
|
-
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
113
|
+
// TODO get performance fee for pool (#477)
|
116
114
|
|
117
|
-
//
|
118
|
-
|
119
|
-
revert ErrorPoolServiceBundleOwnerRoleAlreadySet(poolNftId);
|
120
|
-
}
|
115
|
+
// releasing collateral in bundle
|
116
|
+
(Amount unstakedAmount, Amount feeAmount) = _bundleService.close(instance, bundleNftId);
|
121
117
|
|
122
|
-
|
123
|
-
|
118
|
+
_componentService.decreasePoolBalance(
|
119
|
+
instance.getInstanceStore(),
|
120
|
+
poolNftId,
|
121
|
+
unstakedAmount + feeAmount,
|
122
|
+
AmountLib.zero());
|
123
|
+
|
124
|
+
emit LogPoolServiceBundleClosed(instance.getNftId(), poolNftId, bundleNftId);
|
124
125
|
|
125
|
-
|
126
|
+
if ((unstakedAmount + feeAmount).gtz()){
|
127
|
+
IComponents.ComponentInfo memory poolComponentInfo = instance.getInstanceReader().getComponentInfo(poolNftId);
|
128
|
+
poolComponentInfo.tokenHandler.distributeTokens(
|
129
|
+
poolComponentInfo.wallet,
|
130
|
+
getRegistry().ownerOf(bundleNftId),
|
131
|
+
unstakedAmount + feeAmount);
|
132
|
+
}
|
126
133
|
}
|
127
134
|
|
128
135
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
136
|
+
/// @inheritdoc IPoolService
|
137
|
+
function processFundedClaim(
|
138
|
+
NftId policyNftId,
|
139
|
+
ClaimId claimId,
|
140
|
+
Amount availableAmount
|
141
|
+
)
|
134
142
|
external
|
135
143
|
virtual
|
136
144
|
{
|
145
|
+
_checkNftType(policyNftId, POLICY());
|
146
|
+
|
137
147
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
148
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
149
|
+
NftId productNftId = _getProductNftId(poolNftId);
|
150
|
+
|
151
|
+
// check policy matches with calling pool
|
152
|
+
IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
153
|
+
if(policyInfo.productNftId != productNftId) {
|
154
|
+
revert ErrorPoolServicePolicyPoolMismatch(
|
155
|
+
policyNftId,
|
156
|
+
policyInfo.productNftId,
|
157
|
+
productNftId);
|
158
|
+
}
|
138
159
|
|
139
|
-
|
140
|
-
poolInfo.poolFee = poolFee;
|
141
|
-
poolInfo.stakingFee = stakingFee;
|
142
|
-
poolInfo.performanceFee = performanceFee;
|
160
|
+
emit LogPoolServiceProcessFundedClaim(policyNftId, claimId, availableAmount);
|
143
161
|
|
144
|
-
|
145
|
-
|
146
|
-
|
162
|
+
// callback to product component if applicable
|
163
|
+
if (instanceReader.getProductInfo(productNftId).isProcessingFundedClaims) {
|
164
|
+
address productAddress = getRegistry().getObjectAddress(productNftId);
|
165
|
+
IProductComponent(productAddress).processFundedClaim(policyNftId, claimId, availableAmount);
|
166
|
+
}
|
147
167
|
}
|
148
168
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
|
153
|
-
Seconds lifetime, // initial duration for which new policies are covered
|
154
|
-
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
155
|
-
)
|
169
|
+
|
170
|
+
/// @inheritdoc IPoolService
|
171
|
+
function stake(NftId bundleNftId, Amount amount)
|
156
172
|
external
|
157
173
|
virtual
|
158
|
-
|
174
|
+
// TODO: restricted() (once #462 is done)
|
175
|
+
returns(Amount netAmount)
|
159
176
|
{
|
177
|
+
_checkNftType(bundleNftId, BUNDLE());
|
178
|
+
|
160
179
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
161
180
|
InstanceReader instanceReader = instance.getInstanceReader();
|
181
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
182
|
+
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
162
183
|
|
163
|
-
(
|
164
|
-
|
165
|
-
|
166
|
-
) = FeeLib.calculateFee(
|
167
|
-
_getStakingFee(instanceReader, poolNftId),
|
168
|
-
stakingAmount);
|
184
|
+
if (bundleInfo.poolNftId != poolNftId) {
|
185
|
+
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
186
|
+
}
|
169
187
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
188
|
+
{
|
189
|
+
Amount currentPoolBalance = instanceReader.getBalanceAmount(poolNftId);
|
190
|
+
if (currentPoolBalance + amount > poolInfo.maxBalanceAmount) {
|
191
|
+
revert ErrorPoolServiceMaxBalanceAmountExceeded(poolNftId, poolInfo.maxBalanceAmount, currentPoolBalance, amount);
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
// calculate fees
|
196
|
+
IRegistry registry = getRegistry();
|
197
|
+
Amount feeAmount;
|
198
|
+
|
199
|
+
{
|
200
|
+
NftId productNftId = registry.getObjectInfo(poolNftId).parentNftId;
|
201
|
+
Fee memory stakingFee = instanceReader.getProductInfo(productNftId).stakingFee;
|
202
|
+
(
|
203
|
+
feeAmount,
|
204
|
+
netAmount
|
205
|
+
) = FeeLib.calculateFee(
|
206
|
+
stakingFee,
|
207
|
+
amount);
|
208
|
+
}
|
178
209
|
|
179
|
-
//
|
210
|
+
// do all the bookkeeping
|
180
211
|
_componentService.increasePoolBalance(
|
181
212
|
instance.getInstanceStore(),
|
182
213
|
poolNftId,
|
183
|
-
|
184
|
-
|
214
|
+
netAmount,
|
215
|
+
feeAmount);
|
185
216
|
|
186
|
-
|
217
|
+
_bundleService.stake(instance, bundleNftId, netAmount);
|
218
|
+
|
219
|
+
// collect tokens from bundle owner
|
220
|
+
address bundleOwner = registry.ownerOf(bundleNftId);
|
221
|
+
emit LogPoolServiceBundleStaked(instance.getNftId(), poolNftId, bundleNftId, amount, netAmount);
|
222
|
+
|
223
|
+
// TODO only collect staking token when pool is not externally managed
|
187
224
|
_collectStakingAmount(
|
188
225
|
instanceReader,
|
189
226
|
poolNftId,
|
190
227
|
bundleOwner,
|
191
|
-
|
192
|
-
|
193
|
-
emit LogPoolServiceBundleCreated(instance.getNftId(), poolNftId, bundleNftId);
|
228
|
+
amount);
|
194
229
|
}
|
195
230
|
|
196
|
-
|
197
|
-
|
231
|
+
/// @inheritdoc IPoolService
|
232
|
+
function unstake(NftId bundleNftId, Amount amount)
|
233
|
+
external
|
198
234
|
virtual
|
199
|
-
|
200
|
-
returns
|
235
|
+
// TODO: restricted() (once #462 is done)
|
236
|
+
returns(Amount netAmount)
|
201
237
|
{
|
202
|
-
|
203
|
-
|
238
|
+
_checkNftType(bundleNftId, BUNDLE());
|
239
|
+
|
240
|
+
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
241
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
242
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
243
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
244
|
+
|
245
|
+
if (bundleInfo.poolNftId != poolNftId) {
|
246
|
+
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
247
|
+
}
|
248
|
+
|
249
|
+
// call bundle service for bookkeeping and additional checks
|
250
|
+
Amount unstakedAmount = _bundleService.unstake(instance, bundleNftId, amount);
|
251
|
+
|
252
|
+
// Important: from now on work only with unstakedAmount as it is the only reliable amount.
|
253
|
+
// if amount was max, this was set to the available amount
|
254
|
+
|
255
|
+
// TODO: handle performance fees (issue #477)
|
256
|
+
|
257
|
+
// update pool bookkeeping - performance fees stay in the pool, but as fees
|
258
|
+
_componentService.decreasePoolBalance(
|
259
|
+
instanceStore,
|
260
|
+
poolNftId,
|
261
|
+
unstakedAmount,
|
262
|
+
AmountLib.zero());
|
263
|
+
|
264
|
+
IComponents.ComponentInfo memory poolComponentInfo = instanceReader.getComponentInfo(poolNftId);
|
265
|
+
|
266
|
+
// transfer amount to bundle owner
|
267
|
+
address owner = getRegistry().ownerOf(bundleNftId);
|
268
|
+
emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount);
|
269
|
+
poolComponentInfo.tokenHandler.distributeTokens(
|
270
|
+
poolComponentInfo.wallet,
|
271
|
+
owner,
|
272
|
+
unstakedAmount);
|
273
|
+
|
274
|
+
return unstakedAmount;
|
204
275
|
}
|
205
276
|
|
206
|
-
|
277
|
+
|
278
|
+
function fundPoolWallet(NftId poolNftId, Amount amount)
|
207
279
|
external
|
208
280
|
virtual
|
281
|
+
restricted()
|
209
282
|
{
|
210
|
-
(
|
211
|
-
|
212
|
-
// TODO
|
283
|
+
_checkNftType(poolNftId, POOL());
|
284
|
+
// TODO check that poolNftId is externally managed
|
285
|
+
// TODO implement
|
286
|
+
}
|
213
287
|
|
214
|
-
// releasing collateral in bundle
|
215
|
-
_bundleService.close(instance, bundleNftId);
|
216
288
|
|
217
|
-
|
289
|
+
function defundPoolWallet(NftId poolNftId, Amount amount)
|
290
|
+
external
|
291
|
+
virtual
|
292
|
+
restricted()
|
293
|
+
{
|
294
|
+
_checkNftType(poolNftId, POOL());
|
218
295
|
|
219
|
-
|
296
|
+
// TODO check that poolNftId is externally managed
|
297
|
+
// TODO implement
|
220
298
|
}
|
221
299
|
|
222
|
-
|
223
300
|
function processSale(
|
224
301
|
NftId bundleNftId,
|
225
|
-
IPolicy.
|
302
|
+
IPolicy.PremiumInfo memory premium
|
226
303
|
)
|
227
304
|
external
|
228
305
|
virtual
|
229
306
|
restricted()
|
230
307
|
{
|
308
|
+
_checkNftType(bundleNftId, BUNDLE());
|
309
|
+
|
231
310
|
IRegistry registry = getRegistry();
|
232
|
-
IRegistry.ObjectInfo memory
|
233
|
-
IRegistry.ObjectInfo memory
|
234
|
-
|
235
|
-
IInstance instance = IInstance(instanceObjectInfo.objectAddress);
|
311
|
+
IRegistry.ObjectInfo memory bundleInfo = registry.getObjectInfo(bundleNftId);
|
312
|
+
IRegistry.ObjectInfo memory poolInfo = registry.getObjectInfo(bundleInfo.parentNftId);
|
313
|
+
IInstance instance = _getInstanceForComponent(registry, poolInfo);
|
236
314
|
|
237
|
-
Amount poolFeeAmount =
|
238
|
-
Amount bundleFeeAmount =
|
239
|
-
Amount bundleNetAmount =
|
315
|
+
Amount poolFeeAmount = premium.poolFeeFixAmount + premium.poolFeeVarAmount;
|
316
|
+
Amount bundleFeeAmount = premium.bundleFeeFixAmount + premium.bundleFeeVarAmount;
|
317
|
+
Amount bundleNetAmount = premium.netPremiumAmount;
|
240
318
|
|
241
319
|
InstanceStore instanceStore = instance.getInstanceStore();
|
242
320
|
_componentService.increasePoolBalance(
|
243
321
|
instanceStore,
|
244
|
-
|
322
|
+
poolInfo.nftId,
|
245
323
|
bundleNetAmount + bundleFeeAmount,
|
246
324
|
poolFeeAmount);
|
247
325
|
|
248
326
|
_componentService.increaseBundleBalance(
|
249
327
|
instanceStore,
|
250
|
-
|
328
|
+
bundleInfo.nftId,
|
251
329
|
bundleNetAmount,
|
252
330
|
bundleFeeAmount);
|
253
331
|
}
|
@@ -265,13 +343,17 @@ contract PoolService is
|
|
265
343
|
virtual
|
266
344
|
restricted()
|
267
345
|
returns (
|
268
|
-
Amount
|
269
|
-
Amount
|
346
|
+
Amount totalCollateralAmount,
|
347
|
+
Amount localCollateralAmount
|
270
348
|
)
|
271
349
|
{
|
350
|
+
_checkNftType(productNftId, PRODUCT());
|
351
|
+
_checkNftType(applicationNftId, POLICY());
|
352
|
+
_checkNftType(bundleNftId, BUNDLE());
|
353
|
+
|
272
354
|
(
|
273
|
-
|
274
|
-
|
355
|
+
totalCollateralAmount,
|
356
|
+
localCollateralAmount
|
275
357
|
) = calculateRequiredCollateral(
|
276
358
|
instance.getInstanceReader(),
|
277
359
|
productNftId,
|
@@ -289,16 +371,9 @@ contract PoolService is
|
|
289
371
|
instance.getNftId(),
|
290
372
|
token,
|
291
373
|
totalCollateralAmount);
|
292
|
-
|
293
|
-
// hierarhical riskpool setup
|
294
|
-
// TODO loop in with pool component to guarantee availability of external capital
|
295
|
-
if(totalCollateralAmount > localCollateralAmount) {
|
296
|
-
|
297
|
-
}
|
298
374
|
}
|
299
375
|
|
300
|
-
|
301
|
-
function reduceCollateral(
|
376
|
+
function processPayout(
|
302
377
|
IInstance instance,
|
303
378
|
address token,
|
304
379
|
NftId policyNftId,
|
@@ -309,6 +384,24 @@ contract PoolService is
|
|
309
384
|
virtual
|
310
385
|
restricted()
|
311
386
|
{
|
387
|
+
_checkNftType(policyNftId, POLICY());
|
388
|
+
|
389
|
+
NftId bundleNftId = policyInfo.bundleNftId;
|
390
|
+
NftId poolNftId = getRegistry().getObjectInfo(bundleNftId).parentNftId;
|
391
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
392
|
+
|
393
|
+
_componentService.decreasePoolBalance(
|
394
|
+
instanceStore,
|
395
|
+
poolNftId,
|
396
|
+
payoutAmount,
|
397
|
+
AmountLib.zero());
|
398
|
+
|
399
|
+
_componentService.decreaseBundleBalance(
|
400
|
+
instanceStore,
|
401
|
+
bundleNftId,
|
402
|
+
payoutAmount,
|
403
|
+
AmountLib.zero());
|
404
|
+
|
312
405
|
_bundleService.releaseCollateral(
|
313
406
|
instance,
|
314
407
|
policyNftId,
|
@@ -335,6 +428,8 @@ contract PoolService is
|
|
335
428
|
virtual
|
336
429
|
restricted()
|
337
430
|
{
|
431
|
+
_checkNftType(policyNftId, POLICY());
|
432
|
+
|
338
433
|
Amount remainingCollateralAmount = policyInfo.sumInsuredAmount - policyInfo.claimAmount;
|
339
434
|
|
340
435
|
_bundleService.releaseCollateral(
|
@@ -363,16 +458,18 @@ contract PoolService is
|
|
363
458
|
public
|
364
459
|
view
|
365
460
|
returns(
|
366
|
-
Amount
|
367
|
-
Amount
|
461
|
+
Amount totalCollateralAmount,
|
462
|
+
Amount localCollateralAmount
|
368
463
|
)
|
369
464
|
{
|
465
|
+
_checkNftType(productNftId, PRODUCT());
|
466
|
+
|
370
467
|
NftId poolNftId = instanceReader.getProductInfo(productNftId).poolNftId;
|
371
468
|
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
372
469
|
|
373
470
|
(
|
374
|
-
|
375
|
-
|
471
|
+
totalCollateralAmount,
|
472
|
+
localCollateralAmount
|
376
473
|
) = calculateRequiredCollateral(
|
377
474
|
poolInfo.collateralizationLevel,
|
378
475
|
poolInfo.retentionLevel,
|
@@ -388,18 +485,17 @@ contract PoolService is
|
|
388
485
|
public
|
389
486
|
pure
|
390
487
|
returns(
|
391
|
-
Amount
|
392
|
-
Amount
|
488
|
+
Amount totalCollateralAmount,
|
489
|
+
Amount localCollateralAmount
|
393
490
|
)
|
394
491
|
{
|
395
|
-
//
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
//
|
400
|
-
|
401
|
-
|
402
|
-
totalCollateralAmount = localCollateralAmount;
|
492
|
+
// collateralization is applied to sum insured
|
493
|
+
UFixed totalUFixed = collateralizationLevel * sumInsuredAmount.toUFixed();
|
494
|
+
totalCollateralAmount = AmountLib.toAmount(totalUFixed.toInt());
|
495
|
+
|
496
|
+
// retention level defines how much capital is required locally
|
497
|
+
localCollateralAmount = AmountLib.toAmount(
|
498
|
+
(retentionLevel * totalUFixed).toInt());
|
403
499
|
}
|
404
500
|
|
405
501
|
|
@@ -408,6 +504,7 @@ contract PoolService is
|
|
408
504
|
Amount stakingAmount
|
409
505
|
)
|
410
506
|
internal
|
507
|
+
pure
|
411
508
|
returns (Amount stakingNetAmount)
|
412
509
|
{
|
413
510
|
stakingNetAmount = stakingAmount;
|
@@ -422,7 +519,6 @@ contract PoolService is
|
|
422
519
|
}
|
423
520
|
|
424
521
|
|
425
|
-
// TODO create (I)TreasuryService that deals with all gif related token transfers
|
426
522
|
/// @dev transfers the specified amount from the bundle owner to the pool's wallet
|
427
523
|
function _collectStakingAmount(
|
428
524
|
InstanceReader instanceReader,
|
@@ -435,15 +531,11 @@ contract PoolService is
|
|
435
531
|
|
436
532
|
// collecting investor token
|
437
533
|
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
438
|
-
TokenHandler tokenHandler = componentInfo.tokenHandler;
|
439
534
|
address poolWallet = componentInfo.wallet;
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
poolWallet,
|
445
|
-
amount);
|
446
|
-
}
|
535
|
+
componentInfo.tokenHandler.collectTokens(
|
536
|
+
bundleOwner,
|
537
|
+
poolWallet,
|
538
|
+
amount);
|
447
539
|
}
|
448
540
|
|
449
541
|
function _getDomain() internal pure override returns(ObjectType) {
|
@@ -1,12 +1,9 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IVersionable} from "../
|
5
|
-
import {ProxyManager} from "../
|
4
|
+
import {IVersionable} from "../upgradeability/IVersionable.sol";
|
5
|
+
import {ProxyManager} from "../upgradeability/ProxyManager.sol";
|
6
6
|
import {PoolService} from "./PoolService.sol";
|
7
|
-
import {Registry} from "../registry/Registry.sol";
|
8
|
-
import {RegistryService} from "../registry/RegistryService.sol";
|
9
|
-
import {REGISTRY} from "../type/ObjectType.sol";
|
10
7
|
|
11
8
|
contract PoolServiceManager is ProxyManager {
|
12
9
|
|
@@ -15,14 +12,14 @@ contract PoolServiceManager is ProxyManager {
|
|
15
12
|
/// @dev initializes proxy manager with pool service implementation
|
16
13
|
constructor(
|
17
14
|
address authority,
|
18
|
-
address
|
15
|
+
address registry,
|
19
16
|
bytes32 salt
|
20
17
|
)
|
21
|
-
ProxyManager(registryAddress)
|
22
18
|
{
|
23
19
|
PoolService poolSrv = new PoolService{salt: salt}();
|
24
|
-
bytes memory data = abi.encode(
|
25
|
-
IVersionable versionable =
|
20
|
+
bytes memory data = abi.encode(registry, authority);
|
21
|
+
IVersionable versionable = initialize(
|
22
|
+
registry,
|
26
23
|
address(poolSrv),
|
27
24
|
data,
|
28
25
|
salt);
|