@etherisc/gif-next 0.0.2-f2b0fa2-473 → 0.0.2-f5a74cc-201

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. package/README.md +67 -1
  2. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
  3. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +139 -0
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +149 -15
  6. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +101 -0
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +28 -2
  11. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  12. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  13. package/artifacts/contracts/components/Pool.sol/Pool.json +181 -16
  14. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  15. package/artifacts/contracts/components/Product.sol/Product.json +157 -56
  16. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
  17. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
  18. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
  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/SM.sol/SM.json +2 -2
  35. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  36. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
  37. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  38. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  39. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
  40. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
  41. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
  42. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +775 -0
  43. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
  44. package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
  45. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +1 -1
  46. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  47. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1369 -22
  48. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
  49. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +448 -0
  50. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  51. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +64 -0
  52. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  53. package/artifacts/contracts/instance/Instance.sol/Instance.json +216 -132
  54. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  55. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +57 -34
  56. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
  57. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +763 -0
  58. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  59. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +202 -37
  60. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  61. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +321 -41
  62. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  63. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +101 -13
  64. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
  65. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +272 -0
  66. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
  67. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +59 -0
  68. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  69. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  70. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  71. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  72. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
  73. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  74. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  75. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  76. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  77. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  78. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  79. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  80. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  81. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  82. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
  83. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +18 -18
  84. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
  85. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +716 -0
  86. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
  87. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +444 -0
  88. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  90. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  91. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +167 -0
  92. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  93. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +40 -31
  94. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
  95. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +1049 -0
  96. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
  97. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +464 -0
  98. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
  99. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +1147 -0
  100. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
  101. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +488 -0
  102. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  103. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  104. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +201 -0
  105. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  106. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +94 -19
  107. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  108. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  109. package/artifacts/contracts/registry/Registry.sol/Registry.json +172 -49
  110. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  111. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +61 -29
  112. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  113. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +47 -34
  114. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
  115. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +410 -0
  116. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  117. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  118. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
  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/IService.sol/IService.dbg.json +1 -1
  122. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  123. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  124. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  125. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  126. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  127. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  128. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +4 -4
  129. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +1 -1
  130. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  131. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  132. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  133. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  134. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  135. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  136. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  137. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +4 -4
  138. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  139. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  140. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  141. package/artifacts/contracts/test/TestService.sol/TestService.json +11 -11
  142. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  143. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  144. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  145. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  146. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
  147. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  148. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  149. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  150. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  151. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  152. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  153. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  154. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  155. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  156. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
  157. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  158. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  159. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  160. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  161. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  163. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  165. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  167. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  168. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  169. package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
  170. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  171. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
  172. package/contracts/components/BaseComponent.sol +57 -11
  173. package/contracts/components/Distribution.sol +15 -18
  174. package/contracts/components/IBaseComponent.sol +7 -0
  175. package/contracts/components/IDistributionComponent.sol +1 -0
  176. package/contracts/components/IPoolComponent.sol +5 -1
  177. package/contracts/components/Pool.sol +36 -28
  178. package/contracts/components/Product.sol +34 -42
  179. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +23 -0
  180. package/contracts/instance/BundleManager.sol +129 -0
  181. package/contracts/instance/Cloneable.sol +46 -0
  182. package/contracts/instance/IInstance.sol +35 -7
  183. package/contracts/instance/IInstanceBase.sol +26 -0
  184. package/contracts/instance/IInstanceService.sol +16 -1
  185. package/contracts/instance/Instance.sol +53 -34
  186. package/contracts/instance/InstanceAccessManager.sol +6 -6
  187. package/contracts/instance/InstanceBase.sol +41 -0
  188. package/contracts/instance/InstanceReader.sol +36 -1
  189. package/contracts/instance/InstanceService.sol +164 -27
  190. package/contracts/instance/InstanceServiceManager.sol +6 -5
  191. package/contracts/instance/ObjectManager.sol +95 -0
  192. package/contracts/instance/base/ComponentServiceBase.sol +91 -6
  193. package/contracts/instance/module/IBundle.sol +1 -0
  194. package/contracts/instance/module/ISetup.sol +3 -0
  195. package/contracts/instance/service/DistributionService.sol +88 -0
  196. package/contracts/instance/service/DistributionServiceManager.sol +54 -0
  197. package/contracts/instance/service/IPoolService.sol +16 -2
  198. package/contracts/instance/service/IProductService.sol +6 -3
  199. package/contracts/instance/service/PoolService.sol +287 -0
  200. package/contracts/instance/service/PoolServiceManager.sol +54 -0
  201. package/contracts/instance/service/ProductService.sol +570 -0
  202. package/contracts/instance/service/ProductServiceManager.sol +54 -0
  203. package/contracts/registry/IRegistry.sol +26 -2
  204. package/contracts/registry/IRegistryService.sol +27 -12
  205. package/contracts/registry/Registry.sol +60 -35
  206. package/contracts/registry/RegistryService.sol +37 -118
  207. package/contracts/registry/RegistryServiceManager.sol +21 -5
  208. package/contracts/registry/TokenRegistry.sol +111 -0
  209. package/contracts/shared/ERC165.sol +6 -2
  210. package/contracts/shared/NftOwnable.sol +2 -4
  211. package/contracts/shared/Registerable.sol +1 -0
  212. package/contracts/shared/Service.sol +1 -0
  213. package/contracts/types/NftIdSet.sol +26 -24
  214. package/contracts/types/RoleId.sol +8 -0
  215. package/contracts/types/StateId.sol +4 -0
  216. package/contracts/types/Version.sol +4 -1
  217. package/package.json +1 -1
  218. package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
  219. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
  220. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1119
  221. package/contracts/instance/AccessManagedSimple.sol +0 -114
  222. package/contracts/instance/AccessManagerSimple.sol +0 -682
