@etherisc/gif-next 0.0.2-96b5b72-170 → 0.0.2-97aac30-275

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 (401) hide show
  1. package/README.md +2 -1
  2. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  3. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +193 -164
  4. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  5. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +114 -321
  6. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  7. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +120 -82
  8. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +72 -108
  10. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  11. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +22 -48
  12. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  13. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
  14. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  15. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +25 -6
  16. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  17. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +56 -22
  18. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  19. package/artifacts/contracts/instance/Instance.sol/Instance.json +53 -18
  20. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +4 -0
  21. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +708 -0
  22. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +1 -1
  23. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +132 -28
  24. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  25. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +458 -331
  26. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  27. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +133 -59
  28. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  29. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +110 -32
  30. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  31. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +1103 -308
  32. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +4 -0
  33. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +318 -0
  34. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  35. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +4 -0
  36. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +10 -0
  37. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  38. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +2 -2
  39. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  40. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +8 -116
  41. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  42. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  43. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  44. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  45. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  46. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +4 -0
  47. package/artifacts/contracts/mock/Dip.sol/Dip.json +376 -0
  48. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +4 -0
  49. package/artifacts/contracts/{instance/module/ISetup.sol/ISetup.json → oracle/IOracle.sol/IOracle.json} +2 -2
  50. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +4 -0
  51. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +759 -0
  52. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +4 -0
  53. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +662 -0
  54. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +4 -0
  55. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +1146 -0
  56. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +4 -0
  57. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +997 -0
  58. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +4 -0
  59. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +718 -0
  60. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  61. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +69 -252
  62. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  63. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +105 -55
  64. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  65. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +8 -53
  66. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  67. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +134 -86
  68. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  69. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +121 -133
  70. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  71. package/artifacts/contracts/pool/Pool.sol/Pool.json +239 -92
  72. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  73. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +170 -368
  74. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  75. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +98 -72
  76. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  77. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +69 -153
  78. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  79. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +105 -31
  80. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  81. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +95 -203
  82. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  83. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +118 -56
  84. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  85. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +7 -1
  86. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  87. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +7 -1
  88. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  89. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +81 -25
  90. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  91. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +27 -1
  92. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  93. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +230 -107
  94. package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +1 -1
  95. package/artifacts/contracts/product/IProductService.sol/IProductService.json +0 -55
  96. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  97. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +164 -299
  98. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  99. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +106 -92
  100. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  101. package/artifacts/contracts/product/PricingService.sol/PricingService.json +139 -160
  102. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  103. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +130 -40
  104. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  105. package/artifacts/contracts/product/Product.sol/Product.json +334 -146
  106. package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +1 -1
  107. package/artifacts/contracts/product/ProductService.sol/ProductService.json +29 -214
  108. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  109. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +88 -34
  110. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  111. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  112. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  113. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +163 -61
  114. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  115. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +256 -65
  116. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  117. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  118. package/artifacts/contracts/registry/Registry.sol/Registry.json +378 -67
  119. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +4 -0
  120. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +407 -0
  121. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  122. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +272 -68
  123. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  124. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +87 -35
  125. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  126. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +799 -127
  127. package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.dbg.json +4 -0
  128. package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.json +137 -0
  129. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  130. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +314 -138
  131. package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.dbg.json +4 -0
  132. package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.json +1193 -0
  133. package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.dbg.json +4 -0
  134. package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.json +1715 -0
  135. package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.dbg.json +4 -0
  136. package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.json +1728 -0
  137. package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.dbg.json +4 -0
  138. package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.json +1806 -0
  139. package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +4 -0
  140. package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +1824 -0
  141. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  142. package/artifacts/contracts/shared/Component.sol/Component.json +184 -11
  143. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  144. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +908 -49
  145. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +4 -0
  146. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +792 -0
  147. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +4 -0
  148. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +526 -0
  149. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  150. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
  151. package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.dbg.json +4 -0
  152. package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.json +1562 -0
  153. package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.dbg.json +4 -0
  154. package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.json +1600 -0
  155. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  156. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +172 -4
  157. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +4 -0
  158. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +867 -0
  159. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  160. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +80 -22
  161. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
  162. package/artifacts/contracts/{instance/base → shared}/IKeyValueStore.sol/IKeyValueStore.json +1 -11
  163. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +4 -0
  164. package/artifacts/contracts/{instance/base → shared}/ILifecycle.sol/ILifecycle.json +1 -1
  165. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  166. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +7 -1
  167. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  168. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +21 -3
  169. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  170. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +7 -1
  171. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  172. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  173. package/artifacts/contracts/shared/IService.sol/IService.json +7 -1
  174. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  175. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +4 -0
  176. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +39 -0
  177. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  178. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +176 -24
  179. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
  180. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +571 -0
  181. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +4 -0
  182. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +194 -0
  183. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.dbg.json +4 -0
  184. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.json +306 -0
  185. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  186. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +13 -7
  187. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  188. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +31 -13
  189. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  190. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +64 -16
  191. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  192. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +21 -7
  193. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  194. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  195. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  196. package/artifacts/contracts/shared/Service.sol/Service.json +7 -1
  197. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  198. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  199. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  200. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  201. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  202. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  203. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +1103 -172
  204. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  205. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +497 -49
  206. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +4 -0
  207. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +444 -0
  208. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  209. package/artifacts/contracts/staking/Staking.sol/Staking.json +1247 -56
  210. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  211. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +167 -30
  212. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +4 -0
  213. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +592 -0
  214. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  215. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +605 -78
  216. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  217. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +122 -28
  218. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +4 -0
  219. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2189 -0
  220. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +4 -0
  221. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +571 -0
  222. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  223. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.json +2 -2
  224. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  225. package/artifacts/contracts/type/Amount.sol/AmountLib.json +68 -4
  226. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  227. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +53 -2
  228. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  229. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  230. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  231. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  232. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  233. package/artifacts/contracts/type/Fee.sol/FeeLib.json +34 -34
  234. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  235. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  236. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  237. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +47 -4
  238. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  239. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  240. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  241. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +15 -2
  242. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  243. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  244. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  245. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  246. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +4 -0
  247. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +204 -0
  248. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  249. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  250. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  251. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
  252. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  253. package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +76 -2
  254. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  255. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -2
  256. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  257. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +17 -4
  258. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  259. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  260. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  261. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
  262. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  263. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +2 -2
  264. package/contracts/distribution/Distribution.sol +27 -51
  265. package/contracts/distribution/DistributionService.sol +55 -106
  266. package/contracts/distribution/DistributionServiceManager.sol +9 -18
  267. package/contracts/distribution/IDistributionComponent.sol +3 -8
  268. package/contracts/distribution/IDistributionService.sol +2 -8
  269. package/contracts/instance/IInstance.sol +12 -7
  270. package/contracts/instance/IInstanceService.sol +13 -5
  271. package/contracts/instance/Instance.sol +30 -23
  272. package/contracts/instance/InstanceAdmin.sol +331 -0
  273. package/contracts/instance/InstanceAuthorizationsLib.sol +210 -141
  274. package/contracts/instance/InstanceReader.sol +64 -42
  275. package/contracts/instance/InstanceService.sol +141 -87
  276. package/contracts/instance/InstanceServiceManager.sol +10 -20
  277. package/contracts/instance/InstanceStore.sol +125 -55
  278. package/contracts/instance/base/BalanceStore.sol +118 -0
  279. package/contracts/instance/base/ObjectCounter.sol +21 -0
  280. package/contracts/instance/module/IAccess.sol +2 -10
  281. package/contracts/instance/module/IBundle.sol +1 -4
  282. package/contracts/instance/module/IComponents.sol +15 -4
  283. package/contracts/instance/module/IPolicy.sol +8 -2
  284. package/contracts/mock/Dip.sol +26 -0
  285. package/contracts/oracle/IOracle.sol +20 -0
  286. package/contracts/oracle/IOracleComponent.sol +32 -0
  287. package/contracts/oracle/IOracleService.sol +65 -0
  288. package/contracts/oracle/Oracle.sol +145 -0
  289. package/contracts/oracle/OracleService.sol +277 -0
  290. package/contracts/oracle/OracleServiceManager.sol +42 -0
  291. package/contracts/pool/BundleService.sol +63 -149
  292. package/contracts/pool/BundleServiceManager.sol +9 -18
  293. package/contracts/pool/IBundleService.sol +4 -16
  294. package/contracts/pool/IPoolComponent.sol +2 -4
  295. package/contracts/pool/IPoolService.sol +45 -9
  296. package/contracts/pool/Pool.sol +37 -40
  297. package/contracts/pool/PoolService.sol +195 -145
  298. package/contracts/pool/PoolServiceManager.sol +9 -18
  299. package/contracts/product/ApplicationService.sol +111 -43
  300. package/contracts/product/ApplicationServiceManager.sol +9 -6
  301. package/contracts/product/ClaimService.sol +21 -21
  302. package/contracts/product/ClaimServiceManager.sol +9 -6
  303. package/contracts/product/IApplicationService.sol +1 -1
  304. package/contracts/product/IClaimService.sol +7 -1
  305. package/contracts/product/IPolicyService.sol +6 -8
  306. package/contracts/product/IPricingService.sol +3 -1
  307. package/contracts/product/IProductComponent.sol +5 -4
  308. package/contracts/product/IProductService.sol +1 -8
  309. package/contracts/product/PolicyService.sol +226 -127
  310. package/contracts/product/PolicyServiceManager.sol +9 -21
  311. package/contracts/product/PricingService.sol +74 -48
  312. package/contracts/product/PricingServiceManager.sol +9 -18
  313. package/contracts/product/Product.sol +45 -47
  314. package/contracts/product/ProductService.sol +26 -112
  315. package/contracts/product/ProductServiceManager.sol +9 -21
  316. package/contracts/registry/ChainNft.sol +1 -0
  317. package/contracts/registry/IRegistry.sol +38 -24
  318. package/contracts/registry/IRegistryService.sol +31 -31
  319. package/contracts/registry/Registry.sol +176 -105
  320. package/contracts/registry/RegistryAdmin.sol +237 -0
  321. package/contracts/registry/RegistryService.sol +44 -82
  322. package/contracts/registry/RegistryServiceManager.sol +21 -23
  323. package/contracts/registry/ReleaseManager.sol +450 -210
  324. package/contracts/registry/ServiceAuthorizationsLib.sol +173 -0
  325. package/contracts/registry/TokenRegistry.sol +261 -62
  326. package/contracts/shared/AccessManagerCustom.sol +736 -0
  327. package/contracts/shared/AccessManagerExtended.sol +470 -0
  328. package/contracts/shared/AccessManagerExtendedInitializeable.sol +13 -0
  329. package/contracts/shared/AccessManagerExtendedWithDisable.sol +137 -0
  330. package/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol +14 -0
  331. package/contracts/shared/Component.sol +153 -49
  332. package/contracts/shared/ComponentService.sol +561 -93
  333. package/contracts/shared/ComponentServiceManager.sol +35 -0
  334. package/contracts/shared/ComponentVerifyingService.sol +117 -0
  335. package/contracts/shared/ERC165.sol +1 -1
  336. package/contracts/shared/IAccessManagerExtended.sol +74 -0
  337. package/contracts/shared/IAccessManagerExtendedWithDisable.sol +18 -0
  338. package/contracts/shared/IComponent.sol +20 -8
  339. package/contracts/shared/IComponentService.sol +102 -0
  340. package/contracts/shared/IInstanceLinkedComponent.sol +5 -11
  341. package/contracts/{instance/base → shared}/IKeyValueStore.sol +6 -6
  342. package/contracts/{instance/base → shared}/ILifecycle.sol +3 -3
  343. package/contracts/shared/INftOwnable.sol +1 -1
  344. package/contracts/shared/IPolicyHolder.sol +6 -1
  345. package/contracts/shared/IService.sol +1 -1
  346. package/contracts/shared/InitializableCustom.sol +177 -0
  347. package/contracts/shared/InstanceLinkedComponent.sol +51 -178
  348. package/contracts/{instance/base → shared}/KeyValueStore.sol +30 -72
  349. package/contracts/{instance/base → shared}/Lifecycle.sol +12 -3
  350. package/contracts/shared/NftIdSetManager.sol +65 -0
  351. package/contracts/shared/NftOwnable.sol +2 -13
  352. package/contracts/shared/PolicyHolder.sol +21 -13
  353. package/contracts/shared/ProxyManager.sol +31 -1
  354. package/contracts/shared/Registerable.sol +2 -2
  355. package/contracts/shared/Service.sol +7 -2
  356. package/contracts/staking/IStaking.sol +146 -8
  357. package/contracts/staking/IStakingService.sol +83 -39
  358. package/contracts/staking/StakeManagerLib.sol +179 -0
  359. package/contracts/staking/Staking.sol +503 -17
  360. package/contracts/staking/StakingManager.sol +22 -14
  361. package/contracts/staking/StakingReader.sol +187 -0
  362. package/contracts/staking/StakingService.sol +246 -44
  363. package/contracts/staking/StakingServiceManager.sol +8 -4
  364. package/contracts/staking/StakingStore.sol +572 -0
  365. package/contracts/staking/TargetManagerLib.sol +207 -0
  366. package/contracts/type/AddressSet.sol +1 -1
  367. package/contracts/type/Amount.sol +20 -1
  368. package/contracts/type/Blocknumber.sol +20 -3
  369. package/contracts/type/Fee.sol +17 -16
  370. package/contracts/type/NftId.sol +14 -16
  371. package/contracts/type/NftIdSet.sol +1 -1
  372. package/contracts/type/ObjectType.sol +12 -10
  373. package/contracts/type/Referral.sol +1 -1
  374. package/contracts/type/RequestId.sol +75 -0
  375. package/contracts/type/RiskId.sol +1 -1
  376. package/contracts/type/RoleId.sol +18 -4
  377. package/contracts/type/Seconds.sol +27 -0
  378. package/contracts/type/StateId.sol +27 -2
  379. package/contracts/type/Timestamp.sol +6 -2
  380. package/contracts/type/Version.sol +1 -1
  381. package/package.json +4 -3
  382. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +0 -4
  383. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +0 -1348
  384. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +0 -4
  385. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +0 -4
  386. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +0 -4
  387. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +0 -581
  388. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +0 -4
  389. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +0 -194
  390. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +0 -4
  391. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +0 -4
  392. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.json +0 -10
  393. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +0 -4
  394. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +0 -285
  395. package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
  396. package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
  397. package/contracts/instance/InstanceAccessManager.sol +0 -543
  398. package/contracts/instance/module/ISetup.sol +0 -33
  399. package/contracts/instance/module/ITreasury.sol +0 -23
  400. package/contracts/registry/RegistryAccessManager.sol +0 -207
  401. package/contracts/shared/AccessManagerUpgradeableInitializeable.sol +0 -13
