@etherisc/gif-next 0.0.2-90f8ffc-398 → 0.0.2-9105e58-225

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 (272) hide show
  1. package/README.md +73 -1
  2. package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
  3. package/artifacts/contracts/components/Component.sol/Component.json +242 -34
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +592 -41
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IComponent.sol/IComponent.json +85 -27
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +327 -32
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +187 -43
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +85 -27
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +443 -54
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  17. package/artifacts/contracts/components/Product.sol/Product.json +342 -34
  18. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
  33. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  35. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  36. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  37. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  38. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  39. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  40. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
  41. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  42. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  43. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +673 -169
  44. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  45. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +96 -34
  46. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  47. package/artifacts/contracts/instance/Instance.sol/Instance.json +762 -422
  48. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +39 -89
  50. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +58 -53
  52. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  53. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +289 -104
  54. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  55. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +163 -57
  56. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  57. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
  58. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
  59. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +151 -52
  60. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  61. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  62. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  63. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
  64. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  65. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  66. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +13 -13
  68. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  69. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  70. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  71. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  72. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  73. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  74. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
  75. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +1047 -0
  76. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
  77. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +543 -0
  78. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  79. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +282 -118
  80. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +149 -51
  82. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
  83. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +932 -0
  84. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
  85. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +523 -0
  86. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  87. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +426 -74
  88. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +174 -48
  90. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
  91. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +612 -0
  92. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  93. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +130 -73
  94. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
  95. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +548 -0
  96. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  97. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +220 -31
  98. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  99. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +44 -88
  100. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  101. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +23 -31
  102. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  103. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +23 -31
  104. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  105. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +212 -149
  106. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  107. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +162 -64
  108. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  109. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +173 -74
  110. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  111. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +146 -48
  112. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  113. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +173 -74
  114. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  115. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +146 -48
  116. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  117. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  118. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +15 -2
  119. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  120. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +82 -34
  121. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  122. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  123. package/artifacts/contracts/registry/Registry.sol/Registry.json +28 -15
  124. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  125. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
  126. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  127. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +218 -63
  128. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  129. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +142 -50
  130. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  131. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +11 -11
  132. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  133. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +141 -37
  134. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  135. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  136. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +41 -3
  137. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  138. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +40 -29
  139. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
  140. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
  141. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  142. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +21 -29
  143. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
  144. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +48 -0
  145. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  146. package/artifacts/contracts/shared/IService.sol/IService.json +23 -31
  147. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  148. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -2
  149. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  150. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +113 -33
  151. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
  152. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +248 -0
  153. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  154. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +143 -39
  155. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  156. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +126 -45
  157. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
  158. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +84 -0
  159. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  160. package/artifacts/contracts/shared/Service.sol/Service.json +143 -44
  161. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  162. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  163. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  164. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  165. package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -2
  166. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  167. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  168. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +126 -45
  169. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  170. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  171. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  172. package/artifacts/contracts/test/TestService.sol/TestService.json +161 -62
  173. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  174. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  175. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  176. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +8 -8
  177. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  178. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  179. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  180. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  181. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
  182. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +100 -0
  183. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  184. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
  185. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  186. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  187. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
  188. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  189. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
  190. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  191. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  192. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  193. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  194. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  195. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
  196. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +100 -0
  197. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  198. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
  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 +2 -2
  203. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  204. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  205. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  206. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  207. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  208. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  209. package/contracts/components/Component.sol +46 -20
  210. package/contracts/components/Distribution.sol +188 -33
  211. package/contracts/components/IComponent.sol +15 -3
  212. package/contracts/components/IDistributionComponent.sol +54 -1
  213. package/contracts/components/IPoolComponent.sol +48 -17
  214. package/contracts/components/Pool.sol +134 -95
  215. package/contracts/components/Product.sol +76 -57
  216. package/contracts/instance/IInstance.sol +21 -1
  217. package/contracts/instance/IInstanceService.sol +18 -0
  218. package/contracts/instance/Instance.sol +58 -36
  219. package/contracts/instance/InstanceAccessManager.sol +12 -13
  220. package/contracts/instance/InstanceService.sol +76 -35
  221. package/contracts/instance/InstanceServiceManager.sol +1 -1
  222. package/contracts/instance/base/ComponentService.sol +1 -1
  223. package/contracts/instance/module/IAccess.sol +3 -4
  224. package/contracts/instance/module/IPolicy.sol +4 -2
  225. package/contracts/instance/module/ISetup.sol +5 -4
  226. package/contracts/instance/service/ApplicationService.sol +268 -0
  227. package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
  228. package/contracts/instance/service/BundleService.sol +11 -6
  229. package/contracts/instance/service/BundleServiceManager.sol +1 -1
  230. package/contracts/instance/service/ClaimService.sol +151 -0
  231. package/contracts/instance/service/ClaimServiceManager.sol +35 -0
  232. package/contracts/instance/service/DistributionService.sol +185 -14
  233. package/contracts/instance/service/DistributionServiceManager.sol +1 -1
  234. package/contracts/instance/service/IApplicationService.sol +82 -0
  235. package/contracts/instance/service/IBundleService.sol +11 -1
  236. package/contracts/instance/service/IClaimService.sol +61 -0
  237. package/contracts/instance/service/IDistributionService.sol +53 -0
  238. package/contracts/instance/service/IPolicyService.sol +41 -46
  239. package/contracts/instance/service/PolicyService.sol +94 -158
  240. package/contracts/instance/service/PolicyServiceManager.sol +1 -1
  241. package/contracts/instance/service/PoolService.sol +2 -3
  242. package/contracts/instance/service/PoolServiceManager.sol +1 -1
  243. package/contracts/instance/service/ProductService.sol +9 -9
  244. package/contracts/instance/service/ProductServiceManager.sol +1 -1
  245. package/contracts/registry/IRegistry.sol +3 -2
  246. package/contracts/registry/IRegistryService.sol +10 -8
  247. package/contracts/registry/Registry.sol +20 -8
  248. package/contracts/registry/RegistryService.sol +70 -49
  249. package/contracts/registry/RegistryServiceManager.sol +13 -13
  250. package/contracts/registry/ReleaseManager.sol +8 -9
  251. package/contracts/registry/TokenRegistry.sol +15 -6
  252. package/contracts/shared/ERC165.sol +14 -12
  253. package/contracts/shared/INftOwnable.sol +11 -10
  254. package/contracts/shared/IPolicyHolder.sol +26 -0
  255. package/contracts/shared/IRegisterable.sol +3 -3
  256. package/contracts/shared/IRegistryLinked.sol +12 -0
  257. package/contracts/shared/IVersionable.sol +2 -2
  258. package/contracts/shared/NftOwnable.sol +66 -85
  259. package/contracts/shared/PolicyHolder.sol +81 -0
  260. package/contracts/shared/ProxyManager.sol +13 -5
  261. package/contracts/shared/Registerable.sol +6 -14
  262. package/contracts/shared/RegistryLinked.sol +48 -0
  263. package/contracts/shared/Service.sol +5 -5
  264. package/contracts/shared/Versionable.sol +3 -2
  265. package/contracts/test/TestRegisterable.sol +1 -1
  266. package/contracts/test/TestService.sol +1 -1
  267. package/contracts/types/ClaimId.sol +52 -0
  268. package/contracts/types/DistributorType.sol +2 -2
  269. package/contracts/types/ObjectType.sol +9 -5
  270. package/contracts/types/PayoutId.sol +54 -0
  271. package/contracts/types/RoleId.sol +3 -3
  272. package/package.json +3 -3
