@etherisc/gif-next 0.0.2-b9e9dc3-713 → 0.0.2-bc11089-132

Sign up to get free protection for your applications and to get access to all the features.
Files changed (256) 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 +155 -0
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +177 -15
  6. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +117 -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 +209 -16
  14. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  15. package/artifacts/contracts/components/Product.sol/Product.json +179 -50
  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 +788 -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/IInstance.sol/IInstance.dbg.json +1 -1
  46. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1408 -22
  47. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
  48. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +448 -0
  49. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  50. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +120 -0
  51. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  52. package/artifacts/contracts/instance/Instance.sol/Instance.json +200 -624
  53. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  54. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +283 -143
  55. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
  56. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +763 -0
  57. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  58. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +202 -37
  59. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  60. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +344 -56
  61. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  62. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +97 -13
  63. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
  64. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +285 -0
  65. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
  66. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +40 -0
  67. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  68. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  69. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  70. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  71. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
  72. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  73. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  74. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  75. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +54 -22
  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/BundleService.sol/BundleService.dbg.json +4 -0
  83. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +923 -0
  84. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
  85. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +440 -0
  86. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
  87. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +18 -18
  88. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
  89. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +684 -0
  90. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
  91. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +428 -0
  92. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
  93. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +669 -0
  94. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
  95. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  96. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
  97. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +664 -0
  98. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  99. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +9 -71
  100. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  101. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +17 -232
  102. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
  103. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +984 -0
  104. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
  105. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +464 -0
  106. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
  107. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +718 -0
  108. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
  109. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +428 -0
  110. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
  111. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +768 -0
  112. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
  113. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +420 -0
  114. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  115. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  116. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +201 -0
  117. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  118. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +94 -19
  119. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  120. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  121. package/artifacts/contracts/registry/Registry.sol/Registry.json +172 -49
  122. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  123. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +61 -29
  124. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  125. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +47 -34
  126. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
  127. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +410 -0
  128. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  129. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  130. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
  131. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  132. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  133. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
  134. package/artifacts/contracts/{instance/base → shared}/IService.sol/IService.json +1 -1
  135. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  136. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  137. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  138. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  139. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  140. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  141. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +4 -4
  142. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +4 -0
  143. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +442 -0
  144. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
  145. package/artifacts/contracts/{instance/base/ServiceBase.sol/ServiceBase.json → shared/Service.sol/Service.json} +2 -2
  146. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  147. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  148. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  149. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  150. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  151. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  152. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +4 -4
  153. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  154. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  155. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  156. package/artifacts/contracts/test/TestService.sol/TestService.json +11 -11
  157. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  158. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  159. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  160. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  161. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
  162. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  163. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  164. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  165. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  167. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  168. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  169. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  170. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  171. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
  172. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  173. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  174. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  175. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  176. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  177. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  178. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  179. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  180. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  181. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  182. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  183. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  184. package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
  185. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  186. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
  187. package/contracts/components/BaseComponent.sol +73 -11
  188. package/contracts/components/Distribution.sol +15 -18
  189. package/contracts/components/IBaseComponent.sol +8 -0
  190. package/contracts/components/IDistributionComponent.sol +1 -0
  191. package/contracts/components/IPoolComponent.sol +5 -1
  192. package/contracts/components/Pool.sol +43 -31
  193. package/contracts/components/Product.sol +42 -47
  194. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +23 -0
  195. package/contracts/instance/BundleManager.sol +129 -0
  196. package/contracts/instance/Cloneable.sol +46 -0
  197. package/contracts/instance/IInstance.sol +41 -7
  198. package/contracts/instance/IInstanceBase.sol +26 -0
  199. package/contracts/instance/IInstanceService.sol +29 -8
  200. package/contracts/instance/Instance.sol +66 -226
  201. package/contracts/instance/InstanceAccessManager.sol +94 -78
  202. package/contracts/instance/InstanceBase.sol +41 -0
  203. package/contracts/instance/InstanceReader.sol +36 -1
  204. package/contracts/instance/InstanceService.sol +245 -47
  205. package/contracts/instance/InstanceServiceManager.sol +6 -5
  206. package/contracts/instance/ObjectManager.sol +101 -0
  207. package/contracts/instance/base/ComponentServiceBase.sol +44 -21
  208. package/contracts/instance/module/IAccess.sol +27 -17
  209. package/contracts/instance/module/IBundle.sol +1 -0
  210. package/contracts/instance/module/ISetup.sol +3 -0
  211. package/contracts/instance/service/BundleService.sol +260 -0
  212. package/contracts/instance/service/BundleServiceManager.sol +54 -0
  213. package/contracts/instance/service/ComponentOwnerService.sol +5 -5
  214. package/contracts/instance/service/DistributionService.sol +118 -0
  215. package/contracts/instance/service/DistributionServiceManager.sol +54 -0
  216. package/contracts/instance/service/IBundleService.sol +45 -0
  217. package/contracts/instance/service/IComponentOwnerService.sol +1 -1
  218. package/contracts/instance/service/IDistributionService.sol +1 -1
  219. package/contracts/instance/service/IPolicyService.sol +87 -0
  220. package/contracts/instance/service/IPoolService.sol +7 -24
  221. package/contracts/instance/service/IProductService.sol +7 -74
  222. package/contracts/instance/service/PolicyService.sol +508 -0
  223. package/contracts/instance/service/PolicyServiceManager.sol +54 -0
  224. package/contracts/instance/service/PoolService.sol +124 -0
  225. package/contracts/instance/service/PoolServiceManager.sol +54 -0
  226. package/contracts/instance/service/ProductService.sol +173 -0
  227. package/contracts/instance/service/ProductServiceManager.sol +54 -0
  228. package/contracts/registry/IRegistry.sol +26 -2
  229. package/contracts/registry/IRegistryService.sol +34 -19
  230. package/contracts/registry/Registry.sol +61 -36
  231. package/contracts/registry/RegistryService.sol +42 -124
  232. package/contracts/registry/RegistryServiceManager.sol +21 -5
  233. package/contracts/registry/TokenRegistry.sol +111 -0
  234. package/contracts/shared/ERC165.sol +6 -2
  235. package/contracts/{instance/base → shared}/IService.sol +3 -3
  236. package/contracts/shared/NftOwnable.sol +2 -4
  237. package/contracts/shared/Registerable.sol +1 -0
  238. package/contracts/shared/RegisterableUpgradable.sol +16 -0
  239. package/contracts/shared/Service.sol +55 -0
  240. package/contracts/test/TestService.sol +3 -5
  241. package/contracts/types/NftIdSet.sol +26 -24
  242. package/contracts/types/RoleId.sol +10 -1
  243. package/contracts/types/StateId.sol +4 -0
  244. package/contracts/types/Version.sol +4 -1
  245. package/package.json +1 -1
  246. package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
  247. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
  248. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1119
  249. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
  250. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
  251. package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
  252. package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
  253. package/contracts/instance/AccessManagedSimple.sol +0 -114
  254. package/contracts/instance/AccessManagerSimple.sol +0 -682
  255. package/contracts/instance/IAccessManagerSimple.sol +0 -391
  256. package/contracts/instance/base/ServiceBase.sol +0 -44