@@ -7,7 +7,7 @@
7
7
  "inputs": [
8
8
  {
9
9
  "internalType": "VersionPart",
10
- "name": "x",
10
+ "name": "a",
11
11
  "type": "uint8"
12
12
  }
13
13
  ],
@@ -21,10 +21,29 @@
21
21
  ],
22
22
  "stateMutability": "pure",
23
23
  "type": "function"
24
+ },
25
+ {
26
+ "inputs": [
27
+ {
28
+ "internalType": "uint256",
29
+ "name": "a",
30
+ "type": "uint256"
31
+ }
32
+ ],
33
+ "name": "toVersionPart",
34
+ "outputs": [
35
+ {
36
+ "internalType": "VersionPart",
37
+ "name": "",
38
+ "type": "uint8"
39
+ }
40
+ ],
41
+ "stateMutability": "pure",
42
+ "type": "function"
24
43
  }
25
44
  ],
26
- "bytecode": "0x60b9610039600b82828239805160001a60731461002c57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063ac43d834146038575b600080fd5b60496043366004605b565b60ff1690565b60405190815260200160405180910390f35b600060208284031215606c57600080fd5b813560ff81168114607c57600080fd5b939250505056fea264697066735822122028c6578af7cf354c26921be53c7bafd817914c3fa380a53d5f0e3935a1b47c8b64736f6c63430008140033",
27
- "deployedBytecode": "0x730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063ac43d834146038575b600080fd5b60496043366004605b565b60ff1690565b60405190815260200160405180910390f35b600060208284031215606c57600080fd5b813560ff81168114607c57600080fd5b939250505056fea264697066735822122028c6578af7cf354c26921be53c7bafd817914c3fa380a53d5f0e3935a1b47c8b64736f6c63430008140033",
45
+ "bytecode": "0x60fb610039600b82828239805160001a60731461002c57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80638e4ad86c146042578063ac43d834146067575b600080fd5b6050604d3660046085565b90565b60405160ff90911681526020015b60405180910390f35b60786072366004609d565b60ff1690565b604051908152602001605e565b600060208284031215609657600080fd5b5035919050565b60006020828403121560ae57600080fd5b813560ff8116811460be57600080fd5b939250505056fea264697066735822122074bb6f75f2cab9692d05e41844bf40283045a9440c662c37a97b2502d38207ed64736f6c63430008140033",
46
+ "deployedBytecode": "0x7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80638e4ad86c146042578063ac43d834146067575b600080fd5b6050604d3660046085565b90565b60405160ff90911681526020015b60405180910390f35b60786072366004609d565b60ff1690565b604051908152602001605e565b600060208284031215609657600080fd5b5035919050565b60006020828403121560ae57600080fd5b813560ff8116811460be57600080fd5b939250505056fea264697066735822122074bb6f75f2cab9692d05e41844bf40283045a9440c662c37a97b2502d38207ed64736f6c63430008140033",
28
47
  "linkReferences": {},
