@etherisc/gif-next 0.0.2-888aabe-141 → 0.0.2-89c8f37-711
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 +14 -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 +50 -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 +24 -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 +24 -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 +2 -2
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +54 -59
- 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 +66 -76
- 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 +24 -0
- 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 +210 -44
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +55 -23
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +102 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +24 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +24 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +2 -2
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +2 -2
- 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/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 +13 -0
- 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/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 +64 -51
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +26 -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/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 +175 -75
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +42 -38
- 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 +92 -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 +2 -2
- 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 +2 -2
- 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/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 +2 -2
- 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 +2 -2
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/distribution/BasicDistribution.sol +4 -15
- package/contracts/distribution/BasicDistributionAuthorization.sol +5 -1
- package/contracts/distribution/Distribution.sol +15 -21
- package/contracts/distribution/DistributionService.sol +59 -10
- package/contracts/distribution/IDistributionComponent.sol +5 -2
- package/contracts/distribution/IDistributionService.sol +12 -0
- package/contracts/instance/InstanceStore.sol +2 -1
- 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/pool/BasicPoolAuthorization.sol +6 -0
- package/contracts/pool/BundleService.sol +59 -2
- package/contracts/pool/IBundleService.sol +14 -0
- package/contracts/pool/IPoolComponent.sol +6 -2
- package/contracts/pool/Pool.sol +17 -18
- package/contracts/pool/PoolService.sol +1 -3
- package/contracts/product/BasicProduct.sol +3 -33
- package/contracts/product/BasicProductAuthorization.sol +3 -0
- package/contracts/product/ClaimService.sol +2 -1
- package/contracts/product/IPolicyService.sol +2 -0
- package/contracts/product/IProductComponent.sol +1 -3
- package/contracts/product/PolicyService.sol +28 -4
- package/contracts/product/Product.sol +9 -17
- package/contracts/registry/ReleaseRegistry.sol +0 -2
- package/contracts/shared/Component.sol +6 -0
- package/contracts/shared/ComponentService.sol +50 -16
- package/contracts/shared/IComponentService.sol +9 -9
- package/contracts/shared/IInstanceLinkedComponent.sol +6 -0
- 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/staking/Staking.sol +3 -1
- package/contracts/type/Amount.sol +12 -5
- package/contracts/type/Blocknumber.sol +7 -1
- package/contracts/type/Referral.sol +1 -0
- package/contracts/type/Timestamp.sol +6 -0
- package/contracts/type/UFixed.sol +29 -10
- package/package.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
@@ -1,8 +1,11 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
|
4
6
|
import {IBundle} from "../instance/module/IBundle.sol";
|
5
7
|
import {IBundleService} from "./IBundleService.sol";
|
8
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
6
9
|
import {IComponentService} from "../shared/IComponentService.sol";
|
7
10
|
import {IRegistry} from "../registry/IRegistry.sol";
|
8
11
|
import {IRegistryService} from "../registry/IRegistryService.sol";
|
@@ -27,8 +30,7 @@ contract BundleService is
|
|
27
30
|
ComponentVerifyingService,
|
28
31
|
IBundleService
|
29
32
|
{
|
30
|
-
|
31
|
-
|
33
|
+
|
32
34
|
string public constant NAME = "BundleService";
|
33
35
|
|
34
36
|
address private _registryAddress;
|
@@ -262,6 +264,61 @@ contract BundleService is
|
|
262
264
|
instance.getBundleSet().unlinkPolicy(policyNftId);
|
263
265
|
}
|
264
266
|
|
267
|
+
/// @inheritdoc IBundleService
|
268
|
+
function withdrawBundleFees(NftId bundleNftId, Amount amount)
|
269
|
+
public
|
270
|
+
virtual
|
271
|
+
// TODO: restricted() (once #462 is done)
|
272
|
+
returns (Amount withdrawnAmount)
|
273
|
+
{
|
274
|
+
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
275
|
+
InstanceReader reader = instance.getInstanceReader();
|
276
|
+
|
277
|
+
IComponents.ComponentInfo memory poolInfo = reader.getComponentInfo(poolNftId);
|
278
|
+
address poolWallet = poolInfo.wallet;
|
279
|
+
|
280
|
+
IBundle.BundleInfo memory bundleInfo = reader.getBundleInfo(bundleNftId);
|
281
|
+
|
282
|
+
// determine withdrawn amount
|
283
|
+
withdrawnAmount = amount;
|
284
|
+
if (withdrawnAmount.gte(AmountLib.max())) {
|
285
|
+
withdrawnAmount = reader.getFeeAmount(bundleNftId);
|
286
|
+
} else {
|
287
|
+
if (withdrawnAmount.gt(reader.getFeeAmount(bundleNftId))) {
|
288
|
+
revert ErrorBundleServiceFeesWithdrawAmountExceedsLimit(withdrawnAmount, reader.getFeeAmount(bundleNftId));
|
289
|
+
}
|
290
|
+
}
|
291
|
+
|
292
|
+
if (withdrawnAmount.eqz()) {
|
293
|
+
revert ErrorBundleServiceFeesWithdrawAmountIsZero();
|
294
|
+
}
|
295
|
+
|
296
|
+
// check allowance
|
297
|
+
IERC20Metadata token = IERC20Metadata(poolInfo.token);
|
298
|
+
uint256 tokenAllowance = token.allowance(poolWallet, address(poolInfo.tokenHandler));
|
299
|
+
if (tokenAllowance < withdrawnAmount.toInt()) {
|
300
|
+
revert ErrorBundleServiceWalletAllowanceTooSmall(poolWallet, address(poolInfo.tokenHandler), tokenAllowance, withdrawnAmount.toInt());
|
301
|
+
}
|
302
|
+
|
303
|
+
// decrease fee counters by withdrawnAmount
|
304
|
+
{
|
305
|
+
InstanceStore store = instance.getInstanceStore();
|
306
|
+
// decrease fee amount of the bundle
|
307
|
+
_componentService.decreaseBundleBalance(store, bundleNftId, AmountLib.zero(), withdrawnAmount);
|
308
|
+
// decrease pool balance
|
309
|
+
_componentService.decreasePoolBalance(store, poolNftId, withdrawnAmount, AmountLib.zero());
|
310
|
+
}
|
311
|
+
|
312
|
+
// transfer amount to bundle owner
|
313
|
+
{
|
314
|
+
address owner = getRegistry().ownerOf(bundleNftId);
|
315
|
+
// TODO: centralize token handling (issue #471)
|
316
|
+
poolInfo.tokenHandler.transfer(poolWallet, owner, withdrawnAmount);
|
317
|
+
|
318
|
+
emit LogBundleServiceFeesWithdrawn(bundleNftId, owner, address(token), withdrawnAmount);
|
319
|
+
}
|
320
|
+
}
|
321
|
+
|
265
322
|
/// @dev links policy to bundle
|
266
323
|
function _linkPolicy(IInstance instance, NftId policyNftId)
|
267
324
|
internal
|
@@ -26,6 +26,13 @@ interface IBundleService is IService {
|
|
26
26
|
|
27
27
|
error ErrorBundleServicePolicyNotCloseable(NftId policyNftId);
|
28
28
|
|
29
|
+
// error ErrorBundleServiceBundleNotActive(NftId distributorNftId);
|
30
|
+
error ErrorBundleServiceFeesWithdrawAmountExceedsLimit(Amount amount, Amount limit);
|
31
|
+
error ErrorBundleServiceFeesWithdrawAmountIsZero();
|
32
|
+
error ErrorBundleServiceWalletAllowanceTooSmall(address wallet, address tokenHandler, uint256 allowance, uint256 amount);
|
33
|
+
|
34
|
+
event LogBundleServiceFeesWithdrawn(NftId bundleNftId, address recipient, address tokenAddress, Amount amount);
|
35
|
+
|
29
36
|
/// @dev create a new bundle for the specified attributes
|
30
37
|
/// may only be called by pool service
|
31
38
|
function create(
|
@@ -103,4 +110,11 @@ interface IBundleService is IService {
|
|
103
110
|
IInstance instance,
|
104
111
|
NftId policyNftId
|
105
112
|
) external;
|
113
|
+
|
114
|
+
/// @dev Withdraw bundle feeds for the given bundle
|
115
|
+
/// @param bundleNftId the bundle Nft Id
|
116
|
+
/// @param amount the amount to withdraw. If set to AMOUNT_MAX, the full commission available is withdrawn
|
117
|
+
/// @return withdrawnAmount the effective withdrawn amount
|
118
|
+
function withdrawBundleFees(NftId bundleNftId, Amount amount) external returns (Amount withdrawnAmount);
|
119
|
+
|
106
120
|
}
|
@@ -46,9 +46,13 @@ 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
|
|
52
|
-
/// @dev Withdraw fees from the distribution component. Only component owner is allowed to withdraw fees.
|
53
|
-
function withdrawFees(Amount amount) external returns (Amount withdrawnAmount);
|
54
58
|
}
|
package/contracts/pool/Pool.sol
CHANGED
@@ -94,6 +94,17 @@ abstract contract Pool is
|
|
94
94
|
_approveTokenHandler(type(uint256).max);
|
95
95
|
}
|
96
96
|
|
97
|
+
/// @inheritdoc IPoolComponent
|
98
|
+
function withdrawBundleFees(NftId bundleNftId, Amount amount)
|
99
|
+
external
|
100
|
+
virtual
|
101
|
+
restricted()
|
102
|
+
onlyBundleOwner(bundleNftId)
|
103
|
+
returns (Amount withdrawnAmount)
|
104
|
+
{
|
105
|
+
return _withdrawBundleFees(bundleNftId, amount);
|
106
|
+
}
|
107
|
+
|
97
108
|
|
98
109
|
function getInitialPoolInfo()
|
99
110
|
public
|
@@ -116,15 +127,6 @@ abstract contract Pool is
|
|
116
127
|
);
|
117
128
|
}
|
118
129
|
|
119
|
-
function withdrawFees(Amount amount)
|
120
|
-
external
|
121
|
-
virtual
|
122
|
-
onlyOwner()
|
123
|
-
returns (Amount withdrawnAmount)
|
124
|
-
{
|
125
|
-
return _withdrawFees(amount);
|
126
|
-
}
|
127
|
-
|
128
130
|
// Internals
|
129
131
|
|
130
132
|
function _initializePool(
|
@@ -306,20 +308,17 @@ abstract contract Pool is
|
|
306
308
|
// TODO add logging
|
307
309
|
}
|
308
310
|
|
309
|
-
function _withdrawFees(Amount amount)
|
310
|
-
internal
|
311
|
-
virtual
|
312
|
-
returns (Amount withdrawnAmount)
|
313
|
-
{
|
314
|
-
return _getPoolStorage()._componentService.withdrawFees(amount);
|
315
|
-
}
|
316
|
-
|
317
|
-
|
318
311
|
// TODO remove function once this is no longer used to produce contract locations on the fly ...
|
319
312
|
function getContractLocation(bytes memory name) external pure returns (bytes32 hash) {
|
320
313
|
return keccak256(abi.encode(uint256(keccak256(name)) - 1)) & ~bytes32(uint256(0xff));
|
321
314
|
}
|
322
315
|
|
316
|
+
function _withdrawBundleFees(NftId bundleNftId, Amount amount)
|
317
|
+
internal
|
318
|
+
returns (Amount withdrawnAmount)
|
319
|
+
{
|
320
|
+
return _getPoolStorage()._bundleService.withdrawBundleFees(bundleNftId, amount);
|
321
|
+
}
|
323
322
|
|
324
323
|
function _getPoolStorage() private pure returns (PoolStorage storage $) {
|
325
324
|
assembly {
|
@@ -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;
|
@@ -423,6 +420,7 @@ contract PoolService is
|
|
423
420
|
address poolWallet = componentInfo.wallet;
|
424
421
|
|
425
422
|
if(amount.gtz()) {
|
423
|
+
// TODO: centralize token handling (issue #471)
|
426
424
|
tokenHandler.transfer(
|
427
425
|
bundleOwner,
|
428
426
|
poolWallet,
|
@@ -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
|
|
@@ -336,7 +336,8 @@ contract ClaimService is
|
|
336
336
|
// TODO transfer processing fees to product wallet
|
337
337
|
// TODO inform product to update fee book keeping
|
338
338
|
}
|
339
|
-
|
339
|
+
|
340
|
+
// TODO: centralize token handling (issue #471)
|
340
341
|
poolInfo.tokenHandler.transfer(
|
341
342
|
poolInfo.wallet,
|
342
343
|
beneficiary,
|
@@ -38,6 +38,8 @@ interface IPolicyService is IService {
|
|
38
38
|
error ErrorPolicyServicePremiumMismatch(NftId policyNftId, Amount expectedPremiumAmount, Amount recalculatedPremiumAmount);
|
39
39
|
error ErrorPolicyServiceTransferredPremiumMismatch(NftId policyNftId, Amount expectedPremiumAmount, Amount transferredPremiumAmount);
|
40
40
|
|
41
|
+
event LogPolicyServicePolicyDeclined(NftId policyNftId);
|
42
|
+
|
41
43
|
/// @dev collateralizes the policy represented by {policyNftId}
|
42
44
|
/// sets the policy state to collateralized
|
43
45
|
/// may set the policy state to activated and set the activation date
|
@@ -36,7 +36,5 @@ interface IProductComponent is
|
|
36
36
|
|
37
37
|
/// @dev returns initial pool specific infos for this pool
|
38
38
|
function getInitialProductInfo() external view returns (IComponents.ProductInfo memory info);
|
39
|
-
|
40
|
-
/// @dev Withdraw fees from the distribution component. Only component owner is allowed to withdraw fees.
|
41
|
-
function withdrawFees(Amount amount) external returns (Amount withdrawnAmount);
|
39
|
+
|
42
40
|
}
|
@@ -90,15 +90,38 @@ contract PolicyService is
|
|
90
90
|
(, productInfo,) = _getAndVerifyActiveComponent(PRODUCT());
|
91
91
|
product = Product(productInfo.objectAddress);
|
92
92
|
}
|
93
|
-
|
93
|
+
|
94
94
|
|
95
95
|
function decline(
|
96
|
-
NftId policyNftId
|
96
|
+
NftId applicationNftId // = policyNftId
|
97
97
|
)
|
98
98
|
external
|
99
|
-
override
|
99
|
+
virtual override
|
100
100
|
{
|
101
|
-
|
101
|
+
(NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
102
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
103
|
+
|
104
|
+
// check policy is in state applied
|
105
|
+
if (instanceReader.getPolicyState(applicationNftId) != APPLIED()) {
|
106
|
+
revert ErrorPolicyServicePolicyStateNotApplied(applicationNftId);
|
107
|
+
}
|
108
|
+
|
109
|
+
// check policy matches with calling product
|
110
|
+
IPolicy.PolicyInfo memory applicationInfo = instanceReader.getPolicyInfo(applicationNftId);
|
111
|
+
if(applicationInfo.productNftId != productNftId) {
|
112
|
+
revert ErrorPolicyServicePolicyProductMismatch(
|
113
|
+
applicationNftId,
|
114
|
+
applicationInfo.productNftId,
|
115
|
+
productNftId);
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
// store updated policy info
|
120
|
+
instance.getInstanceStore().updatePolicyState(
|
121
|
+
applicationNftId,
|
122
|
+
DECLINED());
|
123
|
+
|
124
|
+
emit LogPolicyServicePolicyDeclined(applicationNftId);
|
102
125
|
}
|
103
126
|
|
104
127
|
event LogDebug(uint idx, string message);
|
@@ -427,6 +450,7 @@ contract PolicyService is
|
|
427
450
|
bundleNftId,
|
428
451
|
premium);
|
429
452
|
|
453
|
+
// TODO: centralize token handling (issue #471)
|
430
454
|
// transfer premium amounts to target wallets
|
431
455
|
tokenHandler.transfer(policyHolder, productWallet, premium.productFeeAmount);
|
432
456
|
tokenHandler.transfer(policyHolder, distributionWallet, premium.distributionFeeAndCommissionAmount);
|
@@ -135,15 +135,6 @@ abstract contract Product is
|
|
135
135
|
return getRegistry().getNftId(address(_getProductStorage()._distribution));
|
136
136
|
}
|
137
137
|
|
138
|
-
function withdrawFees(Amount amount)
|
139
|
-
external
|
140
|
-
virtual
|
141
|
-
onlyOwner()
|
142
|
-
returns (Amount withdrawnAmount)
|
143
|
-
{
|
144
|
-
return _withdrawFees(amount);
|
145
|
-
}
|
146
|
-
|
147
138
|
function _initializeProduct(
|
148
139
|
address registry,
|
149
140
|
NftId instanceNftId,
|
@@ -274,6 +265,15 @@ abstract contract Product is
|
|
274
265
|
activateAt);
|
275
266
|
}
|
276
267
|
|
268
|
+
function _decline(
|
269
|
+
NftId policyNftId
|
270
|
+
)
|
271
|
+
internal
|
272
|
+
{
|
273
|
+
_getProductStorage()._policyService.decline(
|
274
|
+
policyNftId);
|
275
|
+
}
|
276
|
+
|
277
277
|
function _collectPremium(
|
278
278
|
NftId policyNftId,
|
279
279
|
Timestamp activateAt
|
@@ -389,14 +389,6 @@ abstract contract Product is
|
|
389
389
|
return RiskIdLib.toRiskId(riskName);
|
390
390
|
}
|
391
391
|
|
392
|
-
function _withdrawFees(Amount amount)
|
393
|
-
internal
|
394
|
-
virtual
|
395
|
-
returns (Amount withdrawnAmount)
|
396
|
-
{
|
397
|
-
return _getProductStorage()._componentService.withdrawFees(amount);
|
398
|
-
}
|
399
|
-
|
400
392
|
function _getProductStorage() private pure returns (ProductStorage storage $) {
|
401
393
|
assembly {
|
402
394
|
$.slot := PRODUCT_STORAGE_LOCATION_V1
|
@@ -32,8 +32,6 @@ import {Registry} from "./Registry.sol";
|
|
32
32
|
import {TokenRegistry} from "./TokenRegistry.sol";
|
33
33
|
import {ReleaseLifecycle} from "./ReleaseLifecycle.sol";
|
34
34
|
|
35
|
-
// TODO rename to something that does not end with 'Manager'
|
36
|
-
// everywhere else *Manager points to an upgradeable contract
|
37
35
|
contract ReleaseRegistry is
|
38
36
|
AccessManaged,
|
39
37
|
ReleaseLifecycle,
|
@@ -39,6 +39,12 @@ abstract contract Component is
|
|
39
39
|
_;
|
40
40
|
}
|
41
41
|
|
42
|
+
modifier onlyNftOwner(NftId nftId) {
|
43
|
+
if(msg.sender != getRegistry().ownerOf(nftId)) {
|
44
|
+
revert ErrorNftOwnableNotOwner(msg.sender);
|
45
|
+
}
|
46
|
+
_;
|
47
|
+
}
|
42
48
|
|
43
49
|
function _getComponentStorage() private pure returns (ComponentStorage storage $) {
|
44
50
|
assembly {
|
@@ -1,33 +1,32 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
|
4
6
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
5
7
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
6
8
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
7
|
-
import {
|
9
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
10
|
+
import {IComponentService} from "./IComponentService.sol";
|
11
|
+
import {IInstance} from "../instance/IInstance.sol";
|
8
12
|
import {IInstanceLinkedComponent} from "./IInstanceLinkedComponent.sol";
|
13
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
14
|
+
import {InstanceStore} from "../instance/InstanceStore.sol";
|
15
|
+
import {IInstanceService} from "../instance/IInstanceService.sol";
|
16
|
+
import {IPoolComponent} from "../pool/IPoolComponent.sol";
|
17
|
+
import {IProductComponent} from "../product/IProductComponent.sol";
|
9
18
|
import {IRegistry} from "../registry/IRegistry.sol";
|
10
19
|
import {IRegistryService} from "../registry/IRegistryService.sol";
|
11
|
-
import {
|
20
|
+
import {KEEP_STATE} from "../type/StateId.sol";
|
12
21
|
import {NftId} from "../type/NftId.sol";
|
13
22
|
import {ObjectType, REGISTRY, COMPONENT, DISTRIBUTION, INSTANCE, ORACLE, POOL, PRODUCT} from "../type/ObjectType.sol";
|
14
23
|
import {RoleId, DISTRIBUTION_OWNER_ROLE, ORACLE_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE} from "../type/RoleId.sol";
|
15
|
-
import {KEEP_STATE} from "../type/StateId.sol";
|
16
|
-
import {IComponents} from "../instance/module/IComponents.sol";
|
17
|
-
import {IComponentService} from "./IComponentService.sol";
|
18
|
-
import {IInstanceService} from "../instance/IInstanceService.sol";
|
19
|
-
import {IPoolComponent} from "../pool/IPoolComponent.sol";
|
20
|
-
import {IProductComponent} from "../product/IProductComponent.sol";
|
21
|
-
import {InstanceReader} from "../instance/InstanceReader.sol";
|
22
|
-
import {InstanceStore} from "../instance/InstanceStore.sol";
|
23
24
|
import {TokenHandler} from "./TokenHandler.sol";
|
24
25
|
|
25
26
|
contract ComponentService is
|
26
27
|
ComponentVerifyingService,
|
27
28
|
IComponentService
|
28
29
|
{
|
29
|
-
using AmountLib for Amount;
|
30
|
-
|
31
30
|
error ErrorComponentServiceAlreadyRegistered(address component);
|
32
31
|
error ErrorComponentServiceNotComponent(address component);
|
33
32
|
error ErrorComponentServiceInvalidType(address component, ObjectType requiredType, ObjectType componentType);
|
@@ -94,7 +93,7 @@ contract ComponentService is
|
|
94
93
|
// TODO implement
|
95
94
|
function unlock() external virtual {}
|
96
95
|
|
97
|
-
function withdrawFees(Amount
|
96
|
+
function withdrawFees(Amount amount)
|
98
97
|
external
|
99
98
|
virtual
|
100
99
|
returns (Amount withdrawnAmount)
|
@@ -103,10 +102,12 @@ contract ComponentService is
|
|
103
102
|
IComponents.ComponentInfo memory info = instance.getInstanceReader().getComponentInfo(componentNftId);
|
104
103
|
address componentWallet = info.wallet;
|
105
104
|
|
106
|
-
// determine
|
107
|
-
withdrawnAmount =
|
108
|
-
if (withdrawnAmount.
|
105
|
+
// determine withdrawn amount
|
106
|
+
withdrawnAmount = amount;
|
107
|
+
if (withdrawnAmount.gte(AmountLib.max())) {
|
109
108
|
withdrawnAmount = instance.getInstanceReader().getFeeAmount(componentNftId);
|
109
|
+
} else if (withdrawnAmount.eqz()) {
|
110
|
+
revert ErrorComponentServiceWithdrawAmountIsZero();
|
110
111
|
} else {
|
111
112
|
Amount withdrawLimit = instance.getInstanceReader().getFeeAmount(componentNftId);
|
112
113
|
if (withdrawnAmount.gt(withdrawLimit)) {
|
@@ -127,7 +128,10 @@ contract ComponentService is
|
|
127
128
|
|
128
129
|
// transfer amount to component owner
|
129
130
|
address componentOwner = getRegistry().ownerOf(componentNftId);
|
131
|
+
// TODO: centralize token handling (issue #471)
|
130
132
|
tokenHandler.transfer(componentWallet, componentOwner, withdrawnAmount);
|
133
|
+
|
134
|
+
emit LogComponentServiceComponentFeesWithdrawn(componentNftId, componentOwner, address(token), withdrawnAmount);
|
131
135
|
}
|
132
136
|
|
133
137
|
|
@@ -291,6 +295,36 @@ contract ComponentService is
|
|
291
295
|
_changeTargetBalance(DECREASE, instanceStore, distributionNftId, amount, feeAmount);
|
292
296
|
}
|
293
297
|
|
298
|
+
//-------- distributor -------------------------------------------------------//
|
299
|
+
|
300
|
+
function increaseDistributorBalance(
|
301
|
+
InstanceStore instanceStore,
|
302
|
+
NftId distributorNftId,
|
303
|
+
Amount amount,
|
304
|
+
Amount feeAmount
|
305
|
+
)
|
306
|
+
external
|
307
|
+
virtual
|
308
|
+
// TODO re-enable once role granting is stable and fixed
|
309
|
+
// restricted()
|
310
|
+
{
|
311
|
+
_changeTargetBalance(INCREASE, instanceStore, distributorNftId, amount, feeAmount);
|
312
|
+
}
|
313
|
+
|
314
|
+
function decreaseDistributorBalance(
|
315
|
+
InstanceStore instanceStore,
|
316
|
+
NftId distributorNftId,
|
317
|
+
Amount amount,
|
318
|
+
Amount feeAmount
|
319
|
+
)
|
320
|
+
external
|
321
|
+
virtual
|
322
|
+
// TODO re-enable once role granting is stable and fixed
|
323
|
+
// restricted()
|
324
|
+
{
|
325
|
+
_changeTargetBalance(DECREASE, instanceStore, distributorNftId, amount, feeAmount);
|
326
|
+
}
|
327
|
+
|
294
328
|
//-------- oracle -------------------------------------------------------//
|
295
329
|
|
296
330
|
function registerOracle()
|
@@ -1,21 +1,12 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
5
|
-
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
6
4
|
|
7
5
|
import {Amount} from "../type/Amount.sol";
|
8
6
|
import {Fee} from "../type/Fee.sol";
|
9
|
-
import {IComponents} from "../instance/module/IComponents.sol";
|
10
|
-
import {IInstance} from "../instance/IInstance.sol";
|
11
|
-
import {IInstanceService} from "../instance/IInstanceService.sol";
|
12
7
|
import {InstanceStore} from "../instance/InstanceStore.sol";
|
13
|
-
import {IProductService} from "../product/IProductService.sol";
|
14
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
15
8
|
import {IService} from "../shared/IService.sol";
|
16
9
|
import {NftId} from "../type/NftId.sol";
|
17
|
-
import {ObjectType} from "../type/ObjectType.sol";
|
18
|
-
import {TokenHandler} from "../shared/TokenHandler.sol";
|
19
10
|
import {UFixed} from "../type/UFixed.sol";
|
20
11
|
|
21
12
|
/// @dev component base class
|
@@ -27,10 +18,12 @@ interface IComponentService is
|
|
27
18
|
error ErrorComponentServiceWalletAddressZero();
|
28
19
|
error ErrorComponentServiceWalletAddressIsSameAsCurrent();
|
29
20
|
|
21
|
+
error ErrorComponentServiceWithdrawAmountIsZero();
|
30
22
|
error ErrorComponentServiceWithdrawAmountExceedsLimit(Amount withdrawnAmount, Amount withdrawLimit);
|
31
23
|
error ErrorComponentServiceWalletAllowanceTooSmall(address wallet, address spender, uint256 allowance, uint256 amount);
|
32
24
|
|
33
25
|
event LogComponentServiceWalletAddressChanged(NftId componentNftId, address currentWallet, address newWallet);
|
26
|
+
event LogComponentServiceComponentFeesWithdrawn(NftId componentNftId, address recipient, address token, Amount withdrawnAmount);
|
34
27
|
event LogComponentServiceProductFeesUpdated(NftId productNftId);
|
35
28
|
event LogComponentServiceDistributionFeesUpdated(NftId distributionNftId);
|
36
29
|
event LogComponentServicePoolFeesUpdated(NftId poolNftId);
|
@@ -55,6 +48,8 @@ interface IComponentService is
|
|
55
48
|
function unlock() external;
|
56
49
|
|
57
50
|
/// @dev Withdraw fees from the distribution component. Only component owner is allowed to withdraw fees.
|
51
|
+
/// @param withdrawAmount the amount to withdraw
|
52
|
+
/// @return withdrawnAmount the amount that was actually withdrawn
|
58
53
|
function withdrawFees(Amount withdrawAmount) external returns (Amount withdrawnAmount);
|
59
54
|
|
60
55
|
//-------- product ------------------------------------------------------//
|
@@ -83,6 +78,10 @@ interface IComponentService is
|
|
83
78
|
function increaseDistributionBalance(InstanceStore instanceStore, NftId distributionNftId, Amount amount, Amount feeAmount) external;
|
84
79
|
function decreaseDistributionBalance(InstanceStore instanceStore, NftId distributionNftId, Amount amount, Amount feeAmount) external;
|
85
80
|
|
81
|
+
//-------- distributor --------------------------------------------------//
|
82
|
+
function increaseDistributorBalance(InstanceStore instanceStore, NftId distributorNftId, Amount amount, Amount feeAmount) external;
|
83
|
+
function decreaseDistributorBalance(InstanceStore instanceStore, NftId distributorNftId, Amount amount, Amount feeAmount) external;
|
84
|
+
|
86
85
|
//-------- oracle -------------------------------------------------------//
|
87
86
|
|
88
87
|
/// @dev registers the sending component as an oracle component
|
@@ -105,4 +104,5 @@ interface IComponentService is
|
|
105
104
|
//-------- bundle -------------------------------------------------------//
|
106
105
|
function increaseBundleBalance(InstanceStore instanceStore, NftId bundleNftId, Amount amount, Amount feeAmount) external;
|
107
106
|
function decreaseBundleBalance(InstanceStore instanceStore, NftId bundleNftId, Amount amount, Amount feeAmount) external;
|
107
|
+
|
108
108
|
}
|
@@ -4,6 +4,7 @@ pragma solidity ^0.8.20;
|
|
4
4
|
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
5
5
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
6
6
|
|
7
|
+
import {Amount} from "../type/Amount.sol";
|
7
8
|
import {IComponent} from "../shared/IComponent.sol";
|
8
9
|
import {IAuthorization} from "../authorization/IAuthorization.sol";
|
9
10
|
import {IComponents} from "../instance/module/IComponents.sol";
|
@@ -47,4 +48,9 @@ interface IInstanceLinkedComponent is
|
|
47
48
|
/// @dev returns the initial component authorization specification.
|
48
49
|
function getAuthorization() external view returns (IAuthorization authorization);
|
49
50
|
|
51
|
+
/// @dev Withdraw fees from the distribution component. Only component owner is allowed to withdraw fees.
|
52
|
+
/// @param amount the amount to withdraw
|
53
|
+
/// @return withdrawnAmount the amount that was actually withdrawn
|
54
|
+
function withdrawFees(Amount amount) external returns (Amount withdrawnAmount);
|
55
|
+
|
50
56
|
}
|
@@ -4,7 +4,7 @@ pragma solidity ^0.8.20;
|
|
4
4
|
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
5
|
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
6
6
|
|
7
|
-
contract
|
7
|
+
contract InitializableERC165 is
|
8
8
|
Initializable,
|
9
9
|
IERC165
|
10
10
|
{
|