@@ -1,17 +1,38 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {NftId} from "../../contracts/types/NftId.sol";
5
- import {ObjectType} from "../../contracts/types/ObjectType.sol";
6
- import {RoleId} from "../../contracts/types/RoleId.sol";
7
- import {IService} from "../../contracts/instance/base/IService.sol";
8
- import {IRegistry} from "../../contracts/registry/IRegistry.sol";
4
+ import {NftId} from "../types/NftId.sol";
5
+ import {ObjectType} from "../types/ObjectType.sol";
6
+ import {RoleId} from "../types/RoleId.sol";
7
+ import {IService} from "../shared/IService.sol";
8
+ import {IRegistry} from "../registry/IRegistry.sol";
9
9
 
10
- import {IRegisterable} from "../../contracts/shared/IRegisterable.sol";
11
- import {IBaseComponent} from "../../contracts/components/IBaseComponent.sol";
10
+ import {IRegisterable} from "../shared/IRegisterable.sol";
11
+ import {IBaseComponent} from "../components/IBaseComponent.sol";
12
+
13
+ import {InstanceAccessManager} from "./InstanceAccessManager.sol";
14
+ import {Instance} from "./Instance.sol";
15
+ import {InstanceReader} from "./InstanceReader.sol";
16
+ import {BundleManager} from "./BundleManager.sol";
12
17
 
