@etherisc/gif-next 0.0.2-a196164-289 → 0.0.2-a25e4b8-781

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 (420) hide show
  1. package/README.md +211 -27
  2. package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
  3. package/artifacts/contracts/components/Component.sol/Component.json +588 -0
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +465 -89
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
  7. package/artifacts/contracts/{instance/base/ComponentServiceBase.sol/ComponentServiceBase.json → components/IComponent.sol/IComponent.json} +213 -187
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +0 -188
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +15 -227
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +5 -218
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +516 -146
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  17. package/artifacts/contracts/components/Product.sol/Product.json +554 -117
  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/Revert.sol/Revert.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  33. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  35. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
  36. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  37. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  38. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  39. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
  40. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  41. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
  42. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  43. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  44. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
  45. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +764 -0
  46. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
  47. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +185 -0
  48. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  49. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +983 -1059
  50. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
  51. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +570 -0
  52. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  53. package/artifacts/contracts/instance/Instance.sol/Instance.json +1728 -1243
  54. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
  55. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +1034 -0
  56. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
  57. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1381 -0
  58. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
  59. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +956 -0
  60. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
  61. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +460 -0
  62. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
  63. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +261 -0
  64. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
  65. package/artifacts/contracts/instance/base/{ServiceBase.sol/ServiceBase.json → ComponentService.sol/ComponentService.json} +266 -58
  66. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  67. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -13
  68. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  69. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +27 -158
  70. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  71. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  72. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +37 -245
  73. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  74. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  75. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +4 -0
  76. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +254 -0
  77. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +4 -0
  78. package/artifacts/contracts/instance/module/{bundle/IBundle.sol → IBundle.sol}/IBundle.json +1 -1
  79. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +4 -0
  80. package/artifacts/contracts/instance/module/{distribution/IDistribution.sol → IDistribution.sol}/IDistribution.json +1 -1
  81. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +4 -0
  82. package/artifacts/contracts/instance/module/{policy/IPolicy.sol → IPolicy.sol}/IPolicy.json +1 -1
  83. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +4 -0
  84. package/artifacts/contracts/instance/module/{risk/IRisk.sol → IRisk.sol}/IRisk.json +1 -1
  85. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +4 -0
  86. package/artifacts/contracts/instance/{base/ModuleBase.sol/ModuleBase.json → module/ISetup.sol/ISetup.json} +2 -2
  87. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +4 -0
  88. package/artifacts/contracts/instance/module/{treasury/ITreasury.sol → ITreasury.sol}/ITreasury.json +1 -1
  89. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
  90. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1094 -0
  91. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
  92. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +436 -0
  93. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  94. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +327 -70
  95. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
  96. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +424 -0
  97. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
  98. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +720 -0
  99. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  100. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +131 -51
  101. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
  102. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +771 -0
  103. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  104. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +132 -114
  105. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  106. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +127 -262
  107. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
  108. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1219 -0
  109. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
  110. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +492 -0
  111. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  112. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +312 -144
  113. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
  114. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +424 -0
  115. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  116. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +275 -372
  117. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
  118. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +424 -0
  119. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  120. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +186 -12
  121. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  122. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +455 -36
  123. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
  124. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +981 -0
  125. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +4 -0
  126. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +34 -0
  127. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  128. package/artifacts/contracts/registry/Registry.sol/Registry.json +465 -111
  129. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
  130. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
  131. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
  132. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +1187 -0
  133. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
  134. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +451 -0
  135. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
  136. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
  137. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
  138. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +381 -0
  139. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +4 -0
  140. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.json +107 -0
  141. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  142. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
  143. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
  144. package/artifacts/contracts/{instance/module/component/ComponentModule.sol/ComponentModule.json → shared/INftOwnable.sol/INftOwnable.json} +67 -57
  145. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  146. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +117 -37
  147. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
  148. package/artifacts/contracts/{instance/service/IComponentOwnerService.sol/IComponentOwnerService.json → shared/IService.sol/IService.json} +133 -117
  149. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  150. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
  151. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +158 -0
  152. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +4 -0
  153. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +349 -0
  154. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  155. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +190 -37
  156. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
  157. package/artifacts/contracts/{instance/base/InstanceBase.sol/InstanceBase.json → shared/Service.sol/Service.json} +148 -143
  158. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +4 -0
  159. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +96 -0
  160. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
  161. package/artifacts/contracts/shared/{Proxy.sol/ProxyWithProxyAdminGetter.json → UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json} +4 -4
  162. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  163. package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -25
  164. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  165. package/artifacts/contracts/test/TestFee.sol/TestFee.json +4 -4
  166. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  167. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +204 -36
  168. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  169. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +14 -14
  170. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  171. package/artifacts/contracts/test/TestService.sol/TestService.json +213 -79
  172. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  173. package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +91 -53
  174. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  175. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  176. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  177. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +27 -34
  178. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  179. package/artifacts/contracts/test/Usdc.sol/USDC.json +91 -53
  180. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  181. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  182. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  183. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
  184. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
  185. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  186. package/artifacts/contracts/types/Fee.sol/FeeLib.json +4 -4
  187. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  188. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +31 -17
  189. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  190. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
  191. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  192. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
  193. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +4 -0
  194. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +100 -0
  195. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  196. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  197. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +4 -0
  198. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +123 -0
  199. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  200. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
  201. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  202. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +134 -8
  203. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  204. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  205. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  206. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +15 -2
  207. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
  208. package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
  209. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
  210. package/artifacts/contracts/types/UFixed.sol/{UFixedMathLib.json → UFixedLib.json} +3 -3
  211. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  212. package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
  213. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  214. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
  215. package/contracts/components/Component.sol +179 -0
  216. package/contracts/components/Distribution.sol +56 -34
  217. package/contracts/components/IComponent.sol +37 -0
  218. package/contracts/components/IDistributionComponent.sol +3 -6
  219. package/contracts/components/IPoolComponent.sol +7 -12
  220. package/contracts/components/IProductComponent.sol +6 -9
  221. package/contracts/components/Pool.sol +122 -99
  222. package/contracts/components/Product.sol +130 -60
  223. package/contracts/experiment/cloning/Cloner.sol +47 -0
  224. package/contracts/instance/BundleManager.sol +125 -0
  225. package/contracts/instance/Cloneable.sol +46 -0
  226. package/contracts/instance/IInstance.sol +57 -44
  227. package/contracts/instance/IInstanceService.sol +40 -0
  228. package/contracts/instance/Instance.sol +237 -58
  229. package/contracts/instance/InstanceAccessManager.sol +298 -0
  230. package/contracts/instance/InstanceReader.sol +293 -0
  231. package/contracts/instance/InstanceService.sol +362 -0
  232. package/contracts/instance/InstanceServiceManager.sol +54 -0
  233. package/contracts/instance/ObjectManager.sol +84 -0
  234. package/contracts/instance/base/ComponentService.sol +133 -0
  235. package/contracts/instance/base/IInstanceBase.sol +2 -3
  236. package/contracts/instance/base/IKeyValueStore.sol +13 -14
  237. package/contracts/instance/base/ILifecycle.sol +3 -3
  238. package/contracts/instance/base/KeyValueStore.sol +49 -38
  239. package/contracts/instance/base/Lifecycle.sol +1 -1
  240. package/contracts/instance/module/IAccess.sol +48 -0
  241. package/contracts/instance/module/IBundle.sol +20 -0
  242. package/contracts/instance/module/IDistribution.sol +39 -0
  243. package/contracts/instance/module/IPolicy.sol +45 -0
  244. package/contracts/instance/module/IRisk.sol +11 -0
  245. package/contracts/instance/module/ISetup.sol +46 -0
  246. package/contracts/instance/module/ITreasury.sol +23 -0
  247. package/contracts/instance/service/BundleService.sol +293 -0
  248. package/contracts/instance/service/BundleServiceManager.sol +51 -0
  249. package/contracts/instance/service/DistributionService.sol +79 -23
  250. package/contracts/instance/service/DistributionServiceManager.sol +51 -0
  251. package/contracts/instance/service/IBundleService.sol +44 -0
  252. package/contracts/instance/service/IDistributionService.sol +1 -1
  253. package/contracts/instance/service/IPolicyService.sol +94 -0
  254. package/contracts/instance/service/IPoolService.sol +7 -24
  255. package/contracts/instance/service/IProductService.sol +9 -76
  256. package/contracts/instance/service/PolicyService.sol +538 -0
  257. package/contracts/instance/service/PolicyServiceManager.sol +54 -0
  258. package/contracts/instance/service/PoolService.sol +105 -112
  259. package/contracts/instance/service/PoolServiceManager.sol +51 -0
  260. package/contracts/instance/service/ProductService.sol +163 -431
  261. package/contracts/instance/service/ProductServiceManager.sol +54 -0
  262. package/contracts/registry/ChainNft.sol +79 -36
  263. package/contracts/registry/IRegistry.sol +65 -24
  264. package/contracts/registry/IRegistryService.sol +57 -0
  265. package/contracts/registry/ITransferInterceptor.sol +6 -0
  266. package/contracts/registry/Registry.sol +358 -287
  267. package/contracts/registry/RegistryAccessManager.sol +216 -0
  268. package/contracts/registry/RegistryService.sol +312 -0
  269. package/contracts/registry/RegistryServiceManager.sol +62 -0
  270. package/contracts/registry/ReleaseManager.sol +352 -0
  271. package/contracts/registry/TokenRegistry.sol +112 -0
  272. package/contracts/shared/ContractDeployerLib.sol +72 -0
  273. package/contracts/shared/ERC165.sol +6 -2
  274. package/contracts/shared/INftOwnable.sol +22 -0
  275. package/contracts/shared/IRegisterable.sol +8 -17
  276. package/contracts/shared/IService.sol +16 -0
  277. package/contracts/shared/IVersionable.sol +44 -13
  278. package/contracts/shared/NftOwnable.sol +136 -0
  279. package/contracts/shared/ProxyManager.sol +94 -0
  280. package/contracts/shared/Registerable.sol +63 -59
  281. package/contracts/shared/Service.sol +60 -0
  282. package/contracts/shared/TokenHandler.sol +27 -0
  283. package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
  284. package/contracts/shared/Versionable.sol +110 -62
  285. package/contracts/test/TestFee.sol +2 -2
  286. package/contracts/test/TestRegisterable.sol +5 -6
  287. package/contracts/test/TestRoleId.sol +1 -1
  288. package/contracts/test/TestService.sol +7 -14
  289. package/contracts/types/DistributorType.sol +55 -0
  290. package/contracts/types/Fee.sol +3 -3
  291. package/contracts/types/Key32.sol +8 -3
  292. package/contracts/types/NftIdSet.sol +26 -24
  293. package/contracts/types/NumberId.sol +52 -0
  294. package/contracts/types/ObjectType.sol +35 -14
  295. package/contracts/types/Referral.sol +85 -0
  296. package/contracts/types/RoleId.sol +61 -9
  297. package/contracts/types/StateId.sol +5 -1
  298. package/contracts/types/Timestamp.sol +7 -3
  299. package/contracts/types/UFixed.sol +128 -12
  300. package/contracts/types/Version.sol +5 -1
  301. package/package.json +4 -3
  302. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
  303. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +0 -174
  304. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
  305. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -174
  306. package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +0 -4
  307. package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.json +0 -24
  308. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
  309. package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
  310. package/artifacts/contracts/instance/base/IService.sol/IService.json +0 -341
  311. package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +0 -4
  312. package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +0 -4
  313. package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
  314. package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +0 -4
  315. package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.json +0 -333
  316. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +0 -4
  317. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.json +0 -10
  318. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +0 -4
  319. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.json +0 -333
  320. package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +0 -4
  321. package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +0 -297
  322. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +0 -4
  323. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +0 -4
  324. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +0 -297
  325. package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
  326. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +0 -4
  327. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.json +0 -10
  328. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +0 -4
  329. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.json +0 -117
  330. package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.dbg.json +0 -4
  331. package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.json +0 -10
  332. package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.dbg.json +0 -4
  333. package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +0 -4
  334. package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.json +0 -10
  335. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
  336. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
  337. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +0 -284
  338. package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
  339. package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +0 -284
  340. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +0 -4
  341. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.json +0 -10
  342. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
  343. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +0 -144
  344. package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
  345. package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +0 -144
  346. package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +0 -4
  347. package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +0 -4
  348. package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.json +0 -113
  349. package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +0 -4
  350. package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +0 -131
  351. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +0 -4
  352. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +0 -4
  353. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +0 -511
  354. package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +0 -4
  355. package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +0 -76
  356. package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +0 -4
  357. package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +0 -511
  358. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
  359. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -618
  360. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
  361. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
  362. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +0 -452
  363. package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +0 -4
  364. package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.json +0 -24
  365. package/artifacts/contracts/registry/RegistryUpgradeable.sol/RegistryUpgradeable.dbg.json +0 -4
  366. package/artifacts/contracts/registry/RegistryUpgradeable.sol/RegistryUpgradeable.json +0 -711
  367. package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +0 -4
  368. package/artifacts/contracts/shared/IOwnable.sol/IOwnable.json +0 -24
  369. package/artifacts/contracts/shared/Proxy.sol/Proxy.dbg.json +0 -4
  370. package/artifacts/contracts/shared/Proxy.sol/Proxy.json +0 -235
  371. package/artifacts/contracts/shared/Proxy.sol/ProxyWithProxyAdminGetter.dbg.json +0 -4
  372. package/artifacts/contracts/shared/VersionableUpgradeable.sol/VersionableUpgradeable.dbg.json +0 -4
  373. package/artifacts/contracts/shared/VersionableUpgradeable.sol/VersionableUpgradeable.json +0 -228
  374. package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.dbg.json +0 -4
  375. package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +0 -405
  376. package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +0 -4
  377. package/artifacts/contracts/test/TestPool.sol/TestPool.json +0 -578
  378. package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +0 -4
  379. package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +0 -575
  380. package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.dbg.json +0 -4
  381. package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.json +0 -99
  382. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
  383. package/contracts/components/BaseComponent.sol +0 -94
  384. package/contracts/components/IBaseComponent.sol +0 -19
  385. package/contracts/experiment/statemachine/README.md +0 -112
  386. package/contracts/instance/IInstanceLinked.sol +0 -8
  387. package/contracts/instance/base/ComponentServiceBase.sol +0 -42
  388. package/contracts/instance/base/IService.sol +0 -15
  389. package/contracts/instance/base/InstanceBase.sol +0 -91
  390. package/contracts/instance/base/ModuleBase.sol +0 -57
  391. package/contracts/instance/base/ServiceBase.sol +0 -37
  392. package/contracts/instance/module/access/Access.sol +0 -149
  393. package/contracts/instance/module/access/IAccess.sol +0 -53
  394. package/contracts/instance/module/bundle/BundleModule.sol +0 -134
  395. package/contracts/instance/module/bundle/IBundle.sol +0 -53
  396. package/contracts/instance/module/component/ComponentModule.sol +0 -70
  397. package/contracts/instance/module/component/IComponent.sol +0 -28
  398. package/contracts/instance/module/distribution/DistributionModule.sol +0 -17
  399. package/contracts/instance/module/distribution/IDistribution.sol +0 -10
  400. package/contracts/instance/module/policy/IPolicy.sol +0 -63
  401. package/contracts/instance/module/policy/PolicyModule.sol +0 -91
  402. package/contracts/instance/module/pool/IPoolModule.sol +0 -40
  403. package/contracts/instance/module/pool/PoolModule.sol +0 -90
  404. package/contracts/instance/module/risk/IRisk.sol +0 -26
  405. package/contracts/instance/module/risk/RiskModule.sol +0 -62
  406. package/contracts/instance/module/treasury/ITreasury.sol +0 -82
  407. package/contracts/instance/module/treasury/TokenHandler.sol +0 -48
  408. package/contracts/instance/module/treasury/TreasuryModule.sol +0 -138
  409. package/contracts/instance/service/ComponentOwnerService.sol +0 -157
  410. package/contracts/instance/service/IComponentOwnerService.sol +0 -22
  411. package/contracts/registry/IChainNft.sol +0 -21
  412. package/contracts/registry/IRegistryLinked.sol +0 -8
  413. package/contracts/registry/RegistryUpgradeable.sol +0 -548
  414. package/contracts/shared/IOwnable.sol +0 -6
  415. package/contracts/shared/Proxy.sol +0 -89
  416. package/contracts/shared/VersionableUpgradeable.sol +0 -120
  417. package/contracts/test/TestDistribution.sol +0 -21
  418. package/contracts/test/TestPool.sol +0 -25
  419. package/contracts/test/TestProduct.sol +0 -72
  420. package/contracts/types/ReferralId.sol +0 -48