@@ -3,10 +3,12 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
5
5
 
6
+ import {Amount} from "../type/Amount.sol";
6
7
  import {Key32, KeyId, Key32Lib} from "../type/Key32.sol";
7
8
  import {NftId} from "../type/NftId.sol";
8
9
  import {ClaimId} from "../type/ClaimId.sol";
9
10
  import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT, DISTRIBUTOR, DISTRIBUTOR_TYPE} from "../type/ObjectType.sol";
11
+ import {RequestId} from "../type/RequestId.sol";
10
12
  import {RiskId, RiskIdLib} from "../type/RiskId.sol";
11
13
  import {RoleId, RoleIdLib, INSTANCE_ROLE, INSTANCE_OWNER_ROLE} from "../type/RoleId.sol";
12
14
  import {StateId, ACTIVE} from "../type/StateId.sol";
@@ -16,20 +18,25 @@ import {ReferralId} from "../type/Referral.sol";
16
18
  import {DistributorType} from "../type/DistributorType.sol";
17
19
  import {PayoutId} from "../type/PayoutId.sol";
18
20
 
21
+ import {BalanceStore} from "./base/BalanceStore.sol";
19
22
  import {IInstance} from "./IInstance.sol";
20
- import {KeyValueStore} from "./base/KeyValueStore.sol";
21
- import {IKeyValueStore} from "./base/KeyValueStore.sol";
23
+ import {KeyValueStore} from "../shared/KeyValueStore.sol";
24
+ import {IKeyValueStore} from "../shared/KeyValueStore.sol";
25
+ import {ObjectCounter} from "./base/ObjectCounter.sol";
22
26
 