@@ -10,6 +10,7 @@ import {IProductService} from "../instance/service/IProductService.sol";
10
10
  import {IInstanceService} from "../instance/IInstanceService.sol";
11
11
  import {IInstance} from "../instance/IInstance.sol";
12
12
  import {InstanceAccessManager} from "../instance/InstanceAccessManager.sol";
13
+ import {InstanceReader} from "../instance/InstanceReader.sol";
13
14
  import {IRegistry} from "../registry/IRegistry.sol";
14
15
  import {NftId} from "../types/NftId.sol";
15
16
  import {ObjectType, INSTANCE, PRODUCT} from "../types/ObjectType.sol";
@@ -17,9 +18,9 @@ import {VersionPart} from "../types/Version.sol";
17
18
  import {Registerable} from "../shared/Registerable.sol";
18
19
  import {RoleId, RoleIdLib} from "../types/RoleId.sol";
19
20
  import {IAccess} from "../instance/module/IAccess.sol";
21
+ import {VersionPart} from "../types/Version.sol";
20
22
 
21
23
  // TODO discuss to inherit from oz accessmanaged
22
- // TODO make contract upgradeable
23
24
  // then add (Distribution|Pool|Product)Upradeable that also intherit from Versionable
24
25
  // same pattern as for Service which is also upgradeable