@@ -170,8 +170,8 @@
170
170
  "type": "function"
171
171
  }
172
172
  ],
173
- "bytecode": "0x61039161003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea26469706673582212208f9511a0a2a546b8c04a7a10d6336736c2c01718b45d7da4362c9eb1545731ca64736f6c63430008140033",
174
- "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea26469706673582212208f9511a0a2a546b8c04a7a10d6336736c2c01718b45d7da4362c9eb1545731ca64736f6c63430008140033",
173
+ "bytecode": "0x61039161003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea264697066735822122096e4b37266f82e0aaf6f30afa90c545c35f82576ca3b67d630233921e58f525b64736f6c63430008140033",
174
+ "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea264697066735822122096e4b37266f82e0aaf6f30afa90c545c35f82576ca3b67d630233921e58f525b64736f6c63430008140033",
175
175
  "linkReferences": {},
176
176
  "deployedLinkReferences": {}
177
177
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/c989a987042e12713329d6223800c8b9.json"
3
+ "buildInfo": "../../../build-info/e54a45d99367d9556932f13b1554e20b.json"
4
4
  }
@@ -7,7 +7,7 @@
7
7
  "inputs": [
8
8
  {
9
9
  "internalType": "VersionPart",
10
- "name": "x",
10
+ "name": "a",
11
11
  "type": "uint8"
12
12
  }
13
13
  ],
