@etherisc/gif-next 0.0.2-7bdd29a-841 → 0.0.2-7bddd7e-496
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 +4 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- 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/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +24 -42
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +2 -2
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +0 -26
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +76 -131
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +39 -51
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +0 -26
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +0 -31
- 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 +54 -54
- 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 +2 -2
- 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 +2 -2
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
- 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/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/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +18 -36
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +2 -2
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +0 -26
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +0 -26
- 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 +0 -26
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +2 -2
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +46 -101
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +24 -36
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +0 -31
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +0 -26
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +0 -31
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +0 -26
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +40 -151
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +21 -61
- 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 +0 -26
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +2 -2
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +58 -66
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +30 -34
- 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/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 +0 -26
- 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 +14 -14
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +8 -8
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +2 -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 +0 -26
- 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 +28 -28
- 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/Component.sol/Component.json +0 -26
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +108 -68
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +55 -35
- 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/IComponent.sol/IComponent.json +0 -26
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +0 -26
- 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 +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +0 -26
- 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/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- 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 +288 -16
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +0 -26
- 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 +30 -113
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +92 -70
- 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 +47 -23
- 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 +2 -2
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +2 -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/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- 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/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/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/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/authorization/Authorization.sol +0 -1
- package/contracts/distribution/DistributionService.sol +3 -17
- package/contracts/distribution/IDistributionService.sol +1 -3
- package/contracts/instance/InstanceAdmin.sol +23 -4
- package/contracts/instance/InstanceService.sol +1 -1
- package/contracts/pool/BundleService.sol +2 -16
- package/contracts/pool/IBundleService.sol +2 -3
- package/contracts/pool/IPoolService.sol +1 -3
- package/contracts/pool/PoolService.sol +12 -53
- package/contracts/product/ClaimService.sol +1 -9
- package/contracts/product/IProductService.sol +1 -0
- package/contracts/product/PolicyService.sol +14 -6
- package/contracts/registry/RegistryAdmin.sol +9 -0
- package/contracts/shared/Component.sol +6 -19
- package/contracts/shared/ComponentService.sol +10 -19
- package/contracts/shared/IComponent.sol +0 -1
- package/contracts/shared/TokenHandler.sol +96 -22
- package/contracts/staking/StakeManagerLib.sol +0 -25
- package/contracts/staking/Staking.sol +3 -23
- package/package.json +1 -1
@@ -1,8 +1,6 @@
|
|
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
|
-
|
6
4
|
import {IRegistry} from "../registry/IRegistry.sol";
|
7
5
|
import {IInstance} from "../instance/IInstance.sol";
|
8
6
|
import {IComponentService} from "../shared/IComponentService.sol";
|
@@ -19,7 +17,7 @@ import {KEEP_STATE} from "../type/StateId.sol";
|
|
19
17
|
import {ObjectType, COMPONENT, DISTRIBUTION, INSTANCE, DISTRIBUTION, DISTRIBUTOR, REGISTRY} from "../type/ObjectType.sol";
|
20
18
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
21
19
|
import {IDistributionService} from "./IDistributionService.sol";
|
22
|
-
import {UFixed
|
20
|
+
import {UFixed} from "../type/UFixed.sol";
|
23
21
|
import {DistributorType, DistributorTypeLib} from "../type/DistributorType.sol";
|
24
22
|
import {ReferralId, ReferralLib} from "../type/Referral.sol";
|
25
23
|
import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
|
@@ -275,17 +273,6 @@ contract DistributionService is
|
|
275
273
|
}
|
276
274
|
}
|
277
275
|
|
278
|
-
if (withdrawnAmount.eqz()) {
|
279
|
-
revert ErrorDistributionServiceCommissionWithdrawAmountIsZero();
|
280
|
-
}
|
281
|
-
|
282
|
-
// check allowance
|
283
|
-
IERC20Metadata token = IERC20Metadata(distributionInfo.token);
|
284
|
-
uint256 tokenAllowance = token.allowance(distributionWallet, address(distributionInfo.tokenHandler));
|
285
|
-
if (tokenAllowance < withdrawnAmount.toInt()) {
|
286
|
-
revert ErrorDistributionServiceWalletAllowanceTooSmall(distributionWallet, address(distributionInfo.tokenHandler), tokenAllowance, withdrawnAmount.toInt());
|
287
|
-
}
|
288
|
-
|
289
276
|
// decrease fee counters by withdrawnAmount and update distributor info
|
290
277
|
{
|
291
278
|
InstanceStore store = instance.getInstanceStore();
|
@@ -298,9 +285,8 @@ contract DistributionService is
|
|
298
285
|
// transfer amount to distributor
|
299
286
|
{
|
300
287
|
address distributor = getRegistry().ownerOf(distributorNftId);
|
301
|
-
emit LogDistributionServiceCommissionWithdrawn(distributorNftId, distributor, address(token), withdrawnAmount);
|
302
|
-
|
303
|
-
distributionInfo.tokenHandler.transfer(distributionWallet, distributor, withdrawnAmount);
|
288
|
+
emit LogDistributionServiceCommissionWithdrawn(distributorNftId, distributor, address(distributionInfo.token), withdrawnAmount);
|
289
|
+
distributionInfo.tokenHandler.distributeTokens(distributionWallet, distributor, withdrawnAmount);
|
304
290
|
}
|
305
291
|
}
|
306
292
|
|
@@ -28,9 +28,7 @@ interface IDistributionService is IService {
|
|
28
28
|
error ErrorIDistributionServiceMinFeeTooHigh(uint256 minFee, uint256 limit);
|
29
29
|
|
30
30
|
error ErrorDistributionServiceCommissionWithdrawAmountExceedsLimit(Amount amount, Amount limit);
|
31
|
-
|
32
|
-
error ErrorDistributionServiceWalletAllowanceTooSmall(address wallet, address tokenHandler, uint256 allowance, uint256 amount);
|
33
|
-
|
31
|
+
|
34
32
|
error ErrorDistributionServiceVariableFeesTooHight(uint256 maxDiscountPercentage, uint256 limit);
|
35
33
|
error ErrorDistributionServiceMaxDiscountTooHigh(uint256 maxDiscountPercentage, uint256 limit);
|
36
34
|
|
@@ -7,6 +7,7 @@ import {AccessAdmin} from "../authorization/AccessAdmin.sol";
|
|
7
7
|
import {AccessManagerCloneable} from "../authorization/AccessManagerCloneable.sol";
|
8
8
|
import {IAccessAdmin} from "../authorization/IAccessAdmin.sol";
|
9
9
|
import {IAuthorization} from "../authorization/IAuthorization.sol";
|
10
|
+
import {IComponent} from "../shared/IComponent.sol";
|
10
11
|
import {IModuleAuthorization} from "../authorization/IModuleAuthorization.sol";
|
11
12
|
import {IRegistry} from "../registry/IRegistry.sol";
|
12
13
|
import {IInstance} from "./IInstance.sol";
|
@@ -14,6 +15,7 @@ import {IService} from "../shared/IService.sol";
|
|
14
15
|
import {ObjectType, ObjectTypeLib, ALL, POOL, RELEASE} from "../type/ObjectType.sol";
|
15
16
|
import {RoleId, RoleIdLib, ADMIN_ROLE, PUBLIC_ROLE, DISTRIBUTION_OWNER_ROLE, ORACLE_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE} from "../type/RoleId.sol";
|
16
17
|
import {Str, StrLib} from "../type/String.sol";
|
18
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
17
19
|
import {VersionPart} from "../type/Version.sol";
|
18
20
|
|
19
21
|
|
@@ -111,26 +113,43 @@ contract InstanceAdmin is
|
|
111
113
|
/// @dev Initializes the authorization for the specified component.
|
112
114
|
/// Important: The component MUST be registered.
|
113
115
|
function initializeComponentAuthorization(
|
114
|
-
|
116
|
+
IComponent component,
|
115
117
|
IAuthorization authorization
|
116
118
|
)
|
117
119
|
external
|
118
120
|
{
|
119
|
-
_checkTargetIsReadyForAuthorization(
|
121
|
+
_checkTargetIsReadyForAuthorization(address(component));
|
120
122
|
|
121
123
|
_createRoles(authorization);
|
122
124
|
|
123
125
|
// create component target
|
124
126
|
_createTarget(
|
125
|
-
|
127
|
+
address(component),
|
126
128
|
authorization.getTargetName(),
|
127
129
|
true, // checkAuthority
|
128
130
|
false); // custom
|
129
131
|
|
132
|
+
_createTarget(
|
133
|
+
address(component.getTokenHandler()),
|
134
|
+
string(abi.encodePacked(authorization.getTargetName(), "TH")),
|
135
|
+
true,
|
136
|
+
false);
|
137
|
+
|
138
|
+
// FIXME: make this a bit nicer and work with IAuthorization. Use a specific role, not public - access to TokenHandler must be restricted
|
139
|
+
FunctionInfo[] memory functions = new FunctionInfo[](3);
|
140
|
+
functions[0] = toFunction(TokenHandler.collectTokens.selector, "collectTokens");
|
141
|
+
functions[1] = toFunction(TokenHandler.collectTokensThreeRecipients.selector, "collectTokensThreeRecipients");
|
142
|
+
functions[2] = toFunction(TokenHandler.distributeTokens.selector, "distributeTokens");
|
143
|
+
|
144
|
+
_authorizeTargetFunctions(
|
145
|
+
address(component.getTokenHandler()),
|
146
|
+
getPublicRole(),
|
147
|
+
functions);
|
148
|
+
|
130
149
|
_grantRoleToAccount(
|
131
150
|
authorization.getTargetRole(
|
132
151
|
authorization.getTarget()),
|
133
|
-
|
152
|
+
address(component));
|
134
153
|
|
135
154
|
_createTargetAuthorizations(authorization);
|
136
155
|
}
|
@@ -1,8 +1,6 @@
|
|
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
|
-
|
6
4
|
import {IBundle} from "../instance/module/IBundle.sol";
|
7
5
|
import {IBundleService} from "./IBundleService.sol";
|
8
6
|
import {IComponents} from "../instance/module/IComponents.sol";
|
@@ -399,17 +397,6 @@ contract BundleService is
|
|
399
397
|
}
|
400
398
|
}
|
401
399
|
|
402
|
-
if (withdrawnAmount.eqz()) {
|
403
|
-
revert ErrorBundleServiceFeesWithdrawAmountIsZero();
|
404
|
-
}
|
405
|
-
|
406
|
-
// check allowance
|
407
|
-
IERC20Metadata token = IERC20Metadata(poolInfo.token);
|
408
|
-
uint256 tokenAllowance = token.allowance(poolWallet, address(poolInfo.tokenHandler));
|
409
|
-
if (tokenAllowance < withdrawnAmount.toInt()) {
|
410
|
-
revert ErrorBundleServiceWalletAllowanceTooSmall(poolWallet, address(poolInfo.tokenHandler), tokenAllowance, withdrawnAmount.toInt());
|
411
|
-
}
|
412
|
-
|
413
400
|
// decrease fee counters by withdrawnAmount
|
414
401
|
{
|
415
402
|
InstanceStore store = instance.getInstanceStore();
|
@@ -422,9 +409,8 @@ contract BundleService is
|
|
422
409
|
// transfer amount to bundle owner
|
423
410
|
{
|
424
411
|
address owner = getRegistry().ownerOf(bundleNftId);
|
425
|
-
emit LogBundleServiceFeesWithdrawn(bundleNftId, owner, address(token), withdrawnAmount);
|
426
|
-
|
427
|
-
poolInfo.tokenHandler.transfer(poolWallet, owner, withdrawnAmount);
|
412
|
+
emit LogBundleServiceFeesWithdrawn(bundleNftId, owner, address(poolInfo.token), withdrawnAmount);
|
413
|
+
poolInfo.tokenHandler.distributeTokens(poolWallet, owner, withdrawnAmount);
|
428
414
|
}
|
429
415
|
}
|
430
416
|
|
@@ -27,9 +27,7 @@ interface IBundleService is IService {
|
|
27
27
|
error ErrorBundleServicePolicyNotCloseable(NftId policyNftId);
|
28
28
|
|
29
29
|
error ErrorBundleServiceFeesWithdrawAmountExceedsLimit(Amount amount, Amount limit);
|
30
|
-
|
31
|
-
error ErrorBundleServiceWalletAllowanceTooSmall(address wallet, address tokenHandler, uint256 allowance, uint256 amount);
|
32
|
-
|
30
|
+
|
33
31
|
error ErrorBundleServiceUnstakeAmountExceedsLimit(Amount amount, Amount limit);
|
34
32
|
|
35
33
|
error ErrorBundleServiceExtensionLifetimeIsZero();
|
@@ -126,6 +124,7 @@ interface IBundleService is IService {
|
|
126
124
|
NftId policyNftId
|
127
125
|
) external;
|
128
126
|
|
127
|
+
// FIXME: move to pool service
|
129
128
|
/// @dev Withdraw bundle feeds for the given bundle
|
130
129
|
/// @param bundleNftId the bundle Nft Id
|
131
130
|
/// @param amount the amount to withdraw. If set to AMOUNT_MAX, the full commission available is withdrawn
|
@@ -30,9 +30,7 @@ interface IPoolService is IService {
|
|
30
30
|
error ErrorPoolServiceInvalidTransferAmount(Amount expectedAmount, Amount actualAmount);
|
31
31
|
error ErrorPoolServiceBundlePoolMismatch(NftId bundleNftId, NftId poolNftId);
|
32
32
|
error ErrorPoolServiceMaxBalanceAmountExceeded(NftId poolNftId, Amount maxBalanceAmount, Amount currentBalanceAmount, Amount transferAmount);
|
33
|
-
|
34
|
-
error ErrorPoolServiceAmountIsZero();
|
35
|
-
|
33
|
+
|
36
34
|
/// @dev defines the required role for bundle owners for the calling pool
|
37
35
|
/// default implementation returns PUBLIC ROLE
|
38
36
|
function setBundleOwnerRole(RoleId bundleOwnerRole) external;
|
@@ -1,8 +1,6 @@
|
|
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
|
-
|
6
4
|
import {IBundle} from "../instance/module/IBundle.sol";
|
7
5
|
import {IBundleService} from "./IBundleService.sol";
|
8
6
|
import {IComponents} from "../instance/module/IComponents.sol";
|
@@ -192,24 +190,10 @@ contract PoolService is
|
|
192
190
|
|
193
191
|
if ((unstakedAmount + feeAmount).gtz()){
|
194
192
|
IComponents.ComponentInfo memory poolComponentInfo = instance.getInstanceReader().getComponentInfo(poolNftId);
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
// check allowance
|
201
|
-
uint256 tokenAllowance = token.allowance(poolComponentInfo.wallet, address(tokenHandler));
|
202
|
-
if (tokenAllowance < (unstakedAmount.toInt() + feeAmount.toInt())) {
|
203
|
-
revert ErrorPoolServiceWalletAllowanceTooSmall(
|
204
|
-
poolComponentInfo.wallet,
|
205
|
-
address(tokenHandler),
|
206
|
-
tokenAllowance,
|
207
|
-
unstakedAmount.toInt() + feeAmount.toInt());
|
208
|
-
}
|
209
|
-
|
210
|
-
// transfer amount to bundle owner
|
211
|
-
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
212
|
-
tokenHandler.transfer(poolComponentInfo.wallet, bundleOwner, unstakedAmount + feeAmount);
|
193
|
+
poolComponentInfo.tokenHandler.distributeTokens(
|
194
|
+
poolComponentInfo.wallet,
|
195
|
+
getRegistry().ownerOf(bundleNftId),
|
196
|
+
unstakedAmount + feeAmount);
|
213
197
|
}
|
214
198
|
}
|
215
199
|
|
@@ -280,10 +264,6 @@ contract PoolService is
|
|
280
264
|
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
281
265
|
}
|
282
266
|
|
283
|
-
if (amount.eqz()) {
|
284
|
-
revert ErrorPoolServiceAmountIsZero();
|
285
|
-
}
|
286
|
-
|
287
267
|
// call bundle service for bookkeeping and additional checks
|
288
268
|
Amount unstakedAmount = _bundleService.unstake(instance, bundleNftId, amount);
|
289
269
|
|
@@ -301,21 +281,13 @@ contract PoolService is
|
|
301
281
|
|
302
282
|
IComponents.ComponentInfo memory poolComponentInfo = instanceReader.getComponentInfo(poolNftId);
|
303
283
|
address poolWallet = poolComponentInfo.wallet;
|
304
|
-
|
305
|
-
// check allowance
|
306
|
-
{
|
307
|
-
IERC20Metadata token = IERC20Metadata(poolComponentInfo.token);
|
308
|
-
uint256 tokenAllowance = token.allowance(poolWallet, address(poolComponentInfo.tokenHandler));
|
309
|
-
if (tokenAllowance < unstakedAmount.toInt()) {
|
310
|
-
revert ErrorPoolServiceWalletAllowanceTooSmall(poolWallet, address(poolComponentInfo.tokenHandler), tokenAllowance, amount.toInt());
|
311
|
-
}
|
312
|
-
}
|
313
|
-
|
314
284
|
// transfer amount to bundle owner
|
315
285
|
address owner = getRegistry().ownerOf(bundleNftId);
|
316
286
|
emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount);
|
317
|
-
|
318
|
-
|
287
|
+
poolComponentInfo.tokenHandler.distributeTokens(
|
288
|
+
poolWallet,
|
289
|
+
owner,
|
290
|
+
unstakedAmount);
|
319
291
|
return unstakedAmount;
|
320
292
|
}
|
321
293
|
|
@@ -521,7 +493,6 @@ contract PoolService is
|
|
521
493
|
}
|
522
494
|
|
523
495
|
|
524
|
-
// TODO create (I)TreasuryService that deals with all gif related token transfers
|
525
496
|
/// @dev transfers the specified amount from the bundle owner to the pool's wallet
|
526
497
|
function _collectStakingAmount(
|
527
498
|
InstanceReader instanceReader,
|
@@ -534,23 +505,11 @@ contract PoolService is
|
|
534
505
|
|
535
506
|
// collecting investor token
|
536
507
|
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
537
|
-
TokenHandler tokenHandler = componentInfo.tokenHandler;
|
538
508
|
address poolWallet = componentInfo.wallet;
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
revert ErrorPoolServiceWalletAllowanceTooSmall(bundleOwner, address(tokenHandler), allowance, amount.toInt());
|
544
|
-
}
|
545
|
-
|
546
|
-
// TODO: centralize token handling (issue #471)
|
547
|
-
tokenHandler.transfer(
|
548
|
-
bundleOwner,
|
549
|
-
poolWallet,
|
550
|
-
amount);
|
551
|
-
} else {
|
552
|
-
revert ErrorPoolServiceAmountIsZero();
|
553
|
-
}
|
509
|
+
componentInfo.tokenHandler.collectTokens(
|
510
|
+
bundleOwner,
|
511
|
+
poolWallet,
|
512
|
+
amount);
|
554
513
|
}
|
555
514
|
|
556
515
|
function _getDomain() internal pure override returns(ObjectType) {
|
@@ -302,20 +302,12 @@ contract ClaimService is
|
|
302
302
|
|
303
303
|
// TODO callback IPolicyHolder
|
304
304
|
|
305
|
-
if (netPayoutAmount.eqz()) {
|
306
|
-
revert ErrorClaimsServicePayoutAmountIsZero(policyNftId, payoutId);
|
307
|
-
}
|
308
|
-
|
309
305
|
emit LogClaimServicePayoutProcessed(policyNftId, payoutId, payoutAmount, beneficiary, netPayoutAmount);
|
310
306
|
|
311
307
|
{
|
312
308
|
NftId poolNftId = getRegistry().getObjectInfo(policyInfo.bundleNftId).parentNftId;
|
313
309
|
IComponents.ComponentInfo memory poolInfo = instanceReader.getComponentInfo(poolNftId);
|
314
|
-
|
315
|
-
poolInfo.tokenHandler.transfer(
|
316
|
-
poolInfo.wallet,
|
317
|
-
beneficiary,
|
318
|
-
netPayoutAmount);
|
310
|
+
poolInfo.tokenHandler.distributeTokens(poolInfo.wallet, beneficiary, netPayoutAmount);
|
319
311
|
}
|
320
312
|
}
|
321
313
|
|
@@ -334,6 +334,7 @@ contract PolicyService is
|
|
334
334
|
}
|
335
335
|
|
336
336
|
// TODO consider to allow for underpaid premiums (with the effects of reducing max payouts accordingly)
|
337
|
+
// TODO consider to remove requirement for fully paid premiums altogether
|
337
338
|
if (!(policyInfo.premiumAmount == policyInfo.premiumPaidAmount)) {
|
338
339
|
revert ErrorPolicyServicePremiumNotFullyPaid(policyNftId, policyInfo.premiumAmount, policyInfo.premiumPaidAmount);
|
339
340
|
}
|
@@ -345,9 +346,13 @@ contract PolicyService is
|
|
345
346
|
policyNftId,
|
346
347
|
policyInfo);
|
347
348
|
|
349
|
+
// TODO consider to also set expiredAt to current block timestamp if that timestamp is still in the futue
|
350
|
+
|
348
351
|
// update policy state to closed
|
349
352
|
policyInfo.closedAt = TimestampLib.blockTimestamp();
|
350
353
|
instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, CLOSED());
|
354
|
+
|
355
|
+
// TODO add logging
|
351
356
|
}
|
352
357
|
|
353
358
|
|
@@ -473,7 +478,7 @@ contract PolicyService is
|
|
473
478
|
address policyHolder = getRegistry().ownerOf(policyNftId);
|
474
479
|
|
475
480
|
(
|
476
|
-
|
481
|
+
,
|
477
482
|
address distributionWallet,
|
478
483
|
address poolWallet,
|
479
484
|
address productWallet
|
@@ -481,11 +486,14 @@ contract PolicyService is
|
|
481
486
|
instanceReader,
|
482
487
|
productNftId);
|
483
488
|
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
+
tokenHandler.collectTokensThreeRecipients(
|
490
|
+
policyHolder,
|
491
|
+
productWallet,
|
492
|
+
premium.productFeeAmount,
|
493
|
+
distributionWallet,
|
494
|
+
premium.distributionFeeAndCommissionAmount,
|
495
|
+
poolWallet,
|
496
|
+
premium.poolPremiumAndFeeAmount);
|
489
497
|
}
|
490
498
|
|
491
499
|
|
@@ -12,6 +12,7 @@ import {ReleaseRegistry} from "./ReleaseRegistry.sol";
|
|
12
12
|
import {RoleId, RoleIdLib, ADMIN_ROLE, GIF_MANAGER_ROLE, GIF_ADMIN_ROLE, PUBLIC_ROLE} from "../type/RoleId.sol";
|
13
13
|
import {StakingStore} from "../staking/StakingStore.sol";
|
14
14
|
import {STAKING} from "../type/ObjectType.sol";
|
15
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
15
16
|
import {TokenRegistry} from "./TokenRegistry.sol";
|
16
17
|
import {VersionPart} from "../type/Version.sol";
|
17
18
|
|
@@ -360,6 +361,14 @@ contract RegistryAdmin is
|
|
360
361
|
functions[13] = toFunction(StakingStore.unstakeUpTo.selector, "unstakeUpTo");
|
361
362
|
_authorizeTargetFunctions(_stakingStore, stakingRoleId, functions);
|
362
363
|
|
364
|
+
// grant token handler authorizations
|
365
|
+
IStaking staking = IStaking(_staking);
|
366
|
+
functions = new FunctionInfo[](2);
|
367
|
+
functions[0] = toFunction(TokenHandler.collectTokens.selector, "collectTokens");
|
368
|
+
functions[1] = toFunction(TokenHandler.distributeTokens.selector, "distributeTokens");
|
369
|
+
// FIXME: replace this with a more specific role instead if public role - access to token handler must be restricted
|
370
|
+
_authorizeTargetFunctions(address(staking.getTokenHandler()), PUBLIC_ROLE(), functions);
|
371
|
+
|
363
372
|
_grantRoleToAccount(stakingRoleId, _staking);
|
364
373
|
}
|
365
374
|
}
|
@@ -124,35 +124,22 @@ abstract contract Component is
|
|
124
124
|
{
|
125
125
|
// checks
|
126
126
|
address currentWallet = getWallet();
|
127
|
-
|
128
|
-
uint256 currentBalance = token.balanceOf(currentWallet);
|
129
|
-
|
130
|
-
if (currentBalance > 0) {
|
131
|
-
if (currentWallet == address(this)) {
|
132
|
-
// move tokens from component smart contract to external wallet
|
133
|
-
} else {
|
134
|
-
// move tokens from external wallet to component smart contract or another external wallet
|
135
|
-
uint256 allowance = token.allowance(currentWallet, address(getTokenHandler()));
|
136
|
-
if (allowance < currentBalance) {
|
137
|
-
revert ErrorComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
|
138
|
-
}
|
139
|
-
}
|
140
|
-
}
|
127
|
+
uint256 currentBalance = getToken().balanceOf(currentWallet);
|
141
128
|
|
142
129
|
// effects
|
143
130
|
_setWallet(newWallet);
|
144
131
|
|
145
132
|
// interactions
|
146
133
|
if (currentBalance > 0) {
|
134
|
+
// move tokens from old to new wallet
|
147
135
|
emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
|
148
136
|
|
149
|
-
// transfer tokens from current wallet to new wallet
|
150
137
|
if (currentWallet == address(this)) {
|
151
|
-
//
|
152
|
-
|
138
|
+
// transfer from the component requires an allowance
|
139
|
+
getTokenHandler().distributeTokens(currentWallet, newWallet, AmountLib.toAmount(currentBalance));
|
140
|
+
} else {
|
141
|
+
getTokenHandler().collectTokens(currentWallet, newWallet, AmountLib.toAmount(currentBalance));
|
153
142
|
}
|
154
|
-
|
155
|
-
getTokenHandler().transfer(currentWallet, newWallet, AmountLib.toAmount(currentBalance));
|
156
143
|
}
|
157
144
|
}
|
158
145
|
|
@@ -1,8 +1,6 @@
|
|
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
|
-
|
6
4
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
7
5
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
8
6
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
@@ -115,22 +113,13 @@ contract ComponentService is
|
|
115
113
|
}
|
116
114
|
}
|
117
115
|
|
118
|
-
// check allowance
|
119
|
-
TokenHandler tokenHandler = info.tokenHandler;
|
120
|
-
IERC20Metadata token = IERC20Metadata(info.token);
|
121
|
-
uint256 tokenAllowance = token.allowance(componentWallet, address(tokenHandler));
|
122
|
-
if (tokenAllowance < withdrawnAmount.toInt()) {
|
123
|
-
revert ErrorComponentServiceWalletAllowanceTooSmall(componentWallet, address(tokenHandler), tokenAllowance, withdrawnAmount.toInt());
|
124
|
-
}
|
125
|
-
|
126
116
|
// decrease fee counters by withdrawnAmount
|
127
117
|
_changeTargetBalance(DECREASE, instance.getInstanceStore(), componentNftId, AmountLib.zero(), withdrawnAmount);
|
128
118
|
|
129
119
|
// transfer amount to component owner
|
130
120
|
address componentOwner = getRegistry().ownerOf(componentNftId);
|
131
|
-
emit LogComponentServiceComponentFeesWithdrawn(componentNftId, componentOwner, address(token), withdrawnAmount);
|
132
|
-
|
133
|
-
tokenHandler.transfer(componentWallet, componentOwner, withdrawnAmount);
|
121
|
+
emit LogComponentServiceComponentFeesWithdrawn(componentNftId, componentOwner, address(info.token), withdrawnAmount);
|
122
|
+
info.tokenHandler.distributeTokens(componentWallet, componentOwner, withdrawnAmount);
|
134
123
|
}
|
135
124
|
|
136
125
|
|
@@ -522,22 +511,24 @@ contract ComponentService is
|
|
522
511
|
|
523
512
|
component.linkToRegisteredNftId();
|
524
513
|
|
525
|
-
// setup initial component authorization
|
526
|
-
_instanceService.initializeAuthorization(
|
527
|
-
instance.getNftId(),
|
528
|
-
component);
|
529
|
-
|
530
514
|
// save amended component info with instance
|
531
515
|
instanceReader = instance.getInstanceReader();
|
532
516
|
instanceStore = instance.getInstanceStore();
|
533
517
|
|
534
518
|
IComponents.ComponentInfo memory componentInfo = component.getInitialComponentInfo();
|
535
|
-
componentInfo.tokenHandler = new TokenHandler(
|
519
|
+
componentInfo.tokenHandler = new TokenHandler(
|
520
|
+
address(componentInfo.token),
|
521
|
+
address(instance.getInstanceAdmin().authority()));
|
536
522
|
|
537
523
|
instanceStore.createComponent(
|
538
524
|
component.getNftId(),
|
539
525
|
componentInfo);
|
540
526
|
|
527
|
+
// setup initial component authorization
|
528
|
+
_instanceService.initializeAuthorization(
|
529
|
+
instance.getNftId(),
|
530
|
+
component);
|
531
|
+
|
541
532
|
// TODO add logging
|
542
533
|
}
|
543
534
|
|