@etherisc/gif-next 0.0.2-b9e43cf-870 → 0.0.2-bad4d33-850

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
  2. package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → Component.sol/Component.json} +273 -14
  3. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.json +184 -10
  5. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
  6. package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → IComponent.sol/IComponent.json} +61 -88
  7. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +496 -0
  9. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +512 -74
  11. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +596 -5
  13. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  14. package/artifacts/contracts/components/Pool.sol/Pool.json +165 -93
  15. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  16. package/artifacts/contracts/components/Product.sol/Product.json +189 -15
  17. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
  18. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  33. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  35. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  36. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  37. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  38. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
  39. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  40. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  41. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +179 -13
  42. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  43. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +21 -5
  44. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  45. package/artifacts/contracts/instance/Instance.sol/Instance.json +111 -74
  46. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  47. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +47 -60
  48. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +41 -82
  50. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +168 -92
  52. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  53. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +37 -24
  54. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  55. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
  56. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
  57. package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +102 -31
  58. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  59. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  60. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  61. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  62. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  63. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  64. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  65. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  66. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  68. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  69. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  70. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +131 -60
  71. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  72. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +31 -18
  73. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  74. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +126 -47
  75. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  76. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +31 -14
  77. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  78. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +0 -5
  79. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  80. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +0 -5
  81. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  82. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +0 -5
  83. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  84. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +0 -5
  85. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  86. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +0 -5
  87. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  88. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +152 -81
  89. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  90. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +44 -31
  91. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  92. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +126 -47
  93. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  94. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +31 -14
  95. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  96. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +126 -47
  97. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  98. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +31 -14
  99. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  100. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  101. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +83 -3
  102. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  103. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +33 -28
  104. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  105. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  106. package/artifacts/contracts/registry/Registry.sol/Registry.json +96 -24
  107. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  108. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +18 -18
  109. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  110. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +61 -56
  111. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  112. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +28 -15
  113. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  114. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +70 -53
  115. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  116. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +23 -26
  117. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  118. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  119. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  120. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  121. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +0 -5
  122. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  123. package/artifacts/contracts/shared/IService.sol/IService.json +0 -5
  124. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  125. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  126. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +19 -6
  127. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  128. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +19 -6
  129. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  130. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +19 -11
  131. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  132. package/artifacts/contracts/shared/Service.sol/Service.json +13 -5
  133. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  134. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  135. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  136. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  137. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  138. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +19 -11
  139. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  140. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  141. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  142. package/artifacts/contracts/test/TestService.sol/TestService.json +29 -21
  143. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  144. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  145. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  146. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  147. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  148. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  149. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  150. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  151. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  152. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  153. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  154. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  155. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  156. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  157. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  158. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  159. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  160. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  161. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  163. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  165. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  167. package/contracts/components/Component.sol +216 -0
  168. package/contracts/components/Distribution.sol +40 -51
  169. package/contracts/components/IComponent.sol +43 -0
  170. package/contracts/components/IDistributionComponent.sol +5 -2
  171. package/contracts/components/IPoolComponent.sol +6 -21
  172. package/contracts/components/IProductComponent.sol +7 -3
  173. package/contracts/components/Pool.sol +44 -108
  174. package/contracts/components/Product.sol +51 -86
  175. package/contracts/instance/BundleManager.sol +7 -11
  176. package/contracts/instance/IInstance.sol +20 -10
  177. package/contracts/instance/IInstanceService.sol +2 -1
  178. package/contracts/instance/Instance.sol +28 -31
  179. package/contracts/instance/InstanceAccessManager.sol +6 -11
  180. package/contracts/instance/InstanceReader.sol +3 -25
  181. package/contracts/instance/InstanceService.sol +112 -22
  182. package/contracts/instance/ObjectManager.sol +7 -24
  183. package/contracts/instance/base/ComponentService.sol +134 -0
  184. package/contracts/instance/service/BundleService.sol +2 -3
  185. package/contracts/instance/service/DistributionService.sol +23 -37
  186. package/contracts/instance/service/PolicyService.sol +2 -3
  187. package/contracts/instance/service/PoolService.sol +20 -55
  188. package/contracts/instance/service/ProductService.sol +50 -30
  189. package/contracts/registry/IRegistry.sol +13 -6
  190. package/contracts/registry/IRegistryService.sol +16 -9
  191. package/contracts/registry/Registry.sol +100 -44
  192. package/contracts/registry/RegistryAccessManager.sol +31 -25
  193. package/contracts/registry/RegistryService.sol +27 -85
  194. package/contracts/registry/ReleaseManager.sol +72 -82
  195. package/contracts/registry/TokenRegistry.sol +5 -3
  196. package/contracts/shared/IRegisterable.sol +1 -3
  197. package/contracts/shared/NftOwnable.sol +5 -0
  198. package/contracts/shared/Registerable.sol +10 -14
  199. package/contracts/shared/Service.sol +4 -2
  200. package/contracts/types/RoleId.sol +2 -2
  201. package/package.json +1 -1
  202. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
  203. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
  204. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
  205. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
  206. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
  207. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
  208. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
  209. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
  210. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
  211. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
  212. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
  213. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
  214. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -814
  215. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
  216. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
  217. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
  218. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +0 -442
  219. package/contracts/components/BaseComponent.sol +0 -159
  220. package/contracts/components/IBaseComponent.sol +0 -34
  221. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +0 -23
  222. package/contracts/instance/IInstanceBase.sol +0 -26
  223. package/contracts/instance/InstanceBase.sol +0 -41
  224. package/contracts/instance/base/ComponentServiceBase.sol +0 -76
  225. package/contracts/instance/base/IInstanceBase.sol +0 -23
  226. package/contracts/instance/service/ComponentOwnerService.sol +0 -315
  227. package/contracts/instance/service/IComponentOwnerService.sol +0 -20
  228. package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -1,29 +1,22 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {ObjectType, POOL} from "../types/ObjectType.sol";
