@etherisc/gif-next 0.0.2-7631288 → 0.0.2-770fd3b-604

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 (363) hide show
  1. package/README.md +524 -2
  2. package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
  3. package/artifacts/contracts/components/Component.sol/Component.json +897 -0
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +1433 -0
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
  7. package/artifacts/contracts/components/IComponent.sol/IComponent.json +520 -0
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +950 -0
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +894 -0
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +4 -0
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +813 -0
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +4 -0
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +1366 -0
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +4 -0
  17. package/artifacts/contracts/components/Product.sol/Product.json +1290 -0
  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 +4 -0
  25. package/artifacts/contracts/experiment/errors/Require.sol/Require.json +105 -0
  26. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +4 -0
  27. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +105 -0
  28. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +4 -0
  29. package/artifacts/contracts/experiment/inheritance/A.sol/A.json +128 -0
  30. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +4 -0
  31. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +42 -0
  32. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +4 -0
  33. package/artifacts/contracts/experiment/inheritance/B.sol/B.json +76 -0
  34. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +4 -0
  35. package/artifacts/contracts/experiment/inheritance/C.sol/C.json +89 -0
  36. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +4 -0
  37. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.json +128 -0
  38. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +4 -0
  39. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.json +37 -0
  40. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +4 -0
  41. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.json +50 -0
  42. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +4 -0
  43. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.json +63 -0
  44. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +4 -0
  45. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +59 -0
  46. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +4 -0
  47. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +124 -0
  48. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +4 -0
  49. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +74 -0
  50. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +4 -0
  51. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +124 -0
  52. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +4 -0
  53. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +207 -0
  54. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +4 -0
  55. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +10 -0
  56. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +4 -0
  57. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +10 -0
  58. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
  59. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +764 -0
  60. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
  61. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +185 -0
  62. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +4 -0
  63. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +2387 -0
  64. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
  65. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +674 -0
  66. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +4 -0
  67. package/artifacts/contracts/instance/Instance.sol/Instance.json +3323 -0
  68. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
  69. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +984 -0
  70. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
  71. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1386 -0
  72. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
  73. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +1260 -0
  74. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
  75. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +610 -0
  76. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
  77. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +261 -0
  78. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
  79. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +754 -0
  80. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
  81. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +429 -0
  82. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +4 -0
  83. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.json +115 -0
  84. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
  85. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +502 -0
  86. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +4 -0
  87. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +169 -0
  88. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +4 -0
  89. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +254 -0
  90. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +4 -0
  91. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.json +10 -0
  92. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +4 -0
  93. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.json +10 -0
  94. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +4 -0
  95. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.json +10 -0
  96. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +4 -0
  97. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.json +10 -0
  98. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +4 -0
  99. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.json +10 -0
  100. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +4 -0
  101. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.json +10 -0
  102. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
  103. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +1117 -0
  104. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
  105. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1318 -0
  106. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
  107. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +586 -0
  108. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
  109. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +1176 -0
  110. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
  111. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +602 -0
  112. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
  113. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +638 -0
  114. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
  115. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +798 -0
  116. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
  117. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +656 -0
  118. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
  119. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +784 -0
  120. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +4 -0
  121. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +512 -0
  122. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +4 -0
  123. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +549 -0
  124. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
  125. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1378 -0
  126. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
  127. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +642 -0
  128. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
  129. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +957 -0
  130. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
  131. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +574 -0
  132. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
  133. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +1007 -0
  134. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
  135. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +574 -0
  136. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +4 -0
  137. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +771 -0
  138. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +4 -0
  139. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +737 -0
  140. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
  141. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +999 -0
  142. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +4 -0
  143. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +34 -0
  144. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +4 -0
  145. package/artifacts/contracts/registry/Registry.sol/Registry.json +839 -0
  146. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
  147. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
  148. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
  149. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +1351 -0
  150. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
  151. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +601 -0
  152. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
  153. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
  154. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
  155. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +531 -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 +73 -0
  160. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
  161. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +164 -0
  162. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
  163. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
  164. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +4 -0
  165. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +214 -0
  166. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
  167. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +69 -0
  168. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
  169. package/artifacts/contracts/shared/IService.sol/IService.json +434 -0
  170. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +4 -0
  171. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +205 -0
  172. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
  173. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +303 -0
  174. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
  175. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +269 -0
  176. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +4 -0
  177. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +499 -0
  178. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +4 -0
  179. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +415 -0
  180. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
  181. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +105 -0
  182. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
  183. package/artifacts/contracts/shared/Service.sol/Service.json +627 -0
  184. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +4 -0
  185. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +96 -0
  186. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
  187. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
  188. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +4 -0
  189. package/artifacts/contracts/shared/Versionable.sol/Versionable.json +228 -0
  190. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +4 -0
  191. package/artifacts/contracts/test/TestFee.sol/TestFee.json +119 -0
  192. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +4 -0
  193. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +446 -0
  194. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +4 -0
  195. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +116 -0
  196. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +4 -0
  197. package/artifacts/contracts/test/TestService.sol/TestService.json +759 -0
  198. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +4 -0
  199. package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +376 -0
  200. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +4 -0
  201. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +218 -0
  202. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +4 -0
  203. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +286 -0
  204. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +4 -0
  205. package/artifacts/contracts/test/Usdc.sol/USDC.json +376 -0
  206. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +4 -0
  207. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.json +10 -0
  208. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +4 -0
  209. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +174 -0
  210. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +4 -0
  211. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +10 -0
  212. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
  213. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
  214. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +4 -0
  215. package/artifacts/contracts/types/Fee.sol/FeeLib.json +257 -0
  216. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +4 -0
  217. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +125 -0
  218. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +4 -0
  219. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +153 -0
  220. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +4 -0
  221. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +33 -0
  222. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +4 -0
  223. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +100 -0
  224. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +4 -0
  225. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +92 -0
  226. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +4 -0
  227. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +123 -0
  228. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +4 -0
  229. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +86 -0
  230. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +4 -0
  231. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +156 -0
  232. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +4 -0
  233. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +92 -0
  234. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +4 -0
  235. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +249 -0
  236. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
  237. package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
  238. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
  239. package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +479 -0
  240. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +4 -0
  241. package/artifacts/contracts/types/Version.sol/VersionLib.json +177 -0
  242. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +4 -0
  243. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +49 -0
  244. package/contracts/components/Component.sol +236 -0
  245. package/contracts/components/Distribution.sol +298 -0
  246. package/contracts/components/IComponent.sol +50 -0
  247. package/contracts/components/IDistributionComponent.sol +100 -0
  248. package/contracts/components/IPoolComponent.sol +87 -0
  249. package/contracts/components/IProductComponent.sol +39 -0
  250. package/contracts/components/Pool.sol +254 -0
  251. package/contracts/components/Product.sol +278 -0
  252. package/contracts/experiment/cloning/Cloner.sol +47 -0
  253. package/contracts/experiment/errors/Require.sol +38 -0
  254. package/contracts/experiment/errors/Revert.sol +44 -0
  255. package/contracts/experiment/inheritance/A.sol +53 -0
  256. package/contracts/experiment/inheritance/B.sol +28 -0
  257. package/contracts/experiment/inheritance/C.sol +34 -0
  258. package/contracts/experiment/inheritance/IA.sol +13 -0
  259. package/contracts/experiment/inheritance/IB.sol +10 -0
  260. package/contracts/experiment/inheritance/IC.sol +12 -0
  261. package/contracts/experiment/statemachine/Dummy.sol +27 -0
  262. package/contracts/experiment/statemachine/ISM.sol +25 -0
  263. package/contracts/experiment/statemachine/SM.sol +57 -0
  264. package/contracts/experiment/statemachine/SimpleStateMachine.sol +31 -0
  265. package/contracts/experiment/types/TypeA.sol +47 -0
  266. package/contracts/experiment/types/TypeB.sol +29 -0
  267. package/contracts/instance/BundleManager.sol +125 -0
  268. package/contracts/instance/Cloneable.sol +46 -0
  269. package/contracts/instance/IInstance.sol +86 -0
  270. package/contracts/instance/IInstanceService.sol +59 -0
  271. package/contracts/instance/Instance.sol +281 -0
  272. package/contracts/instance/InstanceAccessManager.sol +297 -0
  273. package/contracts/instance/InstanceReader.sol +293 -0
  274. package/contracts/instance/InstanceService.sol +433 -0
  275. package/contracts/instance/InstanceServiceManager.sol +54 -0
  276. package/contracts/instance/ObjectManager.sol +84 -0
  277. package/contracts/instance/base/ComponentService.sol +134 -0
  278. package/contracts/instance/base/IKeyValueStore.sol +49 -0
  279. package/contracts/instance/base/ILifecycle.sol +30 -0
  280. package/contracts/instance/base/KeyValueStore.sol +172 -0
  281. package/contracts/instance/base/Lifecycle.sol +100 -0
  282. package/contracts/instance/module/IAccess.sol +47 -0
  283. package/contracts/instance/module/IBundle.sol +20 -0
  284. package/contracts/instance/module/IDistribution.sol +39 -0
  285. package/contracts/instance/module/IPolicy.sol +45 -0
  286. package/contracts/instance/module/IRisk.sol +11 -0
  287. package/contracts/instance/module/ISetup.sol +47 -0
  288. package/contracts/instance/module/ITreasury.sol +23 -0
  289. package/contracts/instance/service/ApplicationService.sol +268 -0
  290. package/contracts/instance/service/BundleService.sol +298 -0
  291. package/contracts/instance/service/BundleServiceManager.sol +51 -0
  292. package/contracts/instance/service/DistributionService.sol +274 -0
  293. package/contracts/instance/service/DistributionServiceManager.sol +51 -0
  294. package/contracts/instance/service/IApplicationService.sol +82 -0
  295. package/contracts/instance/service/IBundleService.sol +54 -0
  296. package/contracts/instance/service/IDistributionService.sol +65 -0
  297. package/contracts/instance/service/IPolicyService.sol +88 -0
  298. package/contracts/instance/service/IPoolService.sol +20 -0
  299. package/contracts/instance/service/IProductService.sol +40 -0
  300. package/contracts/instance/service/PolicyService.sol +524 -0
  301. package/contracts/instance/service/PolicyServiceManager.sol +54 -0
  302. package/contracts/instance/service/PoolService.sol +109 -0
  303. package/contracts/instance/service/PoolServiceManager.sol +51 -0
  304. package/contracts/instance/service/ProductService.sol +233 -0
  305. package/contracts/instance/service/ProductServiceManager.sol +54 -0
  306. package/contracts/registry/ChainNft.sol +202 -0
  307. package/contracts/registry/IRegistry.sol +99 -0
  308. package/contracts/registry/IRegistryService.sol +65 -0
  309. package/contracts/registry/ITransferInterceptor.sol +6 -0
  310. package/contracts/registry/Registry.sol +462 -0
  311. package/contracts/registry/RegistryAccessManager.sol +216 -0
  312. package/contracts/registry/RegistryService.sol +261 -0
  313. package/contracts/registry/RegistryServiceManager.sol +62 -0
  314. package/contracts/registry/ReleaseManager.sol +332 -0
  315. package/contracts/registry/TokenRegistry.sol +113 -0
  316. package/contracts/shared/ContractDeployerLib.sol +72 -0
  317. package/contracts/shared/ERC165.sol +26 -0
  318. package/contracts/shared/INftOwnable.sol +28 -0
  319. package/contracts/shared/IPolicyHolder.sol +26 -0
  320. package/contracts/shared/IRegisterable.sol +15 -0
  321. package/contracts/shared/IRegistryLinked.sol +15 -0
  322. package/contracts/shared/IService.sol +16 -0
  323. package/contracts/shared/IVersionable.sol +96 -0
  324. package/contracts/shared/NftOwnable.sol +190 -0
  325. package/contracts/shared/PolicyHolder.sol +81 -0
  326. package/contracts/shared/ProxyManager.sol +95 -0
  327. package/contracts/shared/Registerable.sol +81 -0
  328. package/contracts/shared/RegistryLinked.sol +64 -0
  329. package/contracts/shared/Service.sol +60 -0
  330. package/contracts/shared/TokenHandler.sol +27 -0
  331. package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
  332. package/contracts/shared/Versionable.sol +148 -0
  333. package/contracts/test/TestFee.sol +25 -0
  334. package/contracts/test/TestRegisterable.sol +18 -0
  335. package/contracts/test/TestRoleId.sol +14 -0
  336. package/contracts/test/TestService.sol +25 -0
  337. package/contracts/{Dip.sol → test/TestToken.sol} +5 -5
  338. package/contracts/test/TestVersion.sol +44 -0
  339. package/contracts/test/TestVersionable.sol +17 -0
  340. package/contracts/test/Usdc.sol +26 -0
  341. package/contracts/types/AddressSet.sol +58 -0
  342. package/contracts/types/Blocknumber.sol +118 -0
  343. package/contracts/types/ChainId.sol +38 -0
  344. package/contracts/types/DistributorType.sol +55 -0
  345. package/contracts/types/Fee.sol +56 -0
  346. package/contracts/types/Key32.sol +50 -0
  347. package/contracts/types/NftId.sol +72 -0
  348. package/contracts/types/NftIdSet.sol +62 -0
  349. package/contracts/types/NumberId.sol +52 -0
  350. package/contracts/types/ObjectType.sol +156 -0
  351. package/contracts/types/Referral.sol +85 -0
  352. package/contracts/types/RiskId.sol +43 -0
  353. package/contracts/types/RoleId.sol +90 -0
  354. package/contracts/types/StateId.sol +105 -0
  355. package/contracts/types/Timestamp.sol +127 -0
  356. package/contracts/types/UFixed.sol +325 -0
  357. package/contracts/types/Version.sol +107 -0
  358. package/package.json +26 -10
  359. package/artifacts/contracts/Dip.sol/DIP.dbg.json +0 -4
  360. package/artifacts/contracts/Dip.sol/DIP.json +0 -338
  361. package/artifacts/contracts/Lock.sol/Lock.dbg.json +0 -4
  362. package/artifacts/contracts/Lock.sol/Lock.json +0 -74
  363. package/contracts/Lock.sol +0 -34