@@ -21,10 +21,29 @@
21
21
  ],
22
22
  "stateMutability": "pure",
23
23
  "type": "function"
24
+ },
25
+ {
26
+ "inputs": [
27
+ {
28
+ "internalType": "uint256",
29
+ "name": "a",
30
+ "type": "uint256"
31
+ }
32
+ ],
33
+ "name": "toVersionPart",
34
+ "outputs": [
35
+ {
36
+ "internalType": "VersionPart",
37
+ "name": "",
38
+ "type": "uint8"
39
+ }
40
+ ],
41
+ "stateMutability": "pure",
42
+ "type": "function"
24
43
  }
25
44
  ],
26
- "bytecode": "0x60b9610039600b82828239805160001a60731461002c57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063ac43d834146038575b600080fd5b60496043366004605b565b60ff1690565b60405190815260200160405180910390f35b600060208284031215606c57600080fd5b813560ff81168114607c57600080fd5b939250505056fea2646970667358221220c9c379b3b5ac83b5051ce617e894b84028046aca89e19f78215b3a3e8442fad464736f6c63430008140033",
27
- "deployedBytecode": "0x730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063ac43d834146038575b600080fd5b60496043366004605b565b60ff1690565b60405190815260200160405180910390f35b600060208284031215606c57600080fd5b813560ff81168114607c57600080fd5b939250505056fea2646970667358221220c9c379b3b5ac83b5051ce617e894b84028046aca89e19f78215b3a3e8442fad464736f6c63430008140033",
45
+ "bytecode": "0x60fb610039600b82828239805160001a60731461002c57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80638e4ad86c146042578063ac43d834146067575b600080fd5b6050604d3660046085565b90565b60405160ff90911681526020015b60405180910390f35b60786072366004609d565b60ff1690565b604051908152602001605e565b600060208284031215609657600080fd5b5035919050565b60006020828403121560ae57600080fd5b813560ff8116811460be57600080fd5b939250505056fea264697066735822122074bb6f75f2cab9692d05e41844bf40283045a9440c662c37a97b2502d38207ed64736f6c63430008140033",
46
+ "deployedBytecode": "0x7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80638e4ad86c146042578063ac43d834146067575b600080fd5b6050604d3660046085565b90565b60405160ff90911681526020015b60405180910390f35b60786072366004609d565b60ff1690565b604051908152602001605e565b600060208284031215609657600080fd5b5035919050565b60006020828403121560ae57600080fd5b813560ff8116811460be57600080fd5b939250505056fea264697066735822122074bb6f75f2cab9692d05e41844bf40283045a9440c662c37a97b2502d38207ed64736f6c63430008140033",
28
47
  "linkReferences": {},