13
18
  interface IInstanceService is IService {
14
19
 
15
-
20
+ error ErrorInstanceServiceRequestUnauhorized(address caller);
21
+ error ErrorInstanceServiceNotInstanceOwner(address caller, NftId instanceNftId);
22
+
23
+ event LogInstanceCloned(address clonedAccessManagerAddress, address clonedInstanceAddress, address clonedInstanceReaderAddress, NftId clonedInstanceNftId);
24
+
25
+ function createInstanceClone()
26
+ external
27
+ returns (
28
+ InstanceAccessManager clonedAccessManager,
29
+ Instance clonedInstance,
30
+ NftId instanceNftId,
31
+ InstanceReader clonedInstanceReader,
32
+ BundleManager clonedBundleManager
33
+ );
34
+
35
+ function hasRole(address account, RoleId role, address instanceAddress) external returns (bool);
36
+
16
37
  }
17
38
 
@@ -3,9 +3,9 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
5
5
  import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
6
+ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
7
+ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
6
8
 
7
- import {AccessManagedSimple} from "./AccessManagedSimple.sol";
8
- import {AccessManagerSimple} from "./AccessManagerSimple.sol";
9
9
  import {IAccess} from "./module/IAccess.sol";
10
10
  import {IBundle} from "./module/IBundle.sol";
11
11
  import {IPolicy} from "./module/IPolicy.sol";
@@ -15,24 +15,32 @@ import {Key32, KeyId, Key32Lib} from "../types/Key32.sol";
15
15
  import {KeyValueStore} from "./base/KeyValueStore.sol";
16
16
  import {IInstance} from "./IInstance.sol";
17
17
  import {InstanceReader} from "./InstanceReader.sol";
18
+ import {InstanceAccessManager} from "./InstanceAccessManager.sol";
19
+ import {BundleManager} from "./BundleManager.sol";
18
20
  import {NftId} from "../types/NftId.sol";
19
21
  import {NumberId} from "../types/NumberId.sol";
20
22
  import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET} from "../types/ObjectType.sol";
21
23
  import {RiskId, RiskIdLib} from "../types/RiskId.sol";
22
24
  import {RoleId, RoleIdLib} from "../types/RoleId.sol";
23
25
  import {StateId, ACTIVE} from "../types/StateId.sol";
26
+ import {TimestampLib} from "../types/Timestamp.sol";
24
27
  import {ERC165} from "../shared/ERC165.sol";
25
28
  import {Registerable} from "../shared/Registerable.sol";
26
29
  import {ComponentOwnerService} from "./service/ComponentOwnerService.sol";
27
30
  import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
31
+ import {IDistributionService} from "./service/IDistributionService.sol";
32
+ import {IPoolService} from "./service/IPoolService.sol";
33
+ import {IProductService} from "./service/IProductService.sol";
34
+ import {IPolicyService} from "./service/IPolicyService.sol";
35
+ import {IBundleService} from "./service/IBundleService.sol";
28
36
  import {VersionPart} from "../types/Version.sol";
37
+ import {InstanceBase} from "./InstanceBase.sol";
29
38
 
30
39
  contract Instance is
31
- AccessManagedSimple,
32
- KeyValueStore,
40
+ AccessManagedUpgradeable,
33
41
  IInstance,