23
27
  import {IBundle} from "./module/IBundle.sol";
24
28
  import {IComponents} from "./module/IComponents.sol";
25
29
  import {IDistribution} from "./module/IDistribution.sol";
26
30
  import {IPolicy} from "./module/IPolicy.sol";
31
+ import {IOracle} from "../oracle/IOracle.sol";
27
32
  import {IRisk} from "./module/IRisk.sol";
28
- import {ISetup} from "./module/ISetup.sol";
29
33
 
30
34
 
31
- // TODO combine with instance reader?
32
- contract InstanceStore is AccessManagedUpgradeable, KeyValueStore
35
+ contract InstanceStore is
36
+ AccessManagedUpgradeable,
37
+ BalanceStore,
38
+ KeyValueStore,
39
+ ObjectCounter
33
40
  {
34
41
  function initialize(address instance)
35
42
  public
@@ -37,163 +44,226 @@ contract InstanceStore is AccessManagedUpgradeable, KeyValueStore
37
44
  {
38
45
  address authority = IInstance(instance).authority();
39
46
  __AccessManaged_init(authority);
47
+
40
48
  initializeLifecycle();
41
49
  }
42
50
 
43
- //--- ProductSetup ------------------------------------------------------//
44
- function createProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup) external restricted() {
45
- create(_toNftKey32(productNftId, PRODUCT()), abi.encode(setup));
46
- }
51
+ //--- Component ---------------------------------------------------------//
47
52
 