29
48
  "deployedLinkReferences": {}
30
49
  }
@@ -0,0 +1,179 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
5
+ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
6
+ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
7
+
8
+ import {IComponent} from "./IComponent.sol";
9
+ import {IProductService} from "../instance/service/IProductService.sol";
10
+ import {IInstanceService} from "../instance/IInstanceService.sol";
11
+ import {IInstance} from "../instance/IInstance.sol";
12
+ import {InstanceAccessManager} from "../instance/InstanceAccessManager.sol";
13
+ import {IRegistry} from "../registry/IRegistry.sol";
14
+ import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
15
+ import {ObjectType, INSTANCE, PRODUCT} from "../types/ObjectType.sol";
16
+ import {VersionLib} from "../types/Version.sol";
17
+ import {Registerable} from "../shared/Registerable.sol";
18
+ import {RoleId, RoleIdLib} from "../types/RoleId.sol";
19
+ import {IAccess} from "../instance/module/IAccess.sol";
20
+
21
+ // TODO discuss to inherit from oz accessmanaged
22
+ // TODO make contract upgradeable, then add ComponentUpradeable that also intherits from Versionable
23
+ // same pattern as for Service which is also upgradeable
24
+ abstract contract Component is
25
+ Registerable,
26
+ IComponent,
27
+ AccessManagedUpgradeable
28
+ {
29
+ IInstanceService internal _instanceService;
30
+ IProductService internal _productService;
31
+
32
+ IInstance internal _instance;
33
+ IERC20Metadata internal _token;
34
+ address internal _wallet;
35
+ NftId internal _productNftId;
36
+
37
+ modifier onlyProductService() {
38
+ if(msg.sender != address(_productService)) {
39
+ revert ErrorComponentNotProductService(msg.sender);
40
+ }
41
+ _;
42
+ }
43
+
44
+ // TODO discuss replacement with modifier restricted from accessmanaged
45
+ modifier onlyInstanceRole(uint64 roleIdNum) {
46
+ RoleId roleId = RoleIdLib.toRoleId(roleIdNum);
47
+ InstanceAccessManager accessManager = InstanceAccessManager(_instance.authority());
48
+ if( !accessManager.hasRole(roleId, msg.sender)) {
49
+ revert ErrorComponentUnauthorized(msg.sender, roleIdNum);
50
+ }
51
+ _;
52
+ }
53
+
54
+ // TODO discuss replacement with modifier restricted from accessmanaged
55
+ modifier isNotLocked() {
56
+ InstanceAccessManager accessManager = InstanceAccessManager(_instance.authority());
57
+ if (accessManager.isTargetLocked(address(this))) {
58
+ revert IAccess.ErrorIAccessTargetLocked(address(this));
59
+ }
60
+ _;
61
+ }
62
+
63
+ function __initialize_component (
64
+ address registry,
65
+ NftId instanceNftId,
66
+ address token,
67
+ ObjectType componentType,
68
+ bool isInterceptor,
69
+ address initialOwner
70
+ ) internal
71
+ {
72
+ bytes memory data = "";
73
+ _initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
74
+
75
+ IRegistry.ObjectInfo memory instanceInfo = _registry.getObjectInfo(instanceNftId);
76
+ _instance = IInstance(instanceInfo.objectAddress);
77
+ require(
78
+ _instance.supportsInterface(type(IInstance).interfaceId),
79
+ ""
80
+ );
81
+
82
+ _instanceService = IInstanceService(_registry.getServiceAddress(INSTANCE(), VersionLib.toVersion(3, 0, 0).toMajorPart()));
83
+ _productService = IProductService(_registry.getServiceAddress(PRODUCT(), VersionLib.toVersion(3, 0, 0).toMajorPart()));
84
+ _wallet = address(this);
85
+ _token = IERC20Metadata(token);
86
+
87
+ _registerInterface(type(IComponent).interfaceId);
88
+ }
89
+
90
+ // TODO discuss replacement with modifier restricted from accessmanaged
91
+ function lock() external onlyOwner override {
92
+ _instanceService.setTargetLocked(getName(), true);
93
+ }
94
+
95
+ // TODO discuss replacement with modifier restricted from accessmanaged
96
+ function unlock() external onlyOwner override {
97
+ _instanceService.setTargetLocked(getName(), false);
98
+ }
99
+
100
+ // TODO discuss to split this base contract into a minimal component base (eg oracle)
101
+ // and a component base that is linked to a product component (all others in v3)
102
+ function setProductNftId(NftId productNftId)
103
+ external
104
+ override
105
+ onlyProductService()
106
+ {
107
+ if(_productNftId.gtz()) {
108
+ revert ErrorComponentProductNftAlreadySet();
109
+ }
110
+
111
+ _productNftId = productNftId;
112
+ }
113
+
114
+ /// @dev Sets the wallet address for the component.
115
+ /// if the current wallet has tokens, these will be transferred.
116
+ /// if the new wallet address is externally owned, an approval from the
117
+ /// owner of the external wallet for the component to move all tokens must exist.
118
+ function setWallet(address newWallet) external override onlyOwner {
119
+ address currentWallet = _wallet;
120
+ uint256 currentBalance = _token.balanceOf(currentWallet);
121
+
122
+ // checks
123
+ if (newWallet == currentWallet) {
124
+ revert ErrorComponentWalletAddressIsSameAsCurrent(newWallet);
125
+ }
126
+
127
+ if (currentBalance > 0) {
128
+ if (currentWallet == address(this)) {
129
+ // move tokens from component smart contract to external wallet
130
+ } else {
131
+ // move tokens from external wallet to component smart contract or another external wallet
132
+ uint256 allowance = _token.allowance(currentWallet, address(this));
133
+ if (allowance < currentBalance) {
134
+ revert ErrorComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
135
+ }
136
+ }
137
+ }
138
+
139
+ // effects
140
+ _wallet = newWallet;
141
+ emit LogComponentWalletAddressChanged(newWallet);
142
+
143
+ // interactions
144
+ if (currentBalance > 0) {
145
+ // transfer tokens from current wallet to new wallet
146
+ if (currentWallet == address(this)) {
147
+ // transferFrom requires self allowance too
148
+ _token.approve(address(this), currentBalance);
149
+ }
150
+
151
+ SafeERC20.safeTransferFrom(_token, currentWallet, newWallet, currentBalance);
152
+ emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
153
+ }
154
+ }
155
+
156
+ // TODO set name via constructor or initialization, pure function likely too restrictive
157
+ function getName() public pure virtual returns (string memory name);
158
+
159
+ function getWallet()
160
+ external
161
+ view
162
+ override
163
+ returns (address walletAddress)
164
+ {
165
+ return _wallet;
166
+ }
167
+
168
+ function getToken() public view override returns (IERC20Metadata token) {
169
+ return _token;
170
+ }
171
+
172
+ function getInstance() public view override returns (IInstance instance) {
173
+ return _instance;
174
+ }
175
+
176
+ function getProductNftId() public view override returns (NftId productNftId) {
177
+ return _productNftId;
178
+ }
179
+ }
@@ -1,48 +1,52 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.19;
3
3
 
