@etherisc/gif-next 0.0.2-9620cae-586 → 0.0.2-9678144-986
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 +16 -2
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +2 -2
- 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/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 +69 -26
- 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 +43 -0
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +237 -74
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +66 -38
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +43 -0
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +102 -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 +2 -2
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +2 -2
- 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 +79 -121
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +2 -2
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +2 -2
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +70 -192
- 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/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 +46 -16
- 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 +30 -0
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +30 -0
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +2 -2
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +2 -2
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +50 -57
- 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 +462 -51
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +106 -26
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +252 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +43 -56
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +188 -53
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +43 -56
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +320 -89
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +67 -19
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +2 -2
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +2 -2
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +19 -0
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +16 -16
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +2 -2
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +2 -2
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +86 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +19 -0
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +169 -52
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +42 -26
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +7 -2
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +2 -2
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +19 -0
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +2 -2
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +2 -2
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- 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 +2 -2
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +2 -2
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +2 -2
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +2 -2
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +2 -2
- 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/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +271 -62
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +60 -32
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +153 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +19 -0
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/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/{ERC165.sol/ERC165.json → InitializableERC165.sol/InitializableERC165.json} +4 -4
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +19 -0
- 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/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- 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 +12 -2
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +36 -36
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +19 -19
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +2 -2
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +2 -2
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +17 -12
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +7 -2
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +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/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- 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/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- 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/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +26 -2
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/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 +4 -0
- package/artifacts/contracts/{shared → upgradeability}/IVersionable.sol/IVersionable.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/{shared → upgradeability}/ProxyManager.sol/ProxyManager.json +3 -3
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +3 -3
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +4 -0
- package/artifacts/contracts/{shared → upgradeability}/Versionable.sol/Versionable.json +1 -1
- package/contracts/distribution/BasicDistribution.sol +4 -15
- package/contracts/distribution/BasicDistributionAuthorization.sol +5 -1
- package/contracts/distribution/Distribution.sol +22 -10
- package/contracts/distribution/DistributionService.sol +61 -26
- package/contracts/distribution/DistributionServiceManager.sol +2 -5
- package/contracts/distribution/IDistributionComponent.sol +8 -4
- package/contracts/distribution/IDistributionService.sol +12 -0
- package/contracts/instance/InstanceAuthorizationV3.sol +2 -0
- package/contracts/instance/InstanceReader.sol +8 -0
- package/contracts/instance/InstanceServiceManager.sol +2 -6
- package/contracts/instance/InstanceStore.sol +2 -1
- package/contracts/instance/module/IBundle.sol +1 -1
- package/contracts/instance/module/IComponents.sol +0 -5
- package/contracts/instance/module/IDistribution.sol +0 -1
- package/contracts/mock/Dip.sol +1 -1
- package/contracts/oracle/IOracleComponent.sol +2 -1
- package/contracts/oracle/Oracle.sol +15 -6
- package/contracts/oracle/OracleServiceManager.sol +2 -5
- package/contracts/pool/BasicPool.sol +3 -1
- package/contracts/pool/BasicPoolAuthorization.sol +9 -0
- package/contracts/pool/BundleService.sol +186 -32
- package/contracts/pool/BundleServiceManager.sol +2 -5
- package/contracts/pool/IBundleService.sol +33 -5
- package/contracts/pool/IPoolComponent.sol +6 -0
- package/contracts/pool/IPoolService.sol +12 -13
- package/contracts/pool/Pool.sol +28 -11
- package/contracts/pool/PoolService.sol +164 -65
- package/contracts/pool/PoolServiceManager.sol +2 -5
- package/contracts/product/ApplicationService.sol +12 -36
- package/contracts/product/ApplicationServiceManager.sol +2 -2
- package/contracts/product/BasicProduct.sol +3 -33
- package/contracts/product/BasicProductAuthorization.sol +3 -0
- package/contracts/product/ClaimService.sol +7 -32
- package/contracts/product/ClaimServiceManager.sol +2 -2
- package/contracts/product/IPolicyService.sol +8 -2
- package/contracts/product/IProductComponent.sol +1 -0
- package/contracts/product/PolicyService.sol +72 -18
- package/contracts/product/PolicyServiceManager.sol +2 -5
- package/contracts/product/PricingServiceManager.sol +2 -5
- package/contracts/product/Product.sol +20 -1
- package/contracts/product/ProductService.sol +7 -32
- package/contracts/product/ProductServiceManager.sol +2 -5
- package/contracts/registry/RegistryService.sol +4 -18
- package/contracts/registry/RegistryServiceManager.sol +2 -2
- package/contracts/registry/ReleaseRegistry.sol +0 -2
- package/contracts/shared/Component.sol +13 -14
- package/contracts/shared/ComponentService.sol +82 -12
- package/contracts/shared/ComponentServiceManager.sol +2 -2
- package/contracts/shared/IComponentService.sol +15 -9
- package/contracts/shared/IInstanceLinkedComponent.sol +6 -0
- package/contracts/shared/IService.sol +1 -1
- package/contracts/shared/{ERC165.sol → InitializableERC165.sol} +1 -1
- package/contracts/shared/InstanceLinkedComponent.sol +21 -0
- package/contracts/shared/NftOwnable.sol +2 -2
- package/contracts/shared/PolicyHolder.sol +2 -5
- package/contracts/shared/Service.sol +3 -4
- package/contracts/staking/IStaking.sol +1 -1
- package/contracts/staking/Staking.sol +19 -14
- package/contracts/staking/StakingManager.sol +2 -5
- package/contracts/staking/StakingReader.sol +6 -9
- package/contracts/staking/StakingServiceManager.sol +2 -2
- package/contracts/staking/StakingStore.sol +5 -15
- package/contracts/type/Amount.sol +12 -5
- package/contracts/type/Blocknumber.sol +7 -1
- package/contracts/type/Referral.sol +1 -0
- package/contracts/type/Seconds.sol +13 -1
- package/contracts/type/Timestamp.sol +11 -1
- package/contracts/type/UFixed.sol +29 -10
- package/contracts/{shared → upgradeability}/ProxyManager.sol +3 -4
- package/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol +1 -3
- package/package.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +0 -4
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +0 -4
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +0 -4
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +0 -4
- /package/contracts/{shared → upgradeability}/IVersionable.sol +0 -0
- /package/contracts/{shared → upgradeability}/Versionable.sol +0 -0
@@ -46,6 +46,12 @@ interface IPoolComponent is IInstanceLinkedComponent {
|
|
46
46
|
view
|
47
47
|
returns (bool isMatching);
|
48
48
|
|
49
|
+
/// @dev Withdraw bundle feeds for the given bundle
|
50
|
+
/// @param bundleNftId the bundle Nft Id
|
51
|
+
/// @param amount the amount to withdraw. If set to AMOUNT_MAX, the full commission available is withdrawn
|
52
|
+
/// @return withdrawnAmount the effective withdrawn amount
|
53
|
+
function withdrawBundleFees(NftId bundleNftId, Amount amount) external returns (Amount withdrawnAmount);
|
54
|
+
|
49
55
|
/// @dev returns initial pool specific infos for this pool
|
50
56
|
function getInitialPoolInfo() external view returns (IComponents.PoolInfo memory info);
|
51
57
|
|
@@ -23,8 +23,15 @@ interface IPoolService is IService {
|
|
23
23
|
event LogPoolServiceBundleCreated(NftId instanceNftId, NftId poolNftId, NftId bundleNftId);
|
24
24
|
event LogPoolServiceBundleClosed(NftId instanceNftId, NftId poolNftId, NftId bundleNftId);
|
25
25
|
|
26
|
+
event LogPoolServiceBundleStaked(NftId instanceNftId, NftId poolNftId, NftId bundleNftId, Amount amount, Amount netAmount);
|
27
|
+
event LogPoolServiceBundleUnstaked(NftId instanceNftId, NftId poolNftId, NftId bundleNftId, Amount amount);
|
28
|
+
|
26
29
|
error ErrorPoolServiceBundleOwnerRoleAlreadySet(NftId poolNftId);
|
27
30
|
error ErrorPoolServiceInvalidTransferAmount(Amount expectedAmount, Amount actualAmount);
|
31
|
+
error ErrorPoolServiceBundlePoolMismatch(NftId bundleNftId, NftId poolNftId);
|
32
|
+
error ErrorPoolServiceMaxCapitalAmountExceeded(NftId poolNftId, Amount maxCapitalAmount, Amount capitalAmount, Amount amountToBeAdded);
|
33
|
+
error ErrorPoolServiceWalletAllowanceTooSmall(address wallet, address spender, uint256 allowance, uint256 amount);
|
34
|
+
error ErrorPoolServiceAmountIsZero();
|
28
35
|
|
29
36
|
/// @dev defines the required role for bundle owners for the calling pool
|
30
37
|
/// default implementation returns PUBLIC ROLE
|
@@ -33,14 +40,6 @@ interface IPoolService is IService {
|
|
33
40
|
/// @dev sets the max capital amount for the calling pool
|
34
41
|
function setMaxCapitalAmount(Amount maxCapitalAmount) external;
|
35
42
|
|
36
|
-
/// @dev set pool sepecific fees
|
37
|
-
function setFees(
|
38
|
-
Fee memory poolFee,
|
39
|
-
Fee memory stakingFee,
|
40
|
-
Fee memory performanceFee
|
41
|
-
) external;
|
42
|
-
|
43
|
-
|
44
43
|
/// @dev locks required collateral to cover the specified application (and turn it into a policy)
|
45
44
|
/// - retention level == 1: the full collateral amount will be locked by the specified bundle
|
46
45
|
/// - retention level < 1: a part of the coverage is provided by the specified bundle, the rest by the pool component
|
@@ -85,7 +84,8 @@ interface IPoolService is IService {
|
|
85
84
|
|
86
85
|
/// @dev create a new bundle for the provided parameters
|
87
86
|
/// staking fees will be deducted by the pool service from the staking amount
|
88
|
-
/// may only be called by registered and unlocked pool components
|
87
|
+
/// may only be called by registered and unlocked pool components.
|
88
|
+
/// The pool balance is equal to the pool fees plus the capital of all bundles.
|
89
89
|
function createBundle(
|
90
90
|
address owner, // initial bundle owner
|
91
91
|
Fee memory fee, // fees deducted from premium that go to bundle owner
|
@@ -94,7 +94,7 @@ interface IPoolService is IService {
|
|
94
94
|
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
95
95
|
)
|
96
96
|
external
|
97
|
-
returns(NftId bundleNftId); // the nft id of the newly created bundle
|
97
|
+
returns(NftId bundleNftId, Amount netStakedAmount); // the nft id of the newly created bundle
|
98
98
|
|
99
99
|
|
100
100
|
/// @dev closes the specified bundle
|
@@ -111,13 +111,12 @@ interface IPoolService is IService {
|
|
111
111
|
/// @dev increase stakes for bundle
|
112
112
|
/// staking fees will be deducted by the pool service from the staking amount
|
113
113
|
/// may only be called by registered and unlocked pool components
|
114
|
-
|
115
|
-
|
114
|
+
function stake(NftId bundleNftId, Amount amount) external returns(Amount netAmount);
|
116
115
|
|
117
116
|
/// @dev decrease stakes for bundle
|
118
117
|
/// performance fees will be deducted by the pool service from the staking amount
|
119
118
|
/// may only be called by registered and unlocked pool components
|
120
|
-
|
119
|
+
function unstake(NftId bundleNftId, Amount amount) external returns(Amount netAmount);
|
121
120
|
|
122
121
|
|
123
122
|
/// @dev calulate required collateral for the provided parameters
|
package/contracts/pool/Pool.sol
CHANGED
@@ -14,6 +14,7 @@ import {Fee, FeeLib} from "../type/Fee.sol";
|
|
14
14
|
import {NftId, NftIdLib} from "../type/NftId.sol";
|
15
15
|
import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
|
16
16
|
import {Seconds} from "../type/Seconds.sol";
|
17
|
+
import {Timestamp} from "../type/Timestamp.sol";
|
17
18
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
18
19
|
import {UFixed, UFixedLib} from "../type/UFixed.sol";
|
19
20
|
|
@@ -91,6 +92,18 @@ abstract contract Pool is
|
|
91
92
|
onlyOwner()
|
92
93
|
{
|
93
94
|
_getPoolStorage()._componentService.registerPool();
|
95
|
+
_approveTokenHandler(type(uint256).max);
|
96
|
+
}
|
97
|
+
|
98
|
+
/// @inheritdoc IPoolComponent
|
99
|
+
function withdrawBundleFees(NftId bundleNftId, Amount amount)
|
100
|
+
external
|
101
|
+
virtual
|
102
|
+
restricted()
|
103
|
+
onlyBundleOwner(bundleNftId)
|
104
|
+
returns (Amount withdrawnAmount)
|
105
|
+
{
|
106
|
+
return _withdrawBundleFees(bundleNftId, amount);
|
94
107
|
}
|
95
108
|
|
96
109
|
|
@@ -101,17 +114,13 @@ abstract contract Pool is
|
|
101
114
|
returns (IComponents.PoolInfo memory poolInfo)
|
102
115
|
{
|
103
116
|
return IComponents.PoolInfo(
|
104
|
-
NftIdLib.zero(), // will be set when GIF registers the related product
|
105
117
|
PUBLIC_ROLE(), // bundleOwnerRole
|
106
118
|
AmountLib.max(), // maxCapitalAmount,
|
107
119
|
isNftInterceptor(), // isInterceptingBundleTransfers
|
108
120
|
false, // isExternallyManaged,
|
109
121
|
false, // isVerifyingApplications,
|
110
122
|
UFixedLib.toUFixed(1), // collateralizationLevel,
|
111
|
-
UFixedLib.toUFixed(1)
|
112
|
-
FeeLib.zero(), // initialPoolFee,
|
113
|
-
FeeLib.zero(), // initialStakingFee,
|
114
|
-
FeeLib.zero() // initialPerformanceFee,
|
123
|
+
UFixedLib.toUFixed(1) // retentionLevel,
|
115
124
|
);
|
116
125
|
}
|
117
126
|
|
@@ -160,8 +169,9 @@ abstract contract Pool is
|
|
160
169
|
)
|
161
170
|
internal
|
162
171
|
virtual
|
172
|
+
returns(Amount netAmount)
|
163
173
|
{
|
164
|
-
|
174
|
+
_getPoolStorage()._poolService.stake(bundleNftId, amount);
|
165
175
|
}
|
166
176
|
|
167
177
|
|
@@ -173,8 +183,9 @@ abstract contract Pool is
|
|
173
183
|
)
|
174
184
|
internal
|
175
185
|
virtual
|
186
|
+
returns(Amount netAmount)
|
176
187
|
{
|
177
|
-
|
188
|
+
return _getPoolStorage()._poolService.unstake(bundleNftId, amount);
|
178
189
|
}
|
179
190
|
|
180
191
|
|
@@ -186,8 +197,9 @@ abstract contract Pool is
|
|
186
197
|
)
|
187
198
|
internal
|
188
199
|
virtual
|
200
|
+
returns (Timestamp extendedExpiredAt)
|
189
201
|
{
|
190
|
-
|
202
|
+
return _getPoolStorage()._bundleService.extend(bundleNftId, lifetimeExtension);
|
191
203
|
}
|
192
204
|
|
193
205
|
|
@@ -284,9 +296,9 @@ abstract contract Pool is
|
|
284
296
|
bytes memory filter
|
285
297
|
)
|
286
298
|
internal
|
287
|
-
returns(NftId bundleNftId)
|
299
|
+
returns(NftId bundleNftId, Amount netStakedAmount)
|
288
300
|
{
|
289
|
-
bundleNftId = _getPoolStorage()._poolService.createBundle(
|
301
|
+
(bundleNftId, netStakedAmount) = _getPoolStorage()._poolService.createBundle(
|
290
302
|
bundleOwner,
|
291
303
|
fee,
|
292
304
|
amount,
|
@@ -296,12 +308,17 @@ abstract contract Pool is
|
|
296
308
|
// TODO add logging
|
297
309
|
}
|
298
310
|
|
299
|
-
|
300
311
|
// TODO remove function once this is no longer used to produce contract locations on the fly ...
|
301
312
|
function getContractLocation(bytes memory name) external pure returns (bytes32 hash) {
|
302
313
|
return keccak256(abi.encode(uint256(keccak256(name)) - 1)) & ~bytes32(uint256(0xff));
|
303
314
|
}
|
304
315
|
|
316
|
+
function _withdrawBundleFees(NftId bundleNftId, Amount amount)
|
317
|
+
internal
|
318
|
+
returns (Amount withdrawnAmount)
|
319
|
+
{
|
320
|
+
return _getPoolStorage()._bundleService.withdrawBundleFees(bundleNftId, amount);
|
321
|
+
}
|
305
322
|
|
306
323
|
function _getPoolStorage() private pure returns (PoolStorage storage $) {
|
307
324
|
assembly {
|
@@ -1,45 +1,33 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
5
|
-
|
6
|
-
import {IInstance} from "../instance/IInstance.sol";
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
|
7
6
|
import {IBundle} from "../instance/module/IBundle.sol";
|
7
|
+
import {IBundleService} from "./IBundleService.sol";
|
8
8
|
import {IComponents} from "../instance/module/IComponents.sol";
|
9
|
+
import {IComponentService} from "../shared/IComponentService.sol";
|
10
|
+
import {IInstance} from "../instance/IInstance.sol";
|
11
|
+
import {IInstanceService} from "../instance/IInstanceService.sol";
|
9
12
|
import {IPolicy} from "../instance/module/IPolicy.sol";
|
10
|
-
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
13
|
+
import {IPoolService} from "./IPoolService.sol";
|
14
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
15
|
+
import {IRegistryService} from "../registry/IRegistryService.sol";
|
16
|
+
import {IStaking} from "../staking/IStaking.sol";
|
14
17
|
|
15
18
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
16
19
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
17
20
|
import {NftId, NftIdLib} from "../type/NftId.sol";
|
18
|
-
import {ObjectType, POOL, BUNDLE, COMPONENT, INSTANCE, REGISTRY
|
21
|
+
import {ObjectType, POOL, BUNDLE, COMPONENT, INSTANCE, REGISTRY} from "../type/ObjectType.sol";
|
19
22
|
import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
|
20
23
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
21
|
-
import {
|
22
|
-
import {KEEP_STATE, StateId} from "../type/StateId.sol";
|
24
|
+
import {KEEP_STATE} from "../type/StateId.sol";
|
23
25
|
import {Seconds} from "../type/Seconds.sol";
|
24
|
-
import {TimestampLib, zeroTimestamp} from "../type/Timestamp.sol";
|
25
26
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
26
27
|
import {UFixed} from "../type/UFixed.sol";
|
27
|
-
import {Version, VersionLib} from "../type/Version.sol";
|
28
|
-
|
29
|
-
import {IService} from "../shared/IService.sol";
|
30
|
-
import {Service} from "../shared/Service.sol";
|
31
28
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
32
|
-
import {IBundleService} from "./IBundleService.sol";
|
33
|
-
import {IComponentService} from "../shared/IComponentService.sol";
|
34
|
-
import {IInstanceService} from "../instance/IInstanceService.sol";
|
35
|
-
import {IPoolService} from "./IPoolService.sol";
|
36
|
-
import {IRegistryService} from "../registry/IRegistryService.sol";
|
37
|
-
import {IStaking} from "../staking/IStaking.sol";
|
38
|
-
import {InstanceService} from "../instance/InstanceService.sol";
|
39
29
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
40
30
|
import {InstanceStore} from "../instance/InstanceStore.sol";
|
41
|
-
import {IComponent} from "../shared/IComponent.sol";
|
42
|
-
import {IPoolComponent} from "./IPoolComponent.sol";
|
43
31
|
|
44
32
|
string constant POOL_SERVICE_NAME = "PoolService";
|
45
33
|
|
@@ -47,9 +35,6 @@ contract PoolService is
|
|
47
35
|
ComponentVerifyingService,
|
48
36
|
IPoolService
|
49
37
|
{
|
50
|
-
using NftIdLib for NftId;
|
51
|
-
using AmountLib for Amount;
|
52
|
-
|
53
38
|
IBundleService internal _bundleService;
|
54
39
|
IComponentService internal _componentService;
|
55
40
|
IInstanceService private _instanceService;
|
@@ -124,27 +109,7 @@ contract PoolService is
|
|
124
109
|
emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
|
125
110
|
}
|
126
111
|
|
127
|
-
|
128
|
-
function setFees(
|
129
|
-
Fee memory poolFee,
|
130
|
-
Fee memory stakingFee,
|
131
|
-
Fee memory performanceFee
|
132
|
-
)
|
133
|
-
external
|
134
|
-
virtual
|
135
|
-
{
|
136
|
-
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
137
|
-
|
138
|
-
IComponents.PoolInfo memory poolInfo = instance.getInstanceReader().getPoolInfo(poolNftId);
|
139
|
-
poolInfo.poolFee = poolFee;
|
140
|
-
poolInfo.stakingFee = stakingFee;
|
141
|
-
poolInfo.performanceFee = performanceFee;
|
142
|
-
|
143
|
-
instance.getInstanceStore().updatePool(poolNftId, poolInfo, KEEP_STATE());
|
144
|
-
|
145
|
-
// TODO add logging
|
146
|
-
}
|
147
|
-
|
112
|
+
/// @inheritdoc IPoolService
|
148
113
|
function createBundle(
|
149
114
|
address bundleOwner, // initial bundle owner
|
150
115
|
Fee memory fee, // fees deducted from premium that go to bundle owner
|
@@ -154,24 +119,23 @@ contract PoolService is
|
|
154
119
|
)
|
155
120
|
external
|
156
121
|
virtual
|
157
|
-
returns(NftId bundleNftId)
|
122
|
+
returns(NftId bundleNftId, Amount netStakedAmount)
|
158
123
|
{
|
159
124
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
160
|
-
|
161
|
-
|
162
|
-
(
|
163
|
-
|
164
|
-
Amount stakingNetAmount
|
165
|
-
) = FeeLib.calculateFee(
|
166
|
-
_getStakingFee(instanceReader, poolNftId),
|
125
|
+
|
126
|
+
Amount stakingFeeAmount;
|
127
|
+
(stakingFeeAmount, netStakedAmount) = FeeLib.calculateFee(
|
128
|
+
_getStakingFee(instance.getInstanceReader(), poolNftId),
|
167
129
|
stakingAmount);
|
168
130
|
|
131
|
+
// TODO: (staking amount + existing pool balance) must be be > maxCapitalAmount
|
132
|
+
|
169
133
|
bundleNftId = _bundleService.create(
|
170
134
|
instance,
|
171
135
|
poolNftId,
|
172
136
|
bundleOwner,
|
173
137
|
fee,
|
174
|
-
|
138
|
+
netStakedAmount,
|
175
139
|
lifetime,
|
176
140
|
filter);
|
177
141
|
|
@@ -179,12 +143,12 @@ contract PoolService is
|
|
179
143
|
_componentService.increasePoolBalance(
|
180
144
|
instance.getInstanceStore(),
|
181
145
|
poolNftId,
|
182
|
-
|
146
|
+
netStakedAmount,
|
183
147
|
stakingFeeAmount);
|
184
148
|
|
185
149
|
// pool bookkeeping and collect tokens from bundle owner
|
186
150
|
_collectStakingAmount(
|
187
|
-
|
151
|
+
instance.getInstanceReader(),
|
188
152
|
poolNftId,
|
189
153
|
bundleOwner,
|
190
154
|
stakingAmount);
|
@@ -198,8 +162,8 @@ contract PoolService is
|
|
198
162
|
view
|
199
163
|
returns (Fee memory stakingFee)
|
200
164
|
{
|
201
|
-
NftId productNftId = instanceReader.
|
202
|
-
return instanceReader.
|
165
|
+
NftId productNftId = instanceReader.getComponentInfo(poolNftId).productNftId;
|
166
|
+
return instanceReader.getProductInfo(productNftId).stakingFee;
|
203
167
|
}
|
204
168
|
|
205
169
|
function closeBundle(NftId bundleNftId)
|
@@ -208,16 +172,143 @@ contract PoolService is
|
|
208
172
|
{
|
209
173
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
210
174
|
|
211
|
-
// TODO
|
175
|
+
// TODO get performance fee for pool (#477)
|
212
176
|
|
213
177
|
// releasing collateral in bundle
|
214
|
-
_bundleService.close(instance, bundleNftId);
|
215
|
-
|
216
|
-
// TODO get performance fee for pool, transfer of remaining funds + bundle fees to bundle owner
|
178
|
+
(Amount balanceAmount, Amount feeAmount) = _bundleService.close(instance, bundleNftId);
|
217
179
|
|
180
|
+
_componentService.decreasePoolBalance(
|
181
|
+
instance.getInstanceStore(),
|
182
|
+
poolNftId,
|
183
|
+
balanceAmount,
|
184
|
+
feeAmount);
|
185
|
+
|
218
186
|
emit LogPoolServiceBundleClosed(instance.getNftId(), poolNftId, bundleNftId);
|
187
|
+
|
188
|
+
{
|
189
|
+
IComponents.ComponentInfo memory poolComponentInfo = instance.getInstanceReader().getComponentInfo(poolNftId);
|
190
|
+
TokenHandler tokenHandler = poolComponentInfo.tokenHandler;
|
191
|
+
IERC20Metadata token = IERC20Metadata(poolComponentInfo.token);
|
192
|
+
|
193
|
+
// TODO: centralize token handling (issue #471)
|
194
|
+
|
195
|
+
// check allowance
|
196
|
+
uint256 tokenAllowance = token.allowance(poolComponentInfo.wallet, address(tokenHandler));
|
197
|
+
if (tokenAllowance < (balanceAmount.toInt() + feeAmount.toInt())) {
|
198
|
+
revert ErrorPoolServiceWalletAllowanceTooSmall(poolComponentInfo.wallet, address(tokenHandler), tokenAllowance, balanceAmount.toInt() + feeAmount.toInt());
|
199
|
+
}
|
200
|
+
|
201
|
+
// transfer amount to bundle owner
|
202
|
+
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
203
|
+
tokenHandler.transfer(poolComponentInfo.wallet, bundleOwner, balanceAmount + feeAmount);
|
204
|
+
}
|
205
|
+
}
|
206
|
+
|
207
|
+
/// @inheritdoc IPoolService
|
208
|
+
function stake(NftId bundleNftId, Amount amount)
|
209
|
+
external
|
210
|
+
virtual
|
211
|
+
// TODO: restricted() (once #462 is done)
|
212
|
+
returns(Amount netAmount)
|
213
|
+
{
|
214
|
+
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
215
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
216
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
217
|
+
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
218
|
+
|
219
|
+
if (bundleInfo.poolNftId != poolNftId) {
|
220
|
+
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
221
|
+
}
|
222
|
+
|
223
|
+
Amount currentPoolBalance = instanceReader.getBalanceAmount(poolNftId);
|
224
|
+
if (amount + currentPoolBalance > poolInfo.maxCapitalAmount) {
|
225
|
+
revert ErrorPoolServiceMaxCapitalAmountExceeded(poolNftId, poolInfo.maxCapitalAmount, currentPoolBalance, amount);
|
226
|
+
}
|
227
|
+
|
228
|
+
// calculate fees
|
229
|
+
(
|
230
|
+
Amount feeAmount,
|
231
|
+
Amount netAmount
|
232
|
+
) = FeeLib.calculateFee(
|
233
|
+
_getStakingFee(instanceReader, poolNftId),
|
234
|
+
amount);
|
235
|
+
|
236
|
+
// do all the bookkeeping
|
237
|
+
_componentService.increasePoolBalance(
|
238
|
+
instance.getInstanceStore(),
|
239
|
+
poolNftId,
|
240
|
+
netAmount,
|
241
|
+
feeAmount);
|
242
|
+
|
243
|
+
_bundleService.stake(instance, bundleNftId, netAmount);
|
244
|
+
|
245
|
+
// collect tokens from bundle owner
|
246
|
+
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
247
|
+
_collectStakingAmount(
|
248
|
+
instanceReader,
|
249
|
+
poolNftId,
|
250
|
+
bundleOwner,
|
251
|
+
amount);
|
252
|
+
|
253
|
+
emit LogPoolServiceBundleStaked(instance.getNftId(), poolNftId, bundleNftId, amount, netAmount);
|
219
254
|
}
|
220
255
|
|
256
|
+
/// @inheritdoc IPoolService
|
257
|
+
function unstake(NftId bundleNftId, Amount amount)
|
258
|
+
external
|
259
|
+
virtual
|
260
|
+
// TODO: restricted() (once #462 is done)
|
261
|
+
returns(Amount netAmount)
|
262
|
+
{
|
263
|
+
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
264
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
265
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
266
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
267
|
+
|
268
|
+
if (bundleInfo.poolNftId != poolNftId) {
|
269
|
+
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
270
|
+
}
|
271
|
+
|
272
|
+
if (amount.eqz()) {
|
273
|
+
revert ErrorPoolServiceAmountIsZero();
|
274
|
+
}
|
275
|
+
|
276
|
+
// call bundle service for bookkeeping and additional checks
|
277
|
+
Amount unstakedAmount = _bundleService.unstake(instance, bundleNftId, amount);
|
278
|
+
|
279
|
+
// Important: from now on work only with unstakedAmount as it is the only reliable amount.
|
280
|
+
// if amount was max, this was set to the available amount
|
281
|
+
|
282
|
+
// TODO: handle performance fees (issue #477)
|
283
|
+
|
284
|
+
// update pool bookkeeping - performance fees stay in the pool, but as fees
|
285
|
+
_componentService.decreasePoolBalance(
|
286
|
+
instanceStore,
|
287
|
+
poolNftId,
|
288
|
+
unstakedAmount,
|
289
|
+
AmountLib.zero());
|
290
|
+
|
291
|
+
IComponents.ComponentInfo memory poolComponentInfo = instanceReader.getComponentInfo(poolNftId);
|
292
|
+
address poolWallet = poolComponentInfo.wallet;
|
293
|
+
|
294
|
+
// check allowance
|
295
|
+
{
|
296
|
+
IERC20Metadata token = IERC20Metadata(poolComponentInfo.token);
|
297
|
+
uint256 tokenAllowance = token.allowance(poolWallet, address(poolComponentInfo.tokenHandler));
|
298
|
+
if (tokenAllowance < unstakedAmount.toInt()) {
|
299
|
+
revert ErrorPoolServiceWalletAllowanceTooSmall(poolWallet, address(poolComponentInfo.tokenHandler), tokenAllowance, amount.toInt());
|
300
|
+
}
|
301
|
+
}
|
302
|
+
|
303
|
+
// transfer amount to bundle owner
|
304
|
+
address owner = getRegistry().ownerOf(bundleNftId);
|
305
|
+
// TODO: centralize token handling (issue #471)
|
306
|
+
poolComponentInfo.tokenHandler.transfer(poolWallet, owner, unstakedAmount);
|
307
|
+
|
308
|
+
emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount);
|
309
|
+
|
310
|
+
return unstakedAmount;
|
311
|
+
}
|
221
312
|
|
222
313
|
function processSale(
|
223
314
|
NftId bundleNftId,
|
@@ -438,10 +529,18 @@ contract PoolService is
|
|
438
529
|
address poolWallet = componentInfo.wallet;
|
439
530
|
|
440
531
|
if(amount.gtz()) {
|
532
|
+
uint256 allowance = IERC20Metadata(componentInfo.token).allowance(bundleOwner, address(tokenHandler));
|
533
|
+
if (allowance < amount.toInt()) {
|
534
|
+
revert ErrorPoolServiceWalletAllowanceTooSmall(bundleOwner, address(tokenHandler), allowance, amount.toInt());
|
535
|
+
}
|
536
|
+
|
537
|
+
// TODO: centralize token handling (issue #471)
|
441
538
|
tokenHandler.transfer(
|
442
539
|
bundleOwner,
|
443
540
|
poolWallet,
|
444
541
|
amount);
|
542
|
+
} else {
|
543
|
+
revert ErrorPoolServiceAmountIsZero();
|
445
544
|
}
|
446
545
|
}
|
447
546
|
|
@@ -1,12 +1,9 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IVersionable} from "../
|
5
|
-
import {ProxyManager} from "../
|
4
|
+
import {IVersionable} from "../upgradeability/IVersionable.sol";
|
5
|
+
import {ProxyManager} from "../upgradeability/ProxyManager.sol";
|
6
6
|
import {PoolService} from "./PoolService.sol";
|
7
|
-
import {Registry} from "../registry/Registry.sol";
|
8
|
-
import {RegistryService} from "../registry/RegistryService.sol";
|
9
|
-
import {REGISTRY} from "../type/ObjectType.sol";
|
10
7
|
|
11
8
|
contract PoolServiceManager is ProxyManager {
|
12
9
|
|
@@ -1,51 +1,27 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {IApplicationService} from "./IApplicationService.sol";
|
5
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
6
|
+
import {IInstance} from "../instance/IInstance.sol";
|
7
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
8
|
+
import {IPolicy} from "../instance/module/IPolicy.sol";
|
9
|
+
import {IDistributionService} from "../distribution/IDistributionService.sol";
|
10
|
+
import {IPricingService} from "./IPricingService.sol";
|
11
|
+
import {IRegistryService} from "../registry/IRegistryService.sol";
|
12
|
+
|
4
13
|
import {AmountLib} from "../type/Amount.sol";
|
5
14
|
import {Seconds} from "../type/Seconds.sol";
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {ObjectType, DISTRIBUTION, INSTANCE, PRODUCT, POOL, REGISTRY, APPLICATION, POLICY, BUNDLE, PRICE} from "../type/ObjectType.sol";
|
10
|
-
import {APPLIED, REVOKED, ACTIVE, KEEP_STATE} from "../type/StateId.sol";
|
15
|
+
import {zeroTimestamp} from "../type/Timestamp.sol";
|
16
|
+
import {ObjectType, DISTRIBUTION, PRODUCT, REGISTRY, APPLICATION, POLICY, PRICE} from "../type/ObjectType.sol";
|
17
|
+
import {REVOKED} from "../type/StateId.sol";
|
11
18
|
import {NftId, NftIdLib} from "../type/NftId.sol";
|
12
|
-
import {Fee, FeeLib} from "../type/Fee.sol";
|
13
19
|
import {ReferralId} from "../type/Referral.sol";
|
14
20
|
import {RiskId} from "../type/RiskId.sol";
|
15
|
-
import {StateId} from "../type/StateId.sol";
|
16
|
-
import {Version, VersionLib} from "../type/Version.sol";
|
17
21
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
18
|
-
|
19
|
-
import {TokenHandler} from "../shared/TokenHandler.sol";
|
20
|
-
import {IVersionable} from "../shared/IVersionable.sol";
|
21
|
-
import {Versionable} from "../shared/Versionable.sol";
|
22
|
-
import {IService} from "../shared/IService.sol";
|
23
|
-
import {Service} from "../shared/Service.sol";
|
24
|
-
|
25
|
-
import {IRegistry} from "../registry/IRegistry.sol";
|
26
|
-
|
27
|
-
import {IProductComponent} from "./IProductComponent.sol";
|
28
|
-
import {IPoolComponent} from "../pool/IPoolComponent.sol";
|
29
|
-
import {IDistributionComponent} from "../distribution/IDistributionComponent.sol";
|
30
|
-
import {Product} from "./Product.sol";
|
31
|
-
|
32
|
-
import {IComponents} from "../instance/module/IComponents.sol";
|
33
|
-
import {IPolicy} from "../instance/module/IPolicy.sol";
|
34
|
-
import {IRisk} from "../instance/module/IRisk.sol";
|
35
|
-
import {IBundle} from "../instance/module/IBundle.sol";
|
36
|
-
import {IProductService} from "./IProductService.sol";
|
37
|
-
|
38
22
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
39
|
-
|
40
|
-
import {IInstance} from "../instance/IInstance.sol";
|
41
23
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
42
24
|
|
43
|
-
import {IApplicationService} from "./IApplicationService.sol";
|
44
|
-
import {IBundleService} from "../pool/IBundleService.sol";
|
45
|
-
import {IDistributionService} from "../distribution/IDistributionService.sol";
|
46
|
-
import {IPoolService} from "../pool/IPoolService.sol";
|
47
|
-
import {IPricingService} from "./IPricingService.sol";
|
48
|
-
import {IRegistryService} from "../registry/IRegistryService.sol";
|
49
25
|
|
50
26
|
|
51
27
|
contract ApplicationService is
|
@@ -1,8 +1,8 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IVersionable} from "../
|
5
|
-
import {ProxyManager} from "../
|
4
|
+
import {IVersionable} from "../upgradeability/IVersionable.sol";
|
5
|
+
import {ProxyManager} from "../upgradeability/ProxyManager.sol";
|
6
6
|
import {ApplicationService} from "./ApplicationService.sol";
|
7
7
|
|
8
8
|
contract ApplicationServiceManager is ProxyManager {
|
@@ -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
|
@@ -49,8 +21,6 @@ abstract contract BasicProduct is
|
|
49
21
|
{
|
50
22
|
_setFees(productFee, processingFee);
|
51
23
|
}
|
52
|
-
|
53
|
-
|
54
24
|
function _initializeBasicProduct(
|
55
25
|
address registry,
|
56
26
|
NftId instanceNftId,
|
@@ -5,6 +5,7 @@ import {Authorization} from "../authorization/Authorization.sol";
|
|
5
5
|
import {BasicProduct} from "./BasicProduct.sol";
|
6
6
|
import {PRODUCT} from "../type/ObjectType.sol";
|
7
7
|
import {IAccess} from "../authorization/IAccess.sol";
|
8
|
+
import {IInstanceLinkedComponent} from "../shared/IInstanceLinkedComponent.sol";
|
8
9
|
import {PUBLIC_ROLE} from "../../contracts/type/RoleId.sol";
|
9
10
|
import {RoleId} from "../type/RoleId.sol";
|
10
11
|
|
@@ -35,6 +36,8 @@ contract BasicProductAuthorization
|
|
35
36
|
// authorize public role (open access to any account, only allows to lock target)
|
36
37
|
functions = _authorizeForTarget(getTargetName(), PUBLIC_ROLE());
|
37
38
|
_authorize(functions, BasicProduct.setFees.selector, "setFees");
|
39
|
+
|
40
|
+
_authorize(functions, IInstanceLinkedComponent.withdrawFees.selector, "withdrawFees");
|
38
41
|
}
|
39
42
|
}
|
40
43
|
|