@etherisc/gif-next 0.0.2-f8e07c7-917 → 0.0.2-f946ccd-184
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +19 -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 +66 -248
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +16 -16
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +24 -222
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +228 -217
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +93 -101
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +24 -37
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +120 -31
- 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 +1712 -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 -123
- 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 -219
- 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 +36 -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 +396 -163
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +137 -89
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +205 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +26 -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 +26 -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 +266 -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 +372 -316
- 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 +118 -265
- 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 +132 -199
- 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/IComponentService.sol/IComponentService.json +56 -0
- 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 +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 +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 +73 -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 +89 -84
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +59 -23
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +37 -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 +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/Fee.sol/FeeLib.json +7 -2
- package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +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/MathLib.json +9 -3
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +39 -2
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +39 -70
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/authorization/AccessAdmin.sol +25 -24
- package/contracts/authorization/Authorization.sol +0 -1
- package/contracts/authorization/IAccessAdmin.sol +0 -1
- package/contracts/distribution/BasicDistribution.sol +4 -15
- package/contracts/distribution/BasicDistributionAuthorization.sol +2 -1
- package/contracts/distribution/Distribution.sol +22 -11
- package/contracts/distribution/DistributionService.sol +73 -25
- package/contracts/distribution/DistributionServiceManager.sol +6 -6
- package/contracts/distribution/IDistributionComponent.sol +6 -1
- package/contracts/distribution/IDistributionService.sol +18 -2
- package/contracts/examples/fire/FirePool.sol +75 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
- package/contracts/examples/fire/FireProduct.sol +324 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +35 -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 +12 -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/IDistribution.sol +0 -1
- package/contracts/instance/module/IPolicy.sol +22 -22
- package/contracts/mock/Dip.sol +1 -1
- package/contracts/oracle/Oracle.sol +4 -7
- 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 +8 -2
- package/contracts/pool/BundleService.sol +184 -30
- package/contracts/pool/BundleServiceManager.sol +6 -6
- package/contracts/pool/IBundleService.sol +33 -5
- package/contracts/pool/IPoolComponent.sol +7 -0
- package/contracts/pool/IPoolService.sol +36 -26
- package/contracts/pool/Pool.sol +39 -24
- package/contracts/pool/PoolService.sol +157 -85
- 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 +3 -32
- package/contracts/product/ClaimService.sol +208 -78
- 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 -32
- 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 +370 -194
- 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 +67 -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 -8
- package/contracts/registry/ServiceAuthorizationV3.sol +2 -3
- package/contracts/shared/Component.sol +23 -29
- package/contracts/shared/ComponentService.sol +51 -32
- 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/IComponentService.sol +5 -9
- package/contracts/shared/IInstanceLinkedComponent.sol +8 -15
- package/contracts/shared/IPolicyHolder.sol +12 -22
- package/contracts/shared/{ERC165.sol → InitializableERC165.sol} +3 -3
- package/contracts/shared/InstanceLinkedComponent.sol +4 -4
- package/contracts/shared/NftOwnable.sol +7 -7
- package/contracts/shared/PolicyHolder.sol +14 -58
- 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 -27
- 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/Amount.sol +12 -5
- package/contracts/type/Blocknumber.sol +7 -1
- package/contracts/type/NftId.sol +1 -0
- package/contracts/type/ObjectType.sol +15 -11
- package/contracts/type/Referral.sol +1 -0
- 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/type/UFixed.sol +29 -10
- 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/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +0 -73
- 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";
|
@@ -32,9 +32,6 @@ contract PoolService is
|
|
32
32
|
ComponentVerifyingService,
|
33
33
|
IPoolService
|
34
34
|
{
|
35
|
-
using NftIdLib for NftId;
|
36
|
-
using AmountLib for Amount;
|
37
|
-
|
38
35
|
IBundleService internal _bundleService;
|
39
36
|
IComponentService internal _componentService;
|
40
37
|
IInstanceService private _instanceService;
|
@@ -47,16 +44,15 @@ contract PoolService is
|
|
47
44
|
bytes memory data
|
48
45
|
)
|
49
46
|
internal
|
50
|
-
initializer
|
51
47
|
virtual override
|
48
|
+
initializer()
|
52
49
|
{
|
53
50
|
(
|
54
|
-
address registryAddress
|
55
|
-
//address managerAddress
|
51
|
+
address registryAddress,
|
56
52
|
address authority
|
57
|
-
) = abi.decode(data, (address, address
|
53
|
+
) = abi.decode(data, (address, address));
|
58
54
|
|
59
|
-
|
55
|
+
_initializeService(registryAddress, authority, owner);
|
60
56
|
|
61
57
|
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
|
62
58
|
_bundleService = IBundleService(_getServiceAddress(BUNDLE()));
|
@@ -65,27 +61,23 @@ contract PoolService is
|
|
65
61
|
|
66
62
|
_staking = IStaking(getRegistry().getStakingAddress());
|
67
63
|
|
68
|
-
|
64
|
+
_registerInterface(type(IPoolService).interfaceId);
|
69
65
|
}
|
70
66
|
|
71
|
-
|
72
|
-
function
|
67
|
+
/// @inheritdoc IPoolService
|
68
|
+
function setMaxBalanceAmount(Amount maxBalanceAmount)
|
73
69
|
external
|
74
70
|
virtual
|
75
71
|
{
|
76
|
-
/*
|
77
72
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
78
73
|
InstanceReader instanceReader = instance.getInstanceReader();
|
74
|
+
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
79
75
|
|
80
|
-
|
81
|
-
|
82
|
-
Amount previousMaxCapitalAmount = poolInfo.maxCapitalAmount;
|
83
|
-
|
84
|
-
poolInfo.maxCapitalAmount = maxCapitalAmount;
|
76
|
+
Amount previousMaxBalanceAmount = poolInfo.maxBalanceAmount;
|
77
|
+
poolInfo.maxBalanceAmount = maxBalanceAmount;
|
85
78
|
instance.getInstanceStore().updatePool(poolNftId, poolInfo, KEEP_STATE());
|
86
79
|
|
87
|
-
emit
|
88
|
-
*/
|
80
|
+
emit LogPoolServiceMaxBalanceAmountUpdated(poolNftId, previousMaxBalanceAmount, maxBalanceAmount);
|
89
81
|
}
|
90
82
|
|
91
83
|
function setBundleOwnerRole(RoleId bundleOwnerRole)
|
@@ -109,31 +101,10 @@ contract PoolService is
|
|
109
101
|
emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
|
110
102
|
}
|
111
103
|
|
112
|
-
|
113
|
-
function setFees(
|
114
|
-
Fee memory poolFee,
|
115
|
-
Fee memory stakingFee,
|
116
|
-
Fee memory performanceFee
|
117
|
-
)
|
118
|
-
external
|
119
|
-
virtual
|
120
|
-
{
|
121
|
-
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
122
|
-
|
123
|
-
IComponents.PoolInfo memory poolInfo = instance.getInstanceReader().getPoolInfo(poolNftId);
|
124
|
-
poolInfo.poolFee = poolFee;
|
125
|
-
poolInfo.stakingFee = stakingFee;
|
126
|
-
poolInfo.performanceFee = performanceFee;
|
127
|
-
|
128
|
-
instance.getInstanceStore().updatePool(poolNftId, poolInfo, KEEP_STATE());
|
129
|
-
|
130
|
-
// TODO add logging
|
131
|
-
}
|
132
|
-
|
104
|
+
/// @inheritdoc IPoolService
|
133
105
|
function createBundle(
|
134
106
|
address bundleOwner, // initial bundle owner
|
135
107
|
Fee memory fee, // fees deducted from premium that go to bundle owner
|
136
|
-
Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
|
137
108
|
Seconds lifetime, // initial duration for which new policies are covered
|
138
109
|
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
139
110
|
)
|
@@ -142,38 +113,17 @@ contract PoolService is
|
|
142
113
|
returns(NftId bundleNftId)
|
143
114
|
{
|
144
115
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
145
|
-
InstanceReader instanceReader = instance.getInstanceReader();
|
146
|
-
|
147
|
-
(
|
148
|
-
Amount stakingFeeAmount,
|
149
|
-
Amount stakingNetAmount
|
150
|
-
) = FeeLib.calculateFee(
|
151
|
-
_getStakingFee(instanceReader, poolNftId),
|
152
|
-
stakingAmount);
|
153
116
|
|
117
|
+
// create the empty bundle
|
154
118
|
bundleNftId = _bundleService.create(
|
155
119
|
instance,
|
156
120
|
poolNftId,
|
157
121
|
bundleOwner,
|
158
122
|
fee,
|
159
|
-
|
123
|
+
AmountLib.zero(),
|
160
124
|
lifetime,
|
161
125
|
filter);
|
162
126
|
|
163
|
-
// pool book keeping
|
164
|
-
_componentService.increasePoolBalance(
|
165
|
-
instance.getInstanceStore(),
|
166
|
-
poolNftId,
|
167
|
-
stakingAmount,
|
168
|
-
stakingFeeAmount);
|
169
|
-
|
170
|
-
// pool bookkeeping and collect tokens from bundle owner
|
171
|
-
_collectStakingAmount(
|
172
|
-
instanceReader,
|
173
|
-
poolNftId,
|
174
|
-
bundleOwner,
|
175
|
-
stakingAmount);
|
176
|
-
|
177
127
|
emit LogPoolServiceBundleCreated(instance.getNftId(), poolNftId, bundleNftId);
|
178
128
|
}
|
179
129
|
|
@@ -183,8 +133,8 @@ contract PoolService is
|
|
183
133
|
view
|
184
134
|
returns (Fee memory stakingFee)
|
185
135
|
{
|
186
|
-
NftId productNftId = instanceReader.
|
187
|
-
return instanceReader.
|
136
|
+
NftId productNftId = instanceReader.getComponentInfo(poolNftId).productNftId;
|
137
|
+
return instanceReader.getProductInfo(productNftId).stakingFee;
|
188
138
|
}
|
189
139
|
|
190
140
|
function closeBundle(NftId bundleNftId)
|
@@ -193,20 +143,147 @@ contract PoolService is
|
|
193
143
|
{
|
194
144
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
195
145
|
|
196
|
-
// TODO
|
146
|
+
// TODO get performance fee for pool (#477)
|
197
147
|
|
198
148
|
// releasing collateral in bundle
|
199
|
-
_bundleService.close(instance, bundleNftId);
|
200
|
-
|
201
|
-
// TODO get performance fee for pool, transfer of remaining funds + bundle fees to bundle owner
|
149
|
+
(Amount unstakedAmount, Amount feeAmount) = _bundleService.close(instance, bundleNftId);
|
202
150
|
|
151
|
+
_componentService.decreasePoolBalance(
|
152
|
+
instance.getInstanceStore(),
|
153
|
+
poolNftId,
|
154
|
+
unstakedAmount + feeAmount,
|
155
|
+
AmountLib.zero());
|
156
|
+
|
203
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
|
+
}
|
166
|
+
}
|
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);
|
204
219
|
}
|
205
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
|
+
}
|
206
283
|
|
207
284
|
function processSale(
|
208
285
|
NftId bundleNftId,
|
209
|
-
IPolicy.
|
286
|
+
IPolicy.PremiumInfo memory premium
|
210
287
|
)
|
211
288
|
external
|
212
289
|
virtual
|
@@ -218,9 +295,9 @@ contract PoolService is
|
|
218
295
|
IRegistry.ObjectInfo memory instanceObjectInfo = registry.getObjectInfo(poolObjectInfo.parentNftId);
|
219
296
|
IInstance instance = IInstance(instanceObjectInfo.objectAddress);
|
220
297
|
|
221
|
-
Amount poolFeeAmount =
|
222
|
-
Amount bundleFeeAmount =
|
223
|
-
Amount bundleNetAmount =
|
298
|
+
Amount poolFeeAmount = premium.poolFeeFixAmount + premium.poolFeeVarAmount;
|
299
|
+
Amount bundleFeeAmount = premium.bundleFeeFixAmount + premium.bundleFeeVarAmount;
|
300
|
+
Amount bundleNetAmount = premium.netPremiumAmount;
|
224
301
|
|
225
302
|
InstanceStore instanceStore = instance.getInstanceStore();
|
226
303
|
_componentService.increasePoolBalance(
|
@@ -406,7 +483,6 @@ contract PoolService is
|
|
406
483
|
}
|
407
484
|
|
408
485
|
|
409
|
-
// TODO create (I)TreasuryService that deals with all gif related token transfers
|
410
486
|
/// @dev transfers the specified amount from the bundle owner to the pool's wallet
|
411
487
|
function _collectStakingAmount(
|
412
488
|
InstanceReader instanceReader,
|
@@ -419,15 +495,11 @@ contract PoolService is
|
|
419
495
|
|
420
496
|
// collecting investor token
|
421
497
|
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
422
|
-
TokenHandler tokenHandler = componentInfo.tokenHandler;
|
423
498
|
address poolWallet = componentInfo.wallet;
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
poolWallet,
|
429
|
-
amount);
|
430
|
-
}
|
499
|
+
componentInfo.tokenHandler.collectTokens(
|
500
|
+
bundleOwner,
|
501
|
+
poolWallet,
|
502
|
+
amount);
|
431
503
|
}
|
432
504
|
|
433
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);
|
@@ -1,43 +1,15 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
5
|
-
|
6
|
-
import {Amount, AmountLib} from "../type/Amount.sol";
|
7
|
-
import {ClaimId} from "../type/ClaimId.sol";
|
8
|
-
import {InstanceLinkedComponent} from "../shared/InstanceLinkedComponent.sol";
|
9
|
-
import {Fee, FeeLib} from "../type/Fee.sol";
|
10
|
-
import {IRisk} from "../instance/module/IRisk.sol";
|
11
|
-
import {IApplicationService} from "./IApplicationService.sol";
|
4
|
+
import {Fee} from "../type/Fee.sol";
|
12
5
|
import {IAuthorization} from "../authorization/IAuthorization.sol";
|
13
|
-
import {
|
14
|
-
import {IPolicyService} from "./IPolicyService.sol";
|
15
|
-
import {IProductService} from "./IProductService.sol";
|
16
|
-
import {IClaimService} from "./IClaimService.sol";
|
17
|
-
import {IPricingService} from "./IPricingService.sol";
|
18
|
-
import {IProductComponent} from "./IProductComponent.sol";
|
19
|
-
import {NftId, NftIdLib} from "../type/NftId.sol";
|
6
|
+
import {NftId} from "../type/NftId.sol";
|
20
7
|
import {Product} from "../product/Product.sol";
|
21
|
-
import {PayoutId} from "../type/PayoutId.sol";
|
22
|
-
import {COMPONENT, PRODUCT, APPLICATION, POLICY, CLAIM, PRICE } from "../type/ObjectType.sol";
|
23
|
-
import {ReferralId} from "../type/Referral.sol";
|
24
|
-
import {RiskId, RiskIdLib} from "../type/RiskId.sol";
|
25
|
-
import {Seconds} from "../type/Seconds.sol";
|
26
|
-
import {StateId} from "../type/StateId.sol";
|
27
|
-
import {Timestamp} from "../type/Timestamp.sol";
|
28
|
-
|
29
|
-
import {TokenHandler} from "../shared/TokenHandler.sol";
|
30
|
-
|
31
|
-
import {InstanceReader} from "../instance/InstanceReader.sol";
|
32
|
-
import {IPolicy} from "../instance/module/IPolicy.sol";
|
33
|
-
import {IComponents} from "../instance/module/IComponents.sol";
|
34
|
-
import {Pool} from "../pool/Pool.sol";
|
35
|
-
import {Distribution} from "../distribution/Distribution.sol";
|
36
8
|
|
37
9
|
abstract contract BasicProduct is
|
38
10
|
Product
|
39
11
|
{
|
40
|
-
|
12
|
+
|
41
13
|
function setFees(
|
42
14
|
Fee memory productFee,
|
43
15
|
Fee memory processingFee
|
@@ -50,7 +22,6 @@ abstract contract BasicProduct is
|
|
50
22
|
_setFees(productFee, processingFee);
|
51
23
|
}
|
52
24
|
|
53
|
-
|
54
25
|
function _initializeBasicProduct(
|
55
26
|
address registry,
|
56
27
|
NftId instanceNftId,
|