29
48
  "deployedLinkReferences": {}
30
49
  }
@@ -1,23 +1,22 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {IBaseComponent} from "./IBaseComponent.sol";
5
+ import {IComponentOwnerService} from "../instance/service/IComponentOwnerService.sol";
4
6
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
-
6
- import {Registerable} from "../shared/Registerable.sol";
7
-
8
- import {IRegistry} from "../registry/IRegistry.sol";
9
- import {IInstance} from "../instance/IInstance.sol";
10
-
11
7
  import {IInstance} from "../instance/IInstance.sol";
12
- import {IComponentOwnerService} from "../instance/service/IComponentOwnerService.sol";
13
- import {IBaseComponent} from "./IBaseComponent.sol";
14
- import {NftId} from "../types/NftId.sol";
8
+ import {IRegistry} from "../registry/IRegistry.sol";
9
+ import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
15
10
  import {ObjectType} from "../types/ObjectType.sol";
11
+ import {Registerable} from "../shared/Registerable.sol";
12
+ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
16
13
 
17
14
  abstract contract BaseComponent is
18
15
  Registerable,
19
16
  IBaseComponent
20
17
  {
18
+ using NftIdLib for NftId;
19
+
21
20
  IComponentOwnerService internal _componentOwnerService;
22
21
 
23
22
  address internal _deployer;
@@ -29,7 +28,6 @@ abstract contract BaseComponent is
29
28
  constructor(
30
29
  address registry,
31
30
  NftId instanceNftId,
32
- NftId productNftId,
33
31
  address token,
34
32
  ObjectType componentType,
35
33
  bool isInterceptor,
@@ -49,16 +47,17 @@ abstract contract BaseComponent is
49
47
  _componentOwnerService = _instance.getComponentOwnerService();
50
48
  _wallet = address(this);
51
49
  _token = IERC20Metadata(token);
52
- _productNftId = productNftId;
53
50
 
54
51
  _registerInterface(type(IBaseComponent).interfaceId);
55
52
  }
56
53
 
57
54
  // from component contract
55
+ // TODO consider to remove/replace with access manager contract locking
58
56
  function lock() external onlyOwner override {
59
57
  _componentOwnerService.lock(this);
60
58
  }
61
59
 
60
+ // TODO consider to remove/replace with access manager contract locking
62
61
  function unlock() external onlyOwner override {
63
62
  _componentOwnerService.unlock(this);
64
63
  }
@@ -72,6 +71,48 @@ abstract contract BaseComponent is
72
71
  return _wallet;
73
72
  }
74
73
 
74
+ /// @dev Sets the wallet address for the component.
75
+ /// if the current wallet has tokens, these will be transferred.
76
+ /// if the new wallet address is externally owned, an approval from the
77
+ /// owner of the external wallet for the component to move all tokens must exist.
78
+ function setWallet(address newWallet) external override onlyOwner {
79
+ address currentWallet = _wallet;
80
+ uint256 currentBalance = _token.balanceOf(currentWallet);
81
+
82
+ // checks
83
+ if (newWallet == currentWallet) {
84
+ revert ErrorBaseComponentWalletAddressIsSameAsCurrent(newWallet);
85
+ }
86
+
87
+ if (currentBalance > 0) {
88
+ if (currentWallet == address(this)) {
89
+ // move tokens from component smart contract to external wallet
90
+ } else {
91
+ // move tokens from external wallet to component smart contract or another external wallet
92
+ uint256 allowance = _token.allowance(currentWallet, address(this));
93
+ if (allowance < currentBalance) {
94
+ revert ErrorBaseComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
95
+ }
96
+ }
97
+ }
98
+
99
+ // effects
100
+ _wallet = newWallet;
101
+ emit LogBaseComponentWalletAddressChanged(newWallet);
102
+
103
+ // interactions
104
+ if (currentBalance > 0) {
105
+ // transfer tokens from current wallet to new wallet
106
+ if (currentWallet == address(this)) {
107
+ // transferFrom requires self allowance too
108
+ _token.approve(address(this), currentBalance);
109
+ }
110
+
111
+ SafeERC20.safeTransferFrom(_token, currentWallet, newWallet, currentBalance);
112
+ emit LogBaseComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
113
+ }
114
+ }
115
+
75
116
  function getToken() public view override returns (IERC20Metadata token) {
76
117
  return _token;
77
118
  }