34
- ERC165,
35
- Registerable
42
+ // Initializable,
43
+ InstanceBase
36
44
  {
37
45
 
38
46
  uint64 public constant ADMIN_ROLE = type(uint64).min;
@@ -41,146 +49,26 @@ contract Instance is
41
49
 
42
50
  uint32 public constant EXECUTION_DELAY = 0;
43
51
 
44
- mapping(ShortString name => RoleId roleId) internal _role;
45
- mapping(RoleId roleId => EnumerableSet.AddressSet roleMembers) internal _roleMembers;
46
- RoleId [] internal _roles;
52
+ bool private _initialized;
47
53
 
48
- mapping(ShortString name => address target) internal _target;
49
-
50
- AccessManagerSimple internal _accessManager;
54
+ InstanceAccessManager internal _accessManager;
51
55
  InstanceReader internal _instanceReader;
56
+ BundleManager internal _bundleManager;
52
57
 
53
- constructor(address accessManagerAddress, address registryAddress, NftId registryNftId)
54
- AccessManagedSimple(accessManagerAddress)
58
+ function initialize(address accessManagerAddress, address registryAddress, NftId registryNftId, address initialOwner)
59
+ public
60
+ initializer
55
61
  {
56
- // TODO move to initializer method and remove constructor - required for the instance to be cloneable
57
- _accessManager = AccessManagerSimple(accessManagerAddress);
58
- _createRole(RoleIdLib.toRoleId(ADMIN_ROLE), "AdminRole", false, false);
59
- _createRole(RoleIdLib.toRoleId(PUBLIC_ROLE), "PublicRole", false, false);
60
-
61
- _initializeRegisterable(registryAddress, registryNftId, INSTANCE(), false, msg.sender, "");
62
-
63
- _registerInterface(type(IInstance).interfaceId);
64
- }
65
-
66
- //--- Role ------------------------------------------------------//
67
- function createStandardRole(RoleId roleId, string memory name) external restricted() {
68
- _createRole(roleId, name, false, true);
69
- }
70
-
71
- function createCustomRole(RoleId roleId, string memory name) external restricted() {
72
- _createRole(roleId, name, true, true);
73
- }
74
-
75
- function updateRole(RoleId roleId, string memory name, StateId newState) external restricted() {
76
- (bool isCustom,) = _validateRoleParameters(roleId, name, false);
77
- IAccess.RoleInfo memory role = _toRole(roleId, name, isCustom);
78
- update(toRoleKey32(roleId), abi.encode(role), newState);
79
- }
80
-
81
- function updateRoleState(RoleId roleId, StateId newState) external restricted() {
82
- updateState(toRoleKey32(roleId), newState);
83
- }
84
-
85
- function grantRole(RoleId roleId, address member) external restricted() returns (bool granted) {
86
- Key32 roleKey = toRoleKey32(roleId);
87
-
88
- if (!exists(roleKey)) {
89
- revert IAccess.ErrorGrantNonexstentRole(roleId);
90
- }
91
-
92
- if (getState(roleKey) != ACTIVE()) {
93
- revert IAccess.ErrorRoleIdNotActive(roleId);
94
- }
95
-
96
- if (!EnumerableSet.contains(_roleMembers[roleId], member)) {
97
- _accessManager.grantRole(roleId.toInt(), member, EXECUTION_DELAY);
98
- EnumerableSet.add(_roleMembers[roleId], member);
99
- return true;
100
- }
101
-
102
- return false;
103
- }
62
+ require(!_initialized, "Contract instance has already been initialized");
104
63
 
105
- function revokeRole(RoleId roleId, address member) external restricted() returns (bool revoked) {
106
- Key32 roleKey = toRoleKey32(roleId);
64
+ __AccessManaged_init(accessManagerAddress);
65
+
66
+ _accessManager = InstanceAccessManager(accessManagerAddress);
67
+
68
+ _initializeRegisterable(registryAddress, registryNftId, INSTANCE(), false, initialOwner, "");
107
69
 
108
- if (!exists(roleKey)) {
109
- revert IAccess.ErrorRevokeNonexstentRole(roleId);
110
- }
111
-
112
- if (EnumerableSet.contains(_roleMembers[roleId], member)) {
113
- _accessManager.revokeRole(roleId.toInt(), member);
114
- EnumerableSet.remove(_roleMembers[roleId], member);
115
- return true;
116
- }
117
-
118
- return false;
119
- }
120
-
121
- /// @dev not restricted function by intention
122
- /// the restriction to role members is already enforced by the call to the access manger
123
- function renounceRole(RoleId roleId) external returns (bool revoked) {
124
- address member = msg.sender;
125
- Key32 roleKey = toRoleKey32(roleId);
126
-
127
- if (!exists(roleKey)) {
128
- revert IAccess.ErrorRenounceNonexstentRole(roleId);
129
- }
130
-
131
- if (EnumerableSet.contains(_roleMembers[roleId], member)) {
132
- _accessManager.renounceRole(roleId.toInt(), member);
133
- EnumerableSet.remove(_roleMembers[roleId], member);
134
- return true;
135
- }
136
-
137
- return false;
138
- }
139
-
140
- function roles() external view returns (uint256 numberOfRoles) {
141
- return _roles.length;
142
- }
143
-
144
- function getRoleId(uint256 idx) external view returns (RoleId roleId) {
145
- return _roles[idx];
146
- }
147
-
148
- function getRole(RoleId roleId) external view returns (IAccess.RoleInfo memory role) {
149
- return abi.decode(getData(roleId.toKey32()), (IAccess.RoleInfo));
150
- }
151
-
152
- function roleMembers(RoleId roleId) external view returns (uint256 numberOfMembers) {
153
- return EnumerableSet.length(_roleMembers[roleId]);
154
- }
155
-
156
- function getRoleMember(RoleId roleId, uint256 idx) external view returns (address roleMember) {
157
- return EnumerableSet.at(_roleMembers[roleId], idx);
158
- }
159
-
160
- function _createRole(RoleId roleId, string memory name, bool isCustom, bool validateParameters) internal {
161
- if (validateParameters) {
162
- _validateRoleParameters(roleId, name, isCustom);
163
- }
164
-
165
- IAccess.RoleInfo memory role = _toRole(roleId, name, isCustom);
166
- _role[role.name] = roleId;
167
- _roles.push(roleId);
168
-
169
- create(toRoleKey32(roleId), abi.encode(role));
170
- }
171
-
172
- //--- Target ------------------------------------------------------//
173
- function createTarget(address target, IAccess.TargetInfo memory targetInfo) external restricted() {
174
- _validateTargetParameters(target, targetInfo);
175
- create(toTargetKey32(target), abi.encode(targetInfo));
176
- }
177
-
178
- function setTargetClosed(address target, bool closed) external restricted() {
179
- if (!exists(toTargetKey32(target))) {
180
- revert IAccess.ErrorTargetDoesNotExist(target);
181
- }
182
-
183
- _accessManager.setTargetClosed(target, closed);
70
+ _registerInterface(type(IInstance).interfaceId);
71
+ _initialized = true;
184
72
  }
185
73
 
186
74
  //--- ProductSetup ------------------------------------------------------//
@@ -210,16 +98,16 @@ contract Instance is
210
98
  }