48
- function updateProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup, StateId newState) external restricted() {
49
- update(_toNftKey32(productNftId, PRODUCT()), abi.encode(setup), newState);
53
+ function createComponent(
54
+ NftId componentNftId,
55
+ IComponents.ComponentInfo memory componentInfo
56
+ )
57
+ external
58
+ restricted()
59
+ {
60
+ _registerBalanceTarget(componentNftId);
61
+ _create(_toNftKey32(componentNftId, COMPONENT()), abi.encode(componentInfo));
50
62
  }
51
63
 
52
- function updateProductSetupState(NftId productNftId, StateId newState) external restricted() {
53
- updateState(_toNftKey32(productNftId, PRODUCT()), newState);
64
+ function updateComponent(
65
+ NftId componentNftId,
66
+ IComponents.ComponentInfo memory componentInfo,
67
+ StateId newState
68
+ )
69
+ external
70
+ restricted()
71
+ {
72
+ _update(_toNftKey32(componentNftId, COMPONENT()), abi.encode(componentInfo), newState);
54
73
  }
55
74
 
56
- //--- DistributionSetup ------------------------------------------------------//
57
- function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external restricted() {
58
- create(_toNftKey32(distributionNftId, DISTRIBUTION()), abi.encode(setup));
75
+ //--- Product -----------------------------------------------------------//
76
+
77
+ function createProduct(NftId productNftId, IComponents.ProductInfo memory info) external restricted() {
78
+ _create(_toNftKey32(productNftId, PRODUCT()), abi.encode(info));
59
79
  }
60
80
 
61
- function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external restricted() {
62
- update(_toNftKey32(distributionNftId, DISTRIBUTION()), abi.encode(setup), newState);
81
+ function updateProduct(NftId productNftId, IComponents.ProductInfo memory info, StateId newState) external restricted() {
82
+ _update(_toNftKey32(productNftId, PRODUCT()), abi.encode(info), newState);
63
83
  }
64
84
 
65
- function updateDistributionSetupState(NftId distributionNftId, StateId newState) external restricted() {
66
- updateState(_toNftKey32(distributionNftId, DISTRIBUTION()), newState);
85
+ function updateProductSetupState(NftId productNftId, StateId newState) external restricted() {
86
+ _updateState(_toNftKey32(productNftId, PRODUCT()), newState);
67
87
  }
68
88
 
69
- //--- PoolSetup ------------------------------------------------------//
70
- function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external restricted() {
71
- create(_toNftKey32(poolNftId, POOL()), abi.encode(info));
89
+ //--- Pool --------------------------------------------------------------//
90
+
91
+ function createPool(
92
+ NftId poolNftId,
93
+ IComponents.PoolInfo memory info
94
+ )
95
+ external
96
+ restricted()
97
+ {
98
+ _create(_toNftKey32(poolNftId, POOL()), abi.encode(info));
72
99
  }
73
100
 
74
- function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external restricted() {
75
- update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
101
+ function updatePool(NftId poolNftId, IComponents.PoolInfo memory info, StateId newState) external restricted() {
102
+ _update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
76
103
  }
77
104
 
78
- function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
79
- updateState(_toNftKey32(poolNftId, POOL()), newState);
105
+ function updatePoolState(NftId poolNftId, StateId newState) external restricted() {
106
+ _updateState(_toNftKey32(poolNftId, POOL()), newState);
80
107
  }
81
108
 
82
- //--- DistributorType -------------------------------------------------------//
109
+ //--- DistributorType ---------------------------------------------------//
83
110
  function createDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info) external restricted() {
84
- create(distributorType.toKey32(), abi.encode(info));
111
+ _create(distributorType.toKey32(), abi.encode(info));
85
112
  }
86
113
 
87
114
  function updateDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info, StateId newState) external restricted() {
88
- update(distributorType.toKey32(), abi.encode(info), newState);
115
+ _update(distributorType.toKey32(), abi.encode(info), newState);
89
116
  }
90
117
 
91
118
  function updateDistributorTypeState(DistributorType distributorType, StateId newState) external restricted() {
92
- updateState(distributorType.toKey32(), newState);
119
+ _updateState(distributorType.toKey32(), newState);
93
120
  }
94
121
 
95
122
  //--- Distributor -------------------------------------------------------//
96
123
  function createDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info) external restricted() {
97
- create(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info));
124
+ _create(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info));
98
125
  }
99
126
 
100
127
  function updateDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info, StateId newState) external restricted() {
101
- update(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info), newState);
128
+ _update(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info), newState);
102
129
  }
103
130
 
104
131
  function updateDistributorState(NftId distributorNftId, StateId newState) external restricted() {
105
- updateState(_toNftKey32(distributorNftId, DISTRIBUTOR()), newState);
132
+ _updateState(_toNftKey32(distributorNftId, DISTRIBUTOR()), newState);
106
133
  }
107
134
 
108
135
  //--- Referral ----------------------------------------------------------//
109
136
  function createReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo) external restricted() {
110
- create(referralId.toKey32(), abi.encode(referralInfo));
137
+ _create(referralId.toKey32(), abi.encode(referralInfo));
111
138
  }
112
139
 
