@etherisc/gif-next 0.0.2-b1fb5f9 → 0.0.2-b244df3-779

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (414) hide show
  1. package/README.md +341 -9
  2. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +4 -0
  3. package/artifacts/contracts/{registry/IChainNft.sol/IChainNft.json → components/BaseComponent.sol/BaseComponent.json} +241 -240
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +744 -0
  6. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +4 -0
  7. package/artifacts/contracts/{instance/component/ComponentModule.sol/ComponentModule.json → components/IBaseComponent.sol/IBaseComponent.json} +195 -154
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +152 -0
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +275 -0
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +4 -0
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +157 -0
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +761 -35
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  17. package/artifacts/contracts/components/Product.sol/Product.json +666 -42
  18. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +4 -0
  19. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +66 -0
  20. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +4 -0
  21. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +24 -0
  22. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +4 -0
  23. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +42 -0
  24. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/errors/Require.sol/Require.json +2 -2
  26. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +2 -2
  28. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/inheritance/A.sol/A.json +2 -2
  30. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +2 -2
  32. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  33. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  35. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  36. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  37. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  38. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +4 -0
  39. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +59 -0
  40. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +4 -0
  41. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +124 -0
  42. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +4 -0
  43. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +74 -0
  44. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +4 -0
  45. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +124 -0
  46. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +4 -0
  47. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +207 -0
  48. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  49. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +2 -2
  50. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  51. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +2 -2
  52. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
  53. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
  54. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
  55. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +788 -0
  56. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
  57. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +185 -0
  58. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +4 -0
  59. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +1082 -0
  60. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  61. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1292 -460
  62. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
  63. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +448 -0
  64. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
  65. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +496 -0
  66. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  67. package/artifacts/contracts/instance/Instance.sol/Instance.json +2541 -573
  68. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
  69. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +1039 -0
  70. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
  71. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +763 -0
  72. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
  73. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1422 -0
  74. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
  75. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +1007 -0
  76. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
  77. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +524 -0
  78. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
  79. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +285 -0
  80. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +4 -0
  81. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +521 -0
  82. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
  83. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +113 -0
  84. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
  85. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +429 -0
  86. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +4 -0
  87. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.json +115 -0
  88. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
  89. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +502 -0
  90. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +4 -0
  91. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +169 -0
  92. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +4 -0
  93. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +243 -0
  94. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +4 -0
  95. package/artifacts/contracts/instance/{access/IAccess.sol/IAccess.json → module/IBundle.sol/IBundle.json} +2 -2
  96. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +4 -0
  97. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.json +10 -0
  98. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +4 -0
  99. package/artifacts/contracts/instance/{policy → module}/IPolicy.sol/IPolicy.json +1 -1
  100. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +4 -0
  101. package/artifacts/contracts/instance/{pool/IPoolModule.sol/IPool.json → module/IRisk.sol/IRisk.json} +2 -2
  102. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +4 -0
  103. package/artifacts/contracts/instance/{component/IComponent.sol/IComponent.json → module/ISetup.sol/ISetup.json} +2 -2
  104. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +4 -0
  105. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.json +10 -0
  106. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
  107. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +923 -0
  108. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
  109. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +440 -0
  110. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +4 -0
  111. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +827 -0
  112. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
  113. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +684 -0
  114. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
  115. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +428 -0
  116. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
  117. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +669 -0
  118. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +4 -0
  119. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +466 -0
  120. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
  121. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +446 -0
  122. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
  123. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +664 -0
  124. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +4 -0
  125. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +499 -0
  126. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +4 -0
  127. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +536 -0
  128. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
  129. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +984 -0
  130. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
  131. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +464 -0
  132. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
  133. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +718 -0
  134. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
  135. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +428 -0
  136. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
  137. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +768 -0
  138. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
  139. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +420 -0
  140. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  141. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +239 -2
  142. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  143. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +429 -63
  144. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
  145. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +947 -0
  146. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +4 -0
  147. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +34 -0
  148. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  149. package/artifacts/contracts/registry/Registry.sol/Registry.json +566 -77
  150. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
  151. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +1293 -0
  152. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
  153. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +517 -0
  154. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
  155. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +410 -0
  156. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +4 -0
  157. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.json +107 -0
  158. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +4 -0
  159. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +35 -0
  160. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
  161. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +127 -0
  162. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +4 -0
  163. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +201 -0
  164. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
  165. package/artifacts/contracts/shared/IService.sol/IService.json +421 -0
  166. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +4 -0
  167. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +205 -0
  168. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
  169. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +158 -0
  170. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +4 -0
  171. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +349 -0
  172. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +4 -0
  173. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +274 -0
  174. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +4 -0
  175. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +442 -0
  176. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
  177. package/artifacts/contracts/shared/Service.sol/Service.json +468 -0
  178. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +4 -0
  179. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +96 -0
  180. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
  181. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
  182. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +4 -0
  183. package/artifacts/contracts/shared/Versionable.sol/Versionable.json +228 -0
  184. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +4 -0
  185. package/artifacts/contracts/test/TestFee.sol/TestFee.json +119 -0
  186. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +4 -0
  187. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +305 -0
  188. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +4 -0
  189. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +116 -0
  190. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +4 -0
  191. package/artifacts/contracts/test/TestService.sol/TestService.json +600 -0
  192. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +4 -0
  193. package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +376 -0
  194. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +4 -0
  195. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +218 -0
  196. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +4 -0
  197. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +286 -0
  198. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +4 -0
  199. package/artifacts/contracts/test/Usdc.sol/USDC.json +376 -0
  200. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +4 -0
  201. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.json +10 -0
  202. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  203. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
  204. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  205. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +2 -2
  206. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
  207. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
  208. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +4 -0
  209. package/artifacts/contracts/types/Fee.sol/FeeLib.json +257 -0
  210. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +4 -0
  211. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +125 -0
  212. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  213. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +65 -4
  214. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +4 -0
  215. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +33 -0
  216. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +4 -0
  217. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +100 -0
  218. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +4 -0
  219. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +92 -0
  220. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +4 -0
  221. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +123 -0
  222. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +4 -0
  223. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +86 -0
  224. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +4 -0
  225. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +156 -0
  226. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +4 -0
  227. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +92 -0
  228. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  229. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +77 -2
  230. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
  231. package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
  232. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
  233. package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +479 -0
  234. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +4 -0
  235. package/artifacts/contracts/types/Version.sol/VersionLib.json +177 -0
  236. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +4 -0
  237. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +49 -0
  238. package/contracts/components/BaseComponent.sol +132 -0
  239. package/contracts/components/Distribution.sol +163 -0
  240. package/contracts/components/IBaseComponent.sol +31 -0
  241. package/contracts/components/IDistributionComponent.sol +44 -0
  242. package/contracts/components/IPoolComponent.sol +66 -0
  243. package/contracts/components/IProductComponent.sol +35 -0
  244. package/contracts/components/Pool.sol +261 -12
  245. package/contracts/components/Product.sol +262 -25
  246. package/contracts/experiment/cloning/Cloner.sol +47 -0
  247. package/contracts/experiment/statemachine/Dummy.sol +27 -0
  248. package/contracts/experiment/statemachine/ISM.sol +25 -0
  249. package/contracts/experiment/statemachine/SM.sol +57 -0
  250. package/contracts/experiment/statemachine/SimpleStateMachine.sol +31 -0
  251. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +23 -0
  252. package/contracts/instance/BundleManager.sol +129 -0
  253. package/contracts/instance/Cloneable.sol +46 -0
  254. package/contracts/instance/IAccessManagerSimple.sol +391 -0
  255. package/contracts/instance/IInstance.sol +59 -17
  256. package/contracts/instance/IInstanceBase.sol +26 -0
  257. package/contracts/instance/IInstanceService.sol +34 -0
  258. package/contracts/instance/Instance.sol +267 -55
  259. package/contracts/instance/InstanceAccessManager.sol +302 -0
  260. package/contracts/instance/InstanceBase.sol +41 -0
  261. package/contracts/instance/InstanceReader.sol +315 -0
  262. package/contracts/instance/InstanceService.sol +284 -0
  263. package/contracts/instance/InstanceServiceManager.sol +57 -0
  264. package/contracts/instance/ObjectManager.sol +101 -0
  265. package/contracts/instance/base/ComponentServiceBase.sol +72 -0
  266. package/contracts/instance/base/IInstanceBase.sol +23 -0
  267. package/contracts/instance/base/IKeyValueStore.sol +49 -0
  268. package/contracts/instance/base/ILifecycle.sol +30 -0
  269. package/contracts/instance/base/KeyValueStore.sol +172 -0
  270. package/contracts/instance/base/Lifecycle.sol +100 -0
  271. package/contracts/instance/module/IAccess.sol +48 -0
  272. package/contracts/instance/module/IBundle.sol +20 -0
  273. package/contracts/instance/module/IDistribution.sol +39 -0
  274. package/contracts/instance/module/IPolicy.sol +45 -0
  275. package/contracts/instance/module/IRisk.sol +11 -0
  276. package/contracts/instance/module/ISetup.sol +46 -0
  277. package/contracts/instance/module/ITreasury.sol +23 -0
  278. package/contracts/instance/service/BundleService.sol +260 -0
  279. package/contracts/instance/service/BundleServiceManager.sol +54 -0
  280. package/contracts/instance/service/ComponentOwnerService.sol +317 -0
  281. package/contracts/instance/service/DistributionService.sol +118 -0
  282. package/contracts/instance/service/DistributionServiceManager.sol +54 -0
  283. package/contracts/instance/service/IBundleService.sol +45 -0
  284. package/contracts/instance/service/IComponentOwnerService.sol +20 -0
  285. package/contracts/instance/service/IDistributionService.sol +12 -0
  286. package/contracts/instance/service/IPolicyService.sol +87 -0
  287. package/contracts/instance/service/IPoolService.sol +20 -0
  288. package/contracts/instance/service/IProductService.sol +40 -0
  289. package/contracts/instance/service/PolicyService.sol +508 -0
  290. package/contracts/instance/service/PolicyServiceManager.sol +54 -0
  291. package/contracts/instance/service/PoolService.sol +124 -0
  292. package/contracts/instance/service/PoolServiceManager.sol +54 -0
  293. package/contracts/instance/service/ProductService.sol +173 -0
  294. package/contracts/instance/service/ProductServiceManager.sol +54 -0
  295. package/contracts/registry/ChainNft.sol +129 -62
  296. package/contracts/registry/IRegistry.sol +54 -53
  297. package/contracts/registry/IRegistryService.sol +50 -0
  298. package/contracts/registry/ITransferInterceptor.sol +6 -0
  299. package/contracts/registry/Registry.sol +379 -140
  300. package/contracts/registry/RegistryService.sol +358 -0
  301. package/contracts/registry/RegistryServiceManager.sol +80 -0
  302. package/contracts/registry/TokenRegistry.sol +111 -0
  303. package/contracts/shared/ContractDeployerLib.sol +72 -0
  304. package/contracts/shared/ERC165.sol +25 -0
  305. package/contracts/shared/INftOwnable.sol +22 -0
  306. package/contracts/shared/IRegisterable.sol +17 -0
  307. package/contracts/shared/IService.sol +15 -0
  308. package/contracts/shared/IVersionable.sol +96 -0
  309. package/contracts/shared/NftOwnable.sol +134 -0
  310. package/contracts/shared/ProxyManager.sol +94 -0
  311. package/contracts/shared/Registerable.sol +90 -0
  312. package/contracts/shared/RegisterableUpgradable.sol +16 -0
  313. package/contracts/shared/Service.sol +55 -0
  314. package/contracts/shared/TokenHandler.sol +27 -0
  315. package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
  316. package/contracts/shared/Versionable.sol +147 -0
  317. package/contracts/test/TestFee.sol +25 -0
  318. package/contracts/test/TestRegisterable.sol +18 -0
  319. package/contracts/test/TestRoleId.sol +14 -0
  320. package/contracts/test/TestService.sol +24 -0
  321. package/contracts/test/TestToken.sol +26 -0
  322. package/contracts/test/TestVersion.sol +44 -0
  323. package/contracts/test/TestVersionable.sol +17 -0
  324. package/contracts/test/Usdc.sol +26 -0
  325. package/contracts/types/AddressSet.sol +58 -0
  326. package/contracts/types/DistributorType.sol +55 -0
  327. package/contracts/types/Fee.sol +56 -0
  328. package/contracts/types/Key32.sol +50 -0
  329. package/contracts/types/NftId.sol +22 -1
  330. package/contracts/types/NftIdSet.sol +62 -0
  331. package/contracts/types/NumberId.sol +52 -0
  332. package/contracts/types/ObjectType.sol +152 -0
  333. package/contracts/types/Referral.sol +85 -0
  334. package/contracts/types/RiskId.sol +43 -0
  335. package/contracts/types/RoleId.sol +92 -0
  336. package/contracts/types/StateId.sol +105 -0
  337. package/contracts/types/Timestamp.sol +29 -4
  338. package/contracts/types/UFixed.sol +150 -30
  339. package/contracts/types/Version.sol +107 -0
  340. package/package.json +17 -6
  341. package/artifacts/contracts/components/Component.sol/Component.dbg.json +0 -4
  342. package/artifacts/contracts/components/Component.sol/Component.json +0 -179
  343. package/artifacts/contracts/components/Component.sol/InstanceLinked.dbg.json +0 -4
  344. package/artifacts/contracts/components/Component.sol/InstanceLinked.json +0 -35
  345. package/artifacts/contracts/components/IPool.sol/IPoolComponent.dbg.json +0 -4
  346. package/artifacts/contracts/components/IPool.sol/IPoolComponent.json +0 -179
  347. package/artifacts/contracts/components/IProduct.sol/IProductComponent.dbg.json +0 -4
  348. package/artifacts/contracts/components/IProduct.sol/IProductComponent.json +0 -192
  349. package/artifacts/contracts/instance/access/Access.sol/AccessModule.dbg.json +0 -4
  350. package/artifacts/contracts/instance/access/Access.sol/AccessModule.json +0 -400
  351. package/artifacts/contracts/instance/access/IAccess.sol/IAccess.dbg.json +0 -4
  352. package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.dbg.json +0 -4
  353. package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.json +0 -35
  354. package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.dbg.json +0 -4
  355. package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.json +0 -50
  356. package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.dbg.json +0 -4
  357. package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.json +0 -336
  358. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
  359. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.dbg.json +0 -4
  360. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.json +0 -147
  361. package/artifacts/contracts/instance/component/IComponent.sol/IComponent.dbg.json +0 -4
  362. package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.dbg.json +0 -4
  363. package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.json +0 -179
  364. package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.dbg.json +0 -4
  365. package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.json +0 -245
  366. package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.dbg.json +0 -4
  367. package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.json +0 -94
  368. package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.dbg.json +0 -4
  369. package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.json +0 -24
  370. package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
  371. package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
  372. package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.json +0 -231
  373. package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
  374. package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.json +0 -231
  375. package/artifacts/contracts/instance/pool/IPoolModule.sol/IPool.dbg.json +0 -4
  376. package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
  377. package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.json +0 -149
  378. package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
  379. package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.json +0 -162
  380. package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.dbg.json +0 -4
  381. package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.json +0 -75
  382. package/artifacts/contracts/instance/product/IProductService.sol/IProductService.dbg.json +0 -4
  383. package/artifacts/contracts/instance/product/IProductService.sol/IProductService.json +0 -114
  384. package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.dbg.json +0 -4
  385. package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.json +0 -75
  386. package/artifacts/contracts/instance/product/ProductService.sol/ProductService.dbg.json +0 -4
  387. package/artifacts/contracts/instance/product/ProductService.sol/ProductService.json +0 -167
  388. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
  389. package/artifacts/contracts/registry/IRegistry.sol/IOwnable.dbg.json +0 -4
  390. package/artifacts/contracts/registry/IRegistry.sol/IOwnable.json +0 -24
  391. package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.dbg.json +0 -4
  392. package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.json +0 -166
  393. package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.dbg.json +0 -4
  394. package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.json +0 -49
  395. package/artifacts/contracts/registry/Registry.sol/Registerable.dbg.json +0 -4
  396. package/artifacts/contracts/registry/Registry.sol/Registerable.json +0 -166
  397. package/artifacts/contracts/registry/Registry.sol/RegistryLinked.dbg.json +0 -4
  398. package/artifacts/contracts/registry/Registry.sol/RegistryLinked.json +0 -60
  399. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
  400. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +0 -453
  401. package/contracts/components/Component.sol +0 -60
  402. package/contracts/components/IPool.sol +0 -9
  403. package/contracts/components/IProduct.sol +0 -9
  404. package/contracts/instance/access/Access.sol +0 -165
  405. package/contracts/instance/access/IAccess.sol +0 -63
  406. package/contracts/instance/component/ComponentModule.sol +0 -213
  407. package/contracts/instance/component/IComponent.sol +0 -73
  408. package/contracts/instance/policy/IPolicy.sol +0 -51
  409. package/contracts/instance/policy/PolicyModule.sol +0 -91
  410. package/contracts/instance/pool/IPoolModule.sol +0 -29
  411. package/contracts/instance/pool/PoolModule.sol +0 -73
  412. package/contracts/instance/product/IProductService.sol +0 -36
  413. package/contracts/instance/product/ProductService.sol +0 -112
  414. package/contracts/registry/IChainNft.sol +0 -21
