@etherisc/gif-next 0.0.2-e1f23dc-329 → 0.0.2-e3f4f82-063

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
  2. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  3. package/artifacts/contracts/components/Distribution.sol/Distribution.json +8 -8
  4. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
  5. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  6. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +2 -2
  8. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  10. package/artifacts/contracts/components/Pool.sol/Pool.json +16 -11
  11. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  12. package/artifacts/contracts/components/Product.sol/Product.json +18 -8
  13. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
  14. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
  15. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
  16. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  17. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  18. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  33. package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +1 -1
  34. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +1 -1
  35. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +1 -1
  36. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  37. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +30 -0
  38. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  39. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  40. package/artifacts/contracts/instance/Instance.sol/Instance.json +52 -22
  41. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  42. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +2 -2
  43. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  44. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +55 -40
  45. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  46. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +2 -2
  47. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  48. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +2 -2
  49. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
  50. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  51. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  52. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  53. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  54. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  55. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  56. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  57. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  58. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  59. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  60. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  61. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  62. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
  63. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +2 -2
  64. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  65. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +2 -2
  66. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  67. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +2 -2
  68. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
  69. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  70. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  71. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +21 -0
  72. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  73. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +21 -0
  74. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  75. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +59 -14
  76. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  77. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +20 -8
  78. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  79. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +89 -36
  80. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +35 -19
  82. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  83. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  84. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  85. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  86. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  87. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  88. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +2 -2
  89. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  90. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +2 -2
  91. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  92. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  93. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  94. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  95. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  96. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  97. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  98. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  99. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  100. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  101. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +1 -1
  102. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  103. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  104. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  105. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  106. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  107. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  108. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  109. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  110. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  111. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  112. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  113. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  114. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  115. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  116. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  117. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  118. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  119. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  120. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  121. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  122. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  123. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  124. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  125. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  126. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  127. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  128. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  129. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  130. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  131. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  132. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  133. package/contracts/components/Distribution.sol +5 -1
  134. package/contracts/components/IPoolComponent.sol +1 -1
  135. package/contracts/components/Pool.sol +12 -7
  136. package/contracts/components/Product.sol +7 -2
  137. package/contracts/instance/module/ISetup.sol +3 -0
  138. package/contracts/instance/service/IPoolService.sol +2 -0
  139. package/contracts/instance/service/IProductService.sol +3 -0
  140. package/contracts/instance/service/PoolService.sol +15 -12
  141. package/contracts/instance/service/ProductService.sol +66 -68
  142. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/975c16748e8c205fdb3397ef4efe6b12.json"
3
+ "buildInfo": "../../../build-info/ce7db40ae97aa24df12e0a58cae71404.json"
4
4
  }
@@ -25,6 +25,8 @@ contract Distribution is
25
25
  Fee internal _initialDistributionFee;
26
26
  bool internal _isVerifying;
27
27
 
28
+ TokenHandler internal _tokenHandler;
29
+
28
30
  IDistributionService private _distributionService;
29
31
  IProductService private _productService;
30
32
 
@@ -49,6 +51,8 @@ contract Distribution is
49
51
  _isVerifying = verifying;
50
52
  _initialDistributionFee = distributionFee;
51
53
 
54
+ _tokenHandler = TokenHandler(token);
55
+
52
56
  _distributionService = _instance.getDistributionService();
53
57
  _productService = _instance.getProductService();
54
58
 