113
140
  function updateReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo, StateId newState) external restricted() {
114
- update(referralId.toKey32(), abi.encode(referralInfo), newState);
141
+ _update(referralId.toKey32(), abi.encode(referralInfo), newState);
115
142
  }
116
143
 
117
144
  function updateReferralState(ReferralId referralId, StateId newState) external restricted() {
118
- updateState(referralId.toKey32(), newState);
145
+ _updateState(referralId.toKey32(), newState);
119
146
  }
120
147
 
121
148
  //--- Bundle ------------------------------------------------------------//
122
149
  function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external restricted() {
123
- create(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle));
150
+ _registerBalanceTarget(bundleNftId);
151
+ _create(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle));
124
152
  }
125
153
 
126
154
  function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external restricted() {
127
- update(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle), newState);
155
+ _update(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle), newState);
128
156
  }
129
157
 
130
158
  function updateBundleState(NftId bundleNftId, StateId newState) external restricted() {
131
- updateState(_toNftKey32(bundleNftId, BUNDLE()), newState);
159
+ _updateState(_toNftKey32(bundleNftId, BUNDLE()), newState);
132
160
  }
133
161
 
134
162
  //--- Risk --------------------------------------------------------------//
135
163
  function createRisk(RiskId riskId, IRisk.RiskInfo memory risk) external restricted() {
136
- create(riskId.toKey32(), abi.encode(risk));
164
+ _create(riskId.toKey32(), abi.encode(risk));
137
165
  }
138
166
 
139
167
  function updateRisk(RiskId riskId, IRisk.RiskInfo memory risk, StateId newState) external restricted() {
140
- update(riskId.toKey32(), abi.encode(risk), newState);
168
+ _update(riskId.toKey32(), abi.encode(risk), newState);
141
169
  }
142
170
 
143
171
  function updateRiskState(RiskId riskId, StateId newState) external restricted() {
144
- updateState(riskId.toKey32(), newState);
172
+ _updateState(riskId.toKey32(), newState);
145
173
  }
146
174
 
147
175
  //--- Application (Policy) ----------------------------------------------//
148
176
  function createApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy) external restricted() {
149
- create(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy));
177
+ _registerBalanceTarget(applicationNftId);
178
+ _create(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy));
150
179
  }
151
180
 
152
181
  function updateApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
153
- update(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy), newState);
182
+ _update(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy), newState);
154
183
  }
155
184
 
156
185
  function updateApplicationState(NftId applicationNftId, StateId newState) external restricted() {
157
- updateState(_toNftKey32(applicationNftId, POLICY()), newState);
186
+ _updateState(_toNftKey32(applicationNftId, POLICY()), newState);
158
187
  }
159
188
 
160
189
  //--- Policy ------------------------------------------------------------//
161
190
  function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
162
- update(_toNftKey32(policyNftId, POLICY()), abi.encode(policy), newState);
191
+ _update(_toNftKey32(policyNftId, POLICY()), abi.encode(policy), newState);
163
192
  }
164
193
 
165
194
  function updatePolicyClaims(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
166
- update(_toNftKey32(policyNftId, POLICY()), abi.encode(policy), newState);
195
+ _update(_toNftKey32(policyNftId, POLICY()), abi.encode(policy), newState);
167
196
  }
168
197
 
169
198
  function updatePolicyState(NftId policyNftId, StateId newState) external restricted() {
170
- updateState(_toNftKey32(policyNftId, POLICY()), newState);
199
+ _updateState(_toNftKey32(policyNftId, POLICY()), newState);
171
200
  }
172
201
 
173
202
  //--- Claim -------------------------------------------------------------//
174
203
  function createClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim) external restricted() {
175
- create(_toClaimKey32(policyNftId, claimId), abi.encode(claim));
204
+ _create(_toClaimKey32(policyNftId, claimId), abi.encode(claim));
176
205
  }
177
206
 
178
207
  function updateClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim, StateId newState) external restricted() {
179
- update(_toClaimKey32(policyNftId, claimId), abi.encode(claim), newState);
208
+ _update(_toClaimKey32(policyNftId, claimId), abi.encode(claim), newState);
180
209
  }
181
210
 
182
211
  function updateClaimState(NftId policyNftId, ClaimId claimId, StateId newState) external restricted() {
183
- updateState(_toClaimKey32(policyNftId, claimId), newState);
212
+ _updateState(_toClaimKey32(policyNftId, claimId), newState);
184
213
  }
185
214
 
186
215
  //--- Payout ------------------------------------------------------------//
187
216
  function createPayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory payout) external restricted() {
188
- create(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout));
217
+ _create(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout));
189
218
  }
190
219
 
191
220
  function updatePayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory payout, StateId newState) external restricted() {
192
- update(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout), newState);
221
+ _update(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout), newState);
193
222
  }
194
223
 