25
26
  abstract contract Component is
@@ -32,9 +33,11 @@ abstract contract Component is
32
33
 
33
34
  struct ComponentStorage {
34
35
  IInstance _instance; // instance for this component
36
+ InstanceReader _instanceReader; // instance reader for this component
35
37
  string _name; // unique (per instance) component name
36
38
  IERC20Metadata _token; // token for this component
37
39
  address _wallet; // wallet for this component (default = component contract itself)
40
+ bool _isNftInterceptor; // declares if component is involved in nft transfers
38
41
  IInstanceService _instanceService; // instance service for this component
39
42
 
40
43
  NftId _productNftId; // only relevant for components that are linked to a aproduct
@@ -42,6 +45,14 @@ abstract contract Component is
42
45
  }
43
46
 
44
47
 
48
+ modifier onlyChainNft() {
49
+ if(msg.sender != getRegistry().getChainNftAddress()) {
50
+ revert ErrorComponentNotChainNft(msg.sender);
51
+ }
52
+ _;
53
+ }
54
+
55
+
45
56
  modifier onlyProductService() {
46
57
  if(msg.sender != address(_getComponentStorage()._productService)) {
47
58
  revert ErrorComponentNotProductService(msg.sender);
@@ -49,26 +60,13 @@ abstract contract Component is
49
60
  _;
50
61
  }
51
62
 
52
- constructor(
53
- address registry,
54
- NftId instanceNftId,
55
- string memory name,
56
- address token,
57
- ObjectType componentType,
58
- bool isInterceptor,
59
- address initialOwner,
60
- bytes memory data
61
- ) {
62
- _initializeComponent(registry, instanceNftId, name, token, componentType, isInterceptor, initialOwner, data);
63
- }
64
-
65
63
  function _getComponentStorage() private pure returns (ComponentStorage storage $) {
66
64
  assembly {
67
65
  $.slot := CONTRACT_LOCATION_V1
68
66
  }
69
67
  }
70
68
 
71
- function _initializeComponent(
69
+ function initializeComponent(
72
70
  address registry,
73
71
  NftId instanceNftId,
74
72
  string memory name,
@@ -78,15 +76,16 @@ abstract contract Component is
78
76
  address initialOwner,
79
77
  bytes memory data
80
78
  )
81
- internal
82
- initializer
79
+ public
83
80
  virtual
81
+ onlyInitializing()
84
82
  {
85
83
  ComponentStorage storage $ = _getComponentStorage();
86
- _initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
84
+ initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
87
85
 
88
86
  // set unique name of component
89
87
  $._name = name;
88
+ $._isNftInterceptor = isInterceptor;
90
89
 
91
90
  // set and check linked instance
92
91
  IRegistry.ObjectInfo memory instanceInfo = getRegistry().getObjectInfo(instanceNftId);
@@ -101,15 +100,25 @@ abstract contract Component is
101
100
  // set linked services
102
101
  VersionPart gifVersion = $._instance.getMajorVersion();
103
102
  $._instanceService = IInstanceService(getRegistry().getServiceAddress(INSTANCE(), gifVersion));
103
+ $._instanceReader = $._instance.getInstanceReader();
104
104
  $._productService = IProductService(getRegistry().getServiceAddress(PRODUCT(), gifVersion));
105
105
 
106
106
  // set wallet and token
107
107
  $._wallet = address(this);
108
108
  $._token = IERC20Metadata(token);
109
109
 
110
- _registerInterface(type(IComponent).interfaceId);
110
+ registerInterface(type(IComponent).interfaceId);
111
111
  }
112
112
 
113
+ /// @dev callback function for nft transfers. may only be called by chain nft contract.
114
+ /// default implementation is empty. overriding functions MUST add onlyChainNft modifier
115
+ function nftTransferFrom(address from, address to, uint256 tokenId)
116
+ external
117
+ virtual override
118
+ onlyChainNft()
119
+ { }
120
+
121
+ // TODO discuss replacement with modifier restricted from accessmanaged
113
122
  function lock() external onlyOwner override {
114
123
  _getComponentStorage()._instanceService.setTargetLocked(getName(), true);
115
124
  }
@@ -137,7 +146,11 @@ abstract contract Component is
137
146
  /// if the current wallet has tokens, these will be transferred.
138
147
  /// if the new wallet address is externally owned, an approval from the
139
148
  /// owner of the external wallet for the component to move all tokens must exist.
140
- function setWallet(address newWallet) external override onlyOwner {
149
+ function setWallet(address newWallet)
150
+ external
151
+ override
152
+ onlyOwner
153
+ {
141
154
  ComponentStorage storage $ = _getComponentStorage();
142
155
 
143
156
  address currentWallet = $._wallet;
@@ -193,10 +206,23 @@ abstract contract Component is
193
206
  return _getComponentStorage()._token;
194
207
  }
195
208
 
209
+ function isNftInterceptor() public view override returns(bool isInterceptor) {
210
+ return _getComponentStorage()._isNftInterceptor;
211
+ }
212
+
196
213
  function getInstance() public view override returns (IInstance instance) {
197
214
  return _getComponentStorage()._instance;
198
215
  }
199
216
 
217
+ function getInstanceReader() public view returns (InstanceReader reader) {
218
+ return _getComponentStorage()._instanceReader;
219
+ }
220
+
221
+ function getServiceAddress(ObjectType domain) public view returns (address service) {
222
+ VersionPart majorVersion = getInstance().getMajorVersion();
223
+ return getRegistry().getServiceAddress(domain, majorVersion);
224
+ }
225
+
200
226
  function getName() public view override returns(string memory name) {
201
227
  return _getComponentStorage()._name;
202
228
  }
@@ -4,8 +4,8 @@ pragma solidity ^0.8.19;
4
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, zeroNftId, NftIdLib} from "../types/NftId.sol";
8
- import {ReferralId} from "../types/Referral.sol";
7
+ import {NftId, zeroNftId, NftIdLib, toNftId} from "../types/NftId.sol";
8
+ import {ReferralId, ReferralStatus, ReferralLib} from "../types/Referral.sol";
9
9
  import {Fee, FeeLib} from "../types/Fee.sol";
10
10
  import {Component} from "./Component.sol";
11
11
  import {IDistributionComponent} from "./IDistributionComponent.sol";
@@ -15,46 +15,48 @@ import {ISetup} from "../instance/module/ISetup.sol";
15
15
  import {Registerable} from "../shared/Registerable.sol";
16
16
  import {TokenHandler} from "../shared/TokenHandler.sol";
17
17
  import {InstanceReader} from "../instance/InstanceReader.sol";
18
+ import {UFixed} from "../types/UFixed.sol";
19
+ import {DistributorType} from "../types/DistributorType.sol";
20
+ import {Timestamp} from "../types/Timestamp.sol";
21
+ import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
22
+
18
23
 
19
24
  abstract contract Distribution is
20
25
  Component,
21
26
  IDistributionComponent
22
27
  {
23
- using NftIdLib for NftId;
24
-
25
- bool internal _isVerifying;
26
- Fee internal _initialDistributionFee;
28
+ // keccak256(abi.encode(uint256(keccak256("etherisc.storage.Distribution")) - 1)) & ~bytes32(uint256(0xff));
29
+ bytes32 public constant DISTRIBUTION_STORAGE_LOCATION_V1 = 0xaab7c5ea03d290056d6c060e0833d3ebcbe647f7694616a2ec52738a64b2f900;
27
30
 
28
- TokenHandler internal _tokenHandler;
29
-
30
- IDistributionService private _distributionService;
31
+ struct DistributionStorage {
32
+ Fee _distributionFee;
33
+ TokenHandler _tokenHandler;
34
+ IDistributionService _distributionService;
35
+ mapping(address distributor => NftId distributorNftId) _distributorNftId;
36
+ }
31
37
 
32
- constructor(
38
+ function initializeDistribution(
33
39
  address registry,
34
40
  NftId instanceNftId,
35
- // TODO refactor into tokenNftId
36
41
  string memory name,
37
42
  address token,
38
- bool verifying,
39
43
  Fee memory distributionFee,
40
44
  address initialOwner,
41
45
  bytes memory data
42
- ) Component (
43
- registry,
44
- instanceNftId,
45
- name, token,
46
- DISTRIBUTION(),
47
- true,
48
- initialOwner,
49
- data
50
- ) {
51
- _isVerifying = verifying;
52
- _initialDistributionFee = distributionFee;
46
+ )
47
+ public
48
+ virtual
49
+ onlyInitializing()
50
+ {
51
+ initializeComponent(registry, instanceNftId, name, token, DISTRIBUTION(), true, initialOwner, data);
53
52
 
54
- _tokenHandler = new TokenHandler(token);
55
- _distributionService = getInstance().getDistributionService();
53
+ DistributionStorage storage $ = _getDistributionStorage();
54
+ // TODO add validation
55
+ $._distributionFee = distributionFee;
56
+ $._tokenHandler = new TokenHandler(token);
57
+ $._distributionService = getInstance().getDistributionService();
56
58
 
57
- _registerInterface(type(IDistributionComponent).interfaceId);
59
+ registerInterface(type(IDistributionComponent).interfaceId);
58
60
  }
59
61
 
60
62
  function setFees(
@@ -65,7 +67,100 @@ abstract contract Distribution is
65
67
  onlyOwner
66
68
  restricted()
67
69
  {
68
- _distributionService.setFees(distributionFee);
70
+ _getDistributionStorage()._distributionService.setFees(distributionFee);
71
+ }
72
+
73
+ function getDistributionFee() external view returns (Fee memory distributionFee) {
74
+ DistributionStorage storage $ = _getDistributionStorage();
75
+ return $._distributionFee;
76
+ }
77
+
78
+ function createDistributorType(
79
+ string memory name,
80
+ UFixed minDiscountPercentage,
81
+ UFixed maxDiscountPercentage,
82
+ UFixed commissionPercentage,
83
+ uint32 maxReferralCount,
84
+ uint32 maxReferralLifetime,
85
+ bool allowSelfReferrals,
86
+ bool allowRenewals,
87
+ bytes memory data
88
+ )
89
+ public
90
+ returns (DistributorType distributorType)
91
+ {
92
+ DistributionStorage storage $ = _getDistributionStorage();
93
+ distributorType = $._distributionService.createDistributorType(
94
+ name,
95
+ minDiscountPercentage,
96
+ maxDiscountPercentage,
97
+ commissionPercentage,
98
+ maxReferralCount,
99
+ maxReferralLifetime,
100
+ allowSelfReferrals,
101
+ allowRenewals,
102
+ data);
103
+ }
104
+
105
+ function createDistributor(
106
+ address distributor,
107
+ DistributorType distributorType,
108
+ bytes memory data
109
+ )
110
+ public
111
+ returns(NftId distributorNftId)
112
+ {
113
+ DistributionStorage storage $ = _getDistributionStorage();
114
+ require($._distributorNftId[distributor].eqz(), "ERROR:DST-030:ALREADY_DISTRIBUTOR");
115
+
116
+ distributorNftId = $._distributionService.createDistributor(
117
+ distributor,
118
+ distributorType,
119
+ data);
120
+
121
+ $._distributorNftId[distributor] = distributorNftId;
122
+ }
123
+
124
+ function updateDistributorType(
125
+ NftId distributorNftId,
126
+ DistributorType distributorType,
127
+ bytes memory data
128
+ )
129
+ public
130
+ // TODO figure out what we need for authz
131
+ // and add it
132
+ {
133
+ DistributionStorage storage $ = _getDistributionStorage();
134
+ $._distributionService.updateDistributorType(
135
+ distributorNftId,
136
+ distributorType,
137
+ data);
138
+ }
139
+
140
+ /**
141
+ * @dev lets distributors create referral codes.
142
+ * referral codes need to be unique
143
+ */
144
+ function createReferral(
145
+ NftId distributorNftId,
146
+ string memory code,
147
+ UFixed discountPercentage,
148
+ uint32 maxReferrals,
149
+ Timestamp expiryAt,
150
+ bytes memory data
151
+ )
152
+ public
153
+ // TODO add authz (only active distributor)
154
+ returns (ReferralId referralId)
155
+ {
156
+ DistributionStorage storage $ = _getDistributionStorage();
157
+ referralId = $._distributionService.createReferral(
158
+ distributorNftId,
159
+ code,
160
+ discountPercentage,
161
+ maxReferrals,
162
+ expiryAt,
163
+ data);
69
164
  }
70
165
 
71
166
  function calculateFeeAmount(
@@ -80,9 +175,53 @@ abstract contract Distribution is
80
175
  ISetup.DistributionSetupInfo memory setupInfo = getSetupInfo();
81
176
  Fee memory fee = setupInfo.distributionFee;
82
177
  (feeAmount,) = FeeLib.calculateFee(fee, netPremiumAmount);
178
+ // TODO: use this?
179
+ // return _distributionService.calculateFeeAmount(referralId, premiumAmount);
180
+ }
181
+
182
+ function isDistributor(address candidate)
183
+ public
184
+ view
185
+ returns (bool)
186
+ {
187
+ DistributionStorage storage $ = _getDistributionStorage();
188
+ return $._distributorNftId[candidate].gtz();
189
+ }
190
+
191
+ function getDistributorNftId(address distributor)
192
+ public
193
+ view
194
+ returns (NftId distributorNftId)
195
+ {
196
+ DistributionStorage storage $ = _getDistributionStorage();
197
+ return $._distributorNftId[distributor];
198
+ }
199
+
200
+ function getDiscountPercentage(string memory referralCode)
201
+ external
202
+ view
203
+ returns (
204
+ UFixed discountPercentage,
205
+ ReferralStatus status
206
+ )
207
+ {
208
+ ReferralId referralId = getReferralId(referralCode);
209
+ return getInstanceReader().getDiscountPercentage(referralId);
83
210
  }
84
211
 
85
212
 
213
+ function getReferralId(
214
+ string memory referralCode
215
+ )
216
+ public
217
+ view
218
+ returns (ReferralId referralId)
219
+ {
220
+ return ReferralLib.toReferralId(
221
+ getNftId(),
222
+ referralCode);
223
+ }
224
+
86
225
  function calculateRenewalFeeAmount(
87
226
  ReferralId referralId,
88
227
  uint256 netPremiumAmount
@@ -98,14 +237,15 @@ abstract contract Distribution is
98
237
 
99
238
  function processSale(
100
239
  ReferralId referralId,
101
- uint256 feeAmount
240
+ uint256 premiumAmount
102
241
  )
103
242
  external
104
243
  onlyOwner
105
244
  restricted()
106
245
  virtual override
107
246
  {
108
- // default is no action
247
+ DistributionStorage storage $ = _getDistributionStorage();
248
+ $._distributionService.processSale(referralId, premiumAmount);
109
249
  }
110
250
 
111
251
  function processRenewal(
@@ -136,18 +276,33 @@ abstract contract Distribution is
136
276
  }
137
277
 
138
278
  function _getInitialSetupInfo() internal view returns (ISetup.DistributionSetupInfo memory setupInfo) {
279
+ DistributionStorage storage $ = _getDistributionStorage();
139
280
  return ISetup.DistributionSetupInfo(
140
281
  zeroNftId(),
141
- _tokenHandler,
142
- _initialDistributionFee,
143
- _isVerifying,
282
+ $._tokenHandler,
283
+ $._distributionFee,
144
284
  address(this)
145
285
  );
146
286
  }
287
+
288
+
289
+ function nftTransferFrom(address from, address to, uint256 tokenId) external virtual override (Component, ITransferInterceptor) {
290
+ // keep track of distributor nft owner
291
+ emit LogDistributorUpdated(to, msg.sender);
292
+ DistributionStorage storage $ = _getDistributionStorage();
293
+ $._distributorNftId[from] = zeroNftId();
294
+ $._distributorNftId[to] = toNftId(tokenId);
295
+ }
147
296
 
148
297
 
149
298
  /// @dev returns true iff the component needs to be called when selling/renewing policis
150
299
  function isVerifying() external view returns (bool verifying) {
151
- return _isVerifying;
300
+ return true;
301
+ }
302
+
303
+ function _getDistributionStorage() private pure returns (DistributionStorage storage $) {
304
+ assembly {
305
+ $.slot := DISTRIBUTION_STORAGE_LOCATION_V1
306
+ }
152
307
  }
153
308
  }
@@ -3,21 +3,27 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
5
 
6
- import {IRegisterable} from "../shared/IRegisterable.sol";
7
6
  import {IInstance} from "../instance/IInstance.sol";
8
7
  import {IInstanceService} from "../instance/IInstanceService.sol";
9
8
  import {IProductService} from "../instance/service/IProductService.sol";
9
+ import {IRegisterable} from "../shared/IRegisterable.sol";
10
+ import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
10
11
  import {NftId} from "../types/NftId.sol";
12
+ import {ObjectType} from "../types/ObjectType.sol";
11
13
 
12
- interface IComponent is IRegisterable {
14
+ interface IComponent is
15
+ IRegisterable,
16
+ ITransferInterceptor
17
+ {
13
18
 
19
+ error ErrorComponentNotChainNft(address caller);
20
+ error ErrorComponentNotProductService(address caller);
14
21
  error ErrorComponentNotInstance(NftId instanceNftId, address instance);
15
22
  error ErrorComponentProductNftAlreadySet();
16
23
  error ErrorComponentWalletAddressZero();
17
24
  error ErrorComponentWalletAddressIsSameAsCurrent(address newWallet);
18
25
  error ErrorComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
19
26
  error ErrorComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
20
- error ErrorComponentNotProductService(address caller);
21
27
 
22
28
  event LogComponentWalletAddressChanged(address newWallet);
23
29
  event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
@@ -33,8 +39,14 @@ interface IComponent is IRegisterable {
33
39
  function setWallet(address walletAddress) external;
34
40
  function getWallet() external view returns (address walletAddress);
35
41
 
42
+ function isNftInterceptor() external view returns(bool isInterceptor);
43
+
36
44
  function getInstance() external view returns (IInstance instance);
37
45
 
46
+ /// @dev returns the service address for the specified domain
47
+ /// gets address via lookup from registry using the major version form the linked instance
48
+ function getServiceAddress(ObjectType domain) external view returns (address service);
49
+
38
50
  function setProductNftId(NftId productNftId) external;
39
51
  function getProductNftId() external view returns (NftId productNftId);
40
52
 
@@ -4,17 +4,60 @@ pragma solidity ^0.8.19;
4
4
  import {Fee} from "../types/Fee.sol";
5
5
  import {IComponent} from "./IComponent.sol";
6
6
  import {ISetup} from "../instance/module/ISetup.sol";
7
- import {ReferralId} from "../types/Referral.sol";
7
+ import {ReferralId, ReferralStatus} from "../types/Referral.sol";
8
8
  import {NftId} from "../types/NftId.sol";
9
+ import {DistributorType} from "../types/DistributorType.sol";
10
+ import {UFixed} from "../types/UFixed.sol";
11
+ import {Timestamp} from "../types/Timestamp.sol";
9
12
 
10
13
  interface IDistributionComponent is IComponent {
11
14
 
15
+ event LogDistributorUpdated(address to, address caller);
16
+
12
17
  function getSetupInfo() external view returns (ISetup.DistributionSetupInfo memory setupInfo);
13
18
 
14
19
  function setFees(
15
20
  Fee memory distributionFee
16
21
  ) external;
17
22
 
23
+ function createDistributorType(
24
+ string memory name,
25
+ UFixed minDiscountPercentage,
26
+ UFixed maxDiscountPercentage,
27
+ UFixed commissionPercentage,
28
+ uint32 maxReferralCount,
29
+ uint32 maxReferralLifetime,
30
+ bool allowSelfReferrals,
31
+ bool allowRenewals,
32
+ bytes memory data
33
+ ) external returns (DistributorType distributorType);
34
+
35
+ function createDistributor(
36
+ address distributor,
37
+ DistributorType distributorType,
38
+ bytes memory data
39
+ ) external returns(NftId distributorNftId);
40
+
41
+ function updateDistributorType(
42
+ NftId distributorNftId,
43
+ DistributorType distributorType,
44
+ bytes memory data
45
+ ) external;
46
+
47
+ /**
48
+ * @dev lets distributors create referral codes.
49
+ * referral codes need to be unique
50
+ * distributor is identified via msg.sender.
51
+ */
52
+ function createReferral(
53
+ NftId distributorNftId,
54
+ string memory code,
55
+ UFixed discountPercentage,
56
+ uint32 maxReferrals,
57
+ Timestamp expiryAt,
58
+ bytes memory data
59
+ ) external returns (ReferralId referralId);
60
+
18
61
  function calculateFeeAmount(
19
62
  ReferralId referralId,
20
63
  uint256 netPremiumAmount
@@ -39,6 +82,16 @@ interface IDistributionComponent is IComponent {
39
82
  uint256 feeAmount
40
83
  ) external;
41
84
 
85
+ function getDiscountPercentage(
86
+ string memory referralCode
87
+ ) external view returns (UFixed discountPercentage, ReferralStatus status);
88
+
89
+ function getDistributionFee() external view returns (Fee memory distibutionFee);
90
+
91
+ function getReferralId(
92
+ string memory referralCode
93
+ ) external returns (ReferralId referralId);
94
+
42
95
  /// @dev returns true iff the referral id is valid
43
96
  function referralIsValid(ReferralId referralId) external view returns (bool isValid);
44
97
 
@@ -7,10 +7,14 @@ import {ISetup} from "../instance/module/ISetup.sol";
7
7
  import {NftId} from "../types/NftId.sol";
8
8
  import {UFixed} from "../types/UFixed.sol";
9
9
 
10
+ /// @dev pool components hold and manage the collateral to cover active policies
11
+ /// pools come in different flavors
10
12
  interface IPoolComponent is IComponent {
11
13
 
12
14
  event LogUnderwrittenByPool(NftId policyNftId, uint256 collateralizationAmount, address pool);
13
15
 
16
+ error ErrorPoolNotPoolService(address service);
17
+
14
18
  function getSetupInfo() external view returns (ISetup.PoolSetupInfo memory setupInfo);
15
19
 
16
20
  function setFees(
@@ -19,28 +23,59 @@ interface IPoolComponent is IComponent {
19
23
  Fee memory performanceFee
20
24
  ) external;
21
25
 
26
+ /// @dev sets an additional bundle fee, this fee is added on top of the poolFee and deducted from the premium amounts.
27
+ /// via these fees individual bundler owner may earn income per policy in the context of peer to peer pools
22
28
  function setBundleFee(
23
- NftId policyNftId,
29
+ NftId bundleNftId,
24
30
  Fee memory fee
25
31
  ) external;
26
32
 
27
- /**
28
- * @dev this is a callback function that is called by the product service when underwriting a policy.
29
- * the pool has the option to check the details and object to underwriting by reverting.
30
- * the function is only called for "active" pools that ask to be involved/notified
31
- * by product related state changes.
32
- */
33
- function underwrite(
34
- NftId policyNftId,
33
+ /// @dev this is a callback function that is called by the product service when underwriting a policy.
34
+ /// the pool has the option to check the details and object to underwriting by reverting.
35
+ /// the function is only called for "active" pools that ask to be involved/notified
36
+ /// by product related state changes.
37
+ function verifyApplication(
38
+ NftId applicationNftId,
35
39
  bytes memory policyData,
36
40
  bytes memory bundleFilter,
37
41
  uint256 collateralizationAmount
38
42
  ) external;
39
43
 
40
- /**
41
- * @dev returns true iff the policy application data in policyData matches
42
- * with the bundle filter criteria encoded in bundleFilter.
43
- */
44
+ function lockBundle(NftId bundleNftId) external;
45
+
46
+ function unlockBundle(NftId bundleNftId) external;
47
+
48
+ /// @dev defines the multiplier to calculate the required collateral to cover a given sum insured amount
49
+ /// default implementation returns 100%
50
+ function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
51
+
52
+ /// @dev defines the amount of collateral held in the pool.
53
+ /// if the value is < 100% the pool is required to hold a policy that covers the locally missing collateral
54
+ /// default implementation returns 100%
55
+ function getRetentionLevel() external view returns (UFixed retentionLevel);
56
+
57
+ /// @dev declares if pool intercept transfers of bundle nft ids
58
+ /// - yes: pool may block transfer of bundle ownership or simply updates some bookkeeping related to bundle ownership. callback function is nftTransferFrom
59
+ /// - no: pool is not involved in transfer of bundle ownership
60
+ /// default implementation returns false (no)
61
+ function isInterceptingBundleTransfers() external view returns (bool);
62
+
63
+ /// @dev declares if pool relies on external management of collateral (yes/no):
64
+ /// - yes: underwriting of new policies does not require an actual token balance, instead it is assumed that the pool owner will manage funds externally and inject enough tokens to allow process confirmed payouts
65
+ /// - no: the pool smart contract ensures that the necessary capacity of the pool prior to underwriting.
66
+ /// default implementation returns false (no)
67
+ function isExternallyManaged() external view returns (bool);
68
+
69
+ /// @dev declares if pool component is actively involved in underwriting (yes/no):
70
+ /// - yes: verifying pools components actively confirm underwriting applications, ie the pool component logic explicitly needs to confirm the locking of collateral to cover the sum insured of the policy
71
+ /// - no: underwriting a policy does not require any interaction with the pool component if the covering bundle can provide the necessary captial
72
+ /// default implementation returnsfalse (no)
73
+ function isVerifyingApplications() external view returns (bool);
74
+
75
+ /// @dev returns true iff the policy application data in policyData matches
76
+ /// with the bundle filter criteria encoded in bundleFilter
77
+ /// this is a callback function that is only called if a pool declares itself as a verifying pool
78
+ /// default implementation returns true
44
79
  function policyMatchesBundle(
45
80
  bytes memory policyData,
46
81
  bytes memory bundleFilter
@@ -49,8 +84,4 @@ interface IPoolComponent is IComponent {
49
84
  view
50
85
  returns (bool isMatching);
51
86
 
52
- function isConfirmingApplication() external view returns (bool isConfirmingApplication);
53
-
54
- function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
55
-
56
87
  }