211
99
 
212
100
  //--- PoolSetup ------------------------------------------------------//
213
- function createPoolSetup(NftId distributionNftId, ISetup.PoolSetupInfo memory setup) external restricted() {
214
- create(_toNftKey32(distributionNftId, POOL()), abi.encode(setup));
101
+ function createPoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup) external restricted() {
102
+ create(_toNftKey32(poolNftId, POOL()), abi.encode(setup));
215
103
  }
216
104
 
217
- function updatePoolSetup(NftId distributionNftId, ISetup.PoolSetupInfo memory setup, StateId newState) external restricted() {
218
- update(_toNftKey32(distributionNftId, POOL()), abi.encode(setup), newState);
105
+ function updatePoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup, StateId newState) external restricted() {
106
+ update(_toNftKey32(poolNftId, POOL()), abi.encode(setup), newState);
219
107
  }
220
108
 
221
- function updatePoolSetupState(NftId distributionNftId, StateId newState) external restricted() {
222
- updateState(_toNftKey32(distributionNftId, POOL()), newState);
109
+ function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
110
+ updateState(_toNftKey32(poolNftId, POOL()), newState);
223
111
  }
224
112
 
225
113
  //--- DistributorType ---------------------------------------------------//
@@ -327,71 +215,6 @@ contract Instance is
327
215
  }
328
216
 
329
217
  //--- internal view/pure functions --------------------------------------//