195
224
  function updatePayoutState(NftId policyNftId, PayoutId payoutId, StateId newState) external restricted() {
196
- updateState(_toPayoutKey32(policyNftId, payoutId), newState);
225
+ _updateState(_toPayoutKey32(policyNftId, payoutId), newState);
226
+ }
227
+
228
+ //--- Request -----------------------------------------------------------//
229
+
230
+ function createRequest(IOracle.RequestInfo memory request) external restricted() returns (RequestId requestId) {
231
+ requestId = _createNextRequestId();
232
+ _create(requestId.toKey32(), abi.encode(request));
233
+ }
234
+
235
+ function updateRequest(RequestId requestId, IOracle.RequestInfo memory request, StateId newState) external restricted() {
236
+ _update(requestId.toKey32(), abi.encode(request), newState);
237
+ }
238
+
239
+ function updateRequestState(RequestId requestId, StateId newState) external restricted() {
240
+ _updateState(requestId.toKey32(), newState);
241
+ }
242
+
243
+ //--- balance and fee management functions ------------------------------//
244
+
245
+ function increaseBalance(NftId targetNftId, Amount amount) external restricted() returns (Amount newBalance) {
246
+ return _increaseBalance(targetNftId, amount);
247
+ }
248
+
249
+ function decreaseBalance(NftId targetNftId, Amount amount) external restricted() returns (Amount newBalance) {
250
+ return _decreaseBalance(targetNftId, amount);
251
+ }
252
+
253
+ function increaseFees(NftId targetNftId, Amount amount) external restricted() returns (Amount newFeeBalance) {
254
+ return _increaseFees(targetNftId, amount);
255
+ }
256
+
257
+ function decreaseFees(NftId targetNftId, Amount amount) external restricted() returns (Amount newFeeBalance) {
258
+ return _decreaseFees(targetNftId, amount);
259
+ }
260
+
261
+ function increaseLocked(NftId targetNftId, Amount amount) external restricted() returns (Amount newBalance) {
262
+ return _increaseLocked(targetNftId, amount);
263
+ }
264
+
265
+ function decreaseLocked(NftId targetNftId, Amount amount) external restricted() returns (Amount newBalance) {
266
+ return _decreaseLocked(targetNftId, amount);
197
267
  }
198
268
 
199
269
  //--- internal view/pure functions --------------------------------------//
@@ -0,0 +1,118 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {Blocknumber, BlocknumberLib} from "../../type/Blocknumber.sol";
5
+ import {NftId} from "../../type/NftId.sol";
6
+ import {Amount} from "../../type/Amount.sol";
7
+
8
+ contract BalanceStore {
9
+
10
+ error ErrorBalanceStoreTargetAlreadyRegistered(NftId targetNftId);
11
+ error ErrorBalanceStoreTargetNotRegistered(NftId targetNftId);
12
+
13
+ event LogBalanceStoreTargetRegistered(NftId targetNftId);
14
+
15
+ event LogBalanceStoreFeesIncreased(NftId targetNftId, Amount addedAmount, Amount newBalance, Blocknumber lastUpdatedIn);
16
+ event LogBalanceStoreFeesDecreased(NftId targetNftId, Amount addedAmount, Amount newBalance, Blocknumber lastUpdatedIn);
17
+
18
+ event LogBalanceStoreLockedIncreased(NftId targetNftId, Amount addedAmount, Amount newBalance, Blocknumber lastUpdatedIn);
19
+ event LogBalanceStoreLockedDecreased(NftId targetNftId, Amount addedAmount, Amount newBalance, Blocknumber lastUpdatedIn);
20
+
21
+ event LogBalanceStoreBalanceIncreased(NftId targetNftId, Amount addedAmount, Amount newBalance, Blocknumber lastUpdatedIn);
22
+ event LogBalanceStoreBalanceDecreased(NftId targetNftId, Amount addedAmount, Amount newBalance, Blocknumber lastUpdatedIn);
23
+
24
+ mapping(NftId nftId => Amount balance) private _balanceAmount;
25
+ mapping(NftId nftId => Amount locked) private _lockedAmount;
26
+ mapping(NftId nftId => Amount fees) private _feeAmount;
27
+ mapping(NftId nftId => bool isRegistered) private _isRegistered;
28
+
29
+ // TODO check if this is made redundant by *Info struct updates
30
+ mapping(NftId nftId => Blocknumber lastUpdatedIn) private _lastUpdatedIn;
31
+
32
+ modifier onlyRegisteredTarget(NftId targetNftId) {
33
+ if (!_isRegistered[targetNftId]) {
34
+ revert ErrorBalanceStoreTargetNotRegistered(targetNftId);
35
+ }
36
+ _;
37
+ }
38
+
39
+ function getBalanceAmount(NftId targetNftId) external view returns (Amount balanceAmount) { return _balanceAmount[targetNftId]; }
40
+ function getLockedAmount(NftId targetNftId) external view returns (Amount lockedAmount) { return _lockedAmount[targetNftId]; }
41
+ function getFeeAmount(NftId targetNftId) external view returns (Amount feeAmount) { return _feeAmount[targetNftId]; }
42
+
43
+ function getAmounts(NftId targetNftId)
44
+ external
45
+ view
46
+ returns (
47
+ Amount balanceAmount,
48
+ Amount lockedAmount,
49
+ Amount feeAmount
50
+ )
51
+ {
52
+ balanceAmount = _balanceAmount[targetNftId];
53
+ lockedAmount = _lockedAmount[targetNftId];
54
+ feeAmount = _feeAmount[targetNftId];
55
+ }
56
+
57
+ function _registerBalanceTarget(NftId targetNftId) internal {
58
+ if (_isRegistered[targetNftId]) {
59
+ revert ErrorBalanceStoreTargetAlreadyRegistered(targetNftId);
60
+ }
61
+
62
+ _isRegistered[targetNftId] = true;
63
+ _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
64
+
65
+ emit LogBalanceStoreTargetRegistered(targetNftId);
66
+ }
67
+
68
+ //--- fee management ----------------------------------------------------//
69
+ function _increaseFees(NftId targetNftId, Amount amount) internal onlyRegisteredTarget(targetNftId) returns (Amount newBalance) {
70
+ newBalance = _feeAmount[targetNftId] + amount;
71
+ _feeAmount[targetNftId] = newBalance;
72
+
73
+ emit LogBalanceStoreFeesIncreased(targetNftId, amount, newBalance, _lastUpdatedIn[targetNftId]);
74
+ _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
75
+ }
76
+
77
+ function _decreaseFees(NftId targetNftId, Amount amount) internal onlyRegisteredTarget(targetNftId) returns (Amount newBalance) {
78
+ newBalance = _feeAmount[targetNftId] - amount;
79
+ _feeAmount[targetNftId] = newBalance;
80
+
81
+ emit LogBalanceStoreFeesDecreased(targetNftId, amount, newBalance, _lastUpdatedIn[targetNftId]);
82
+ _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
83
+ }
84
+
85
+ //--- locked management -------------------------------------------------//
86
+ function _increaseLocked(NftId targetNftId, Amount amount) internal onlyRegisteredTarget(targetNftId) returns (Amount newBalance) {
87
+ newBalance = _lockedAmount[targetNftId] + amount;
88
+ _lockedAmount[targetNftId] = newBalance;
89
+
90
+ emit LogBalanceStoreLockedIncreased(targetNftId, amount, newBalance, _lastUpdatedIn[targetNftId]);
91
+ _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
92
+ }
93
+
94
+ function _decreaseLocked(NftId targetNftId, Amount amount) internal onlyRegisteredTarget(targetNftId) returns (Amount newBalance) {
95
+ newBalance = _lockedAmount[targetNftId] - amount;
96
+ _lockedAmount[targetNftId] = newBalance;
97
+
98
+ emit LogBalanceStoreLockedDecreased(targetNftId, amount, newBalance, _lastUpdatedIn[targetNftId]);
99
+ _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
100
+ }
101
+
102
+ //--- balance management ------------------------------------------------//
103
+ function _increaseBalance(NftId targetNftId, Amount amount) internal onlyRegisteredTarget(targetNftId) returns (Amount newBalance) {
104
+ newBalance = _balanceAmount[targetNftId] + amount;
105
+ _balanceAmount[targetNftId] = newBalance;
106
+
107
+ emit LogBalanceStoreBalanceIncreased(targetNftId, amount, newBalance, _lastUpdatedIn[targetNftId]);
108
+ _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
109
+ }
110
+
111
+ function _decreaseBalance(NftId targetNftId, Amount amount) internal onlyRegisteredTarget(targetNftId) returns (Amount newBalance) {
112
+ newBalance = _balanceAmount[targetNftId] - amount;
113
+ _balanceAmount[targetNftId] = newBalance;
114
+
115
+ emit LogBalanceStoreBalanceDecreased(targetNftId, amount, newBalance, _lastUpdatedIn[targetNftId]);
116
+ _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
117
+ }
118
+ }
@@ -0,0 +1,21 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {Blocknumber, BlocknumberLib} from "../../type/Blocknumber.sol";
5
+ import {NftId} from "../../type/NftId.sol";
6
+ import {Amount} from "../../type/Amount.sol";
7
+ import {RequestId, RequestIdLib} from "../../type/RequestId.sol";
8
+
9
+ contract ObjectCounter {
10
+
11
+ // TODO refactor risk id
12
+ // mapping(NftId productNftId => uint64 risks) private _riskCounter;
13
+
14
+ uint256 private _requestCounter;
15
+
16
+ // TODO introduce RequestId (uint64)
17
+ function _createNextRequestId() internal returns (RequestId requestId) {
18
+ _requestCounter++;
19
+ requestId = RequestIdLib.toRequestId(_requestCounter);
20
+ }
21
+ }
@@ -3,6 +3,7 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
5
5
 