@@ -0,0 +1,274 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {IRegistry} from "../../registry/IRegistry.sol";
5
+ import {IInstance} from "../../instance/IInstance.sol";
6
+ import {InstanceAccessManager} from "../InstanceAccessManager.sol";
7
+ import {InstanceReader} from "../../instance/InstanceReader.sol";
8
+ import {ISetup} from "../../instance/module/ISetup.sol";
9
+
10
+ import {NftId, NftIdLib} from "../../types/NftId.sol";
11
+ import {Fee} from "../../types/Fee.sol";
12
+ import {DISTRIBUTION_OWNER_ROLE} from "../../types/RoleId.sol";
13
+ import {KEEP_STATE} from "../../types/StateId.sol";
14
+ import {ObjectType, DISTRIBUTION, INSTANCE, DISTRIBUTION, DISTRIBUTOR} from "../../types/ObjectType.sol";
15
+ import {Version, VersionLib} from "../../types/Version.sol";
16
+
17
+ import {IVersionable} from "../../shared/IVersionable.sol";
18
+ import {Versionable} from "../../shared/Versionable.sol";
19
+
20
+ import {IService} from "../../shared/IService.sol";
21
+ import {Service} from "../../shared/Service.sol";
22
+ import {ComponentService} from "../base/ComponentService.sol";
23
+ import {InstanceService} from "../InstanceService.sol";
24
+ import {IComponent} from "../../components/IComponent.sol";
25
+ import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
26
+ import {IDistributionService} from "./IDistributionService.sol";
27
+
28
+ import {UFixed} from "../../types/UFixed.sol";
29
+ import {DistributorType, DistributorTypeLib} from "../../types/DistributorType.sol";
30
+ import {ReferralId, ReferralStatus, ReferralLib} from "../../types/Referral.sol";
31
+ import {Timestamp, TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
32
+ import {Key32} from "../../types/Key32.sol";
33
+ import {IDistribution} from "../module/IDistribution.sol";
34
+
35
+
36
+ contract DistributionService is
37
+ ComponentService,
38
+ IDistributionService
39
+ {
40
+ using NftIdLib for NftId;
41
+
42
+ address internal _registryAddress;
43
+
44
+ function _initialize(
45
+ address owner,
46
+ bytes memory data
47
+ )
48
+ internal
49
+ initializer
50
+ virtual override
51
+ {
52
+ address initialOwner;
53
+ address registryAddress;
54
+ (registryAddress, initialOwner) = abi.decode(data, (address, address));
55
+ // TODO while DistributionService is not deployed in DistributionServiceManager constructor
56
+ // owner is DistributionServiceManager deployer
57
+ initializeService(registryAddress, owner);
58
+ registerInterface(type(IDistributionService).interfaceId);
59
+ }
60
+
61
+ function getDomain() public pure override(Service, IService) returns(ObjectType) {
62
+ return DISTRIBUTION();
63
+ }
64
+
65
+ function register(address distributionAddress)
66
+ external
67
+ returns(NftId distributionNftId)
68
+ {
69
+ (
70
+ IComponent component,
71
+ address owner,
72
+ IInstance instance,
73
+ NftId instanceNftId
74
+ ) = _checkComponentForRegistration(
75
+ distributionAddress,
76
+ DISTRIBUTION(),
77
+ DISTRIBUTION_OWNER_ROLE());
78
+
79
+ IRegistry.ObjectInfo memory distributionInfo = getRegistryService().registerDistribution(component, owner);
80
+ IDistributionComponent distribution = IDistributionComponent(distributionAddress);
81
+ distribution.linkToRegisteredNftId();
82
+ distributionNftId = distributionInfo.nftId;
83
+
84
+ instance.createDistributionSetup(distributionNftId, distribution.getSetupInfo());
85
+ getInstanceService().createGifTarget(instanceNftId, distributionAddress, distribution.getName());
86
+ getInstanceService().grantDistributionDefaultPermissions(instanceNftId, distributionAddress, distribution.getName());
87
+ }
88
+
89
+ function setFees(
90
+ Fee memory distributionFee
91
+ )
92
+ external
93
+ override
94
+ {
95
+ (IRegistry.ObjectInfo memory info , IInstance instance) = _getAndVerifyComponentInfoAndInstance(DISTRIBUTION());
96
+ InstanceReader instanceReader = instance.getInstanceReader();
97
+ NftId distributionNftId = info.nftId;
98
+
99
+ ISetup.DistributionSetupInfo memory distSetupInfo = instanceReader.getDistributionSetupInfo(distributionNftId);
100
+ distSetupInfo.distributionFee = distributionFee;
101
+
102
+ instance.updateDistributionSetup(distributionNftId, distSetupInfo, KEEP_STATE());
103
+ }
104
+
105
+ function createDistributorType(
106
+ string memory name,
107
+ UFixed minDiscountPercentage,
108
+ UFixed maxDiscountPercentage,
109
+ UFixed commissionPercentage,
110
+ uint32 maxReferralCount,
111
+ uint32 maxReferralLifetime,
112
+ bool allowSelfReferrals,
113
+ bool allowRenewals,
114
+ bytes memory data
115
+ )
116
+ external
117
+ returns (DistributorType distributorType)
118
+ {
119
+ (,NftId distributionNftId, IInstance instance) = _getAndVerifyCallingDistribution();
120
+ distributorType = DistributorTypeLib.toDistributorType(distributionNftId, name);
121
+ Key32 key32 = distributorType.toKey32();
122
+
123
+ if(!instance.exists(key32)) {
124
+ IDistribution.DistributorTypeInfo memory info = IDistribution.DistributorTypeInfo(
125
+ name,
126
+ minDiscountPercentage,
127
+ maxDiscountPercentage,
128
+ commissionPercentage,
129
+ maxReferralCount,
130
+ maxReferralLifetime,
131
+ allowSelfReferrals,
132
+ allowRenewals,
133
+ data);
134
+
135
+ instance.createDistributorType(key32, info);
136
+ }
137
+ }
138
+
139
+ function createDistributor(
140
+ address distributor,
141
+ DistributorType distributorType,
142
+ bytes memory data
143
+ ) external returns (NftId distributorNftId)
144
+ {
145
+ (, NftId distributionNftId, IInstance instance) = _getAndVerifyCallingDistribution();
146
+
147
+ // FIXME: add this function
148
+ // distributorNftId = _registryService.registerDistributor(
149
+ // distributionNftId,
150
+ // DISTRIBUTOR(),
151
+ // true, // distribution module is intercepting
152
+ // distributor,
153
+ // "");
154
+
155
+ IDistribution.DistributorInfo memory info = IDistribution.DistributorInfo(
156
+ distributorType,
157
+ true, // active
158
+ data);
159
+
160
+ instance.createDistributor(distributorNftId, info);
161
+ }
162
+
163
+ function updateDistributorType(
164
+ NftId distributorNftId,
165
+ DistributorType distributorType,
166
+ bytes memory data
167
+ ) external virtual
168
+ {
169
+ (,, IInstance instance) = _getAndVerifyCallingDistribution();
170
+
171
+ IDistribution.DistributorInfo memory info = IDistribution.DistributorInfo(
172
+ distributorType,
173
+ true, // active
174
+ data);
175
+
176
+ instance.updateDistributor(distributorNftId, info, KEEP_STATE());
177
+ }
178
+
179
+
180
+ function createReferral(
181
+ NftId distributorNftId,
182
+ string memory code,
183
+ UFixed discountPercentage,
184
+ uint32 maxReferrals,
185
+ Timestamp expiryAt,
186
+ bytes memory data
187
+ )
188
+ external
189
+ virtual
190
+ returns (ReferralId referralId)
191
+ {
192
+ (,NftId distributionNftId, IInstance instance) = _getAndVerifyCallingDistribution();
193
+ require(bytes(code).length > 0, "ERROR:DSV-030:CODE_INVALID");
194
+ require(expiryAt > zeroTimestamp(), "ERROR:DSV-031:EXPIRY_AT_ZERO");
195
+
196
+ referralId = ReferralLib.toReferralId(distributionNftId, code);
197
+ IDistribution.ReferralInfo memory info = IDistribution.ReferralInfo(
198
+ distributorNftId,
199
+ code,
200
+ discountPercentage,
201
+ maxReferrals,
202
+ 0, // used referrals
203
+ expiryAt,
204
+ data
205
+ );
206
+
207
+ instance.createReferral(referralId.toKey32(), info);
208
+ return referralId;
209
+ }
210
+
211
+ function processSale(
212
+ ReferralId referralId,
213
+ uint256 premiumAmount
214
+ )
215
+ external
216
+ virtual
217
+ {
218
+ revert("NOT_IMPLEMENTED_YET");
219
+ }
220
+
221
+ function calculateFeeAmount(
222
+ ReferralId referralId,
223
+ uint256 premiumAmount
224
+ )
225
+ external
226
+ virtual
227
+ view
228
+ returns (uint256 feeAmount)
229
+ {
230
+ revert("NOT_IMPLEMENTED_YET");
231
+ }
232
+
233
+ function _getAndVerifyCallingDistribution()
234
+ internal
235
+ view
236
+ returns(
237
+ address distributionAddress,
238
+ NftId distributionNftId,
239
+ IInstance instance
240
+ )
241
+ {
242
+ ObjectType objectType;
243
+ (
244
+ distributionAddress,
245
+ distributionNftId,
246
+ objectType,
247
+ instance
248
+ ) = _getAndVerifyCaller();
249
+
250
+ require(objectType == DISTRIBUTION(), "ERROR:PRS-031:CALLER_NOT_DISTRUBUTION");
251
+ }
252
+
253
+ function _getAndVerifyCaller()
254
+ internal
255
+ view
256
+ returns(
257
+ address objectAddress,
258
+ NftId objectNftId,
259
+ ObjectType objectType,
260
+ IInstance instance
261
+ )
262
+ {
263
+ objectAddress = msg.sender;
264
+ objectNftId = getRegistry().getNftId(objectAddress);
265
+ require(objectNftId.gtz(), "ERROR:SRV-030:CALLER_UNKNOWN");
266
+ IRegistry.ObjectInfo memory info = getRegistry().getObjectInfo(objectNftId);
267
+ objectType = info.objectType;
268
+
269
+ IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(info.parentNftId);
270
+ require(parentInfo.objectType == INSTANCE(), "ERROR:SRV-031:PARENT_NOT_INSTANCE");
271
+ instance = IInstance(parentInfo.objectAddress);
272
+ }
273
+
274
+ }
@@ -0,0 +1,51 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IVersionable} from "../../shared/IVersionable.sol";
5
+ import {ProxyManager} from "../../shared/ProxyManager.sol";
6
+ import {DistributionService} from "./DistributionService.sol";
7
+ import {Registry} from "../../registry/Registry.sol";
8
+ import {RegistryService} from "../../registry/RegistryService.sol";
9
+ import {REGISTRY} from "../../types/ObjectType.sol";
10
+
11
+ contract DistributionServiceManager is ProxyManager {
12
+
13
+ DistributionService private _distributionService;
14
+
15
+ /// @dev initializes proxy manager with distribution service implementation and deploys instance
16
+ constructor(
17
+ address registryAddress
18
+ )
19
+ ProxyManager()
20
+ {
21
+ DistributionService distSrv = new DistributionService();
22
+ bytes memory data = abi.encode(registryAddress, address(this));
23
+ IVersionable versionable = deploy(
24
+ address(distSrv),
25
+ data);
26
+
27
+ _distributionService = DistributionService(address(versionable));
28
+
29
+ // TODO `thi` must have a role or own nft to register service
30
+ //Registry registry = Registry(registryAddress);
31
+ //address registryServiceAddress = registry.getServiceAddress(REGISTRY(), _distributionService.getMajorVersion());
32
+ //RegistryService registryService = RegistryService(registryServiceAddress);
33
+ //registryService.registerService(_distributionService);
34
+
35
+ // TODO no nft to link yet
36
+ // link ownership of instance service manager ot nft owner of instance service
37
+ //_linkToNftOwnable(
38
+ // address(registryAddress),
39
+ // address(_distributionService));
40
+ }
41
+
42
+ //--- view functions ----------------------------------------------------//
43
+ function getDistributionService()
44
+ external
45
+ view
46
+ returns (DistributionService distributionService)
47
+ {
48
+ return _distributionService;
49
+ }
50
+
51
+ }
@@ -0,0 +1,82 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {IRisk} from "../module/IRisk.sol";
5
+ import {IService} from "../../shared/IService.sol";
6
+
7
+ import {NftId} from "../../types/NftId.sol";
8
+ import {ReferralId} from "../../types/Referral.sol";
9
+ import {RiskId} from "../../types/RiskId.sol";
10
+ import {StateId} from "../../types/StateId.sol";
11
+ import {Timestamp} from "../../types/Timestamp.sol";
12
+ import {UFixed} from "../../types/UFixed.sol";
13
+ import {Fee} from "../../types/Fee.sol";
14
+
15
+ /// @dev gif service responsible for creating applications
16
+ /// only product components may call transaction functions
17
+ interface IApplicationService is IService {
18
+
19
+ error IApplicationServicePolicyNotApplied(NftId applicationNftId);
20
+
21
+ /// @dev creates a new application based on the specified attributes
22
+ /// may only be called by a product component
23
+ function create(
24
+ address applicationOwner,
25
+ RiskId riskId,
26
+ NftId bundleNftId,
27
+ ReferralId referralId,
28
+ uint256 sumInsuredAmount,
29
+ uint256 lifetime,
30
+ bytes memory applicationData
31
+ ) external returns (NftId applicationNftId);
32
+
33
+ /// @dev updates application attributes
34
+ /// may only be called while the application is in applied state
35
+ /// may only be called by the referenced product related to applicationNftId
36
+ function ajust(
37
+ NftId applicationNftId,
38
+ RiskId riskId,
39
+ NftId bundleNftId,
40
+ ReferralId referralId,
41
+ uint256 sumInsuredAmount,
42
+ uint256 lifetime,
43
+ bytes memory applicationData
44
+ ) external;
45
+
46
+ /// @dev creates a new application that extends the provided policy
47
+ /// lifetime will seamlessly extend referenced policy, for closed policies
48
+ /// lifetime will start at underwriting time
49
+ /// product will need to limit the time window for renewal as underwriting
50
+ /// will lock the collateral at underwriting time which might be earlier than activation time
51
+ /// policyNftId needs to refer to an underwritten (or active or closed) policy
52
+ /// may only be called by the referenced product related to policyNftId
53
+ function renew(
54
+ NftId policyNftId, // policy to be renewd (renewal inherits policy attributes)
55
+ NftId bundleNftId // will likely need a newer bundle for underwriting
56
+ ) external returns (NftId applicationNftId);
57
+
58
+ /// @dev revokes the application represented by {policyNftId}
59
+ /// an application can only be revoked in applied state
60
+ /// only the application holder may revoke an application
61
+ function revoke(NftId policyNftId) external;
62
+
63
+ /// @dev calculates the premium amount for the specified attributes
64
+ /// also returns the various fee components involved with creating a policy
65
+ function calculatePremium(
66
+ RiskId riskId,
67
+ uint256 sumInsuredAmount,
68
+ uint256 lifetime,
69
+ bytes memory applicationData,
70
+ NftId bundleNftId,
71
+ ReferralId referralId
72
+ )
73
+ external
74
+ view
75
+ returns (
76
+ uint256 premiumAmount,
77
+ uint256 distributionFeeAmount,
78
+ uint256 productFeeAmount,
79
+ uint256 poolFeeAmount,
80
+ uint256 bundleFeeAmount
81
+ );
82
+ }
@@ -0,0 +1,54 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {NftId} from "../../types/NftId.sol";
5
+ import {Fee} from "../../types/Fee.sol";
6
+ import {StateId} from "../../types/StateId.sol";
7
+ import {IService} from "../../shared/IService.sol";
8
+ import {IBundle} from "../module/IBundle.sol";
9
+ import {IInstance} from "../../instance/IInstance.sol";
10
+
11
+ interface IBundleService is IService {
12
+ error ErrorIBundleServiceInsufficientAllowance(address bundleOwner, address tokenHandlerAddress, uint256 amount);
13
+
14
+ function createBundle(
15
+ address owner,
16
+ Fee memory fee,
17
+ uint256 amount,
18
+ uint256 lifetime,
19
+ bytes calldata filter
20
+ ) external returns(NftId bundleNftId);
21
+
22
+ function setBundleFee(
23
+ NftId bundleNftId,
24
+ Fee memory fee
25
+ ) external;
26
+
27
+ function updateBundle(NftId instanceNftId, NftId bundleNftId, IBundle.BundleInfo memory bundleInfo, StateId state) external;
28
+
29
+ function lockCollateral(
30
+ IInstance instanceNftId,
31
+ NftId policyNftId,
32
+ NftId bundleNftId,
33
+ uint256 collateralAmount,
34
+ uint256 netPremium
35
+ )
36
+ external
37
+ returns (
38
+ IBundle.BundleInfo memory bundleInfo
39
+ );
40
+
41
+ function increaseBalance(IInstance instance, NftId bundleNftId, uint256 amount) external;
42
+
43
+ function closePolicy(IInstance instance, NftId policyNftId, NftId bundleNftId, uint256 collateralAmount) external;
44
+
45
+ // function fundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
46
+
47
+ // function defundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
48
+
49
+ function lockBundle(NftId bundleNftId) external;
50
+
51
+ function unlockBundle(NftId bundleNftId) external;
52
+
53
+ // function closeBundle(NftId bundleNftId) external;
54
+ }
@@ -0,0 +1,65 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {NftId} from "../../types/NftId.sol";
5
+ import {Fee} from "../../types/Fee.sol";
6
+ import {IService} from "../../shared/IService.sol";
7
+ import {UFixed} from "../../types/UFixed.sol";
8
+ import {DistributorType} from "../../types/DistributorType.sol";
9
+ import {ReferralId} from "../../types/Referral.sol";
10
+ import {Timestamp} from "../../types/Timestamp.sol";
11
+
12
+
13
+ interface IDistributionService is IService {
14
+ function setFees(
15
+ Fee memory distributionFee
16
+ ) external;
17
+
18
+ function createDistributorType(
19
+ string memory name,
20
+ UFixed minDiscountPercentage,
21
+ UFixed maxDiscountPercentage,
22
+ UFixed commissionPercentage,
23
+ uint32 maxReferralCount,
24
+ uint32 maxReferralLifetime,
25
+ bool allowSelfReferrals,
26
+ bool allowRenewals,
27
+ bytes memory data
28
+ )
29
+ external
30
+ returns (DistributorType distributorType);
31
+
32
+ function createDistributor(
33
+ address distributor,
34
+ DistributorType distributorType,
35
+ bytes memory data
36
+ ) external returns (NftId distributorNftId);
37
+
38
+ function updateDistributorType(
39
+ NftId distributorNftId,
40
+ DistributorType distributorType,
41
+ bytes memory data
42
+ ) external;
43
+
44
+ function createReferral(
45
+ NftId distributorNftId,
46
+ string memory code,
47
+ UFixed discountPercentage,
48
+ uint32 maxReferrals,
49
+ Timestamp expiryAt,
50
+ bytes memory data
51
+ )
52
+ external
53
+ returns (ReferralId referralId);
54
+
55
+ /// @dev callback from product service when selling a policy for a specific referralId
56
+ function processSale(
57
+ ReferralId referralId,
58
+ uint256 premiumAmount
59
+ ) external;
60
+
61
+ function calculateFeeAmount(
62
+ ReferralId referralId,
63
+ uint256 premiumAmount
64
+ ) external view returns (uint256 feeAmount);
65
+ }
@@ -0,0 +1,88 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {IRisk} from "../module/IRisk.sol";
5
+ import {IService} from "../../shared/IService.sol";
6
+
7
+ import {NftId} from "../../types/NftId.sol";
8
+ import {ReferralId} from "../../types/Referral.sol";
9
+ import {RiskId} from "../../types/RiskId.sol";
10
+ import {StateId} from "../../types/StateId.sol";
11
+ import {Timestamp} from "../../types/Timestamp.sol";
12
+ import {UFixed} from "../../types/UFixed.sol";
13
+ import {Fee} from "../../types/Fee.sol";
14
+
15
+ interface IPolicyService is IService {
16
+
17
+ error ErrorIPolicyServiceInsufficientAllowance(address customer, address tokenHandlerAddress, uint256 amount);
18
+ error ErrorIPolicyServicePremiumAlreadyPaid(NftId policyNftId, uint256 premiumPaidAmount);
19
+ error ErrorIPolicyServicePolicyNotActivated(NftId policyNftId);
20
+ error ErrorIPolicyServicePolicyAlreadyClosed(NftId policyNftId);
21
+ error ErrorIPolicyServicePolicyNotActive(NftId policyNftId, StateId state);
22
+ error ErrorIPolicyServicePremiumNotFullyPaid(NftId policyNftId, uint256 premiumAmount, uint256 premiumPaidAmount);
23
+ error ErrorIPolicyServiceOpenClaims(NftId policyNftId, uint16 openClaimsCount);
24
+ error ErrorIPolicyServicePolicyHasNotExpired(NftId policyNftId, Timestamp expiredAt);
25
+
26
+ function calculatePremium(
27
+ RiskId riskId,
28
+ uint256 sumInsuredAmount,
29
+ uint256 lifetime,
30
+ bytes memory applicationData,
31
+ NftId bundleNftId,
32
+ ReferralId referralId
33
+ )
34
+ external
35
+ view
36
+ returns (
37
+ uint256 premiumAmount,
38
+ uint256 productFeeAmount,
39
+ uint256 poolFeeAmount,
40
+ uint256 bundleFeeAmount,
41
+ uint256 distributionFeeAmount
42
+ );
43
+
44
+
45
+ function createApplication(
46
+ address applicationOwner,
47
+ RiskId riskId,
48
+ uint256 sumInsuredAmount,
49
+ uint256 lifetime,
50
+ bytes memory applicationData,
51
+ NftId bundleNftId,
52
+ ReferralId referralId
53
+ ) external returns (NftId nftId);
54
+
55
+ /// @dev declines an application represented by {policyNftId}
56
+ /// an application can only be declined in applied state
57
+ /// only the related product may decline an application
58
+ function decline(NftId policyNftId) external;
59
+
60
+ /// @dev underwrites the policy represented by {policyNftId}.
61
+ /// optionally collects premiums and activates the policy.
62
+ /// - premium payment is only attempted if requirePremiumPayment is set to true
63
+ /// - activation is only done if activateAt is a non-zero timestamp
64
+ /// an application can only be underwritten in applied state
65
+ /// only the related product may underwrite an application
66
+ function underwrite(
67
+ NftId policyNftId,
68
+ bool requirePremiumPayment,
69
+ Timestamp activateAt
70
+ ) external;
71
+
72
+ function collectPremium(NftId policyNftId, Timestamp activateAt) external;
73
+
74
+ function activate(NftId policyNftId, Timestamp activateAt) external;
75
+
76
+ function close(NftId nftId) external;
77
+
78
+ // function createClaim(uint256 nftId, uint256 claimAmount) external;
79
+ // function confirmClaim(uint256 nftId, uint256 claimId, uint256 claimAmount) external;
80
+ // function declineClaim(uint256 nftId, uint256 claimId) external;
81
+ // function closeClaim(uint256 nftId, uint256 claimId) external; // TODO payoutClaim() -> implicit close when payed out in full
82
+
83
+ function calculateRequiredCollateral(
84
+ UFixed collateralizationLevel,
85
+ uint256 sumInsuredAmount
86
+ ) external pure returns(uint256 collateralAmount);
87
+
88
+ }
@@ -0,0 +1,20 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {NftId} from "../../types/NftId.sol";
5
+ import {Fee} from "../../types/Fee.sol";
6
+ import {StateId} from "../../types/StateId.sol";
7
+ import {IService} from "../../shared/IService.sol";
8
+ import {IBundle} from "../module/IBundle.sol";
9
+ import {IInstance} from "../../instance/IInstance.sol";
10
+
11
+ interface IPoolService is IService {
12
+
13
+ function register(address poolAddress) external returns(NftId);
14
+
15
+ function setFees(
16
+ Fee memory poolFee,
17
+ Fee memory stakingFee,
18
+ Fee memory performanceFee
19
+ ) external;
20
+ }
@@ -0,0 +1,40 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {IRisk} from "../module/IRisk.sol";
5
+ import {IService} from "../../shared/IService.sol";
6
+
7
+ import {NftId} from "../../types/NftId.sol";
8
+ import {ReferralId} from "../../types/Referral.sol";
9
+ import {RiskId} from "../../types/RiskId.sol";
10
+ import {StateId} from "../../types/StateId.sol";
11
+ import {Timestamp} from "../../types/Timestamp.sol";
12
+ import {UFixed} from "../../types/UFixed.sol";
13
+ import {Fee} from "../../types/Fee.sol";
14
+
15
+ interface IProductService is IService {
16
+
17
+ function register(address productAddress) external returns(NftId);
18
+
19
+ function setFees(
20
+ Fee memory productFee,
21
+ Fee memory processingFee
22
+ ) external;
23
+
24
+ function createRisk(
25
+ RiskId riskId,
26
+ bytes memory data
27
+ ) external;
28
+
29
+
30
+ function updateRisk(
31
+ RiskId riskId,
32
+ bytes memory data
33
+ ) external;
34
+
35
+
36
+ function updateRiskState(
37
+ RiskId riskId,
38
+ StateId newState
39
+ ) external;
40
+ }