@etherisc/gif-next 0.0.2-d911522 → 0.0.2-da77c50-824

Sign up to get free protection for your applications and to get access to all the features.
Files changed (317) hide show
  1. package/README.md +125 -0
  2. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +4 -0
  3. package/artifacts/contracts/components/{Component.sol/Component.json → BaseComponent.sol/BaseComponent.json} +48 -53
  4. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +4 -0
  5. package/artifacts/contracts/components/{IPool.sol/IPoolComponent.json → IBaseComponent.sol/IBaseComponent.json} +48 -53
  6. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
  7. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +356 -0
  8. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +4 -0
  9. package/artifacts/contracts/components/{IProduct.sol → IProductComponent.sol}/IProductComponent.json +139 -52
  10. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  11. package/artifacts/contracts/components/Pool.sol/Pool.json +218 -44
  12. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  13. package/artifacts/contracts/components/Product.sol/Product.json +144 -70
  14. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  15. package/artifacts/contracts/experiment/errors/Require.sol/Require.json +2 -2
  16. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  17. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +2 -2
  18. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/inheritance/A.sol/A.json +2 -2
  20. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +2 -2
  22. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +4 -0
  29. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +59 -0
  30. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +4 -0
  31. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +124 -0
  32. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +4 -0
  33. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +74 -0
  34. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +4 -0
  35. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +124 -0
  36. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +4 -0
  37. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +207 -0
  38. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  39. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +2 -2
  40. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  41. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +2 -2
  42. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  43. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1419 -289
  44. package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +4 -0
  45. package/artifacts/contracts/instance/{component/IComponent.sol → IInstanceLinked.sol}/IInstanceLinked.json +1 -1
  46. package/artifacts/contracts/instance/IServiceLinked.sol/IServiceLinked.dbg.json +4 -0
  47. package/artifacts/contracts/instance/{access/IAccess.sol/IAccessComponentTypeRoles.json → IServiceLinked.sol/IServiceLinked.json} +14 -14
  48. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  49. package/artifacts/contracts/instance/Instance.sol/Instance.json +1569 -348
  50. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
  51. package/artifacts/contracts/instance/{component/ComponentModule.sol/ComponentModule.json → InstanceBase.sol/InstanceBase.json} +128 -142
  52. package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +4 -0
  53. package/artifacts/contracts/instance/{access → module/access}/Access.sol/AccessModule.json +85 -152
  54. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +4 -0
  55. package/artifacts/contracts/instance/{access → module/access}/IAccess.sol/IAccess.json +1 -1
  56. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +4 -0
  57. package/artifacts/contracts/instance/{access → module/access}/IAccess.sol/IAccessModule.json +96 -99
  58. package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +4 -0
  59. package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +276 -0
  60. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +4 -0
  61. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.json +10 -0
  62. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +4 -0
  63. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +276 -0
  64. package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +4 -0
  65. package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +188 -0
  66. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +4 -0
  67. package/artifacts/contracts/instance/{component → module/component}/IComponent.sol/IComponent.json +1 -1
  68. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +4 -0
  69. package/artifacts/contracts/instance/{component → module/component}/IComponent.sol/IComponentModule.json +40 -97
  70. package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycle.dbg.json +4 -0
  71. package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycle.json +134 -0
  72. package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycleModule.dbg.json +4 -0
  73. package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycleModule.json +182 -0
  74. package/artifacts/contracts/instance/module/lifecycle/LifecycleModule.sol/LifecycleModule.dbg.json +4 -0
  75. package/artifacts/contracts/instance/module/lifecycle/LifecycleModule.sol/LifecycleModule.json +221 -0
  76. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +4 -0
  77. package/artifacts/contracts/instance/{policy → module/policy}/IPolicy.sol/IPolicy.json +1 -1
  78. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +4 -0
  79. package/artifacts/contracts/instance/{policy → module/policy}/IPolicy.sol/IPolicyModule.json +142 -112
  80. package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +4 -0
  81. package/artifacts/contracts/instance/{policy → module/policy}/PolicyModule.sol/PolicyModule.json +142 -112
  82. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +4 -0
  83. package/artifacts/contracts/instance/{pool → module/pool}/IPoolModule.sol/IPool.json +1 -1
  84. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +4 -0
  85. package/artifacts/contracts/instance/{pool → module/pool}/IPoolModule.sol/IPoolModule.json +57 -57
  86. package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +4 -0
  87. package/artifacts/contracts/instance/{pool → module/pool}/PoolModule.sol/PoolModule.json +50 -63
  88. package/artifacts/contracts/instance/module/product/IProductModule.sol/IProductModule.dbg.json +4 -0
  89. package/artifacts/contracts/instance/module/product/IProductModule.sol/IProductModule.json +10 -0
  90. package/artifacts/contracts/instance/module/product/ProductModule.sol/ProductModule.dbg.json +4 -0
  91. package/artifacts/contracts/instance/module/product/ProductModule.sol/ProductModule.json +10 -0
  92. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +4 -0
  93. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.json +10 -0
  94. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +4 -0
  95. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +538 -0
  96. package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +4 -0
  97. package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +76 -0
  98. package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +4 -0
  99. package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +538 -0
  100. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +4 -0
  101. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +519 -0
  102. package/artifacts/contracts/instance/service/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +4 -0
  103. package/artifacts/contracts/instance/service/ComponentServiceBase.sol/ComponentServiceBase.json +300 -0
  104. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +4 -0
  105. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +364 -0
  106. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +4 -0
  107. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +376 -0
  108. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +4 -0
  109. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +477 -0
  110. package/artifacts/contracts/instance/service/IService.sol/IService.dbg.json +4 -0
  111. package/artifacts/contracts/instance/{component/IComponent.sol/IComponentContract.json → service/IService.sol/IService.json} +148 -27
  112. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
  113. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +499 -0
  114. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
  115. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +685 -0
  116. package/artifacts/contracts/instance/service/ServiceBase.sol/ServiceBase.dbg.json +4 -0
  117. package/artifacts/contracts/instance/service/ServiceBase.sol/ServiceBase.json +300 -0
  118. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  119. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +65 -2
  120. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
  121. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  122. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +103 -77
  123. package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
  124. package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.json +24 -0
  125. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  126. package/artifacts/contracts/registry/Registry.sol/Registry.json +194 -69
  127. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +4 -0
  128. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +35 -0
  129. package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +4 -0
  130. package/artifacts/contracts/{registry/IRegistry.sol → shared/IOwnable.sol}/IOwnable.json +1 -1
  131. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +4 -0
  132. package/artifacts/contracts/{registry/IRegistry.sol → shared/IRegisterable.sol}/IRegisterable.json +18 -63
  133. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +4 -0
  134. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +164 -0
  135. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +4 -0
  136. package/artifacts/contracts/{registry/Registry.sol → shared/Registerable.sol}/Registerable.json +18 -63
  137. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +4 -0
  138. package/artifacts/contracts/shared/Versionable.sol/Versionable.json +164 -0
  139. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +4 -0
  140. package/artifacts/contracts/test/TestFee.sol/TestFee.json +95 -0
  141. package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +4 -0
  142. package/artifacts/contracts/test/TestPool.sol/TestPool.json +387 -0
  143. package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +4 -0
  144. package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +393 -0
  145. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +4 -0
  146. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +137 -0
  147. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +4 -0
  148. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +82 -0
  149. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +4 -0
  150. package/artifacts/contracts/test/TestService.sol/TestService.json +407 -0
  151. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +4 -0
  152. package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +338 -0
  153. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +4 -0
  154. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +222 -0
  155. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +4 -0
  156. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +230 -0
  157. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +4 -0
  158. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.json +10 -0
  159. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  160. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
  161. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +2 -2
  163. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
  165. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +4 -0
  166. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +10 -0
  167. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +4 -0
  168. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +92 -0
  169. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +4 -0
  170. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +92 -0
  171. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  172. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +64 -2
  173. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +1 -1
  174. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +68 -55
  175. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +4 -0
  176. package/artifacts/contracts/types/Version.sol/VersionLib.json +78 -0
  177. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +4 -0
  178. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +30 -0
  179. package/contracts/components/BaseComponent.sol +89 -0
  180. package/contracts/components/IBaseComponent.sol +19 -0
  181. package/contracts/components/IPoolComponent.sol +57 -0
  182. package/contracts/components/IProductComponent.sol +19 -0
  183. package/contracts/components/Pool.sol +161 -16
  184. package/contracts/components/Product.sol +77 -26
  185. package/contracts/experiment/errors/Require.sol +10 -5
  186. package/contracts/experiment/errors/Revert.sol +13 -8
  187. package/contracts/experiment/inheritance/A.sol +8 -11
  188. package/contracts/experiment/inheritance/B.sol +10 -5
  189. package/contracts/experiment/inheritance/C.sol +11 -5
  190. package/contracts/experiment/inheritance/IA.sol +2 -7
  191. package/contracts/experiment/inheritance/IB.sol +3 -2
  192. package/contracts/experiment/inheritance/IC.sol +4 -3
  193. package/contracts/experiment/statemachine/Dummy.sol +27 -0
  194. package/contracts/experiment/statemachine/ISM.sol +25 -0
  195. package/contracts/experiment/statemachine/README.md +112 -0
  196. package/contracts/experiment/statemachine/SM.sol +57 -0
  197. package/contracts/experiment/statemachine/SimpleStateMachine.sol +31 -0
  198. package/contracts/experiment/types/TypeA.sol +14 -9
  199. package/contracts/experiment/types/TypeB.sol +14 -9
  200. package/contracts/instance/IInstance.sol +38 -8
  201. package/contracts/instance/IInstanceLinked.sol +8 -0
  202. package/contracts/instance/IServiceLinked.sol +12 -0
  203. package/contracts/instance/Instance.sol +43 -45
  204. package/contracts/instance/InstanceBase.sol +74 -0
  205. package/contracts/instance/module/access/Access.sol +149 -0
  206. package/contracts/instance/module/access/IAccess.sol +53 -0
  207. package/contracts/instance/module/bundle/BundleModule.sol +228 -0
  208. package/contracts/instance/module/bundle/IBundle.sol +53 -0
  209. package/contracts/instance/module/component/ComponentModule.sol +104 -0
  210. package/contracts/instance/module/component/IComponent.sol +53 -0
  211. package/contracts/instance/module/lifecycle/ILifecycle.sol +47 -0
  212. package/contracts/instance/module/lifecycle/LifecycleModule.sol +89 -0
  213. package/contracts/instance/module/policy/IPolicy.sol +60 -0
  214. package/contracts/instance/module/policy/PolicyModule.sol +84 -0
  215. package/contracts/instance/module/pool/IPoolModule.sol +41 -0
  216. package/contracts/instance/module/pool/PoolModule.sol +87 -0
  217. package/contracts/instance/module/product/IProductModule.sol +6 -0
  218. package/contracts/instance/module/product/ProductModule.sol +8 -0
  219. package/contracts/instance/module/treasury/ITreasury.sol +104 -0
  220. package/contracts/instance/module/treasury/TokenHandler.sol +48 -0
  221. package/contracts/instance/module/treasury/TreasuryModule.sol +148 -0
  222. package/contracts/instance/service/ComponentOwnerService.sol +174 -0
  223. package/contracts/instance/service/ComponentServiceBase.sol +41 -0
  224. package/contracts/instance/service/IComponentOwnerService.sol +22 -0
  225. package/contracts/instance/service/IPoolService.sol +30 -0
  226. package/contracts/instance/service/IProductService.sol +58 -0
  227. package/contracts/instance/service/IService.sol +15 -0
  228. package/contracts/instance/service/PoolService.sol +98 -0
  229. package/contracts/instance/service/ProductService.sol +358 -0
  230. package/contracts/instance/service/ServiceBase.sol +39 -0
  231. package/contracts/registry/ChainNft.sol +80 -94
  232. package/contracts/registry/IChainNft.sol +10 -7
  233. package/contracts/registry/IRegistry.sol +38 -51
  234. package/contracts/registry/IRegistryLinked.sol +8 -0
  235. package/contracts/registry/Registry.sol +310 -111
  236. package/contracts/shared/ERC165.sol +21 -0
  237. package/contracts/shared/IOwnable.sol +6 -0
  238. package/contracts/shared/IRegisterable.sol +24 -0
  239. package/contracts/shared/IVersionable.sol +52 -0
  240. package/contracts/shared/Registerable.sol +86 -0
  241. package/contracts/shared/Versionable.sol +92 -0
  242. package/contracts/test/TestFee.sol +25 -0
  243. package/contracts/test/TestPool.sol +22 -0
  244. package/contracts/test/TestProduct.sol +44 -0
  245. package/contracts/test/TestRegisterable.sol +19 -0
  246. package/contracts/test/TestRoleId.sol +14 -0
  247. package/contracts/test/TestService.sol +35 -0
  248. package/contracts/test/TestToken.sol +26 -0
  249. package/contracts/test/TestVersion.sol +47 -0
  250. package/contracts/test/TestVersionable.sol +20 -0
  251. package/contracts/types/AddressSet.sol +58 -0
  252. package/contracts/types/Blocknumber.sol +76 -18
  253. package/contracts/types/ChainId.sol +18 -10
  254. package/contracts/types/Fee.sol +32 -0
  255. package/contracts/types/NftId.sol +33 -11
  256. package/contracts/types/NftIdSet.sol +60 -0
  257. package/contracts/types/ObjectType.sol +115 -0
  258. package/contracts/types/RoleId.sol +36 -0
  259. package/contracts/types/StateId.sol +95 -0
  260. package/contracts/types/Timestamp.sol +85 -17
  261. package/contracts/types/UFixed.sol +71 -72
  262. package/contracts/types/Version.sol +91 -0
  263. package/package.json +19 -5
  264. package/artifacts/contracts/components/Component.sol/Component.dbg.json +0 -4
  265. package/artifacts/contracts/components/Component.sol/InstanceLinked.dbg.json +0 -4
  266. package/artifacts/contracts/components/Component.sol/InstanceLinked.json +0 -35
  267. package/artifacts/contracts/components/IPool.sol/IPoolComponent.dbg.json +0 -4
  268. package/artifacts/contracts/components/IProduct.sol/IProductComponent.dbg.json +0 -4
  269. package/artifacts/contracts/instance/access/Access.sol/AccessModule.dbg.json +0 -4
  270. package/artifacts/contracts/instance/access/IAccess.sol/IAccess.dbg.json +0 -4
  271. package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.dbg.json +0 -4
  272. package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.json +0 -35
  273. package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.dbg.json +0 -4
  274. package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.dbg.json +0 -4
  275. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
  276. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.dbg.json +0 -4
  277. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.json +0 -147
  278. package/artifacts/contracts/instance/component/IComponent.sol/IComponent.dbg.json +0 -4
  279. package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.dbg.json +0 -4
  280. package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.dbg.json +0 -4
  281. package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.dbg.json +0 -4
  282. package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.json +0 -94
  283. package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.dbg.json +0 -4
  284. package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
  285. package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
  286. package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
  287. package/artifacts/contracts/instance/pool/IPoolModule.sol/IPool.dbg.json +0 -4
  288. package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
  289. package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
  290. package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.dbg.json +0 -4
  291. package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.json +0 -75
  292. package/artifacts/contracts/instance/product/IProductService.sol/IProductService.dbg.json +0 -4
  293. package/artifacts/contracts/instance/product/IProductService.sol/IProductService.json +0 -114
  294. package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.dbg.json +0 -4
  295. package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.json +0 -75
  296. package/artifacts/contracts/instance/product/ProductService.sol/ProductService.dbg.json +0 -4
  297. package/artifacts/contracts/instance/product/ProductService.sol/ProductService.json +0 -167
  298. package/artifacts/contracts/registry/IRegistry.sol/IOwnable.dbg.json +0 -4
  299. package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.dbg.json +0 -4
  300. package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.dbg.json +0 -4
  301. package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.json +0 -49
  302. package/artifacts/contracts/registry/Registry.sol/Registerable.dbg.json +0 -4
  303. package/artifacts/contracts/registry/Registry.sol/RegistryLinked.dbg.json +0 -4
  304. package/artifacts/contracts/registry/Registry.sol/RegistryLinked.json +0 -60
  305. package/contracts/components/Component.sol +0 -62
  306. package/contracts/components/IPool.sol +0 -9
  307. package/contracts/components/IProduct.sol +0 -12
  308. package/contracts/instance/access/Access.sol +0 -218
  309. package/contracts/instance/access/IAccess.sol +0 -83
  310. package/contracts/instance/component/ComponentModule.sol +0 -248
  311. package/contracts/instance/component/IComponent.sol +0 -95
  312. package/contracts/instance/policy/IPolicy.sol +0 -66
  313. package/contracts/instance/policy/PolicyModule.sol +0 -107
  314. package/contracts/instance/pool/IPoolModule.sol +0 -41
  315. package/contracts/instance/pool/PoolModule.sol +0 -86
  316. package/contracts/instance/product/IProductService.sol +0 -46
  317. package/contracts/instance/product/ProductService.sol +0 -108