6
+ import {NftId} from "../../type/NftId.sol";
6
7
  import {RoleId} from "../../type/RoleId.sol";
7
8
  import {Timestamp} from "../../type/Timestamp.sol";
8
9
 
@@ -32,23 +33,14 @@ interface IAccess {
32
33
  Timestamp updatedAt;
33
34
  }
34
35
 
35
- error ErrorIAccessCallerIsNotRoleAdmin(address caller, RoleId roleId);
36
-
37
- error ErrorIAccessRoleIdDoesNotExist(RoleId roleId);
38
36
  error ErrorIAccessRoleIdTooBig(RoleId roleId);
39
37
  error ErrorIAccessRoleIdTooSmall(RoleId roleId);
40
- error ErrorIAccessRoleIdExists(RoleId roleId);
41
- error ErrorIAccessRoleNameEmpty(RoleId roleId);
42
- error ErrorIAccessRoleNameExists(RoleId roleId, RoleId existingRoleId, ShortString name);
43
38
  error ErrorIAccessRoleTypeInvalid(RoleId roleId, Type rtype);
44
39
 
45
40
  error ErrorIAccessTargetAddressZero();
46
- error ErrorIAccessTargetDoesNotExist(address target);
47
- error ErrorIAccessTargetExists(address target, ShortString name);
48
41
  error ErrorIAccessTargetTypeInvalid(address target, Type ttype);
49
- error ErrorIAccessTargetNameEmpty(address target);
50
- error ErrorIAccessTargetNameExists(address target, address existingTarget, ShortString name);
51
42
  error ErrorIAccessTargetLocked(address target);
52
43
  error ErrorIAccessTargetNotRegistered(address target);
53
44
  error ErrorIAccessTargetAuthorityInvalid(address target, address targetAuthority);
45
+ error ErrorIAccessTargetInstanceMismatch(address target, NftId targetParentNftId, NftId instanceNftId);
54
46
  }
@@ -13,10 +13,7 @@ interface IBundle {
13
13
  NftId poolNftId;
14
14
  Fee fee; // bundle fee on net premium amounts
15
15
  bytes filter; // required conditions for applications to be considered for collateralization by this bundle
16
- Amount capitalAmount; // net stakings + net premiums - payouts
17
- Amount lockedAmount; // capital amount linked to collateralizaion of non-closed policies (<= capital amount)
18
- Amount feeAmount; // accumulated fee amount
19
- Seconds lifetime;
16
+ Seconds lifetime; // lifetime of bundle after creation
20
17
  Timestamp expiredAt; // no new policies starting with this timestamp
21
18
  Timestamp closedAt; // no open policies, locked amount = 0
22
19
  }
