@etherisc/gif-next 0.0.2-c4ddbb7-673 → 0.0.2-c5049d4-401
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +33 -52
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +2 -2
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +0 -19
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +2 -2
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +42 -248
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +2 -2
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +0 -222
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +134 -286
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +84 -120
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +0 -37
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +49 -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 +1463 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +410 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +1936 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +414 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1411 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1171 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1517 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +1978 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +10 -99
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +97 -100
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +14 -14
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +238 -118
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +39 -146
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +61 -81
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +215 -209
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.json +2 -2
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +32 -238
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +2 -2
- 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 +0 -37
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +0 -222
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +37 -144
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +60 -80
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +12 -284
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +16 -16
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +268 -201
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +113 -97
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +125 -23
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +2 -95
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +220 -100
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +2 -280
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +269 -248
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +66 -82
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +36 -162
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +57 -89
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +3 -225
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +2 -2
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +206 -175
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +92 -100
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +5 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +114 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +253 -119
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +43 -43
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +0 -37
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
- package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +2 -2
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +358 -315
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +104 -100
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +115 -267
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +80 -120
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +3 -225
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +588 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +682 -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 +221 -21
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +419 -82
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +243 -131
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +23 -130
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +52 -72
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +24 -14
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +0 -211
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +89 -212
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +96 -114
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +5 -112
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +92 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +0 -26
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +0 -37
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +14 -46
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -22
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +0 -222
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +6 -57
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +18 -140
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +8 -97
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +5 -112
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +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 +27 -27
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +63 -93
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +85 -262
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +77 -88
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +6 -6
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +31 -138
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +56 -76
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +84 -84
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +54 -23
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/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 +2 -2
- 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/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 +2 -2
- 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 +50 -2
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +23 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +39 -70
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/authorization/AccessAdmin.sol +25 -24
- package/contracts/authorization/Authorization.sol +0 -1
- package/contracts/authorization/IAccessAdmin.sol +0 -1
- package/contracts/distribution/Distribution.sol +1 -1
- package/contracts/distribution/DistributionService.sol +31 -32
- package/contracts/distribution/DistributionServiceManager.sol +6 -6
- package/contracts/distribution/IDistributionService.sol +9 -5
- package/contracts/examples/fire/DamageLevel.sol +56 -0
- package/contracts/examples/fire/FirePool.sol +75 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
- package/contracts/examples/fire/FireProduct.sol +390 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +39 -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 +23 -4
- package/contracts/instance/InstanceAuthorizationV3.sol +3 -3
- package/contracts/instance/InstanceReader.sol +32 -7
- package/contracts/instance/InstanceService.sol +62 -39
- package/contracts/instance/InstanceServiceManager.sol +6 -7
- package/contracts/instance/InstanceStore.sol +11 -1
- package/contracts/instance/base/ObjectLifecycle.sol +9 -4
- package/contracts/instance/module/IBundle.sol +1 -1
- package/contracts/instance/module/IComponents.sol +1 -6
- package/contracts/instance/module/IPolicy.sol +22 -22
- package/contracts/mock/Dip.sol +1 -1
- package/contracts/oracle/Oracle.sol +2 -1
- package/contracts/oracle/OracleService.sol +9 -6
- package/contracts/oracle/OracleServiceManager.sol +6 -6
- package/contracts/pool/BasicPool.sol +7 -5
- package/contracts/pool/BasicPoolAuthorization.sol +5 -2
- package/contracts/pool/BundleService.sol +142 -45
- package/contracts/pool/BundleServiceManager.sol +6 -6
- package/contracts/pool/IBundleService.sol +22 -8
- package/contracts/pool/IPoolService.sol +36 -26
- package/contracts/pool/Pool.sol +22 -24
- package/contracts/pool/PoolService.sol +157 -83
- package/contracts/pool/PoolServiceManager.sol +4 -4
- package/contracts/product/ApplicationService.sol +43 -26
- package/contracts/product/ApplicationServiceManager.sol +4 -4
- package/contracts/product/BasicProduct.sol +1 -0
- package/contracts/product/ClaimService.sol +208 -79
- package/contracts/product/ClaimServiceManager.sol +4 -4
- package/contracts/product/IApplicationService.sol +1 -0
- package/contracts/product/IClaimService.sol +28 -5
- package/contracts/product/IPolicyService.sol +31 -34
- package/contracts/product/IPricingService.sol +7 -7
- package/contracts/product/IProductComponent.sol +0 -1
- package/contracts/product/{IProductService.sol → IRiskService.sol} +1 -1
- package/contracts/product/PolicyService.sol +345 -193
- package/contracts/product/PolicyServiceManager.sol +4 -4
- package/contracts/product/PricingService.sol +46 -46
- package/contracts/product/PricingServiceManager.sol +3 -3
- package/contracts/product/Product.sol +58 -34
- 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 +49 -15
- package/contracts/registry/Registry.sol +321 -195
- package/contracts/registry/RegistryAdmin.sol +150 -51
- package/contracts/registry/RegistryService.sol +2 -2
- package/contracts/registry/RegistryServiceManager.sol +2 -2
- package/contracts/registry/ReleaseRegistry.sol +12 -6
- package/contracts/registry/ServiceAuthorizationV3.sol +2 -3
- package/contracts/shared/Component.sol +17 -29
- package/contracts/shared/ComponentService.sol +20 -30
- package/contracts/shared/ComponentServiceManager.sol +8 -5
- package/contracts/shared/ComponentVerifyingService.sol +1 -1
- package/contracts/shared/ContractLib.sol +38 -0
- package/contracts/shared/IComponent.sol +4 -4
- package/contracts/shared/IInstanceLinkedComponent.sol +8 -15
- package/contracts/shared/IPolicyHolder.sol +12 -22
- package/contracts/shared/InitializableERC165.sol +2 -2
- package/contracts/shared/InstanceLinkedComponent.sol +4 -4
- package/contracts/shared/NftOwnable.sol +5 -5
- package/contracts/shared/PolicyHolder.sol +12 -53
- package/contracts/shared/Registerable.sol +4 -4
- package/contracts/shared/RegistryLinked.sol +3 -2
- package/contracts/shared/Service.sol +16 -11
- package/contracts/shared/TokenHandler.sol +100 -19
- package/contracts/shared/TokenHandlerDeployerLib.sol +12 -0
- package/contracts/staking/IStaking.sol +2 -1
- package/contracts/staking/StakeManagerLib.sol +18 -25
- package/contracts/staking/Staking.sol +11 -29
- package/contracts/staking/StakingManager.sol +8 -6
- package/contracts/staking/StakingService.sol +10 -14
- package/contracts/staking/StakingServiceManager.sol +2 -2
- package/contracts/staking/TargetManagerLib.sol +7 -3
- package/contracts/type/Blocknumber.sol +7 -1
- package/contracts/type/NftId.sol +1 -0
- package/contracts/type/ObjectType.sol +15 -11
- package/contracts/type/RiskId.sol +15 -1
- package/contracts/type/Seconds.sol +21 -1
- package/contracts/type/StateId.sol +1 -0
- package/contracts/type/Timestamp.sol +11 -1
- package/contracts/upgradeability/ProxyManager.sol +67 -34
- package/contracts/upgradeability/Versionable.sol +2 -2
- package/package.json +1 -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/contracts/product/ProductServiceManager.sol +0 -39
@@ -1,6 +1,7 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {IBundle} from "../instance/module/IBundle.sol";
|
4
5
|
import {IBundleService} from "./IBundleService.sol";
|
5
6
|
import {IComponents} from "../instance/module/IComponents.sol";
|
6
7
|
import {IComponentService} from "../shared/IComponentService.sol";
|
@@ -14,13 +15,12 @@ import {IStaking} from "../staking/IStaking.sol";
|
|
14
15
|
|
15
16
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
16
17
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
17
|
-
import {NftId
|
18
|
+
import {NftId} from "../type/NftId.sol";
|
18
19
|
import {ObjectType, POOL, BUNDLE, COMPONENT, INSTANCE, REGISTRY} from "../type/ObjectType.sol";
|
19
20
|
import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
|
20
21
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
21
22
|
import {KEEP_STATE} from "../type/StateId.sol";
|
22
23
|
import {Seconds} from "../type/Seconds.sol";
|
23
|
-
import {TokenHandler} from "../shared/TokenHandler.sol";
|
24
24
|
import {UFixed} from "../type/UFixed.sol";
|
25
25
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
26
26
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
@@ -44,16 +44,15 @@ contract PoolService is
|
|
44
44
|
bytes memory data
|
45
45
|
)
|
46
46
|
internal
|
47
|
-
initializer
|
48
47
|
virtual override
|
48
|
+
initializer()
|
49
49
|
{
|
50
50
|
(
|
51
|
-
address registryAddress
|
52
|
-
//address managerAddress
|
51
|
+
address registryAddress,
|
53
52
|
address authority
|
54
|
-
) = abi.decode(data, (address, address
|
53
|
+
) = abi.decode(data, (address, address));
|
55
54
|
|
56
|
-
|
55
|
+
_initializeService(registryAddress, authority, owner);
|
57
56
|
|
58
57
|
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
|
59
58
|
_bundleService = IBundleService(_getServiceAddress(BUNDLE()));
|
@@ -62,27 +61,23 @@ contract PoolService is
|
|
62
61
|
|
63
62
|
_staking = IStaking(getRegistry().getStakingAddress());
|
64
63
|
|
65
|
-
|
64
|
+
_registerInterface(type(IPoolService).interfaceId);
|
66
65
|
}
|
67
66
|
|
68
|
-
|
69
|
-
function
|
67
|
+
/// @inheritdoc IPoolService
|
68
|
+
function setMaxBalanceAmount(Amount maxBalanceAmount)
|
70
69
|
external
|
71
70
|
virtual
|
72
71
|
{
|
73
|
-
/*
|
74
72
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
75
73
|
InstanceReader instanceReader = instance.getInstanceReader();
|
74
|
+
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
76
75
|
|
77
|
-
|
78
|
-
|
79
|
-
Amount previousMaxCapitalAmount = poolInfo.maxCapitalAmount;
|
80
|
-
|
81
|
-
poolInfo.maxCapitalAmount = maxCapitalAmount;
|
76
|
+
Amount previousMaxBalanceAmount = poolInfo.maxBalanceAmount;
|
77
|
+
poolInfo.maxBalanceAmount = maxBalanceAmount;
|
82
78
|
instance.getInstanceStore().updatePool(poolNftId, poolInfo, KEEP_STATE());
|
83
79
|
|
84
|
-
emit
|
85
|
-
*/
|
80
|
+
emit LogPoolServiceMaxBalanceAmountUpdated(poolNftId, previousMaxBalanceAmount, maxBalanceAmount);
|
86
81
|
}
|
87
82
|
|
88
83
|
function setBundleOwnerRole(RoleId bundleOwnerRole)
|
@@ -106,31 +101,10 @@ contract PoolService is
|
|
106
101
|
emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
|
107
102
|
}
|
108
103
|
|
109
|
-
|
110
|
-
function setFees(
|
111
|
-
Fee memory poolFee,
|
112
|
-
Fee memory stakingFee,
|
113
|
-
Fee memory performanceFee
|
114
|
-
)
|
115
|
-
external
|
116
|
-
virtual
|
117
|
-
{
|
118
|
-
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
119
|
-
|
120
|
-
IComponents.PoolInfo memory poolInfo = instance.getInstanceReader().getPoolInfo(poolNftId);
|
121
|
-
poolInfo.poolFee = poolFee;
|
122
|
-
poolInfo.stakingFee = stakingFee;
|
123
|
-
poolInfo.performanceFee = performanceFee;
|
124
|
-
|
125
|
-
instance.getInstanceStore().updatePool(poolNftId, poolInfo, KEEP_STATE());
|
126
|
-
|
127
|
-
// TODO add logging
|
128
|
-
}
|
129
|
-
|
104
|
+
/// @inheritdoc IPoolService
|
130
105
|
function createBundle(
|
131
106
|
address bundleOwner, // initial bundle owner
|
132
107
|
Fee memory fee, // fees deducted from premium that go to bundle owner
|
133
|
-
Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
|
134
108
|
Seconds lifetime, // initial duration for which new policies are covered
|
135
109
|
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
136
110
|
)
|
@@ -139,38 +113,17 @@ contract PoolService is
|
|
139
113
|
returns(NftId bundleNftId)
|
140
114
|
{
|
141
115
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
142
|
-
InstanceReader instanceReader = instance.getInstanceReader();
|
143
|
-
|
144
|
-
(
|
145
|
-
Amount stakingFeeAmount,
|
146
|
-
Amount stakingNetAmount
|
147
|
-
) = FeeLib.calculateFee(
|
148
|
-
_getStakingFee(instanceReader, poolNftId),
|
149
|
-
stakingAmount);
|
150
116
|
|
117
|
+
// create the empty bundle
|
151
118
|
bundleNftId = _bundleService.create(
|
152
119
|
instance,
|
153
120
|
poolNftId,
|
154
121
|
bundleOwner,
|
155
122
|
fee,
|
156
|
-
|
123
|
+
AmountLib.zero(),
|
157
124
|
lifetime,
|
158
125
|
filter);
|
159
126
|
|
160
|
-
// pool book keeping
|
161
|
-
_componentService.increasePoolBalance(
|
162
|
-
instance.getInstanceStore(),
|
163
|
-
poolNftId,
|
164
|
-
stakingAmount,
|
165
|
-
stakingFeeAmount);
|
166
|
-
|
167
|
-
// pool bookkeeping and collect tokens from bundle owner
|
168
|
-
_collectStakingAmount(
|
169
|
-
instanceReader,
|
170
|
-
poolNftId,
|
171
|
-
bundleOwner,
|
172
|
-
stakingAmount);
|
173
|
-
|
174
127
|
emit LogPoolServiceBundleCreated(instance.getNftId(), poolNftId, bundleNftId);
|
175
128
|
}
|
176
129
|
|
@@ -180,8 +133,8 @@ contract PoolService is
|
|
180
133
|
view
|
181
134
|
returns (Fee memory stakingFee)
|
182
135
|
{
|
183
|
-
NftId productNftId = instanceReader.
|
184
|
-
return instanceReader.
|
136
|
+
NftId productNftId = instanceReader.getComponentInfo(poolNftId).productNftId;
|
137
|
+
return instanceReader.getProductInfo(productNftId).stakingFee;
|
185
138
|
}
|
186
139
|
|
187
140
|
function closeBundle(NftId bundleNftId)
|
@@ -190,20 +143,147 @@ contract PoolService is
|
|
190
143
|
{
|
191
144
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
192
145
|
|
193
|
-
// TODO
|
146
|
+
// TODO get performance fee for pool (#477)
|
194
147
|
|
195
148
|
// releasing collateral in bundle
|
196
|
-
_bundleService.close(instance, bundleNftId);
|
197
|
-
|
198
|
-
// TODO get performance fee for pool, transfer of remaining funds + bundle fees to bundle owner
|
149
|
+
(Amount unstakedAmount, Amount feeAmount) = _bundleService.close(instance, bundleNftId);
|
199
150
|
|
151
|
+
_componentService.decreasePoolBalance(
|
152
|
+
instance.getInstanceStore(),
|
153
|
+
poolNftId,
|
154
|
+
unstakedAmount + feeAmount,
|
155
|
+
AmountLib.zero());
|
156
|
+
|
200
157
|
emit LogPoolServiceBundleClosed(instance.getNftId(), poolNftId, bundleNftId);
|
158
|
+
|
159
|
+
if ((unstakedAmount + feeAmount).gtz()){
|
160
|
+
IComponents.ComponentInfo memory poolComponentInfo = instance.getInstanceReader().getComponentInfo(poolNftId);
|
161
|
+
poolComponentInfo.tokenHandler.distributeTokens(
|
162
|
+
poolComponentInfo.wallet,
|
163
|
+
getRegistry().ownerOf(bundleNftId),
|
164
|
+
unstakedAmount + feeAmount);
|
165
|
+
}
|
201
166
|
}
|
202
167
|
|
168
|
+
/// @inheritdoc IPoolService
|
169
|
+
function stake(NftId bundleNftId, Amount amount)
|
170
|
+
external
|
171
|
+
virtual
|
172
|
+
// TODO: restricted() (once #462 is done)
|
173
|
+
returns(Amount netAmount)
|
174
|
+
{
|
175
|
+
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
176
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
177
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
178
|
+
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
179
|
+
|
180
|
+
if (bundleInfo.poolNftId != poolNftId) {
|
181
|
+
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
182
|
+
}
|
183
|
+
|
184
|
+
{
|
185
|
+
Amount currentPoolBalance = instanceReader.getBalanceAmount(poolNftId);
|
186
|
+
if (currentPoolBalance + amount > poolInfo.maxBalanceAmount) {
|
187
|
+
revert ErrorPoolServiceMaxBalanceAmountExceeded(poolNftId, poolInfo.maxBalanceAmount, currentPoolBalance, amount);
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
// calculate fees
|
192
|
+
Amount feeAmount;
|
193
|
+
(
|
194
|
+
feeAmount,
|
195
|
+
netAmount
|
196
|
+
) = FeeLib.calculateFee(
|
197
|
+
_getStakingFee(instanceReader, poolNftId),
|
198
|
+
amount);
|
199
|
+
|
200
|
+
// do all the bookkeeping
|
201
|
+
_componentService.increasePoolBalance(
|
202
|
+
instance.getInstanceStore(),
|
203
|
+
poolNftId,
|
204
|
+
netAmount,
|
205
|
+
feeAmount);
|
206
|
+
|
207
|
+
_bundleService.stake(instance, bundleNftId, netAmount);
|
208
|
+
|
209
|
+
// collect tokens from bundle owner
|
210
|
+
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
211
|
+
emit LogPoolServiceBundleStaked(instance.getNftId(), poolNftId, bundleNftId, amount, netAmount);
|
212
|
+
|
213
|
+
// TODO only collect staking token when pool is not externally managed
|
214
|
+
_collectStakingAmount(
|
215
|
+
instanceReader,
|
216
|
+
poolNftId,
|
217
|
+
bundleOwner,
|
218
|
+
amount);
|
219
|
+
}
|
220
|
+
|
221
|
+
/// @inheritdoc IPoolService
|
222
|
+
function unstake(NftId bundleNftId, Amount amount)
|
223
|
+
external
|
224
|
+
virtual
|
225
|
+
// TODO: restricted() (once #462 is done)
|
226
|
+
returns(Amount netAmount)
|
227
|
+
{
|
228
|
+
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
229
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
230
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
231
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
232
|
+
|
233
|
+
if (bundleInfo.poolNftId != poolNftId) {
|
234
|
+
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
235
|
+
}
|
236
|
+
|
237
|
+
// call bundle service for bookkeeping and additional checks
|
238
|
+
Amount unstakedAmount = _bundleService.unstake(instance, bundleNftId, amount);
|
239
|
+
|
240
|
+
// Important: from now on work only with unstakedAmount as it is the only reliable amount.
|
241
|
+
// if amount was max, this was set to the available amount
|
242
|
+
|
243
|
+
// TODO: handle performance fees (issue #477)
|
244
|
+
|
245
|
+
// update pool bookkeeping - performance fees stay in the pool, but as fees
|
246
|
+
_componentService.decreasePoolBalance(
|
247
|
+
instanceStore,
|
248
|
+
poolNftId,
|
249
|
+
unstakedAmount,
|
250
|
+
AmountLib.zero());
|
251
|
+
|
252
|
+
IComponents.ComponentInfo memory poolComponentInfo = instanceReader.getComponentInfo(poolNftId);
|
253
|
+
address poolWallet = poolComponentInfo.wallet;
|
254
|
+
// transfer amount to bundle owner
|
255
|
+
address owner = getRegistry().ownerOf(bundleNftId);
|
256
|
+
emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount);
|
257
|
+
poolComponentInfo.tokenHandler.distributeTokens(
|
258
|
+
poolWallet,
|
259
|
+
owner,
|
260
|
+
unstakedAmount);
|
261
|
+
return unstakedAmount;
|
262
|
+
}
|
263
|
+
|
264
|
+
|
265
|
+
function fundPoolWallet(NftId poolNftId, Amount amount)
|
266
|
+
external
|
267
|
+
virtual
|
268
|
+
restricted()
|
269
|
+
{
|
270
|
+
// TODO check that poolNftId is externally managed
|
271
|
+
// TODO implement
|
272
|
+
}
|
273
|
+
|
274
|
+
|
275
|
+
function defundPoolWallet(NftId poolNftId, Amount amount)
|
276
|
+
external
|
277
|
+
virtual
|
278
|
+
restricted()
|
279
|
+
{
|
280
|
+
// TODO check that poolNftId is externally managed
|
281
|
+
// TODO implement
|
282
|
+
}
|
203
283
|
|
204
284
|
function processSale(
|
205
285
|
NftId bundleNftId,
|
206
|
-
IPolicy.
|
286
|
+
IPolicy.PremiumInfo memory premium
|
207
287
|
)
|
208
288
|
external
|
209
289
|
virtual
|
@@ -215,9 +295,9 @@ contract PoolService is
|
|
215
295
|
IRegistry.ObjectInfo memory instanceObjectInfo = registry.getObjectInfo(poolObjectInfo.parentNftId);
|
216
296
|
IInstance instance = IInstance(instanceObjectInfo.objectAddress);
|
217
297
|
|
218
|
-
Amount poolFeeAmount =
|
219
|
-
Amount bundleFeeAmount =
|
220
|
-
Amount bundleNetAmount =
|
298
|
+
Amount poolFeeAmount = premium.poolFeeFixAmount + premium.poolFeeVarAmount;
|
299
|
+
Amount bundleFeeAmount = premium.bundleFeeFixAmount + premium.bundleFeeVarAmount;
|
300
|
+
Amount bundleNetAmount = premium.netPremiumAmount;
|
221
301
|
|
222
302
|
InstanceStore instanceStore = instance.getInstanceStore();
|
223
303
|
_componentService.increasePoolBalance(
|
@@ -403,7 +483,6 @@ contract PoolService is
|
|
403
483
|
}
|
404
484
|
|
405
485
|
|
406
|
-
// TODO create (I)TreasuryService that deals with all gif related token transfers
|
407
486
|
/// @dev transfers the specified amount from the bundle owner to the pool's wallet
|
408
487
|
function _collectStakingAmount(
|
409
488
|
InstanceReader instanceReader,
|
@@ -416,16 +495,11 @@ contract PoolService is
|
|
416
495
|
|
417
496
|
// collecting investor token
|
418
497
|
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
419
|
-
TokenHandler tokenHandler = componentInfo.tokenHandler;
|
420
498
|
address poolWallet = componentInfo.wallet;
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
bundleOwner,
|
426
|
-
poolWallet,
|
427
|
-
amount);
|
428
|
-
}
|
499
|
+
componentInfo.tokenHandler.collectTokens(
|
500
|
+
bundleOwner,
|
501
|
+
poolWallet,
|
502
|
+
amount);
|
429
503
|
}
|
430
504
|
|
431
505
|
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);
|
@@ -41,18 +41,17 @@ contract ApplicationService is
|
|
41
41
|
initializer()
|
42
42
|
{
|
43
43
|
(
|
44
|
-
address registryAddress
|
45
|
-
//address managerAddress
|
44
|
+
address registryAddress,
|
46
45
|
address authority
|
47
|
-
) = abi.decode(data, (address, address
|
46
|
+
) = abi.decode(data, (address, address));
|
48
47
|
|
49
|
-
|
48
|
+
_initializeService(registryAddress, authority, owner);
|
50
49
|
|
51
50
|
_distributionService = IDistributionService(_getServiceAddress(DISTRIBUTION()));
|
52
51
|
_pricingService = IPricingService(_getServiceAddress(PRICE()));
|
53
52
|
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
|
54
53
|
|
55
|
-
|
54
|
+
_registerInterface(type(IApplicationService).interfaceId);
|
56
55
|
}
|
57
56
|
|
58
57
|
|
@@ -111,8 +110,7 @@ contract ApplicationService is
|
|
111
110
|
view
|
112
111
|
returns (Amount premiumAmount)
|
113
112
|
{
|
114
|
-
return
|
115
|
-
_pricingService.calculatePremium(
|
113
|
+
return _pricingService.calculatePremium(
|
116
114
|
info.productNftId,
|
117
115
|
info.riskId,
|
118
116
|
info.sumInsuredAmount,
|
@@ -120,7 +118,7 @@ contract ApplicationService is
|
|
120
118
|
info.applicationData,
|
121
119
|
info.bundleNftId,
|
122
120
|
info.referralId
|
123
|
-
).premiumAmount
|
121
|
+
).premiumAmount;
|
124
122
|
}
|
125
123
|
|
126
124
|
|
@@ -128,6 +126,7 @@ contract ApplicationService is
|
|
128
126
|
address applicationOwner,
|
129
127
|
RiskId riskId,
|
130
128
|
Amount sumInsuredAmount,
|
129
|
+
Amount premiumAmount,
|
131
130
|
Seconds lifetime,
|
132
131
|
NftId bundleNftId,
|
133
132
|
ReferralId referralId,
|
@@ -152,14 +151,45 @@ contract ApplicationService is
|
|
152
151
|
applicationNftId = _registerApplication(productNftId, applicationOwner);
|
153
152
|
|
154
153
|
// create policy info for application
|
155
|
-
IPolicy.PolicyInfo memory applicationInfo =
|
154
|
+
IPolicy.PolicyInfo memory applicationInfo = _createApplicationInfo(
|
155
|
+
productNftId,
|
156
|
+
riskId,
|
157
|
+
sumInsuredAmount,
|
158
|
+
premiumAmount,
|
159
|
+
lifetime,
|
160
|
+
bundleNftId,
|
161
|
+
referralId,
|
162
|
+
applicationData);
|
163
|
+
|
164
|
+
// register application with instance
|
165
|
+
instance.getInstanceStore().createApplication(
|
166
|
+
applicationNftId,
|
167
|
+
applicationInfo);
|
168
|
+
|
169
|
+
// TODO: add logging
|
170
|
+
}
|
171
|
+
|
172
|
+
function _createApplicationInfo(
|
173
|
+
NftId productNftId,
|
174
|
+
RiskId riskId,
|
175
|
+
Amount sumInsuredAmount,
|
176
|
+
Amount premiumAmount,
|
177
|
+
Seconds lifetime,
|
178
|
+
NftId bundleNftId,
|
179
|
+
ReferralId referralId,
|
180
|
+
bytes memory applicationData
|
181
|
+
)
|
182
|
+
internal
|
183
|
+
virtual
|
184
|
+
returns (IPolicy.PolicyInfo memory applicationInfo)
|
185
|
+
{
|
186
|
+
return IPolicy.PolicyInfo({
|
156
187
|
productNftId: productNftId,
|
157
188
|
bundleNftId: bundleNftId,
|
158
189
|
referralId: referralId,
|
159
190
|
riskId: riskId,
|
160
191
|
sumInsuredAmount: sumInsuredAmount,
|
161
|
-
premiumAmount:
|
162
|
-
premiumPaidAmount: AmountLib.zero(),
|
192
|
+
premiumAmount: premiumAmount,
|
163
193
|
lifetime: lifetime,
|
164
194
|
applicationData: applicationData,
|
165
195
|
processData: "",
|
@@ -171,21 +201,8 @@ contract ApplicationService is
|
|
171
201
|
expiredAt: zeroTimestamp(),
|
172
202
|
closedAt: zeroTimestamp()
|
173
203
|
});
|
174
|
-
|
175
|
-
// TODO consider to provide this amount externally
|
176
|
-
// actual calculation is done 2nd time anyway for premium collection
|
177
|
-
// calculate premium amount
|
178
|
-
applicationInfo.premiumAmount = _calculatePremiumAmount(applicationInfo);
|
179
|
-
|
180
|
-
// register application with instance
|
181
|
-
instance.getInstanceStore().createApplication(
|
182
|
-
applicationNftId,
|
183
|
-
applicationInfo);
|
184
|
-
|
185
|
-
// TODO: add logging
|
186
204
|
}
|
187
205
|
|
188
|
-
|
189
206
|
function renew(
|
190
207
|
NftId policyNftId, // policy to be renewd (renewal inherits policy attributes)
|
191
208
|
NftId bundleNftId // will likely need a newer bundle for underwriting
|
@@ -194,7 +211,7 @@ contract ApplicationService is
|
|
194
211
|
virtual override
|
195
212
|
returns (NftId applicationNftId)
|
196
213
|
{
|
197
|
-
|
214
|
+
// TODO implement
|
198
215
|
}
|
199
216
|
|
200
217
|
|
@@ -210,7 +227,7 @@ contract ApplicationService is
|
|
210
227
|
external
|
211
228
|
virtual override
|
212
229
|
{
|
213
|
-
|
230
|
+
// TODO implement
|
214
231
|
}
|
215
232
|
|
216
233
|
function revoke(NftId applicationNftId)
|
@@ -12,14 +12,14 @@ contract ApplicationServiceManager is ProxyManager {
|
|
12
12
|
/// @dev initializes proxy manager with 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
|
ApplicationService svc = new ApplicationService{salt: salt}();
|
21
|
-
bytes memory data = abi.encode(
|
22
|
-
IVersionable versionable =
|
20
|
+
bytes memory data = abi.encode(registry, authority);
|
21
|
+
IVersionable versionable = initialize(
|
22
|
+
registry,
|
23
23
|
address(svc),
|
24
24
|
data,
|
25
25
|
salt);
|