4
- import {ObjectType, DISTRIBUTION} from "../types/ObjectType.sol";
4
+ import {DISTRIBUTION} from "../types/ObjectType.sol";
5
5
  import {IDistributionService} from "../instance/service/IDistributionService.sol";
6
6
  import {IProductService} from "../instance/service/IProductService.sol";
7
- import {NftId} from "../types/NftId.sol";
8
- import {ReferralId} from "../types/ReferralId.sol";
7
+ import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
8
+ import {ReferralId} from "../types/Referral.sol";
9
9
  import {Fee, FeeLib} from "../types/Fee.sol";
10
- import {BaseComponent} from "./BaseComponent.sol";
10
+ import {Component} from "./Component.sol";
11
11
  import {IDistributionComponent} from "./IDistributionComponent.sol";
12
-
13
- contract Distribution is
14
- BaseComponent,
12
+ import {IRegistry} from "../registry/IRegistry.sol";
13
+ import {IRegisterable} from "../shared/IRegisterable.sol";
14
+ import {ISetup} from "../instance/module/ISetup.sol";
15
+ import {Registerable} from "../shared/Registerable.sol";
16
+ import {TokenHandler} from "../shared/TokenHandler.sol";
17
+ import {InstanceReader} from "../instance/InstanceReader.sol";
18
+
19
+ abstract contract Distribution is
20
+ Component,
15
21
  IDistributionComponent