@@ -1,83 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
3
-
4
- import {IOwnable, IRegistryLinked} from "../../registry/IRegistry.sol";
5
-
6
- interface IAccess {
7
-
8
- struct RoleInfo {
9
- bytes32 id;
10
- string name;
11
- bool isActive;
12
- }
13
- }
14
-
15
- interface IAccessCheckRole {
16
-
17
- function hasRole(bytes32 role, address member)
18
- external
19
- view
20
- returns(bool);
21
- }
22
-
23
- interface IAccessComponentTypeRoles {
24
- function PRODUCT_OWNER_ROLE() external view returns(bytes32 role);
25
- function ORACLE_OWNER_ROLE() external view returns(bytes32 role);
26
- function POOL_OWNER_ROLE() external view returns(bytes32 role);
27
- }
28
-
29
-
30
- interface IAccessModule is
31
- IOwnable,
32
- IRegistryLinked,
33
- IAccess,
34
- IAccessComponentTypeRoles,
35
- IAccessCheckRole
36
- {
37
-
38
- function createRole(string memory roleName)
39
- external
40
- returns(bytes32 role);
41
-
42
- function enableRole(bytes32 role)
43
- external;
44
-
45
- function disableRole(bytes32 role)
46
- external;
47
-
48
- function grantRole(bytes32 role, address member)
49
- external;
50
-
51
- function revokeRole(bytes32 role, address member)
52
- external;
53
-
54
- function getRole(uint256 idx)
55
- external
56
- view
57
- returns(bytes32 role);
58
-
59
- function getRoleInfo(bytes32 role)
60
- external
61
- view
62
- returns(RoleInfo memory info);
63
-
64
- function getRoleForName(string memory roleName)
65
- external
66
- pure
67
- returns(bytes32 role);
68
-
69
- function getRoleCount()
70
- external
71
- view
72
- returns(uint256 roles);
73
-
74
- function getRoleMemberCount(bytes32 role)
75
- external
76
- view
77
- returns(uint256 roleMembers);
78
-
79
- function getRoleMember(bytes32 role, uint256 idx)
80
- external
81
- view
82
- returns(address roleMembers);
83
- }
@@ -1,248 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
3
-
4
- import {RegistryLinked} from "../../registry/Registry.sol";
5
- import {IRegistry, IRegistryLinked} from "../../registry/IRegistry.sol";
6
- import {IAccessComponentTypeRoles, IAccessCheckRole} from "../access/IAccess.sol";
7
- import {IInstance} from "../IInstance.sol";
8
-
9
- import {IComponent, IComponentContract, IComponentModule, IComponentOwnerService} from "./IComponent.sol";
10
- import {IProductComponent} from "../../components/IProduct.sol";
11
- import {IPoolModule} from "../pool/IPoolModule.sol";
12
- import {NftId, NftIdLib} from "../../types/NftId.sol";
13
-
14
- abstract contract ComponentModule is
15
- IRegistryLinked,
16
- IAccessComponentTypeRoles,
17
- IAccessCheckRole,
18
- IComponentModule
19
- {
20
- using NftIdLib for NftId;
21
-
22
- mapping(NftId nftId => ComponentInfo info) private _componentInfo;
23
- mapping(NftId nftId => NftId poolNftId) private _poolNftIdForProduct;
24
- mapping(address cAddress => NftId nftId) private _nftIdByAddress;
25
- NftId[] private _nftIds;
26
-
27
- mapping(uint256 cType => bytes32 role) private _componentOwnerRole;
28
-
29
- IComponentOwnerService private _componentOwnerService;
30
-
31
- modifier onlyComponentOwnerService() {
32
- require(address(_componentOwnerService) == msg.sender, "ERROR:CMP-001:NOT_OWNER_SERVICE");
33
- _;
34
- }
35
-
36
- constructor(address componentOwnerService) {
37
- _componentOwnerService = ComponentOwnerService(componentOwnerService);
38
- }
39
-
40
- function registerComponent(IComponentContract component)
41
- external
42
- override
43
- onlyComponentOwnerService
44
- returns(NftId nftId)
45
- {
46
- bytes32 typeRole = getRoleForType(component.getType());
47
- require(
48
- this.hasRole(typeRole, component.getInitialOwner()),
49
- "ERROR:CMP-004:TYPE_ROLE_MISSING");
50
-
51
- nftId = this.getRegistry().register(address(component));
52
-
53
- _componentInfo[nftId] = ComponentInfo(
54
- nftId,
55
- CState.Active);
56
-
57
- // special case product -> persist product - pool assignment
58
- if(component.getType() == this.getRegistry().PRODUCT()) {
59
- IProductComponent product = IProductComponent(address(component));
60
- NftId poolNftId = product.getPoolNftId();
61
- require(poolNftId.gtz(), "ERROR:CMP-005:POOL_UNKNOWN");
62
- // add more validation (type, token, ...)
63
-
64
- _poolNftIdForProduct[nftId] = poolNftId;
65
-
66
- // add creation of productInfo
67
- }
68
- else if(component.getType() == this.getRegistry().POOL()) {
69
- IPoolModule poolModule = IPoolModule(address(this));
70
- poolModule.createPoolInfo(
71
- nftId,
72
- address(component), // set pool as its wallet
73
- address(0) // don't deal with token yet
74
- );
75
- }
76
-
77
- _nftIdByAddress[address(component)] = nftId;
78
- _nftIds.push(nftId);
79
-
80
- // add logging
81
- }
82
-
83
- function getPoolNftId(NftId productNftId)
84
- external
85
- view
86
- override
87
- returns(NftId poolNftId)
88
- {
89
- poolNftId = _poolNftIdForProduct[productNftId];
90
- }
91
-
92
-
93
- function getComponentOwnerService()
94
- external
95
- override
96
- view
97
- returns(IComponentOwnerService)
98
- {
99
- return _componentOwnerService;
100
- }
101
-
102
- function setComponentInfo(ComponentInfo memory info)
103
- external
104
- onlyComponentOwnerService
105
- returns(NftId nftId)
106
- {
107
- nftId = info.nftId;
108
- require(
109
- nftId.gtz() && _componentInfo[nftId].nftId.eq(nftId),
110
- "ERROR:CMP-006:COMPONENT_UNKNOWN");
111
-
112
- _componentInfo[nftId] = info;
113
-
114
- // add logging
115
- }
116
-
117
- function getComponentInfo(NftId nftId)
118
- external
119
- override
120
- view
121
- returns(ComponentInfo memory)
122
- {
123
- return _componentInfo[nftId];
124
- }
125
-
126
- function getComponentOwner(NftId nftId)
127
- external
128
- view
129
- returns(address owner)
130
- {
131
-
132
- }
133
-
134
- function getComponentId(address componentAddress)
135
- external
136
- view
137
- returns(NftId componentNftId)
138
- {
139
- return _nftIdByAddress[componentAddress];
140
- }
141
-
142
-
143
- function getComponentId(uint256 idx)
144
- external
145
- override
146
- view
147
- returns(NftId componentNftId)
148
- {
149
- return _nftIds[idx];
150
- }
151
-
152
-
153
- function components()
154
- external
155
- override
156
- view
157
- returns(uint256 numberOfCompnents)
158
- {
159
- return _nftIds.length;
160
- }
161
-
162
- function getRoleForType(uint256 cType)
163
- public
164
- view
165
- returns(bytes32 role)
166
- {
167
- if(cType == this.getRegistry().PRODUCT()) {
168
- return this.PRODUCT_OWNER_ROLE();
169
- }
170
- if(cType == this.getRegistry().POOL()) {
171
- return this.POOL_OWNER_ROLE();
172
- }
173
- if(cType == this.getRegistry().ORACLE()) {
174
- return this.ORACLE_OWNER_ROLE();
175
- }
176
-
177
- }
178
- }
179
-
180
-
181
- // this is actually the component owner service
182
- contract ComponentOwnerService is
183
- RegistryLinked,
184
- IComponent,
185
- IComponentOwnerService
186
- {
187
- using NftIdLib for NftId;
188
-
189
- modifier onlyComponentOwner(IComponentContract component) {
190
- NftId nftId = _registry.getNftId(address(component));
191
- require(
192
- nftId.gtz(),
193
- "ERROR:COS-001:COMPONENT_UNKNOWN");
194
- require(
195
- msg.sender == _registry.getOwner(nftId),
196
- "ERROR:COS-002:NOT_OWNER"
197
- );
198
- _;
199
- }
200
-
201
- constructor(address registry)
202
- RegistryLinked(registry)
203
- { }
204
-
205
- function register(IComponentContract component)
206
- external
207
- override
208
- returns(NftId nftId)
209
- {
210
- require(
211
- msg.sender == component.getInitialOwner(),
212
- "ERROR:COS-003:NOT_OWNER");
213
-
214
- IInstance instance = component.getInstance();
215
- nftId = instance.registerComponent(component);
216
- }
217
-
218
-
219
- function lock(IComponentContract component)
220
- external
221
- override
222
- onlyComponentOwner(component)
223
- {
224
- IInstance instance = component.getInstance();
225
- ComponentInfo memory info = instance.getComponentInfo(component.getNftId());
226
- require(info.nftId.gtz(), "ERROR_COMPONENT_UNKNOWN");
227
- // TODO add state change validation
228
-
229
- info.state = CState.Locked;
230
- instance.setComponentInfo(info);
231
- }
232
-
233
-
234
- function unlock(IComponentContract component)
235
- external
236
- override
237
- onlyComponentOwner(component)
238
- {
239
- IInstance instance = component.getInstance();
240
- ComponentInfo memory info = instance.getComponentInfo(component.getNftId());
241
- require(info.nftId.gtz(), "ERROR_COMPONENT_UNKNOWN");
242
- // TODO state change validation
243
-
244
- info.state = CState.Active;
245
- instance.setComponentInfo(info);
246
- }
247
-
248
- }
@@ -1,95 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
3
-
4
-
5
- import {IOwnable, IRegistryLinked, IRegisterable} from "../../registry/IRegistry.sol";
6
- import {IInstance} from "../IInstance.sol";
7
- import {NftId} from "../../types/NftId.sol";
8
-
9
- interface IComponent {
10
-
11
- // TODO decide if enum or uints with constants (as in IRegistry.PRODUCT())
12
- enum CState {
13
- Undefined,
14
- Active,
15
- Locked
16
- }
17
-
18
- // component dynamic info (static info kept in registry)
19
- struct ComponentInfo {
20
- NftId nftId;
21
- CState state;
22
- }
23
- }
24
-
25
-
26
- interface IInstanceLinked {
27
- // function setInstance(address instance) external;
28
- function getInstance() external view returns(IInstance instance);
29
- }
30
-
31
-
32
- interface IComponentContract is
33
- IRegisterable,
34
- IInstanceLinked,
35
- IComponent
36
- { }
37
-
38
-
39
- interface IComponentOwnerService is IRegistryLinked{
40
-
41
- function register(IComponentContract component) external returns(NftId nftId);
42
- function lock(IComponentContract component) external;
43
- function unlock(IComponentContract component) external;
44
- }
45
-
46
-
47
- interface IComponentModule is
48
- IOwnable,
49
- IRegistryLinked,
50
- IComponent
51
- {
52
-
53
- function registerComponent(IComponentContract component)
54
- external
55
- returns(NftId nftId);
56
-
57
- function setComponentInfo(ComponentInfo memory info)
58
- external
59
- returns(NftId componentNftId);
60
-
61
- function getComponentInfo(NftId nftId)
62
- external
63
- view
64
- returns(ComponentInfo memory info);
65
-
66
- function getComponentOwner(NftId nftId)
67
- external
68
- view
69
- returns(address owner);
70
-
71
- function getComponentId(address componentAddress)
72
- external
73
- view
74
- returns(NftId nftId);
75
-
76
- function getComponentId(uint256 idx)
77
- external
78
- view
79
- returns(NftId nftId);
80
-
81
- function getPoolNftId(NftId productNftId)
82
- external
83
- view
84
- returns(NftId poolNftId);
85
-
86
- function components()
87
- external
88
- view
89
- returns(uint256 numberOfCompnents);
90
-
91
- function getComponentOwnerService()
92
- external
93
- view
94
- returns(IComponentOwnerService);
95
- }
@@ -1,66 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
3
-
4
-
5
- import {IOwnable, IRegistryLinked, IRegisterable, IRegistry} from "../../registry/IRegistry.sol";
6
- import {IInstance} from "../IInstance.sol";
7
- import {IProductService} from "../product/IProductService.sol";
8
- import {NftId} from "../../types/NftId.sol";
9
-
10
- // TODO check if there is value to introuce IContract and let IPolicy derive from IContract
11
- interface IPolicy {
12
-
13
- enum PolicyState {
14
- Undefined,
15
- Applied,
16
- Rejected,
17
- Active,
18
- Closed
19
- }
20
-
21
- struct PolicyInfo {
22
- NftId nftId;
23
- PolicyState state; // applied, withdrawn, rejected, active, closed
24
-
25
- uint256 sumInsuredAmount;
26
- uint256 premiumAmount;
27
- uint256 lifetime; // activatedAt + lifetime >= expiredAt
28
-
29
- uint256 createdAt;
30
- uint256 activatedAt; // time of underwriting
31
- uint256 expiredAt; // no new claims
32
- uint256 closedAt; // no locked capital
33
- }
34
- }
35
-
36
- interface IPolicyModule is
37
- IOwnable,
38
- IRegistryLinked,
39
- IPolicy
40
- {
41
-
42
- function createApplication(
43
- IRegistry.RegistryInfo memory productInfo,
44
- address applicationOwner,
45
- uint256 sumInsuredAmount,
46
- uint256 premiumAmount,
47
- uint256 lifetime,
48
- NftId bundleNftId
49
- )
50
- external
51
- returns(NftId nftId);
52
-
53
- function activate(NftId nftId)
54
- external;
55
-
56
- function getBundleNftForPolicy(NftId nftId)
57
- external
58
- view
59
- returns(NftId bundleNft);
60
-
61
- function getPolicyInfo(NftId nftId)
62
- external
63
- view
64
- returns(PolicyInfo memory info);
65
-
66
- }
@@ -1,107 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
3
-
4
-
5
- // import {IOwnable, IRegistryLinked, IRegisterable} from "../../registry/IRegistry.sol";
6
- import {IRegistry, IRegistryLinked} from "../../registry/IRegistry.sol";
7
-
8
- import {IProductService} from "../product/IProductService.sol";
9
- import {IPolicy, IPolicyModule} from "./IPolicy.sol";
10
- import {NftId, NftIdLib} from "../../types/NftId.sol";
11
-
12
- abstract contract PolicyModule is
13
- IRegistryLinked,
14
- IPolicyModule
15
- {
16
- using NftIdLib for NftId;
17
-
18
- mapping(NftId nftId => PolicyInfo info) private _policyInfo;
19
- mapping(NftId nftId => NftId bundleNftId) private _bundleForPolicy;
20
-
21
- IProductService private _productService;
22
-
23
- // TODO find a better place to avoid dupliation
24
- modifier onlyProductService2() {
25
- require(address(_productService) == msg.sender, "ERROR:POL-001:NOT_PRODUCT_SERVICE");
26
- _;
27
- }
28
-
29
- constructor(address productService) {
30
- _productService = IProductService(productService);
31
- }
32
-
33
-
34
- function createApplication(
35
- IRegistry.RegistryInfo memory productInfo,
36
- address applicationOwner,
37
- uint256 sumInsuredAmount,
38
- uint256 premiumAmount,
39
- uint256 lifetime,
40
- NftId bundleNftId
41
- )
42
- external
43
- override
44
- onlyProductService2
45
- returns(NftId nftId)
46
- {
47
- // TODO add parameter validation
48
- if(bundleNftId.gtz()) {
49
- IRegistry.RegistryInfo memory bundleInfo = this.getRegistry().getInfo(bundleNftId);
50
- // IRegistry.RegistryInfo memory poolInfo = this.getRegistry().getInfo(bundleInfo.parentNftId);
51
- }
52
-
53
- nftId = this.getRegistry().registerObjectForInstance(
54
- productInfo.nftId,
55
- this.getRegistry().POLICY(),
56
- applicationOwner);
57
-
58
- _policyInfo[nftId] = PolicyInfo(
59
- nftId,
60
- PolicyState.Applied,
61
- sumInsuredAmount,
62
- premiumAmount,
63
- lifetime,
64
- block.timestamp,
65
- 0, // activatedAt
66
- 0, // expiredAt
67
- 0 // closedAt
68
- );
69
-
70
- _bundleForPolicy[nftId] = bundleNftId;
71
-
72
- // add logging
73
- }
74
-
75
-
76
- function activate(NftId nftId)
77
- external
78
- override
79
- onlyProductService2
80
- {
81
- PolicyInfo storage info = _policyInfo[nftId];
82
- info.activatedAt = block.timestamp;
83
- info.expiredAt = block.timestamp + info.lifetime;
84
- info.state = PolicyState.Active;
85
-
86
- // add logging
87
- }
88
-
89
-
90
-
91
- function getBundleNftForPolicy(NftId nftId)
92
- external
93
- view
94
- returns(NftId bundleNft)
95
- {
96
- return _bundleForPolicy[nftId];
97
- }
98
-
99
-
100
- function getPolicyInfo(NftId nftId)
101
- external
102
- view
103
- returns(PolicyInfo memory info)
104
- {
105
- return _policyInfo[nftId];
106
- }
107
- }
@@ -1,41 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
3
-
4
- import {IOwnable, IRegistry, IRegistryLinked} from "../../registry/IRegistry.sol";
5
- import {NftId} from "../../types/NftId.sol";
6
-
7
- interface IPool {
8
-
9
- struct PoolInfo {
10
- NftId nftId;
11
- address wallet;
12
- address token;
13
- uint256 capital;
14
- uint256 lockedCapital;
15
- }
16
- }
17
-
18
- interface IPoolModule is
19
- IOwnable,
20
- IRegistryLinked,
21
- IPool
22
- {
23
-
24
- function underwrite(
25
- NftId poolNftId,
26
- NftId policyNftId
27
- )
28
- external;
29
-
30
- function createPoolInfo(
31
- NftId nftId,
32
- address wallet,
33
- address token
34
- )
35
- external;
36
-
37
- function getPoolInfo(NftId nftId)
38
- external
39
- view
40
- returns(PoolInfo memory info);
41
- }