@@ -80,6 +121,11 @@ abstract contract BaseComponent is
80
121
  return _instance;
81
122
  }
82
123
 
124
+ function setProductNftId(NftId productNftId) public override onlyOwner {
125
+ require(_productNftId.eq(zeroNftId()), "product nft id already set");
126
+ _productNftId = productNftId;
127
+ }
128
+
83
129
  function getProductNftId() public view override returns (NftId productNftId) {
84
130
  return _productNftId;
85
131
  }
@@ -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
 
@@ -38,21 +40,21 @@ contract Distribution is
38
40
  constructor(
39
41
  address registry,
40
42
  NftId instanceNftId,
41
- NftId productNftId,
42
43
  // TODO refactor into tokenNftId
43
44
  address token,
44
45
  bool verifying,
45
46
  Fee memory distributionFee,
46
47
  address initialOwner
47
48
  )
48
- BaseComponent(registry, instanceNftId, productNftId, token, DISTRIBUTION(), true, initialOwner)
49
+ BaseComponent(registry, instanceNftId, token, DISTRIBUTION(), true, initialOwner)
49
50
  {
50
51
  _isVerifying = verifying;
51
52
  _initialDistributionFee = distributionFee;
52
53
 
53
- // TODO: reactivate when services are available again
54
- // _distributionService = _instance.getDistributionService();
55
- // _productService = _instance.getProductService();
54
+ _tokenHandler = TokenHandler(token);
55
+
56
+ _distributionService = _instance.getDistributionService();
57
+ _productService = _instance.getProductService();
56
58
 
57
59
  _registerInterface(type(IDistributionComponent).interfaceId);
58
60
  }
@@ -123,19 +125,10 @@ contract Distribution is
123
125
  }
124
126
 
125
127
  function getSetupInfo() public view returns (ISetup.DistributionSetupInfo memory setupInfo) {
126
- if (getNftId().eq(zeroNftId())) {
127
- return ISetup.DistributionSetupInfo(
128
- _productNftId,
129
- TokenHandler(address(0)),
130
- _initialDistributionFee,
131
- _isVerifying,
132
- address(0)
133
- );
134
- }
135
-
136
128
  InstanceReader reader = _instance.getInstanceReader();
137
129
  return reader.getDistributionSetupInfo(getNftId());
138
130
  }
131
+
139
132
 
140
133
  /// @dev returns true iff the component needs to be called when selling/renewing policis