16
22
  {
23
+ using NftIdLib for NftId;
17
24
 
18
25
  Fee internal _initialDistributionFee;
19
26
  bool internal _isVerifying;
20
27
 
21
- IDistributionService private _distributionService;
22
- IProductService private _productService;
28
+ TokenHandler internal _tokenHandler;
23
29
 
24
- modifier onlyProductService() {
25
- require(
26
- msg.sender == address(_productService),
27
- "ERROR:POL-002:NOT_PRODUCT_SERVICE");
28
- _;
29
- }
30
+ IDistributionService private _distributionService;
30
31
 
31
- constructor(
32
+ function __initialize(
32
33
  address registry,
33
34
  NftId instanceNftId,
34
35
  // TODO refactor into tokenNftId
35
36
  address token,
36
37
  bool verifying,
37
- Fee memory distributionFee
38
- )
39
- BaseComponent(registry, instanceNftId, token)
40
- {
38
+ Fee memory distributionFee,
39
+ address initialOwner
40
+ ) internal {
41
+ __initialize_component(registry, instanceNftId, token, DISTRIBUTION(), true, initialOwner);
42
+
41
43
  _isVerifying = verifying;
42
44
  _initialDistributionFee = distributionFee;
43
45
 
46
+ _tokenHandler = TokenHandler(token);
44
47
  _distributionService = _instance.getDistributionService();
45
- _productService = _instance.getProductService();
48
+
49
+ _registerInterface(type(IDistributionComponent).interfaceId);
46
50
  }
47
51
 
48
52
 
@@ -64,7 +68,8 @@ contract Distribution is
64
68
  virtual override
65
69
  returns (uint256 feeAmount)
66
70
  {
67
- Fee memory fee = getDistributionFee();
71
+ ISetup.DistributionSetupInfo memory setupInfo = getSetupInfo();
72
+ Fee memory fee = setupInfo.distributionFee;
68
73
  (feeAmount,) = FeeLib.calculateFee(fee, netPremiumAmount);
69
74
  }
70
75
 
@@ -109,24 +114,41 @@ contract Distribution is
109
114
  return false;
110
115
  }
111
116
 
112
- /// @dev default distribution fee, ie when not using any valid referralId
113
- function getDistributionFee() public view returns (Fee memory distributionFee) {
114
- NftId productNftId = _instance.getProductNftId(getNftId());
115
- if (_instance.hasTreasuryInfo(productNftId)) {
116
- return _instance.getTreasuryInfo(productNftId).distributionFee;
117
- } else {
118
- return _initialDistributionFee;
119
- }
117
+ function getSetupInfo() public view returns (ISetup.DistributionSetupInfo memory setupInfo) {
118
+ InstanceReader reader = _instance.getInstanceReader();
119
+ return reader.getDistributionSetupInfo(getNftId());
120
120
  }
121
-
121
+
122
122
 
123
123
  /// @dev returns true iff the component needs to be called when selling/renewing policis
124
124
  function isVerifying() external view returns (bool verifying) {
125
125
  return _isVerifying;
126
126
  }
127
127
 
128
- // from registerable
129
- function getType() public pure override returns (ObjectType) {
130
- return DISTRIBUTION();
128
+ // from IRegisterable
129
+
130
+ function getInitialInfo()
131
+ public
132
+ view
133
+ override (IRegisterable, Registerable)
134
+ returns(IRegistry.ObjectInfo memory, bytes memory)
135
+ {
136
+ (
137
+ IRegistry.ObjectInfo memory info,
138
+ ) = super.getInitialInfo();
139
+
140
+ return (
141
+ info,
142
+ abi.encode(
143
+ getName(),
144
+ ISetup.DistributionSetupInfo(
145
+ _productNftId,
146
+ _tokenHandler,
147
+ _initialDistributionFee,
148
+ _isVerifying,
149
+ address(this)
150
+ )
151
+ )
152
+ );
131
153
  }
132
154
  }
@@ -0,0 +1,37 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
+
6
+ import {IRegisterable} from "../shared/IRegisterable.sol";
7
+ import {IInstance} from "../instance/IInstance.sol";
8
+ import {NftId} from "../types/NftId.sol";
9
+
10
+ interface IComponent is IRegisterable {
11
+
12
+ error ErrorComponentProductNftAlreadySet();
13
+ error ErrorComponentWalletAddressIsSameAsCurrent(address newWallet);
14
+ error ErrorComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
15
+ error ErrorComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
16
+ error ErrorComponentNotProductService(address caller);
17
+
18
+ event LogComponentWalletAddressChanged(address newWallet);
19
+ event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
20
+
21
+ function getName() external pure returns (string memory name);
22
+
23
+ // TODO remove and replace with accessmanaged target locking mechanism
24
+ function lock() external;
25
+ function unlock() external;
26
+
27
+ function getToken() external view returns (IERC20Metadata token);
28
+
29
+ function setWallet(address walletAddress) external;
30
+ function getWallet() external view returns (address walletAddress);
31
+
32
+ function getInstance() external view returns (IInstance instance);
33
+
34
+ function setProductNftId(NftId productNftId) external;
35
+ function getProductNftId() external view returns (NftId productNftId);
36
+
37
+ }
@@ -2,11 +2,11 @@
2
2
  pragma solidity ^0.8.19;
3
3
 
4
4
  import {Fee} from "../types/Fee.sol";
5
- import {ReferralId} from "../types/ReferralId.sol";
5
+ import {ReferralId} from "../types/Referral.sol";
6
6
  import {NftId} from "../types/NftId.sol";
7
- import {IBaseComponent} from "./IBaseComponent.sol";
7
+ import {ISetup} from "../instance/module/ISetup.sol";
8
8
 
9
- interface IDistributionComponent is IBaseComponent {
9
+ interface IDistributionComponent {
10
10
 
11
11
  function setFees(
12
12
  Fee memory distributionFee
@@ -39,9 +39,6 @@ interface IDistributionComponent is IBaseComponent {
39
39
  /// @dev returns true iff the referral id is valid
40
40
  function referralIsValid(ReferralId referralId) external view returns (bool isValid);
41
41
 
42
- /// @dev default distribution fee, ie when not using any valid referralId
43
- function getDistributionFee() external view returns (Fee memory distributionFee);
44
-
45
42
  /// @dev returns true iff the component needs to be called when selling/renewing policis
46
43
  function isVerifying() external view returns (bool verifying);
47
44
  }
@@ -1,12 +1,11 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
2
+ pragma solidity ^0.8.20;
3
3
 
4
4
  import {NftId} from "../types/NftId.sol";
5
5
  import {Fee} from "../types/Fee.sol";
6
6
  import {UFixed} from "../types/UFixed.sol";
7
- import {IBaseComponent} from "./IBaseComponent.sol";
8
7
 
9
- interface IPoolComponent is IBaseComponent {
8
+ interface IPoolComponent {
10
9
 
11
10
  event LogUnderwrittenByPool(NftId policyNftId, uint256 collateralizationAmount, address pool);
12
11
 
@@ -44,6 +43,10 @@ interface IPoolComponent is IBaseComponent {
44
43
  uint256 collateralizationAmount
45
44
  ) external;
46
45
 
46
+ function lockBundle(NftId bundleNftId) external;
47
+
48
+ function unlockBundle(NftId bundleNftId) external;
49
+
47
50
  /**
48
51
  * @dev returns true iff the policy application data in policyData matches
49
52
  * with the bundle filter criteria encoded in bundleFilter.
@@ -56,16 +59,8 @@ interface IPoolComponent is IBaseComponent {
56
59
  view
57
60
  returns (bool isMatching);
58
61
 
59
- function isVerifying() external view returns (bool verifying);
62
+ function isConfirmingApplication() external view returns (bool isConfirmingApplication);
60
63
 
61
64
  function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
62
65
 
63
- function getPoolFee() external view returns (Fee memory poolFee);
64
-
65
- function getStakingFee() external view returns (Fee memory stakingFee);
66
-
67
- function getPerformanceFee()
68
- external
69
- view
70
- returns (Fee memory performanceFee);
71
66
  }
@@ -1,14 +1,13 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
2
+ pragma solidity ^0.8.20;
3
3
 
4
4
  import {Fee} from "../types/Fee.sol";
5
5
  import {NftId} from "../types/NftId.sol";
6
- import {ReferralId} from "../types/ReferralId.sol";
6
+ import {ReferralId} from "../types/Referral.sol";
7
7
  import {RiskId} from "../types/RiskId.sol";
8
8
 
9
- import {IBaseComponent} from "./IBaseComponent.sol";
9
+ interface IProductComponent {
10
10
 
11
- interface IProductComponent is IBaseComponent {
12
11
  function setFees(
13
12
  Fee memory productFee,
14
13
  Fee memory processingFee
@@ -19,8 +18,8 @@ interface IProductComponent is IBaseComponent {
19
18
  RiskId riskId,
20
19
  uint256 lifetime,
21
20
  bytes memory applicationData,
22
- ReferralId referralId,
23
- NftId bundleNftId
21
+ NftId bundleNftId,
22
+ ReferralId referralId
24
23
  ) external view returns (uint256 premiumAmount);
25
24
 
26
25
  function calculateNetPremium(
@@ -30,9 +29,7 @@ interface IProductComponent is IBaseComponent {
30
29
  bytes memory applicationData
31
30
  ) external view returns (uint256 netPremiumAmount);
32
31
 
33
- function getProductFee() external view returns (Fee memory productFee);
34
- function getProcessingFee() external view returns (Fee memory processingFee);
35
-
32
+
36
33
  function getPoolNftId() external view returns (NftId poolNftId);
37
34
  function getDistributionNftId() external view returns (NftId distributionNftId);
38
35
  }