330
- function _toRole(RoleId roleId, string memory name, bool isCustom)
331
- internal
332
- pure
333
- returns (IAccess.RoleInfo memory role)
334
- {
335
- return IAccess.RoleInfo(
336
- ShortStrings.toShortString(name),
337
- isCustom);
338
- }
339
-
340
- function _validateRoleParameters(
341
- RoleId roleId,
342
- string memory name,
343
- bool isCustom
344
- )
345
- internal
346
- view
347
- returns (
348
- bool roleExists,
349
- bool roleIsCustom
350
- )
351
- {
352
- Key32 roleKey = toRoleKey32(roleId);
353
- roleExists = exists(roleKey);
354
- if (roleExists) {
355
- roleIsCustom = abi.decode(getData(roleKey), (IAccess.RoleInfo)).isCustom;
356
- } else {
357
- roleIsCustom = isCustom;
358
- }
359
-
360
- // check role id
361
- uint64 roleIdInt = RoleId.unwrap(roleId);
362
- if(roleIdInt == ADMIN_ROLE || roleIdInt == PUBLIC_ROLE) {
363
- revert IAccess.ErrorRoleIdInvalid(roleId);
364
- }
365
-
366
- if (roleIsCustom && roleIdInt < CUSTOM_ROLE_ID_MIN) {
367
- revert IAccess.ErrorRoleIdTooSmall(roleId);
368
- } else if (roleIsCustom && roleIdInt >= CUSTOM_ROLE_ID_MIN) {
369
- revert IAccess.ErrorRoleIdTooBig(roleId);
370
- }
371
-
372
- // role name checks
373
- ShortString nameShort = ShortStrings.toShortString(name);
374
- if (ShortStrings.byteLength(nameShort) == 0) {
375
- revert IAccess.ErrorRoleNameEmpty(roleId);
376
- }
377
-
378
- if (_role[nameShort] != RoleIdLib.zero() && _role[nameShort] != roleId) {
379
- revert IAccess.ErrorRoleNameNotUnique(_role[nameShort], nameShort);
380
- }
381
- }
382
-
383
- function _validateTargetParameters(address target, IAccess.TargetInfo memory targetInfo) internal view {
384
-
385
- }
386
-
387
- function toRoleKey32(RoleId roleId) public pure returns (Key32) {
388
- return roleId.toKey32();
389
- }
390
-
391
- function toTargetKey32(address target) public pure returns (Key32) {
392
- return Key32Lib.toKey32(TARGET(), KeyId.wrap(bytes20(target)));
393
- }
394
-
395
218
  function _toNftKey32(NftId nftId, ObjectType objectType) internal pure returns (Key32) {
396
219
  return nftId.toKey32(objectType);
397
220
  }
@@ -408,29 +231,46 @@ contract Instance is
408
231
  return ComponentOwnerService(_registry.getServiceAddress("ComponentOwnerService", VersionPart.wrap(3)));
409
232
  }
410
233
 
411
- // TODO reactivate when services are available
412
- // function getDistributionService() external view returns (IDistributionService) {
413
- // return DistributionService(_registry.getServiceAddress("DistributionService", VersionPart.wrap(3)));
414
- // }
234
+ function getDistributionService() external view returns (IDistributionService) {
235
+ return IDistributionService(_registry.getServiceAddress("DistributionService", VersionPart.wrap(3)));
236
+ }
415
237
 
416
- // TODO reactivate when services are available
417
- // function getProductService() external view returns (IProductService) {
418
- // return ProductService(_registry.getServiceAddress("ProductService", VersionPart.wrap(3)));
419
- // }
238
+ function getProductService() external view returns (IProductService) {
239
+ return IProductService(_registry.getServiceAddress("ProductService", VersionPart.wrap(3)));
240
+ }
420
241
 
421
- // TODO reactivate when services are available
422
- // function getPoolService() external view returns (IPoolService) {
423
- // return PoolService(_registry.getServiceAddress("PoolService", VersionPart.wrap(3)));
424
- // }
242
+ function getPoolService() external view returns (IPoolService) {
243
+ return IPoolService(_registry.getServiceAddress("PoolService", VersionPart.wrap(3)));
244
+ }
245
+
246
+ function getPolicyService() external view returns (IPolicyService) {
247
+ return IPolicyService(_registry.getServiceAddress("PolicyService", VersionPart.wrap(3)));
248
+ }
249
+
250
+ function getBundleService() external view returns (IBundleService) {
251
+ return IBundleService(_registry.getServiceAddress("BundleService", VersionPart.wrap(3)));
252
+ }
253
+
254
+ function getInstanceAccessManager() external view returns (InstanceAccessManager) {
255
+ return _accessManager;
256
+ }
425
257
 
426
258
  function setInstanceReader(InstanceReader instanceReader) external restricted() {
427
- if (address(_instanceReader) != address(0)) {
428
- revert("InstanceReader is set");
429
- }
259
+ require(instanceReader.getInstanceNftId() == getNftId(), "NFT ID of InstanceReader does not match");
430
260
  _instanceReader = instanceReader;
431
261
  }
432
262
 
433
263
  function getInstanceReader() external view returns (InstanceReader) {
434
264
  return _instanceReader;
435
265
  }
266
+
267
+ function setBundleManager(BundleManager bundleManager) external restricted() {
268
+ require(address(_bundleManager) == address(0), "BundleManager is set");
269
+ require(bundleManager.getInstanceNftId() == getNftId(), "NFT ID of BundleManager does not match");
270
+ _bundleManager = bundleManager;
271
+ }
272
+
273
+ function getBundleManager() external view returns (BundleManager) {
274
+ return _bundleManager;
275
+ }
436
276
  }