@@ -14,21 +14,32 @@ interface IComponents {
14
14
 
15
15
  struct ComponentInfo {
16
16
  string name; // component name (needs to be unique per instance)
17
+ NftId productNftId;
17
18
  IERC20Metadata token;
18
19
  TokenHandler tokenHandler;
19
20
  address wallet;
20
- Amount balanceAmount; // calculated balance (may not necessarily match withg wallet balance)
21
- Amount feeAmount; // accumulated fees belonging to component owner
22
21
  bytes data; // will hold component type specific additional info (eg encoded pool info)
23
22
  }
24
23
 
24
+
25
+ struct ProductInfo {
26
+ NftId distributionNftId;
27
+ NftId poolNftId;
28
+ Fee productFee; // product fee on net premium
29
+ Fee processingFee; // product fee on payout amounts
30
+ Fee distributionFee; // distribution fee for sales that do not include commissions
31
+ Fee minDistributionOwnerFee; // min fee required by distribution owner (not including commissions for distributors)
32
+ Fee poolFee; // pool fee on net premium
33
+ Fee stakingFee; // pool fee on staked capital from investor
34
+ Fee performanceFee; // pool fee on profits from capital investors
35
+ }
36
+
37
+
25
38
  struct PoolInfo {
26
39
  NftId productNftId; // the nft of the product this pool is linked to
27
40
  RoleId bundleOwnerRole; // the required role for bundle owners
28
41
  // TODO maxCapitalAmount -> maxBalanceAmount
29
42
  Amount maxCapitalAmount; // max capital amount allowed for pool
30
- Amount balanceAmount; // current pool balance (accounting view)
31
- Amount feeAmount; // accumulated fee amount
32
43
  bool isInterceptingBundleTransfers; // intercepts nft transfers for bundles
33
44
  bool isExternallyManaged; // funding bundles is restricted to book keeping, actual funds may be provided as needed to support payouts
34
45
  bool isVerifyingApplications; // underwriting requires the pool component checks/confirms the applications
@@ -12,6 +12,12 @@ import {Timestamp} from "../../type/Timestamp.sol";
12
12
  interface IPolicy {
13
13
 
14
14
  struct Premium {
15
+ // premium splitting per target wallet
16
+ Amount productFeeAmount;
17
+ Amount distributionFeeAndCommissionAmount;
18
+ Amount poolPremiumAndFeeAmount;
19
+
20
+ // detailed positions
15
21
  // this is the net premium calculated by the product
16
22
  uint256 netPremiumAmount;
17
23
  // fullPremium = netPremium + all fixed amounts + all variable amounts (excl commission and minDistribtuionOwnerFee variable part)
@@ -42,8 +48,8 @@ interface IPolicy {
42
48
  ReferralId referralId;
43
49
  RiskId riskId;
44
50
  Amount sumInsuredAmount;
45
- Amount premiumAmount;
46
- Amount premiumPaidAmount; // when lower than premium amount: max payout decreased accordingly
51
+ Amount premiumAmount; // expected premium at application time
52
+ Amount premiumPaidAmount; // actual paid premium
47
53
  Seconds lifetime;
48
54
  // policy application data, no changes after applying for a policy
49
55
  bytes applicationData;
@@ -0,0 +1,26 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5
+
6
+ contract Dip is ERC20 {
7
+
8
+ // https://etherscan.io/token/0xc719d010b63e5bbf2c0551872cd5316ed26acd83#readContract
9
+ string public constant NAME = "Decentralized Insurance Protocol - DUMMY";
10
+ string public constant SYMBOL = "DIP";
11
+ uint8 public constant DECIMALS = 18;
12
+ uint256 public constant INITIAL_SUPPLY = 10**9 * 10**DECIMALS; // 1 Billion 1'000'000'000
13
+ // decimals == 18 (openzeppelin erc20 default)
14
+ constructor()
15
+ ERC20(NAME, SYMBOL)
16
+ {
17
+ _mint(
18
+ _msgSender(),
19
+ INITIAL_SUPPLY
20
+ );
21
+ }
22
+
23
+ function decimals() public pure override returns(uint8) {
24
+ return DECIMALS;
25
+ }
26
+ }
@@ -0,0 +1,20 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {NftId} from "../type/NftId.sol";
5
+ import {Timestamp} from "../type/Timestamp.sol";
6
+
7
+
8
+ interface IOracle {
9
+
10
+ struct RequestInfo {
11
+ NftId requesterNftId; // originator of the request
12
+ string callbackMethodName; // callback function of the requestor to call to provide response data
13
+ NftId oracleNftId; // responsible oracle component
14
+ bytes requestData;
15
+ bytes responseData;
16
+ Timestamp respondedAt; // response timestamp
17
+ Timestamp expiredAt; // expiry timestamp
18
+ bool isCancelled;
19
+ }
20
+ }
@@ -0,0 +1,32 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {Fee} from "../type/Fee.sol";
5
+ import {IInstanceLinkedComponent} from "../shared/IInstanceLinkedComponent.sol";
6
+ import {ReferralId, ReferralStatus} from "../type/Referral.sol";
7
+ import {NftId} from "../type/NftId.sol";
8
+ import {DistributorType} from "../type/DistributorType.sol";
9
+ import {RequestId} from "../type/RequestId.sol";
10
+ import {UFixed} from "../type/UFixed.sol";
11
+ import {Timestamp} from "../type/Timestamp.sol";
12
+
13
+ interface IOracleComponent is IInstanceLinkedComponent {
14
+
15
+ /// @dev callback method for requesting some data from the oracle
16
+ function request(
17
+ RequestId requestId,
18
+ NftId requesterNftId,
19
+ bytes calldata requestData,
20
+ Timestamp expiryAt
21
+ ) external;
22
+
23
+
24
+ /// @dev callback method for cancelling the specified oracle request
25
+ function cancel(
26
+ RequestId requestId
27
+ ) external;
28
+
29
+
30
+ /// @dev returns true iff the component needs to be called when selling/renewing policis
31
+ function isVerifying() external view returns (bool verifying);
32
+ }