@@ -148,7 +152,7 @@ contract Distribution is
148
152
  abi.encode(
149
153
  ISetup.DistributionSetupInfo(
150
154
  _productNftId,
151
- TokenHandler(address(_token)),
155
+ _tokenHandler,
152
156
  _initialDistributionFee,
153
157
  _isVerifying,
154
158
  address(this)
@@ -55,7 +55,7 @@ interface IPoolComponent {
55
55
  view
56
56
  returns (bool isMatching);
57
57
 
58
- function isVerifying() external view returns (bool verifying);
58
+ function isConfirmingApplication() external view returns (bool isConfirmingApplication);
59
59
 
60
60
  function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
61
61
 
@@ -25,13 +25,15 @@ import {Registerable} from "../shared/Registerable.sol";
25
25
  contract Pool is BaseComponent, IPoolComponent {
26
26
  using NftIdLib for NftId;
27
27
 
28
- bool internal _isVerifying;
28
+ bool internal _isConfirmingApplication;
29
29
  UFixed internal _collateralizationLevel;
30
30
 
31
31
  Fee internal _initialPoolFee;
32
32
  Fee internal _initialStakingFee;
33
33
  Fee internal _initialPerformanceFee;
34
34
 
35
+ TokenHandler internal _tokenHandler;
36
+
35
37
  // may be used to interact with instance by derived contracts
36
38
  IPoolService internal _poolService;
37
39
 
@@ -58,7 +60,7 @@ contract Pool is BaseComponent, IPoolComponent {
58
60
  // TODO refactor into tokenNftId
59
61
  address token,
60
62
  bool isInterceptor,
61
- bool verifying,
63
+ bool isConfirmingApplication,
62
64
  UFixed collateralizationLevel,
63
65
  Fee memory poolFee,
64
66
  Fee memory stakingFee,
@@ -67,13 +69,15 @@ contract Pool is BaseComponent, IPoolComponent {
67
69
  )
68
70
  BaseComponent(registry, instanceNftId, token, POOL(), isInterceptor, initialOwner)
69
71
  {
70
- _isVerifying = verifying;
72
+ _isConfirmingApplication = isConfirmingApplication;
71
73
  // TODO add validation
72
74
  _collateralizationLevel = collateralizationLevel;
73
75
  _initialPoolFee = poolFee;
74
76
  _initialStakingFee = stakingFee;
75
77
  _initialPerformanceFee = performanceFee;
76
78
 
79
+ _tokenHandler = new TokenHandler(token);
80
+
77
81
  _poolService = _instance.getPoolService();
78
82
  _productService = _instance.getProductService();
79
83
 
@@ -136,8 +140,8 @@ contract Pool is BaseComponent, IPoolComponent {
136
140
  }
137
141
 
138
142
 
139
- function isVerifying() external view override returns (bool verifying) {
140
- return _isVerifying;
143
+ function isConfirmingApplication() external view override returns (bool isConfirmingApplication) {
144
+ return _isConfirmingApplication;
141
145
  }
142
146
 
143
147
  function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
@@ -191,12 +195,13 @@ contract Pool is BaseComponent, IPoolComponent {
191
195
  abi.encode(
192
196
  ISetup.PoolSetupInfo(
193
197
  _productNftId,
194
- TokenHandler(address(_token)),
198
+ _tokenHandler,
195
199
  _collateralizationLevel,
196
200
  _initialPoolFee,
197
201
  _initialStakingFee,
198
202
  _initialPerformanceFee,
199
- _isVerifying,
203
+ false,
204
+ _isConfirmingApplication,
200
205
  _wallet
201
206
  )
202
207
  )
@@ -36,6 +36,7 @@ contract Product is BaseComponent, IProductComponent {
36
36
  Distribution internal _distribution;
37
37
  Fee internal _initialProductFee;
38
38
  Fee internal _initialProcessingFee;
39
+ TokenHandler internal _tokenHandler;
39
40
 
40
41
  NftId internal _poolNftId;
41
42
  NftId internal _distributionNftId;
@@ -58,6 +59,8 @@ contract Product is BaseComponent, IProductComponent {
58
59
  _initialProductFee = productFee;
59
60
  _initialProcessingFee = processingFee;
60
61
 
62
+ _tokenHandler = new TokenHandler(token);
63
+
61
64
  _poolNftId = getRegistry().getNftId(address(_pool));
62
65
  _distributionNftId = getRegistry().getNftId(address(_distribution));
63
66
 
@@ -268,7 +271,7 @@ contract Product is BaseComponent, IProductComponent {
268
271
  abi.encode(
269
272
  ISetup.ProductSetupInfo(
270
273
  _token,
271
- TokenHandler(address(_token)),
274
+ _tokenHandler,
272
275
  _distributionNftId,
273
276
  _poolNftId,
274
277
  distributionSetupInfo.distributionFee,
@@ -276,7 +279,9 @@ contract Product is BaseComponent, IProductComponent {
276
279
  _initialProcessingFee,
277
280
  poolSetupInfo.poolFee,
278
281
  poolSetupInfo.stakingFee,
279
- poolSetupInfo.performanceFee
282
+ poolSetupInfo.performanceFee,
283
+ false,
284
+ _wallet
280
285
  )
281
286
  )
282
287
  );
@@ -21,6 +21,8 @@ interface ISetup {
21
21
  Fee poolFee; // pool fee on net premium
22
22
  Fee stakingFee; // pool fee on staked capital from investor
23
23
  Fee performanceFee; // pool fee on profits from capital investors
24
+ bool isIntercepting; // intercepts nft transfers (for products)
25
+ address wallet;
24
26
  }
25
27
 
26
28
  struct DistributionSetupInfo {
@@ -39,6 +41,7 @@ interface ISetup {
39
41
  Fee stakingFee; // pool fee on staked capital from investor
40
42
  Fee performanceFee; // pool fee on profits from capital investors
41
43
  bool isIntercepting; // intercepts nft transfers (for bundles)
44
+ bool isConfirmingApplication; // confirms applications before they are underwritten
42
45
  address wallet;
43
46
  }
44
47
  }
@@ -8,6 +8,8 @@ import {IService} from "../../shared/IService.sol";
8
8
  import {IBundle} from "../module/IBundle.sol";
9
9
 
10
10
  interface IPoolService is IService {
11
+ error ErrorIPoolServiceInsufficientAllowance(address bundleOwner, address tokenHandlerAddress, uint256 amount);
12
+
11
13
  function setFees(
12
14
  Fee memory poolFee,
13
15
  Fee memory stakingFee,
@@ -13,6 +13,9 @@ import {UFixed} from "../../types/UFixed.sol";
13
13
  import {Fee} from "../../types/Fee.sol";
14
14
 
15
15
  interface IProductService is IService {
16
+
17
+ error ErrorIProductServiceInsufficientAllowance(address customer, address tokenHandlerAddress, uint256 amount);
18
+
16
19
  function setFees(
17
20
  Fee memory productFee,
18
21
  Fee memory processingFee
@@ -28,7 +28,6 @@ import {IRegistryService} from "../../registry/IRegistryService.sol";
28
28
  import {InstanceService} from "../InstanceService.sol";
29
29
  import {InstanceReader} from "../InstanceReader.sol";
30
30
 
31
-
32
31
  string constant POOL_SERVICE_NAME = "PoolService";
33
32
 
34
33
  contract PoolService is
@@ -136,13 +135,11 @@ contract PoolService is
136
135
 
137
136
  // TODO add bundle to pool in instance
138
137
 
139
- // TODO collect capital
140
- // _processStakingByTreasury(
141
- // instanceReader,
142
- // zeroNftId(),
143
- // poolNftId,
144
- // bundleNftId,
145
- // stakingAmount);
138
+ _processStakingByTreasury(
139
+ instanceReader,
140
+ poolNftId,
141
+ bundleNftId,
142
+ stakingAmount);
146
143
 
147
144
  // TODO add logging
148
145
  }
@@ -178,7 +175,6 @@ contract PoolService is
178
175
 
179
176
  function _processStakingByTreasury(
180
177
  InstanceReader instanceReader,
181
- NftId productNftId,
182
178
  NftId poolNftId,
183
179
  NftId bundleNftId,
184
180
  uint256 stakingAmount
@@ -187,15 +183,22 @@ contract PoolService is
187
183
  {
188
184
  // process token transfer(s)
189
185
  if(stakingAmount > 0) {
190
- TokenHandler tokenHandler = TokenHandler(instanceReader.getTokenHandler(productNftId));
191
- address bundleOwner = getRegistry().ownerOf(bundleNftId);
192
186
  ISetup.PoolSetupInfo memory poolInfo = instanceReader.getPoolSetupInfo(poolNftId);
193
-
187
+ TokenHandler tokenHandler = poolInfo.tokenHandler;
188
+ address bundleOwner = getRegistry().ownerOf(bundleNftId);
189
+ Fee memory stakingFee = poolInfo.stakingFee;
190
+
194
191
  tokenHandler.transfer(
195
192
  bundleOwner,
196
193
  poolInfo.wallet,
197
194
  stakingAmount
198
195
  );
196
+
197
+
198
+ if (! FeeLib.feeIsZero(stakingFee)) {
199
+ (uint256 stakingFeeAmount, uint256 netAmount) = FeeLib.calculateFee(stakingFee, stakingAmount);
200
+ // TODO: track staking fees in pool's state (issue #177)
201
+ }
199
202
  }
200
203
  }
201
204
  }