@@ -1,165 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
3
-
4
- // role admin handling of oz doesn't fit nft ownability
5
- // import {AccessControlEnumerable} from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
6
- import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
7
-
8
- import {IAccessModule} from "./IAccess.sol";
9
-
10
- abstract contract AccessModule is IAccessModule {
11
- string public constant PRODUCT_OWNER = "ProductOwner";
12
- string public constant ORACLE_OWNER = "OracleOwner";
13
- string public constant POOL_OWNER = "PoolOwner";
14
-
15
- using EnumerableSet for EnumerableSet.AddressSet;
16
-
17
- event LogAccessRoleGranted(bytes32 role, address member, bool isMember);
18
-
19
- mapping(bytes32 role => RoleInfo info) private _info;
20
- bytes32[] private _roles;
21
-
22
- bytes32 private immutable _productOwnerRole;
23
- bytes32 private immutable _oracleOwnerRole;
24
- bytes32 private immutable _poolOwnerRole;
25
-
26
- mapping(bytes32 role => mapping(address member => bool isMember))
27
- private _isRoleMember;
28
- mapping(bytes32 role => EnumerableSet.AddressSet) private _roleMembers;
29
-
30
- modifier onlyOwner() {
31
- require(msg.sender == this.getOwner(), "ERROR:ACM-001:NOT_OWNER");
32
- _;
33
- }
34
-
35
- constructor() {
36
- _productOwnerRole = _createRole(PRODUCT_OWNER);
37
- _oracleOwnerRole = _createRole(ORACLE_OWNER);
38
- _poolOwnerRole = _createRole(POOL_OWNER);
39
- }
40
-
41
- function PRODUCT_OWNER_ROLE() public view override returns (bytes32 role) {
42
- return _productOwnerRole;
43
- }
44
-
45
- function ORACLE_OWNER_ROLE() public view override returns (bytes32 role) {
46
- return _oracleOwnerRole;
47
- }
48
-
49
- function POOL_OWNER_ROLE() public view override returns (bytes32 role) {
50
- return _poolOwnerRole;
51
- }
52
-
53
- function createRole(
54
- string memory roleName
55
- ) external override onlyOwner returns (bytes32 role) {
56
- return _createRole(roleName);
57
- }
58
-
59
- function _createRole(
60
- string memory roleName
61
- ) internal returns (bytes32 role) {
62
- RoleInfo memory info = RoleInfo(0, roleName, true);
63
-
64
- role = _setRoleInfo(info);
65
- }
66
-
67
- // TODO move to module
68
- function disableRole(bytes32 role) external override onlyOwner {
69
- RoleInfo memory info = _info[role];
70
- require(info.id == role, "ERROR:AOS-001:ROLE_DOES_NOT_EXIST");
71
-
72
- info.isActive = false;
73
- _setRoleInfo(info);
74
- }
75
-
76
- // TODO move to module
77
- function enableRole(bytes32 role) external override onlyOwner {
78
- RoleInfo memory info = _info[role];
79
- require(info.id == role, "ERROR:AOS-002:ROLE_DOES_NOT_EXIST");
80
-
81
- info.isActive = true;
82
- _setRoleInfo(info);
83
- }
84
-
85
- function grantRole(
86
- bytes32 role,
87
- address member
88
- ) external override onlyOwner {
89
- require(_info[role].id == role, "ERROR:ACM-010:ROLE_NOT_EXISTING");
90
- require(_info[role].isActive, "ERROR:ACM-011:ROLE_NOT_ACTIVE");
91
-
92
- _isRoleMember[role][member] = true;
93
- _roleMembers[role].add(member);
94
-
95
- emit LogAccessRoleGranted(role, member, _isRoleMember[role][member]);
96
- }
97
-
98
- function revokeRole(
99
- bytes32 role,
100
- address member
101
- ) external override onlyOwner {
102
- require(_info[role].id == role, "ERROR:ACM-020:ROLE_NOT_EXISTING");
103
-
104
- _isRoleMember[role][member] = false;
105
- _roleMembers[role].remove(member);
106
- }
107
-
108
- function hasRole(
109
- bytes32 role,
110
- address member
111
- ) external view override returns (bool) {
112
- return _isRoleMember[role][member];
113
- }
114
-
115
- function getRoleInfo(
116
- bytes32 role
117
- ) external view override returns (RoleInfo memory info) {
118
- return _info[role];
119
- }
120
-
121
- function getRole(
122
- uint256 idx
123
- ) external view override returns (bytes32 role) {
124
- return _roles[idx];
125
- }
126
-
127
- function getRoleCount() external view override returns (uint256 roles) {
128
- return _roles.length;
129
- }
130
-
131
- function getRoleMemberCount(
132
- bytes32 role
133
- ) public view override returns (uint256 roleMembers) {
134
- return _roleMembers[role].length();
135
- }
136
-
137
- function getRoleMember(
138
- bytes32 role,
139
- uint256 idx
140
- ) public view override returns (address roleMembers) {
141
- return _roleMembers[role].at(idx);
142
- }
143
-
144
- function getRoleForName(
145
- string memory roleName
146
- ) public pure override returns (bytes32 role) {
147
- return keccak256(abi.encode(roleName));
148
- }
149
-
150
- function _setRoleInfo(
151
- RoleInfo memory info
152
- ) internal returns (bytes32 role) {
153
- role = info.id;
154
-
155
- if (role == bytes32(0)) {
156
- role = getRoleForName(info.name);
157
- // TODO check that this is a new role id
158
-
159
- info.id = role;
160
- _roles.push(role);
161
- }
162
-
163
- _info[role] = info;
164
- }
165
- }
@@ -1,63 +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
- struct RoleInfo {
8
- bytes32 id;
9
- string name;
10
- bool isActive;
11
- }
12
- }
13
-
14
- interface IAccessCheckRole {
15
- function hasRole(bytes32 role, address member) external view returns (bool);
16
- }
17
-
18
- interface IAccessComponentTypeRoles {
19
- function PRODUCT_OWNER_ROLE() external view returns (bytes32 role);
20
-
21
- function ORACLE_OWNER_ROLE() external view returns (bytes32 role);
22
-
23
- function POOL_OWNER_ROLE() external view returns (bytes32 role);
24
- }
25
-
26
- interface IAccessModule is
27
- IOwnable,
28
- IRegistryLinked,
29
- IAccess,
30
- IAccessComponentTypeRoles,
31
- IAccessCheckRole
32
- {
33
- function createRole(string memory roleName) external returns (bytes32 role);
34
-
35
- function enableRole(bytes32 role) external;
36
-
37
- function disableRole(bytes32 role) external;
38
-
39
- function grantRole(bytes32 role, address member) external;
40
-
41
- function revokeRole(bytes32 role, address member) external;
42
-
43
- function getRole(uint256 idx) external view returns (bytes32 role);
44
-
45
- function getRoleInfo(
46
- bytes32 role
47
- ) external view returns (RoleInfo memory info);
48
-
49
- function getRoleForName(
50
- string memory roleName
51
- ) external pure returns (bytes32 role);
52
-
53
- function getRoleCount() external view returns (uint256 roles);
54
-
55
- function getRoleMemberCount(
56
- bytes32 role
57
- ) external view returns (uint256 roleMembers);
58
-
59
- function getRoleMember(
60
- bytes32 role,
61
- uint256 idx
62
- ) external view returns (address roleMembers);
63
- }
@@ -1,213 +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(
33
- address(_componentOwnerService) == msg.sender,
34
- "ERROR:CMP-001:NOT_OWNER_SERVICE"
35
- );
36
- _;
37
- }
38
-
39
- constructor(address componentOwnerService) {
40
- _componentOwnerService = ComponentOwnerService(componentOwnerService);
41
- }
42
-
43
- function registerComponent(
44
- IComponentContract component
45
- ) external override onlyComponentOwnerService returns (NftId nftId) {
46
- bytes32 typeRole = getRoleForType(component.getType());
47
- require(
48
- this.hasRole(typeRole, component.getInitialOwner()),
49
- "ERROR:CMP-004:TYPE_ROLE_MISSING"
50
- );
51
-
52
- nftId = this.getRegistry().register(address(component));
53
-
54
- _componentInfo[nftId] = ComponentInfo(nftId, CState.Active);
55
-
56
- // special case product -> persist product - pool assignment
57
- if (component.getType() == this.getRegistry().PRODUCT()) {
58
- IProductComponent product = IProductComponent(address(component));
59
- NftId poolNftId = product.getPoolNftId();
60
- require(poolNftId.gtz(), "ERROR:CMP-005:POOL_UNKNOWN");
61
- // add more validation (type, token, ...)
62
-
63
- _poolNftIdForProduct[nftId] = poolNftId;
64
-
65
- // add creation of productInfo
66
- } else if (component.getType() == this.getRegistry().POOL()) {
67
- IPoolModule poolModule = IPoolModule(address(this));
68
- poolModule.createPoolInfo(
69
- nftId,
70
- address(component), // set pool as its wallet
71
- address(0) // don't deal with token yet
72
- );
73
- }
74
-
75
- _nftIdByAddress[address(component)] = nftId;
76
- _nftIds.push(nftId);
77
-
78
- // add logging
79
- }
80
-
81
- function getPoolNftId(
82
- NftId productNftId
83
- ) external view override returns (NftId poolNftId) {
84
- poolNftId = _poolNftIdForProduct[productNftId];
85
- }
86
-
87
- function getComponentOwnerService()
88
- external
89
- view
90
- override
91
- returns (IComponentOwnerService)
92
- {
93
- return _componentOwnerService;
94
- }
95
-
96
- function setComponentInfo(
97
- ComponentInfo memory info
98
- ) external onlyComponentOwnerService returns (NftId nftId) {
99
- nftId = info.nftId;
100
- require(
101
- nftId.gtz() && _componentInfo[nftId].nftId.eq(nftId),
102
- "ERROR:CMP-006:COMPONENT_UNKNOWN"
103
- );
104
-
105
- _componentInfo[nftId] = info;
106
-
107
- // add logging
108
- }
109
-
110
- function getComponentInfo(
111
- NftId nftId
112
- ) external view override returns (ComponentInfo memory) {
113
- return _componentInfo[nftId];
114
- }
115
-
116
- function getComponentOwner(
117
- NftId nftId
118
- ) external view returns (address owner) {}
119
-
120
- function getComponentId(
121
- address componentAddress
122
- ) external view returns (NftId componentNftId) {
123
- return _nftIdByAddress[componentAddress];
124
- }
125
-
126
- function getComponentId(
127
- uint256 idx
128
- ) external view override returns (NftId componentNftId) {
129
- return _nftIds[idx];
130
- }
131
-
132
- function components()
133
- external
134
- view
135
- override
136
- returns (uint256 numberOfCompnents)
137
- {
138
- return _nftIds.length;
139
- }
140
-
141
- function getRoleForType(uint256 cType) public view returns (bytes32 role) {
142
- if (cType == this.getRegistry().PRODUCT()) {
143
- return this.PRODUCT_OWNER_ROLE();
144
- }
145
- if (cType == this.getRegistry().POOL()) {
146
- return this.POOL_OWNER_ROLE();
147
- }
148
- if (cType == this.getRegistry().ORACLE()) {
149
- return this.ORACLE_OWNER_ROLE();
150
- }
151
- }
152
- }
153
-
154
- // this is actually the component owner service
155
- contract ComponentOwnerService is
156
- RegistryLinked,
157
- IComponent,
158
- IComponentOwnerService
159
- {
160
- using NftIdLib for NftId;
161
-
162
- modifier onlyComponentOwner(IComponentContract component) {
163
- NftId nftId = _registry.getNftId(address(component));
164
- require(nftId.gtz(), "ERROR:COS-001:COMPONENT_UNKNOWN");
165
- require(
166
- msg.sender == _registry.getOwner(nftId),
167
- "ERROR:COS-002:NOT_OWNER"
168
- );
169
- _;
170
- }
171
-
172
- constructor(address registry) RegistryLinked(registry) {}
173
-
174
- function register(
175
- IComponentContract component
176
- ) external override returns (NftId nftId) {
177
- require(
178
- msg.sender == component.getInitialOwner(),
179
- "ERROR:COS-003:NOT_OWNER"
180
- );
181
-
182
- IInstance instance = component.getInstance();
183
- nftId = instance.registerComponent(component);
184
- }
185
-
186
- function lock(
187
- IComponentContract component
188
- ) external override onlyComponentOwner(component) {
189
- IInstance instance = component.getInstance();
190
- ComponentInfo memory info = instance.getComponentInfo(
191
- component.getNftId()
192
- );
193
- require(info.nftId.gtz(), "ERROR_COMPONENT_UNKNOWN");
194
- // TODO add state change validation
195
-
196
- info.state = CState.Locked;
197
- instance.setComponentInfo(info);
198
- }
199
-
200
- function unlock(
201
- IComponentContract component
202
- ) external override onlyComponentOwner(component) {
203
- IInstance instance = component.getInstance();
204
- ComponentInfo memory info = instance.getComponentInfo(
205
- component.getNftId()
206
- );
207
- require(info.nftId.gtz(), "ERROR_COMPONENT_UNKNOWN");
208
- // TODO state change validation
209
-
210
- info.state = CState.Active;
211
- instance.setComponentInfo(info);
212
- }
213
- }
@@ -1,73 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
3
-
4
- import {IOwnable, IRegistryLinked, IRegisterable} from "../../registry/IRegistry.sol";
5
- import {IInstance} from "../IInstance.sol";
6
- import {NftId} from "../../types/NftId.sol";
7
-
8
- interface IComponent {
9
- // TODO decide if enum or uints with constants (as in IRegistry.PRODUCT())
10
- enum CState {
11
- Undefined,
12
- Active,
13
- Locked
14
- }
15
-
16
- // component dynamic info (static info kept in registry)
17
- struct ComponentInfo {
18
- NftId nftId;
19
- CState state;
20
- }
21
- }
22
-
23
- interface IInstanceLinked {
24
- // function setInstance(address instance) external;
25
- function getInstance() external view returns (IInstance instance);
26
- }
27
-
28
- interface IComponentContract is IRegisterable, IInstanceLinked, IComponent {}
29
-
30
- interface IComponentOwnerService is IRegistryLinked {
31
- function register(
32
- IComponentContract component
33
- ) external returns (NftId nftId);
34
-
35
- function lock(IComponentContract component) external;
36
-
37
- function unlock(IComponentContract component) external;
38
- }
39
-
40
- interface IComponentModule is IOwnable, IRegistryLinked, IComponent {
41
- function registerComponent(
42
- IComponentContract component
43
- ) external returns (NftId nftId);
44
-
45
- function setComponentInfo(
46
- ComponentInfo memory info
47
- ) external returns (NftId componentNftId);
48
-
49
- function getComponentInfo(
50
- NftId nftId
51
- ) external view returns (ComponentInfo memory info);
52
-
53
- function getComponentOwner(
54
- NftId nftId
55
- ) external view returns (address owner);
56
-
57
- function getComponentId(
58
- address componentAddress
59
- ) external view returns (NftId nftId);
60
-
61
- function getComponentId(uint256 idx) external view returns (NftId nftId);
62
-
63
- function getPoolNftId(
64
- NftId productNftId
65
- ) external view returns (NftId poolNftId);
66
-
67
- function components() external view returns (uint256 numberOfCompnents);
68
-
69
- function getComponentOwnerService()
70
- external
71
- view
72
- returns (IComponentOwnerService);
73
- }
@@ -1,51 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
3
-
4
- import {IOwnable, IRegistryLinked, IRegisterable, IRegistry} from "../../registry/IRegistry.sol";
5
- import {IInstance} from "../IInstance.sol";
6
- import {IProductService} from "../product/IProductService.sol";
7
- import {NftId} from "../../types/NftId.sol";
8
-
9
- // TODO check if there is value to introuce IContract and let IPolicy derive from IContract
10
- interface IPolicy {
11
- enum PolicyState {
12
- Undefined,
13
- Applied,
14
- Rejected,
15
- Active,
16
- Closed
17
- }
18
-
19
- struct PolicyInfo {
20
- NftId nftId;
21
- PolicyState state; // applied, withdrawn, rejected, active, closed
22
- uint256 sumInsuredAmount;
23
- uint256 premiumAmount;
24
- uint256 lifetime; // activatedAt + lifetime >= expiredAt
25
- uint256 createdAt;
26
- uint256 activatedAt; // time of underwriting
27
- uint256 expiredAt; // no new claims
28
- uint256 closedAt; // no locked capital
29
- }
30
- }
31
-
32
- interface IPolicyModule is IOwnable, IRegistryLinked, IPolicy {
33
- function createApplication(
34
- IRegistry.RegistryInfo memory productInfo,
35
- address applicationOwner,
36
- uint256 sumInsuredAmount,
37
- uint256 premiumAmount,
38
- uint256 lifetime,
39
- NftId bundleNftId
40
- ) external returns (NftId nftId);
41
-
42
- function activate(NftId nftId) external;
43
-
44
- function getBundleNftForPolicy(
45
- NftId nftId
46
- ) external view returns (NftId bundleNft);
47
-
48
- function getPolicyInfo(
49
- NftId nftId
50
- ) external view returns (PolicyInfo memory info);
51
- }
@@ -1,91 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
3
-
4
- // import {IOwnable, IRegistryLinked, IRegisterable} from "../../registry/IRegistry.sol";
5
- import {IRegistry, IRegistryLinked} from "../../registry/IRegistry.sol";
6
-
7
- import {IProductService} from "../product/IProductService.sol";
8
- import {IPolicy, IPolicyModule} from "./IPolicy.sol";
9
- import {NftId, NftIdLib} from "../../types/NftId.sol";
10
-
11
- abstract contract PolicyModule is IRegistryLinked, IPolicyModule {
12
- using NftIdLib for NftId;
13
-
14
- mapping(NftId nftId => PolicyInfo info) private _policyInfo;
15
- mapping(NftId nftId => NftId bundleNftId) private _bundleForPolicy;
16
-
17
- IProductService private _productService;
18
-
19
- // TODO find a better place to avoid dupliation
20
- modifier onlyProductService2() {
21
- require(
22
- address(_productService) == msg.sender,
23
- "ERROR:POL-001:NOT_PRODUCT_SERVICE"
24
- );
25
- _;
26
- }
27
-
28
- constructor(address productService) {
29
- _productService = IProductService(productService);
30
- }
31
-
32
- function createApplication(
33
- IRegistry.RegistryInfo memory productInfo,
34
- address applicationOwner,
35
- uint256 sumInsuredAmount,
36
- uint256 premiumAmount,
37
- uint256 lifetime,
38
- NftId bundleNftId
39
- ) external override onlyProductService2 returns (NftId nftId) {
40
- // TODO add parameter validation
41
- if (bundleNftId.gtz()) {
42
- IRegistry.RegistryInfo memory bundleInfo = this
43
- .getRegistry()
44
- .getInfo(bundleNftId);
45
- // IRegistry.RegistryInfo memory poolInfo = this.getRegistry().getInfo(bundleInfo.parentNftId);
46
- }
47
-
48
- nftId = this.getRegistry().registerObjectForInstance(
49
- productInfo.nftId,
50
- this.getRegistry().POLICY(),
51
- applicationOwner
52
- );
53
-
54
- _policyInfo[nftId] = PolicyInfo(
55
- nftId,
56
- PolicyState.Applied,
57
- sumInsuredAmount,
58
- premiumAmount,
59
- lifetime,
60
- block.timestamp,
61
- 0, // activatedAt
62
- 0, // expiredAt
63
- 0 // closedAt
64
- );
65
-
66
- _bundleForPolicy[nftId] = bundleNftId;
67
-
68
- // add logging
69
- }
70
-
71
- function activate(NftId nftId) external override onlyProductService2 {
72
- PolicyInfo storage info = _policyInfo[nftId];
73
- info.activatedAt = block.timestamp;
74
- info.expiredAt = block.timestamp + info.lifetime;
75
- info.state = PolicyState.Active;
76
-
77
- // add logging
78
- }
79
-
80
- function getBundleNftForPolicy(
81
- NftId nftId
82
- ) external view returns (NftId bundleNft) {
83
- return _bundleForPolicy[nftId];
84
- }
85
-
86
- function getPolicyInfo(
87
- NftId nftId
88
- ) external view returns (PolicyInfo memory info) {
89
- return _policyInfo[nftId];
90
- }
91
- }
@@ -1,29 +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
- struct PoolInfo {
9
- NftId nftId;
10
- address wallet;
11
- address token;
12
- uint256 capital;
13
- uint256 lockedCapital;
14
- }
15
- }
16
-
17
- interface IPoolModule is IOwnable, IRegistryLinked, IPool {
18
- function underwrite(NftId poolNftId, NftId policyNftId) external;
19
-
20
- function createPoolInfo(
21
- NftId nftId,
22
- address wallet,
23
- address token
24
- ) external;
25
-
26
- function getPoolInfo(
27
- NftId nftId
28
- ) external view returns (PoolInfo memory info);
29
- }