5
- import {IProductService} from "../instance/service/IProductService.sol";
4
+ import {POOL} from "../types/ObjectType.sol";
6
5
  import {IPoolService} from "../instance/service/IPoolService.sol";
7
6
  import {IBundleService} from "../instance/service/IBundleService.sol";
8
- import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
7
+ import {NftId, NftIdLib} from "../types/NftId.sol";
9
8
  import {Fee} from "../types/Fee.sol";
10
9
  import {UFixed} from "../types/UFixed.sol";
11
10
  import {IPoolComponent} from "./IPoolComponent.sol";
12
- import {BaseComponent} from "./BaseComponent.sol";
11
+ import {Component} from "./Component.sol";
13
12
  import {TokenHandler} from "../shared/TokenHandler.sol";
14
13
  import {ISetup} from "../instance/module/ISetup.sol";
15
14
 
16
- import {IRegistry} from "../registry/IRegistry.sol";
17
-
18
- // import {IPool} from "../instance/module/pool/IPoolModule.sol";
19
- import {ITreasury} from "../instance/module/ITreasury.sol";
20
15
  import {ISetup} from "../instance/module/ISetup.sol";
21
16
  import {InstanceReader} from "../instance/InstanceReader.sol";
22
17
 
23
- import {IRegisterable} from "../shared/IRegisterable.sol";
24
- import {Registerable} from "../shared/Registerable.sol";
25
18
 