141
134
  function isVerifying() external view returns (bool verifying) {
@@ -152,14 +145,18 @@ contract Distribution is
152
145
  {
153
146
  (
154
147
  IRegistry.ObjectInfo memory info,
155
- bytes memory data
156
148
  ) = super.getInitialInfo();
157
149
 
158
150
  return (
159
151
  info,
160
152
  abi.encode(
161
- _initialDistributionFee,
162
- _isVerifying
153
+ ISetup.DistributionSetupInfo(
154
+ _productNftId,
155
+ _tokenHandler,
156
+ _initialDistributionFee,
157
+ _isVerifying,
158
+ address(this)
159
+ )
163
160
  )
164
161
  );
165
162
  }
@@ -8,6 +8,11 @@ import {IInstance} from "../instance/IInstance.sol";
8
8
  import {NftId} from "../types/NftId.sol";
9
9
 
10
10
  interface IBaseComponent is IRegisterable {
11
+ error ErrorBaseComponentWalletAddressIsSameAsCurrent(address newWallet);
12
+ error ErrorBaseComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
13
+
14
+ event LogBaseComponentWalletAddressChanged(address newWallet);
15
+ event LogBaseComponentWalletTokensTransferred(address from, address to, uint256 amount);
11
16
 
12
17
  function lock() external;
13
18
 
@@ -15,10 +20,12 @@ interface IBaseComponent is IRegisterable {
15
20
 
16
21
  function getToken() external view returns (IERC20Metadata token);
17
22
 
23
+ function setWallet(address walletAddress) external;
18
24
  function getWallet() external view returns (address walletAddress);
19
25
 
20
26
  function getInstance() external view returns (IInstance instance);
21
27
 
28
+ function setProductNftId(NftId productNftId) external;
22
29
  function getProductNftId() external view returns (NftId productNftId);
23
30
 
24
31
  }
@@ -4,6 +4,7 @@ pragma solidity ^0.8.19;
4
4
  import {Fee} from "../types/Fee.sol";
5
5
  import {ReferralId} from "../types/Referral.sol";
6
6
  import {NftId} from "../types/NftId.sol";
7
+ import {ISetup} from "../instance/module/ISetup.sol";
7
8
 
8
9
  interface IDistributionComponent {
9
10
 
@@ -43,6 +43,10 @@ interface IPoolComponent {
43
43
  uint256 collateralizationAmount
44
44
  ) external;
45
45
 
46
+ function lockBundle(NftId bundleNftId) external;
47
+
48
+ function unlockBundle(NftId bundleNftId) external;
49
+
46
50
  /**
47
51
  * @dev returns true iff the policy application data in policyData matches
48
52
  * with the bundle filter criteria encoded in bundleFilter.
@@ -55,7 +59,7 @@ interface IPoolComponent {
55
59
  view
56
60
  returns (bool isMatching);
57
61
 
58
- function isVerifying() external view returns (bool verifying);
62
+ function isConfirmingApplication() external view returns (bool isConfirmingApplication);
59
63
 
60
64
  function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
61
65
 
@@ -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
 
@@ -55,29 +57,29 @@ contract Pool is BaseComponent, IPoolComponent {
55
57
  constructor(
56
58
  address registry,
57
59
  NftId instanceNftId,
58
- NftId productNftId,
59
60
  // TODO refactor into tokenNftId
60
61
  address token,
61
62
  bool isInterceptor,
62
- bool verifying,
63
+ bool isConfirmingApplication,
63
64
  UFixed collateralizationLevel,
64
65
  Fee memory poolFee,
65
66
  Fee memory stakingFee,
66
67
  Fee memory performanceFee,
67
68
  address initialOwner
68
69
  )
69
- BaseComponent(registry, instanceNftId, productNftId, token, POOL(), isInterceptor, initialOwner)
70
+ BaseComponent(registry, instanceNftId, token, POOL(), isInterceptor, initialOwner)
70
71
  {
71
- _isVerifying = verifying;
72
+ _isConfirmingApplication = isConfirmingApplication;
72
73
  // TODO add validation
73
74
  _collateralizationLevel = collateralizationLevel;
74
75
  _initialPoolFee = poolFee;
75
76
  _initialStakingFee = stakingFee;
76
77
  _initialPerformanceFee = performanceFee;
77
78
 
78
- // TODO: reactivate when services are available again
79
- // _poolService = _instance.getPoolService();
80
- // _productService = _instance.getProductService();
79
+ _tokenHandler = new TokenHandler(token);
80
+
81
+ _poolService = _instance.getPoolService();
82
+ _productService = _instance.getProductService();
81
83
 
82
84
  _registerInterface(type(IPoolComponent).interfaceId);
83
85
  }
@@ -138,8 +140,8 @@ contract Pool is BaseComponent, IPoolComponent {
138
140
  }
139
141
 
140
142
 
141
- function isVerifying() external view override returns (bool verifying) {
142
- return _isVerifying;
143
+ function isConfirmingApplication() external view override returns (bool isConfirmingApplication) {
144
+ return _isConfirmingApplication;
143
145
  }
144
146
 
145
147
  function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
@@ -169,21 +171,27 @@ contract Pool is BaseComponent, IPoolComponent {
169
171
  _poolService.setBundleFee(bundleNftId, fee);
170
172
  }
171
173
 
172
- function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
173
- // TODO fix this
174
- if (getNftId().eq(zeroNftId())) {
175
- return ISetup.PoolSetupInfo(
176
- _productNftId,
177
- TokenHandler(address(0)),
178
- _collateralizationLevel,
179
- _initialPoolFee,
180
- _initialStakingFee,
181
- _initialPerformanceFee,
182
- _isVerifying,
183
- _wallet
184
- );
185
- }
174
+ function lockBundle(
175
+ NftId bundleNftId
176
+ )
177
+ external
178
+ override
179
+ // TODO add onlyBundleOwner
180
+ {
181
+ _poolService.lockBundle(bundleNftId);
182
+ }
186
183
 
184
+ function unlockBundle(
185
+ NftId bundleNftId
186
+ )
187
+ external
188
+ override
189
+ // TODO add onlyBundleOwner
190
+ {
191
+ _poolService.unlockBundle(bundleNftId);
192
+ }
193
+
194
+ function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
187
195
  InstanceReader reader = _instance.getInstanceReader();
188
196
  return reader.getPoolSetupInfo(getNftId());
189
197
  }
@@ -200,20 +208,20 @@ contract Pool is BaseComponent, IPoolComponent {
200
208
  {
201
209
  (
202
210
  IRegistry.ObjectInfo memory info,
203
- bytes memory data
204
211
  ) = super.getInitialInfo();
205
212
 
206
213
  return (
207
214
  info,
208
215
  abi.encode(
209
216
  ISetup.PoolSetupInfo(
210
- getProductNftId(),
211
- TokenHandler(address(0)),
217
+ _productNftId,
218
+ _tokenHandler,
212
219
  _collateralizationLevel,
213
220
  _initialPoolFee,
214
221
  _initialStakingFee,
215
222
  _initialPerformanceFee,
216
- _isVerifying,
223
+ false,
224
+ _isConfirmingApplication,
217
225
  _wallet
218
226
  )
219
227
  )
@@ -24,6 +24,7 @@ import {TokenHandler} from "../shared/TokenHandler.sol";
24
24
  import {InstanceReader} from "../instance/InstanceReader.sol";
25
25
  import {ISetup} from "../instance/module/ISetup.sol";
26
26
  import {Pool} from "../components/Pool.sol";
27
+ import {Distribution} from "../components/Distribution.sol";
27
28
 
28
29
  import {zeroNftId} from "../types/NftId.sol";
29
30
 
@@ -32,9 +33,10 @@ contract Product is BaseComponent, IProductComponent {
32
33
 
33
34
  IProductService internal _productService;
34
35
  Pool internal _pool;
35
- address internal _distribution;
36
+ Distribution internal _distribution;
36
37
  Fee internal _initialProductFee;
37
38
  Fee internal _initialProcessingFee;
39
+ TokenHandler internal _tokenHandler;
38
40
 
39
41
  NftId internal _poolNftId;
40
42
  NftId internal _distributionNftId;
@@ -49,17 +51,18 @@ contract Product is BaseComponent, IProductComponent {
49
51
  Fee memory productFee,
50
52
  Fee memory processingFee,
51
53
  address initialOwner
52
- ) BaseComponent(registry, instanceNftid, zeroNftId(), token, PRODUCT(), isInterceptor, initialOwner) {
54
+ ) BaseComponent(registry, instanceNftid, token, PRODUCT(), isInterceptor, initialOwner) {
53
55
  // TODO add validation
54
- // TODO: reactivate when services are available again
55
- // _productService = _instance.getProductService();
56
+ _productService = _instance.getProductService();
56
57
  _pool = Pool(pool);
57
- _distribution = distribution;
58
+ _distribution = Distribution(distribution);
58
59
  _initialProductFee = productFee;
59
60
  _initialProcessingFee = processingFee;
60
61
 
62
+ _tokenHandler = new TokenHandler(token);
63
+
61
64
  _poolNftId = getRegistry().getNftId(address(_pool));
62
- _distributionNftId = getRegistry().getNftId(_distribution);
65
+ _distributionNftId = getRegistry().getNftId(address(_distribution));
63
66
 
64
67
  _registerInterface(type(IProductComponent).interfaceId);
65
68
  }
@@ -118,13 +121,13 @@ contract Product is BaseComponent, IProductComponent {
118
121
  );
119
122
  }
120
123
 
121
- function _setRiskInfo(
124
+ function _updateRisk(
122
125
  RiskId id,
123
- IRisk.RiskInfo memory info
126
+ bytes memory data
124
127
  ) internal {
125
- _productService.setRiskInfo(
128
+ _productService.updateRisk(
126
129
  id,
127
- info
130
+ data
128
131
  );
129
132
  }
130
133
 
@@ -202,7 +205,7 @@ contract Product is BaseComponent, IProductComponent {
202
205
  }
203
206
 
204
207
  function getDistributionNftId() external view override returns (NftId distributionNftId) {
205
- return getRegistry().getNftId(_distribution);
208
+ return getRegistry().getNftId(address(_distribution));
206
209
  }
207
210
 
208
211
  // from product component
@@ -218,28 +221,12 @@ contract Product is BaseComponent, IProductComponent {
218
221
  }
219
222
 
220
223
  function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
221
- if (getNftId().eq(zeroNftId())) {
222
- return ISetup.ProductSetupInfo(
223
- _token,
224
- TokenHandler(address(0)),
225
- _distributionNftId,
226
- _poolNftId,
227
- FeeLib.zeroFee(), //_instance.getDistributionFee(_distributionNftId)
228
- _initialProductFee,
229
- _initialProcessingFee,
230
- FeeLib.zeroFee(), //_instance.getPoolFee(_poolNftId)
231
- FeeLib.zeroFee(), //_instance.getStakingFee(_poolNftId)
232
- FeeLib.zeroFee() //_instance.getPerformanceFee(_poolNftId)
233
- );
234
- }
235
-
236
224
  InstanceReader reader = _instance.getInstanceReader();
237
225
  return reader.getProductSetupInfo(getNftId());
238
226
  }
239
227
 
240
228
  // from IRegisterable
241
229
 
242
- // TODO used only once, occupies space
243
230
  function getInitialInfo()
244
231
  public
245
232
  view
@@ -251,7 +238,7 @@ contract Product is BaseComponent, IProductComponent {
251
238
  IRegistry.ObjectInfo memory productInfo,
252
239
  bytes memory data
253
240
  ) = super.getInitialInfo();
254
-
241
+
255
242
  // TODO read pool & distribution fees
256
243
  // 1) from pool -> the only option -> pool must be registered first?
257
244
  // 2) from instance -> all fees are set into instance at product registration which is ongoing here
@@ -261,35 +248,40 @@ contract Product is BaseComponent, IProductComponent {
261
248
 
262
249
  // from PoolComponent
263
250
  (
264
- IRegistry.ObjectInfo memory poolInfo,
251
+ ,
265
252
  bytes memory poolData
266
253
  ) = _pool.getInitialInfo();
254
+
255
+ (
256
+ ISetup.PoolSetupInfo memory poolSetupInfo
257
+ ) = abi.decode(poolData, (ISetup.PoolSetupInfo));
267
258
 
259
+ // from DistributionComponent
268
260
  (
269
- /*IPool.PoolInfo memory info*/,
270
- /*address wallet*/,
271
- /*IERC20Metadata token*/,
272
- Fee memory initialPoolFee,
273
- Fee memory initialStakingFee,
274
- Fee memory initialPerformanceFee
275
- ) = abi.decode(poolData, (ISetup.PoolSetupInfo, address, IERC20Metadata, Fee, Fee, Fee));
261
+ ,
262
+ bytes memory distributionData
263
+ ) = _distribution.getInitialInfo();
276
264
 
277
- // TODO from DistributionComponent
265
+ (
266
+ ISetup.DistributionSetupInfo memory distributionSetupInfo
267
+ ) = abi.decode(distributionData, (ISetup.DistributionSetupInfo));
278
268
 
279
269
  return (
280
270
  productInfo,
281
271
  abi.encode(
282
272
  ISetup.ProductSetupInfo(
283
273
  _token,
284
- TokenHandler(address(0)),
274
+ _tokenHandler,
285
275
  _distributionNftId,
286
276
  _poolNftId,
287
- FeeLib.zeroFee(), //_instance.getDistributionFee(_distributionNftId)
277
+ distributionSetupInfo.distributionFee,
288
278
  _initialProductFee,
289
279
  _initialProcessingFee,
290
- initialPoolFee,
291
- initialStakingFee,
292
- initialPerformanceFee
280
+ poolSetupInfo.poolFee,
281
+ poolSetupInfo.stakingFee,
282
+ poolSetupInfo.performanceFee,
283
+ false,
284
+ _wallet
293
285
  )
294
286
  )
295
287
  );
@@ -0,0 +1,23 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {AccessManagerUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagerUpgradeable.sol";
5
+
6
+
7
+ contract AccessManagerUpgradeableInitializeable is AccessManagerUpgradeable {
8
+
9
+ bool private _initialized;
10
+
11
+ function __AccessManagerUpgradeableInitializeable_init(address initialAdmin) public {
12
+ require(!_initialized, "AccessManager: already initialized");
13
+
14
+ if (initialAdmin == address(0)) {
15
+ revert AccessManagerInvalidInitialAdmin(address(0));
16
+ }
17
+
18
+ // admin is active immediately and without any execution delay.
19
+ _grantRole(ADMIN_ROLE, initialAdmin, 0, 0);
20
+ _initialized = true;
21
+ }
22
+
23
+ }