26
- abstract contract Pool is BaseComponent, IPoolComponent {
19
+ abstract contract Pool is Component, IPoolComponent {
27
20
  using NftIdLib for NftId;
28
21
 
29
22
  bool internal _isConfirmingApplication;
@@ -37,10 +30,6 @@ abstract contract Pool is BaseComponent, IPoolComponent {
37
30
 
38
31
  // may be used to interact with instance by derived contracts
39
32
  IPoolService internal _poolService;
40
-
41
- // only relevant to protect callback functions for "active" pools
42
- IProductService private _productService;
43
-
44
33
  IBundleService private _bundleService;
45
34
 
46
35
  modifier onlyPoolService() {
@@ -50,16 +39,10 @@ abstract contract Pool is BaseComponent, IPoolComponent {
50
39
  _;
51
40
  }
52
41
 
53
- modifier onlyProductService() {
54
- require(
55
- msg.sender == address(_productService),
56
- "ERROR:POL-002:NOT_PRODUCT_SERVICE");
57
- _;
58
- }
59
-
60
42
  constructor(
61
43
  address registry,
62
44
  NftId instanceNftId,
45
+ string memory name,
63
46
  // TODO refactor into tokenNftId
64
47
  address token,
65
48
  bool isInterceptor,
@@ -68,10 +51,18 @@ abstract contract Pool is BaseComponent, IPoolComponent {
68
51
  Fee memory poolFee,
69
52
  Fee memory stakingFee,
70
53
  Fee memory performanceFee,
71
- address initialOwner
72
- )
73
- BaseComponent(registry, instanceNftId, token, POOL(), isInterceptor, initialOwner)
74
- {
54
+ address initialOwner,
55
+ bytes memory data
56
+ ) Component(
57
+ registry,
58
+ instanceNftId,
59
+ name,
60
+ token,
61
+ POOL(),
62
+ isInterceptor,
63
+ initialOwner,
64
+ data
65
+ ) {
75
66
  _isConfirmingApplication = isConfirmingApplication;
76
67
  // TODO add validation
77
68
  _collateralizationLevel = collateralizationLevel;
@@ -81,35 +72,12 @@ abstract contract Pool is BaseComponent, IPoolComponent {
81
72
 
82
73
  _tokenHandler = new TokenHandler(token);
83
74
 
84
- _poolService = _instance.getPoolService();
85
- _productService = _instance.getProductService();
86
- _bundleService = _instance.getBundleService();
75
+ _poolService = getInstance().getPoolService();
76
+ _bundleService = getInstance().getBundleService();
87
77
 
88
78
  _registerInterface(type(IPoolComponent).interfaceId);
89
79
  }
90
80
 
91
- function createBundle(
92
- Fee memory fee,
93
- uint256 initialAmount,
94
- uint256 lifetime,
95
- bytes memory filter
96
- )
97
- external
98
- virtual override
99
- returns(NftId bundleNftId)
100
- {
101
- address owner = msg.sender;
102
- bundleNftId = _bundleService.createBundle(
103
- owner,
104
- fee,
105
- initialAmount,
106
- lifetime,
107
- filter
108
- );
109
-
110
- // TODO add logging
111
- }
112
-
113
81
  /**
114
82
  * @dev see {IPool.underwrite}.
115
83
  * Default implementation that only writes a {LogUnderwrittenByPool} entry.
@@ -121,7 +89,7 @@ abstract contract Pool is BaseComponent, IPoolComponent {
121
89
  uint256 collateralizationAmount
122
90
  )
123
91
  external
124
- onlyProductService
92
+ restricted()
125
93
  virtual override
126
94
  {
127
95
  _underwrite(policyNftId, policyData, bundleFilter, collateralizationAmount);
@@ -159,77 +127,45 @@ abstract contract Pool is BaseComponent, IPoolComponent {
159
127
  )
160
128
  external
161
129
  onlyOwner
130
+ restricted()
162
131
  override
163
132
  {
164
133
  _poolService.setFees(poolFee, stakingFee, performanceFee);
165
134
  }
166
135
 
167
- function setBundleFee(
168
- NftId bundleNftId,
169
- Fee memory fee
170
- )
171
- external
172
- override
173
- // TODO add onlyBundleOwner
174
- {
136
+ function _setBundleFee(NftId bundleNftId, Fee memory fee) internal {
175
137
  _bundleService.setBundleFee(bundleNftId, fee);
176
138
  }
177
139
 
178
- function lockBundle(
179
- NftId bundleNftId
180
- )
181
- external
182
- override
183
- // TODO add onlyBundleOwner
184
- {
140
+ function _lockBundle(NftId bundleNftId) internal {
185
141
  _bundleService.lockBundle(bundleNftId);
186
142
  }
187
143
 
188
- function unlockBundle(
189
- NftId bundleNftId
190
- )
191
- external
192
- override
193
- // TODO add onlyBundleOwner
194
- {
144
+ function _unlockBundle(NftId bundleNftId) internal {
195
145
  _bundleService.unlockBundle(bundleNftId);
196
146
  }
197
147
 
198
148
  function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
199
- InstanceReader reader = _instance.getInstanceReader();
200
- return reader.getPoolSetupInfo(getNftId());
201
- }
202
-
203
- // from IRegisterable
204
-
205
- // TODO used only once, occupies space
206
- // TODO do not use super
207
- function getInitialInfo()
208
- public
209
- view
210
- override (IRegisterable, Registerable)
211
- returns (IRegistry.ObjectInfo memory, bytes memory)
212
- {
213
- (
214
- IRegistry.ObjectInfo memory info,
215
- ) = super.getInitialInfo();
216
-
217
- return (
218
- info,
219
- abi.encode(
220
- getName(),
221
- ISetup.PoolSetupInfo(
222
- _productNftId,
223
- _tokenHandler,
224
- _collateralizationLevel,
225
- _initialPoolFee,
226
- _initialStakingFee,
227
- _initialPerformanceFee,
228
- false,
229
- _isConfirmingApplication,
230
- _wallet
231
- )
232
- )
149
+ InstanceReader reader = getInstance().getInstanceReader();
150
+ setupInfo = reader.getPoolSetupInfo(getNftId());
151
+
152
+ // fallback to initial setup info (wallet is always != address(0))
153
+ if(setupInfo.wallet == address(0)) {
154
+ setupInfo = _getInitialSetupInfo();
155
+ }
156
+ }
157
+
158
+ function _getInitialSetupInfo() internal view returns (ISetup.PoolSetupInfo memory) {
159
+ return ISetup.PoolSetupInfo(
160
+ getProductNftId(),
161
+ _tokenHandler,
162
+ _collateralizationLevel,
163
+ _initialPoolFee,
164
+ _initialStakingFee,
165
+ _initialPerformanceFee,
166
+ false,
167
+ _isConfirmingApplication,
168
+ getWallet()
233
169
  );
234
170
  }
235
171
 
@@ -4,22 +4,17 @@ pragma solidity ^0.8.19;
4
4
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
5
 
6
6
  import {IRisk} from "../instance/module/IRisk.sol";
7
- import {ITreasury} from "../instance/module/ITreasury.sol";
8
- import {IProductService} from "../instance/service/IProductService.sol";
9
7
  import {IPolicyService} from "../instance/service/IPolicyService.sol";
10
8
  import {IProductComponent} from "./IProductComponent.sol";
11
- import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
12
- import {ObjectType, PRODUCT} from "../types/ObjectType.sol";
9
+ import {NftId, NftIdLib} from "../types/NftId.sol";
10
+ import {PRODUCT} from "../types/ObjectType.sol";
13
11
  import {ReferralId} from "../types/Referral.sol";
14
12
  import {RiskId, RiskIdLib} from "../types/RiskId.sol";
15
13
  import {StateId} from "../types/StateId.sol";
16
14
  import {Timestamp} from "../types/Timestamp.sol";
17
- import {Fee, FeeLib} from "../types/Fee.sol";
18
- import {BaseComponent} from "./BaseComponent.sol";
15
+ import {Fee} from "../types/Fee.sol";
16
+ import {Component} from "./Component.sol";
19
17
 
20
- import {IRegistry} from "../registry/IRegistry.sol";
21
- import {IRegisterable} from "../shared/IRegisterable.sol";
22
- import {Registerable} from "../shared/Registerable.sol";
23
18
  import {TokenHandler} from "../shared/TokenHandler.sol";
24
19
 
25
20
  import {InstanceReader} from "../instance/InstanceReader.sol";
@@ -27,12 +22,9 @@ import {ISetup} from "../instance/module/ISetup.sol";
27
22
  import {Pool} from "../components/Pool.sol";
28
23
  import {Distribution} from "../components/Distribution.sol";
29
24
 
30
- import {zeroNftId} from "../types/NftId.sol";
31
-
32
- abstract contract Product is BaseComponent, IProductComponent {
25
+ abstract contract Product is Component, IProductComponent {
33
26
  using NftIdLib for NftId;
34
27
 
35
- IProductService internal _productService;
36
28
  IPolicyService internal _policyService;
37
29
  Pool internal _pool;
38
30
  Distribution internal _distribution;
@@ -46,17 +38,27 @@ abstract contract Product is BaseComponent, IProductComponent {
46
38
  constructor(
47
39
  address registry,
48
40
  NftId instanceNftid,
41
+ string memory name,
49
42
  address token,
50
43
  bool isInterceptor,
51
44
  address pool,
52
45
  address distribution,
53
46
  Fee memory productFee,
54
47
  Fee memory processingFee,
55
- address initialOwner
56
- ) BaseComponent(registry, instanceNftid, token, PRODUCT(), isInterceptor, initialOwner) {
48
+ address initialOwner,
49
+ bytes memory data
50
+ ) Component (
51
+ registry,
52
+ instanceNftid,
53
+ name,
54
+ token,
55
+ PRODUCT(),
56
+ isInterceptor,
57
+ initialOwner,
58
+ data
59
+ ) {
57
60
  // TODO add validation
58
- _productService = _instance.getProductService();
59
- _policyService = _instance.getPolicyService();
61
+ _policyService = getInstance().getPolicyService();
60
62
  _pool = Pool(pool);
61
63
  _distribution = Distribution(distribution);
62
64
  _initialProductFee = productFee;
@@ -76,8 +78,8 @@ abstract contract Product is BaseComponent, IProductComponent {
76
78
  RiskId riskId,
77
79
  uint256 lifetime,
78
80
  bytes memory applicationData,
79
- ReferralId referralId,
80
- NftId bundleNftId
81
+ NftId bundleNftId,
82
+ ReferralId referralId
81
83
  )
82
84
  external
83
85
  view
@@ -118,7 +120,7 @@ abstract contract Product is BaseComponent, IProductComponent {
118
120
  RiskId id,
119
121
  bytes memory data
120
122
  ) internal {
121
- _productService.createRisk(
123
+ getProductService().createRisk(
122
124
  id,
123
125
  data
124
126
  );
@@ -128,7 +130,7 @@ abstract contract Product is BaseComponent, IProductComponent {
128
130
  RiskId id,
129
131
  bytes memory data
130
132
  ) internal {
131
- _productService.updateRisk(
133
+ getProductService().updateRisk(
132
134
  id,
133
135
  data
134
136
  );
@@ -138,14 +140,14 @@ abstract contract Product is BaseComponent, IProductComponent {
138
140
  RiskId id,
139
141
  StateId state
140
142
  ) internal {
141
- _productService.updateRiskState(
143
+ getProductService().updateRiskState(
142
144
  id,
143
145
  state
144
146
  );
145
147
  }
146
148
 
147
149
  function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
148
- return _instance.getInstanceReader().getRiskInfo(id);
150
+ return getInstance().getInstanceReader().getRiskInfo(id);
149
151
  }
150
152
 
151
153
  function _createApplication(
@@ -226,76 +228,39 @@ abstract contract Product is BaseComponent, IProductComponent {
226
228
  )
227
229
  external
228
230
  onlyOwner
231
+ restricted()
229
232
  override
230
233
  {
231
- _productService.setFees(productFee, processingFee);
234
+ getProductService().setFees(productFee, processingFee);
232
235
  }
233
236
 
234
237
  function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
235
- InstanceReader reader = _instance.getInstanceReader();
236
- return reader.getProductSetupInfo(getNftId());
237
- }
238
+ InstanceReader reader = getInstance().getInstanceReader();
239
+ setupInfo = reader.getProductSetupInfo(getNftId());
238
240
 
239
- // from IRegisterable
241
+ // fallback to initial setup info (wallet is always != address(0))
242
+ if(setupInfo.wallet == address(0)) {
243
+ setupInfo = _getInitialSetupInfo();
244
+ }
245
+ }
240
246
 
241
- function getInitialInfo()
242
- public
243
- view
244
- override (IRegisterable, Registerable)
245
- returns (IRegistry.ObjectInfo memory, bytes memory)
246
- {
247
- // from Registerable
248
- (
249
- IRegistry.ObjectInfo memory productInfo,
250
- bytes memory data
251
- ) = super.getInitialInfo();
252
-
253
- // TODO read pool & distribution fees
254
- // 1) from pool -> the only option -> pool must be registered first?
255
- // 2) from instance -> all fees are set into instance at product registration which is ongoing here
256
- // checks are done in registryProduct() where THIS function is called
257
- //require(getRegistry().getObjectInfo(_poolNftId).objectType == POOL(), "POOL_NOT_REGISTERED");
258
- //require(getRegistry().getObjectInfo(_distributionNftId).objectType == DISTRIBUTION(), "DISTRIBUTION_NOT_REGISTERED");
259
-
260
- // from PoolComponent
261
- (
262
- ,
263
- bytes memory poolData
264
- ) = _pool.getInitialInfo();
265
-
266
- (
267
- , ISetup.PoolSetupInfo memory poolSetupInfo
268
- ) = abi.decode(poolData, (string, ISetup.PoolSetupInfo));
269
-
270
- // from DistributionComponent
271
- (
272
- ,
273
- bytes memory distributionData
274
- ) = _distribution.getInitialInfo();
275
-
276
- (
277
- , ISetup.DistributionSetupInfo memory distributionSetupInfo
278
- ) = abi.decode(distributionData, (string, ISetup.DistributionSetupInfo));
279
-
280
- return (
281
- productInfo,
282
- abi.encode(
283
- getName(),
284
- ISetup.ProductSetupInfo(
285
- _token,
286
- _tokenHandler,
287
- _distributionNftId,
288
- _poolNftId,
289
- distributionSetupInfo.distributionFee,
290
- _initialProductFee,
291
- _initialProcessingFee,
292
- poolSetupInfo.poolFee,
293
- poolSetupInfo.stakingFee,
294
- poolSetupInfo.performanceFee,
295
- false,
296
- _wallet
297
- )
298
- )
247
+ function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
248
+ ISetup.DistributionSetupInfo memory distributionSetupInfo = _distribution.getSetupInfo();
249
+ ISetup.PoolSetupInfo memory poolSetupInfo = _pool.getSetupInfo();
250
+
251
+ return ISetup.ProductSetupInfo(
252
+ getToken(),
253
+ _tokenHandler,
254
+ _distributionNftId,
255
+ _poolNftId,
256
+ distributionSetupInfo.distributionFee,
257
+ _initialProductFee,
258
+ _initialProcessingFee,
259
+ poolSetupInfo.poolFee,
260
+ poolSetupInfo.stakingFee,
261
+ poolSetupInfo.performanceFee,
262
+ false,
263
+ getWallet()
299
264
  );
300
265
  }
301
266
  }
@@ -32,17 +32,13 @@ contract BundleManager is
32
32
 
33
33
  mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
34
34
 
35
- constructor() ObjectManager() {
36
- }
37
-
38
-
39
35
  /// @dev links a policy with its bundle
40
36
  // to link a policy it MUST NOT yet have been activated
41
37
  // the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
42
38
  function linkPolicy(NftId policyNftId) external restricted() {
43
- NftId bundleNftId = _instanceReader.getPolicyInfo(policyNftId).bundleNftId;
39
+ NftId bundleNftId = _instance.getInstanceReader().getPolicyInfo(policyNftId).bundleNftId;
44
40
  // decision will likely depend on the decision what to check here and what in the service
45
- NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
41
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
46
42
 
47
43
  // ensure bundle is unlocked (in active set) and registered with this instance
48
44
  if (!_isActive(poolNftId, bundleNftId)) {
@@ -59,11 +55,11 @@ contract BundleManager is
59
55
  // - the policy MUST be past its expiry period and it MUST NOT have any open claims
60
56
  // - the policy's payoutAmount MUST be equal to its sumInsuredAmount and MUST NOT have any open claims
61
57
  function unlinkPolicy(NftId policyNftId) external restricted() {
62
- IPolicy.PolicyInfo memory policyInfo = _instanceReader.getPolicyInfo(policyNftId);
58
+ IPolicy.PolicyInfo memory policyInfo = _instance.getInstanceReader().getPolicyInfo(policyNftId);
63
59
 
64
60
  NftId bundleNftId = policyInfo.bundleNftId;
65
61
  // decision will likely depend on the decision what to check here and what in the service
66
- NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
62
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
67
63
 
68
64
  // ensure bundle is registered with this instance
69
65
  if (!_contains(poolNftId, bundleNftId)) {
@@ -78,7 +74,7 @@ contract BundleManager is
78
74
  /// @dev add a new bundle to a riskpool registerd with this instance
79
75
  // the corresponding pool is fetched via instance reader
80
76
  function add(NftId bundleNftId) external restricted() {
81
- NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
77
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
82
78
 
83
79
  // ensure pool is registered with instance
84
80
  if(poolNftId.eqz()) {
@@ -91,14 +87,14 @@ contract BundleManager is
91
87
 
92
88
  /// @dev unlocked (active) bundles are available to underwrite new policies
93
89
  function unlock(NftId bundleNftId) external restricted() {
94
- NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
90
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
95
91
  _activate(poolNftId, bundleNftId);
96
92
  emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
97
93
  }
98
94
 
99
95
  /// @dev locked (deactivated) bundles may not underwrite any new policies
100
96
  function lock(NftId bundleNftId) external restricted() {
101
- NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
97
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
102
98
  _deactivate(poolNftId, bundleNftId);
103
99
  emit LogBundleManagerBundleLocked(poolNftId, bundleNftId);
104
100
  }
@@ -1,32 +1,41 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
4
  import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
6
5
 
6
+ import {NftId} from "../types/NftId.sol";
7
+ import {StateId} from "../types/StateId.sol";
8
+ import {RiskId} from "../types/RiskId.sol";
9
+
10
+ import {IRegisterable} from "../shared/IRegisterable.sol";
11
+
12
+ import {InstanceAccessManager} from "./InstanceAccessManager.sol";
7
13
  import {BundleManager} from "./BundleManager.sol";
8
14
  import {InstanceReader} from "./InstanceReader.sol";
9
15
 
10
- import {InstanceAccessManager} from "./InstanceAccessManager.sol";
11
- import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
16
+ import {IBundle} from "./module/IBundle.sol";
17
+ import {IBundleService} from "./service/IBundleService.sol";
12
18
  import {IDistributionService} from "./service/IDistributionService.sol";
19
+ import {InstanceAccessManager} from "./InstanceAccessManager.sol";
20
+ import {IKeyValueStore} from "./base/IKeyValueStore.sol";
21
+ import {IPolicy} from "./module/IPolicy.sol";
22
+ import {IPolicyService} from "./service/IPolicyService.sol";
13
23
  import {IPoolService} from "./service/IPoolService.sol";
14
24
  import {IProductService} from "./service/IProductService.sol";
15
25
  import {IPolicyService} from "./service/IPolicyService.sol";
16
26
  import {IBundleService} from "./service/IBundleService.sol";
17
- import {IBundle} from "./module/IBundle.sol";
27
+ import {IRisk} from "./module/IRisk.sol";
18
28
  import {ISetup} from "./module/ISetup.sol";
19
29
  import {NftId} from "../types/NftId.sol";
20
- import {StateId} from "../types/StateId.sol";
21
30
  import {RiskId} from "../types/RiskId.sol";
22
- import {IRisk} from "./module/IRisk.sol";
23
- import {IPolicy} from "./module/IPolicy.sol";
24
- import {IKeyValueStore} from "./base/IKeyValueStore.sol";
31
+ import {StateId} from "../types/StateId.sol";
32
+ import {VersionPart} from "../types/Version.sol";
33
+
34
+
25
35
 
26
36
 
27
- interface IInstance is IERC165, IKeyValueStore, IAccessManaged {
37
+ interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
28
38
 
29
- function getComponentOwnerService() external view returns (IComponentOwnerService);
30
39
  function getDistributionService() external view returns (IDistributionService);
31
40
  function getProductService() external view returns (IProductService);
32
41
  function getPoolService() external view returns (IPoolService);
@@ -57,6 +66,7 @@ interface IInstance is IERC165, IKeyValueStore, IAccessManaged {
57
66
  function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
58
67
  function updatePolicyState(NftId policyNftId, StateId newState) external;
59
68
 
69
+ function getMajorVersion() external pure returns (VersionPart majorVersion);
60
70
  function getInstanceReader() external view returns (InstanceReader);
61
71
  function getBundleManager() external view returns (BundleManager);
62
72
  }
@@ -8,7 +8,7 @@ import {IService} from "../shared/IService.sol";
8
8
  import {IRegistry} from "../registry/IRegistry.sol";
9
9
 
10
10
  import {IRegisterable} from "../shared/IRegisterable.sol";
11
- import {IBaseComponent} from "../components/IBaseComponent.sol";
11
+ import {IComponent} from "../components/IComponent.sol";
12
12
 
13
13
  import {InstanceAccessManager} from "./InstanceAccessManager.sol";
14
14
  import {Instance} from "./Instance.sol";
@@ -20,6 +20,7 @@ interface IInstanceService is IService {
20
20
  error ErrorInstanceServiceRequestUnauhorized(address caller);
21
21
  error ErrorInstanceServiceNotInstanceOwner(address caller, NftId instanceNftId);
22
22
  error ErrorInstanceServiceComponentNotRegistered(address componentAddress);
23
+ error ErrorInstanceServiceInvalidComponentType(address componentAddress, ObjectType expectedType, ObjectType componentType);
23
24
 
24
25
  event LogInstanceCloned(address clonedAccessManagerAddress, address clonedInstanceAddress, address clonedInstanceReaderAddress, NftId clonedInstanceNftId);
25
26