@etherisc/gif-next 0.0.2-9e6b423-414 → 0.0.2-9f51324-299

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 (337) hide show
  1. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +2 -2
  3. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +2 -2
  5. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
  6. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  7. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +97 -267
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +4 -0
  9. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.json +24 -0
  10. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +36 -652
  12. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +2 -2
  14. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  15. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +47 -222
  16. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  17. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  18. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +27 -175
  19. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  20. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +12 -85
  21. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  22. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +16 -246
  23. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  24. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +27 -420
  25. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +3 -3
  27. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +60 -221
  29. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +1 -1
  31. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  32. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +114 -167
  33. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  34. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +60 -72
  35. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  36. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  37. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +0 -29
  38. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  39. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  40. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +2 -2
  41. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  42. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +59 -220
  43. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  44. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2 -2
  45. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  46. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +59 -220
  47. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  48. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  49. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +3 -3
  50. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
  51. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +59 -220
  52. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  53. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +2 -2
  54. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  55. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +2 -2
  56. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
  57. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +59 -220
  58. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  59. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2 -2
  60. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
  61. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +59 -220
  62. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  63. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  64. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  65. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +32 -310
  66. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  67. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +0 -182
  68. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  69. package/artifacts/contracts/instance/Instance.sol/Instance.json +72 -322
  70. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  71. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +292 -605
  72. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  73. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +56 -242
  74. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  75. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +290 -478
  76. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  77. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +26 -208
  78. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  79. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +14 -14
  80. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  81. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2 -2
  82. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
  83. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +2 -2
  84. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  85. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  86. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  87. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  88. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  89. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  90. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  91. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  92. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  93. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +1 -1
  94. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +2 -2
  95. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  96. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  97. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  98. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  99. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  100. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  101. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  102. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +2 -2
  103. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  104. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +56 -234
  105. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  106. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  107. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  108. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  109. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  110. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +2 -2
  111. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  112. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +2 -2
  113. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  114. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  115. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +59 -220
  116. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  117. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +108 -92
  118. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  119. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +55 -31
  120. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  121. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  122. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  123. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  124. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
  125. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +26 -92
  126. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  127. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +2 -2
  128. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  129. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +2 -2
  130. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  131. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +36 -60
  132. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  133. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +19 -15
  134. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  135. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  136. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +59 -220
  137. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  138. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +78 -78
  139. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  140. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +40 -40
  141. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  142. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  143. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  144. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  145. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  146. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  147. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  148. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +2 -2
  149. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
  150. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +26 -82
  151. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  152. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +2 -2
  153. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  154. package/artifacts/contracts/product/PricingService.sol/PricingService.json +2 -2
  155. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  156. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +2 -2
  157. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  158. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  159. package/artifacts/contracts/product/RiskService.sol/RiskService.json +2 -2
  160. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  161. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +2 -2
  162. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  163. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  164. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  165. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +1 -1
  166. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  167. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  168. package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
  169. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  170. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +249 -378
  171. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +1 -1
  172. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +68 -243
  173. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  174. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -18
  175. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  176. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +10 -10
  177. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
  178. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +186 -384
  179. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  180. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  181. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  182. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +76 -128
  183. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  184. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +26 -437
  185. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  186. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  187. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  188. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  189. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +54 -54
  190. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  191. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +28 -28
  192. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  193. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  194. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +45 -16
  195. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
  196. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
  197. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +1 -1
  198. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  199. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  200. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  201. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  202. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  203. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  204. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  205. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  206. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  207. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  208. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  209. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  210. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  211. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  212. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  213. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  214. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  215. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  216. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  217. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  218. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  219. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  220. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  221. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  222. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  223. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  224. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
  225. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
  226. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  227. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  228. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  229. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  230. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  231. package/artifacts/contracts/staking/Staking.sol/Staking.json +8 -8
  232. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +1 -1
  233. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +2 -2
  234. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  235. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  236. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  237. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +5 -5
  238. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  239. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
  240. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  241. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +2 -2
  242. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  243. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +2 -2
  244. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  245. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2 -2
  246. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  247. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +3 -3
  248. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  249. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  250. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  251. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  252. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  253. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  254. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  255. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  256. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  257. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  258. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
  259. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +2 -2
  260. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  261. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  262. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  263. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  264. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  265. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +6 -6
  266. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  267. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  268. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  269. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  270. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  271. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  272. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  273. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  274. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  275. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +218 -39
  276. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  277. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  278. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  279. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  281. package/artifacts/contracts/type/String.sol/StrLib.json +2 -50
  282. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  283. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  284. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  286. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  287. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  288. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +2 -2
  289. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  290. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  291. package/contracts/authorization/AccessAdmin.sol +185 -261
  292. package/contracts/authorization/AccessAdminLib.sol +7 -220
  293. package/contracts/authorization/Authorization.sol +229 -38
  294. package/contracts/authorization/IAccess.sol +4 -14
  295. package/contracts/authorization/IAccessAdmin.sol +45 -19
  296. package/contracts/authorization/IAuthorization.sol +56 -3
  297. package/contracts/authorization/IServiceAuthorization.sol +17 -55
  298. package/contracts/authorization/ServiceAuthorization.sol +33 -247
  299. package/contracts/distribution/BasicDistributionAuthorization.sol +4 -11
  300. package/contracts/distribution/Distribution.sol +1 -2
  301. package/contracts/distribution/DistributionService.sol +33 -75
  302. package/contracts/distribution/IDistributionComponent.sol +1 -3
  303. package/contracts/distribution/IDistributionService.sol +4 -10
  304. package/contracts/instance/IInstance.sol +4 -43
  305. package/contracts/instance/IInstanceService.sol +3 -28
  306. package/contracts/instance/Instance.sol +39 -80
  307. package/contracts/instance/InstanceAdmin.sol +229 -162
  308. package/contracts/instance/InstanceAuthorizationV3.sol +28 -58
  309. package/contracts/instance/InstanceReader.sol +389 -371
  310. package/contracts/instance/InstanceService.sol +53 -105
  311. package/contracts/oracle/BasicOracleAuthorization.sol +2 -18
  312. package/contracts/pool/BasicPoolAuthorization.sol +3 -9
  313. package/contracts/pool/BundleService.sol +9 -8
  314. package/contracts/pool/PoolLib.sol +0 -44
  315. package/contracts/product/ApplicationService.sol +26 -4
  316. package/contracts/product/BasicProductAuthorization.sol +4 -9
  317. package/contracts/product/ClaimService.sol +20 -11
  318. package/contracts/product/PolicyService.sol +2 -2
  319. package/contracts/product/PolicyServiceLib.sol +0 -20
  320. package/contracts/registry/RegistryAdmin.sol +97 -27
  321. package/contracts/registry/RegistryAuthorization.sol +25 -35
  322. package/contracts/registry/ReleaseAdmin.sol +100 -42
  323. package/contracts/registry/ReleaseRegistry.sol +9 -12
  324. package/contracts/registry/ServiceAuthorizationV3.sol +20 -32
  325. package/contracts/registry/TokenRegistry.sol +4 -2
  326. package/contracts/shared/ComponentService.sol +5 -22
  327. package/contracts/shared/ContractLib.sol +45 -9
  328. package/contracts/shared/IRegisterable.sol +1 -0
  329. package/contracts/shared/Service.sol +4 -6
  330. package/contracts/staking/Staking.sol +5 -4
  331. package/contracts/staking/TargetManagerLib.sol +1 -1
  332. package/contracts/type/ObjectType.sol +3 -16
  333. package/contracts/type/RoleId.sol +59 -57
  334. package/contracts/type/String.sol +0 -12
  335. package/contracts/upgradeability/ProxyManager.sol +2 -2
  336. package/contracts/upgradeability/Versionable.sol +1 -4
  337. package/package.json +1 -1
@@ -3,7 +3,6 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
5
 
6
- import {IAccess} from "../authorization/IAccess.sol";
7
6
  import {IBundle} from "../instance/module/IBundle.sol";
8
7
  import {IComponents} from "../instance/module/IComponents.sol";
9
8
  import {IDistribution} from "../instance/module/IDistribution.sol";
@@ -14,31 +13,28 @@ import {IOracle} from "../oracle/IOracle.sol";
14
13
  import {IPolicy} from "../instance/module/IPolicy.sol";
15
14
  import {IRegistry} from "../registry/IRegistry.sol";
16
15
  import {IRisk} from "../instance/module/IRisk.sol";
16
+ import {TimestampLib} from "../type/Timestamp.sol";
17
17
 
18
- import {AccessAdminLib} from "../authorization/AccessAdminLib.sol";
19
18
  import {Amount} from "../type/Amount.sol";
20
19
  import {BundleSet} from "./BundleSet.sol";
21
20
  import {BUNDLE, COMPONENT, DISTRIBUTOR, DISTRIBUTION, FEE, PREMIUM, POLICY, POOL, PRODUCT} from "../type/ObjectType.sol";
22
21
  import {ClaimId, ClaimIdLib} from "../type/ClaimId.sol";
23
22
  import {DistributorType} from "../type/DistributorType.sol";
24
- import {InstanceAdmin} from "./InstanceAdmin.sol";
25
23
  import {InstanceStore} from "./InstanceStore.sol";
26
24
  import {Key32} from "../type/Key32.sol";
27
25
  import {NftId} from "../type/NftId.sol";
28
26
  import {PayoutId, PayoutIdLib} from "../type/PayoutId.sol";
29
- import {PolicyServiceLib} from "../product/PolicyServiceLib.sol";
30
- import {ReferralId, ReferralStatus, ReferralLib} from "../type/Referral.sol";
27
+ import {ReferralId, ReferralStatus, ReferralLib, REFERRAL_OK, REFERRAL_ERROR_UNKNOWN, REFERRAL_ERROR_EXPIRED, REFERRAL_ERROR_EXHAUSTED} from "../type/Referral.sol";
31
28
  import {RequestId} from "../type/RequestId.sol";
32
29
  import {RiskId} from "../type/RiskId.sol";
33
30
  import {RiskSet} from "./RiskSet.sol";
34
- import {RoleId, INSTANCE_OWNER_ROLE} from "../type/RoleId.sol";
31
+ import {RoleId} from "../type/RoleId.sol";
35
32
  import {StateId} from "../type/StateId.sol";
36
33
  import {TokenHandler} from "../shared/TokenHandler.sol";
37
34
  import {UFixed, UFixedLib} from "../type/UFixed.sol";
38
35
 
39
36
 
40
- /// @dev Central reader contract for a specific instance.
41
- /// Provides reading functions for all instance data and related component data.
37
+
42
38
  contract InstanceReader {
43
39
 
44
40
  error ErrorInstanceReaderAlreadyInitialized();
@@ -48,7 +44,6 @@ contract InstanceReader {
48
44
 
49
45
  IRegistry internal _registry;
50
46
  IInstance internal _instance;
51
- InstanceAdmin internal _instanceAdmin;
52
47
 
53
48
  InstanceStore internal _store;
54
49
  BundleSet internal _bundleSet;
@@ -64,8 +59,6 @@ contract InstanceReader {
64
59
  initializeWithInstance(msg.sender);
65
60
  }
66
61
 
67
-
68
- /// @dev Initializer to upgrade instance reader via instance service
69
62
  function initializeWithInstance(address instanceAddress)
70
63
  public
71
64
  {
@@ -75,7 +68,6 @@ contract InstanceReader {
75
68
 
76
69
  _initialized = true;
77
70
  _instance = IInstance(instanceAddress);
78
- _instanceAdmin = _instance.getInstanceAdmin();
79
71
  _registry = _instance.getRegistry();
80
72
 
81
73
  _store = _instance.getInstanceStore();
@@ -85,347 +77,466 @@ contract InstanceReader {
85
77
  }
86
78
 
87
79
 
88
- //--- instance functions ---------------------------------------------------------//
80
+ // instance level functions
89
81
 
90
- /// @dev Returns the registry this instance is registered in.
91
82
  function getRegistry() public view returns (IRegistry registry) {
92
83
  return _registry;
93
84
  }
94
85
 
95
-
96
- /// @dev Returns the instance NFT ID.
97
86
  function getInstanceNftId() public view returns (NftId instanceNftid) {
98
87
  return _registry.getNftIdForAddress(address(_instance));
99
88
  }
100
89
 
101
-
102
- /// @dev Returns the instance contract.
103
90
  function getInstance() public view returns (IInstance instance) {
104
91
  return _instance;
105
92
  }
106
93
 
107
-
108
- //--- component functions ------------------------------------------------------//
109
-
110
- /// @dev Returns the number of registered components.
111
- /// Components may be products, distributions, oracles or pools.
112
94
  function components() public view returns (uint256 componentCount) {
113
- return _instanceAdmin.components();
95
+ return _instance.getInstanceAdmin().components();
114
96
  }
115
97
 
116
-
117
- /// @dev Returns the component info for the given component NFT ID.
118
- function getComponentInfo(NftId componentNftId) public view returns (IComponents.ComponentInfo memory info) {
119
- (bytes memory data, bool success) = _getData(_toComponentKey(componentNftId));
120
- if (success) { return abi.decode(data, (IComponents.ComponentInfo)); }
98
+ function products() public view returns (uint256 productCount) {
99
+ return _instance.products();
121
100
  }
122
101
 
123
-
124
- /// @dev Returns the registered token for the given component NFT ID.
125
- function getToken(NftId componentNftId) public view returns (IERC20Metadata token) {
126
- TokenHandler tokenHandler = getTokenHandler(componentNftId);
127
- if (address(tokenHandler) != address(0)) { return tokenHandler.TOKEN(); }
102
+ function getProductNftId(uint256 idx) public view returns (NftId productNftId) {
103
+ return _instance.getProductNftId(idx);
128
104
  }
129
105
 
106
+ // module specific functions
130
107
 
131
- /// @dev Returns the current wallet address for the given component NFT ID.
132
- /// The wallet address is either the component's own address or any other wallet address specified by the component owner.
133
- /// The wallet holds the component's funds. Tokens collected by the component are transferred to the wallet and
134
- /// Tokens distributed from the component are transferred from this wallet.
135
- function getWallet(NftId componentNftId) public view returns (address wallet) {
136
- TokenHandler tokenHandler = getTokenHandler(componentNftId);
137
- if (address(tokenHandler) != address(0)) { return tokenHandler.getWallet(); }
108
+ function getPolicyInfo(NftId policyNftId)
109
+ public
110
+ view
111
+ returns (IPolicy.PolicyInfo memory info)
112
+ {
113
+ bytes memory data = _store.getData(toPolicyKey(policyNftId));
114
+ if (data.length > 0) {
115
+ return abi.decode(data, (IPolicy.PolicyInfo));
116
+ }
138
117
  }
139
118
 
140
-
141
- /// @dev Returns the token handler for the given component NFT ID.
142
- /// The token handler manages all transfers from/to the component's wallet.
143
- /// To allow a component to collect funds from an account, it has to create a corresponding allowance from the
144
- /// account to the address of the component's token handler.
145
- function getTokenHandler(NftId componentNftId) public view returns (TokenHandler tokenHandler) {
146
- (bytes memory data, bool success) = _getData(_toComponentKey(componentNftId));
147
- if (success) { return abi.decode(data, (IComponents.ComponentInfo)).tokenHandler; }
119
+ function getPolicyState(NftId policyNftId)
120
+ public
121
+ view
122
+ returns (StateId state)
123
+ {
124
+ return _store.getState(toPolicyKey(policyNftId));
148
125
  }
149
126
 
150
-
151
- /// @dev Returns the current token balance amount for the given component NFT ID.
152
- /// The balance amount includes the fee amount.
153
- function getBalanceAmount(NftId targetNftId) external view returns (Amount) {
154
- return _store.getBalanceAmount(targetNftId);
127
+ function getPremiumInfo(NftId policyNftId)
128
+ public
129
+ view
130
+ returns (IPolicy.PremiumInfo memory info)
131
+ {
132
+ bytes memory data = _store.getData(toPremiumKey(policyNftId));
133
+ if (data.length > 0) {
134
+ return abi.decode(data, (IPolicy.PremiumInfo));
135
+ }
155
136
  }
156
137
 
157
-
158
- /// @dev Returns the current fee amount for the given NFT ID.
159
- /// The target NFT ID may reference a component, a distributor or a bundle.
160
- function getFeeAmount(NftId targetNftId) external view returns (Amount) {
161
- return _store.getFeeAmount(targetNftId);
138
+ function getPremiumInfoState(NftId policyNftId)
139
+ public
140
+ view
141
+ returns (StateId state)
142
+ {
143
+ return _store.getState(toPremiumKey(policyNftId));
162
144
  }
163
145
 
164
-
165
- /// @dev Returns the currently locked amount for the given NFT ID.
166
- /// The target NFT ID may reference a pool or a bundle.
167
- function getLockedAmount(NftId targetNftId) external view returns (Amount) {
168
- return _store.getLockedAmount(targetNftId);
146
+ function bundles(NftId poolNftId)
147
+ public
148
+ view
149
+ returns (uint256 bundleCount)
150
+ {
151
+ return _bundleSet.bundles(poolNftId);
169
152
  }
170
153
 
171
- //--- product functions ------------------------------------------------------//
172
-
173
- /// @dev Returns the number of registered products.
174
- function products() public view returns (uint256 productCount) {
175
- return _instance.products();
154
+ function activeBundles(NftId poolNftId)
155
+ public
156
+ view
157
+ returns (uint256 bundleCount)
158
+ {
159
+ return _bundleSet.activeBundles(poolNftId);
176
160
  }
177
161
 
178
-
179
- /// @dev Returns th product NFT ID for the given index.
180
- function getProductNftId(uint256 idx) public view returns (NftId productNftId) {
181
- return _instance.getProductNftId(idx);
162
+ function getActiveBundleNftId(NftId poolNftId, uint256 idx)
163
+ public
164
+ view
165
+ returns (NftId bundleNftId)
166
+ {
167
+ return _bundleSet.getActiveBundleNftId(poolNftId, idx);
182
168
  }
183
169
 
184
-
185
- /// @dev Returns the product info for the given product NFT ID.
186
- function getProductInfo(NftId productNftId) public view returns (IComponents.ProductInfo memory info) {
187
- (bytes memory data, bool success) = _getData(productNftId.toKey32(PRODUCT()));
188
- if (success) { return abi.decode(data, (IComponents.ProductInfo)); }
170
+ function getBundleNftId(NftId poolNftId, uint256 idx)
171
+ public
172
+ view
173
+ returns (NftId bundleNftId)
174
+ {
175
+ return _bundleSet.getBundleNftId(poolNftId, idx);
189
176
  }
190
177
 
191
-
192
- /// @dev Returns the current fee settings for the given product NFT ID.
193
- function getFeeInfo(NftId productNftId) public view returns (IComponents.FeeInfo memory feeInfo) {
194
- (bytes memory data, bool success) = _getData(productNftId.toKey32(FEE()));
195
- if (success) { return abi.decode(data, (IComponents.FeeInfo)); }
178
+ function getBundleState(NftId bundleNftId)
179
+ public
180
+ view
181
+ returns (StateId state)
182
+ {
183
+ return _store.getState(toBundleKey(bundleNftId));
196
184
  }
197
185
 
198
- //--- risk functions ---------------------------------------------------------//
199
-
200
- /// @dev Returns the total number of registered risks for the specified product.
201
- function risks(NftId productNftId) public view returns (uint256 riskCount) {
202
- return _riskSet.risks(productNftId);
203
- }
186
+ /// @dev Returns true iff policy is active.
187
+ function policyIsActive(NftId policyNftId)
188
+ public
189
+ view
190
+ returns (bool isCloseable)
191
+ {
192
+ IPolicy.PolicyInfo memory info = getPolicyInfo(policyNftId);
204
193
 
194
+ if (info.productNftId.eqz()) { return false; } // not closeable: policy does not exist (or does not belong to this instance)
195
+ if (info.activatedAt.eqz()) { return false; } // not closeable: not yet activated
196
+ if (info.activatedAt > TimestampLib.blockTimestamp()) { return false; } // not yet active
197
+ if (info.expiredAt <= TimestampLib.blockTimestamp()) { return false; } // already expired
205
198
 
206
- /// @dev Returns the number of active risks for the specified product.
207
- function activeRisks(NftId productNftId) public view returns (uint256 activeRiskCount) {
208
- return _riskSet.activeRisks(productNftId);
199
+ return true;
209
200
  }
210
201
 
211
-
212
- /// @dev Returns the risk ID for the given product NFT ID and (registered) risk index.
213
- function getRiskId(NftId productNftId, uint256 idx) public view returns (RiskId riskId) {
214
- return _riskSet.getRiskId(productNftId, idx);
202
+ function claims(NftId policyNftId)
203
+ public
204
+ view
205
+ returns (uint16 claimCount)
206
+ {
207
+ return getPolicyInfo(policyNftId).claimsCount;
215
208
  }
216
209
 
217
210
 
218
- /// @dev Returns the active risk ID for the given product NFT ID and (active) risk index.
219
- function getActiveRiskId(NftId productNftId, uint256 idx) public view returns (RiskId riskId) {
220
- return _riskSet.getActiveRiskId(productNftId, idx);
211
+ function getClaimId(uint idx)
212
+ public
213
+ view
214
+ returns (ClaimId claimId)
215
+ {
216
+ return ClaimIdLib.toClaimId(idx + 1);
221
217
  }
222
218
 
223
-
224
- /// @dev Returns the risk info for the given risk ID.
225
- function getRiskInfo(RiskId riskId) public view returns (IRisk.RiskInfo memory info) {
226
- (bytes memory data, bool success) = _getData(riskId.toKey32());
227
- if (success) { return abi.decode(data, (IRisk.RiskInfo)); }
219
+ function getClaimInfo(NftId policyNftId, ClaimId claimId)
220
+ public
221
+ view
222
+ returns (IPolicy.ClaimInfo memory info)
223
+ {
224
+ bytes memory data = _store.getData(claimId.toKey32(policyNftId));
225
+ if (data.length > 0) {
226
+ return abi.decode(data, (IPolicy.ClaimInfo));
227
+ }
228
228
  }
229
229
 
230
230
 
231
- /// @dev Returns the risk state for the given risk ID.
232
- function getRiskState(RiskId riskId) public view returns (StateId stateId) {
233
- return getState(riskId.toKey32());
231
+ function getClaimState(NftId policyNftId, ClaimId claimId)
232
+ public
233
+ view
234
+ returns (StateId state)
235
+ {
236
+ return _store.getState(claimId.toKey32(policyNftId));
234
237
  }
235
238
 
236
239
 
237
- //--- policy functions -------------------------------------------------------//
238
-
239
- /// @dev Returns the number of linked policies for the given risk ID.
240
- function policiesForRisk(RiskId riskId) public view returns (uint256 linkedPolicies) {
241
- return _riskSet.linkedPolicies(riskId);
240
+ function payouts(NftId policyNftId, ClaimId claimId)
241
+ public
242
+ view
243
+ returns (uint24 payoutCount)
244
+ {
245
+ return getClaimInfo(policyNftId, claimId).payoutsCount;
242
246
  }
243
247
 
244
248
 
245
- /// @dev Returns the linked policy NFT ID for the given risk ID and index.
246
- function getPolicyNftIdForRisk(RiskId riskId, uint256 idx) public view returns (NftId linkedPolicyNftId) {
247
- return _riskSet.getLinkedPolicyNftId(riskId, idx);
249
+ function getPayoutId(ClaimId claimId, uint24 idx)
250
+ public
251
+ view
252
+ returns (PayoutId payoutId)
253
+ {
254
+ return PayoutIdLib.toPayoutId(claimId, idx + 1);
248
255
  }
249
256
 
250
257
 
251
- /// @dev Returns the info for the given policy NFT ID.
252
- function getPolicyInfo(NftId policyNftId) public view returns (IPolicy.PolicyInfo memory info) {
253
- (bytes memory data, bool success) = _getData(_toPolicyKey(policyNftId));
254
- if (success) { return abi.decode(data, (IPolicy.PolicyInfo)); }
258
+ function getRemainingClaimableAmount(NftId policyNftId)
259
+ public
260
+ view
261
+ returns (Amount remainingClaimableAmount)
262
+ {
263
+ IPolicy.PolicyInfo memory info = getPolicyInfo(policyNftId);
264
+ return info.sumInsuredAmount - info.claimAmount;
255
265
  }
256
266
 
257
-
258
- /// @dev Returns the state for the given policy NFT ID.
259
- function getPolicyState(NftId policyNftId) public view returns (StateId state) {
260
- return getState(_toPolicyKey(policyNftId));
267
+ function getPayoutInfo(NftId policyNftId, PayoutId payoutId)
268
+ public
269
+ view
270
+ returns (IPolicy.PayoutInfo memory info)
271
+ {
272
+ bytes memory data = _store.getData(payoutId.toKey32(policyNftId));
273
+ if (data.length > 0) {
274
+ return abi.decode(data, (IPolicy.PayoutInfo));
275
+ }
261
276
  }
262
277
 
263
-
264
- /// @dev Returns true iff policy is active.
265
- function policyIsActive(NftId policyNftId) public view returns (bool isCloseable) {
266
- return PolicyServiceLib.policyIsActive(this, policyNftId);
278
+ function getPayoutState(NftId policyNftId, PayoutId payoutId)
279
+ public
280
+ view
281
+ returns (StateId state)
282
+ {
283
+ return _store.getState(payoutId.toKey32(policyNftId));
267
284
  }
268
285
 
269
- //--- claim functions -------------------------------------------------------//
270
-
271
- /// @dev Returns the number of claims for the given policy NFT ID.
272
- function claims(NftId policyNftId) public view returns (uint16 claimCount) {
273
- return getPolicyInfo(policyNftId).claimsCount;
286
+ function risks(NftId productNftId)
287
+ public
288
+ view
289
+ returns (uint256 riskCount)
290
+ {
291
+ return _riskSet.risks(productNftId);
274
292
  }
275
293
 
294
+ function getRiskId(NftId productNftId, uint256 idx)
295
+ public
296
+ view
297
+ returns (RiskId riskId)
298
+ {
299
+ return _riskSet.getRiskId(productNftId, idx);
300
+ }
276
301
 
277
- /// @dev Returns the claim ID for the given policy NFT ID and index.
278
- function getClaimId(uint256 idx) public pure returns (ClaimId claimId) {
279
- return ClaimIdLib.toClaimId(idx + 1);
302
+ function activeRisks(NftId productNftId)
303
+ public
304
+ view
305
+ returns (uint256 activeRiskCount)
306
+ {
307
+ return _riskSet.activeRisks(productNftId);
280
308
  }
281
309
 
310
+ function getActiveRiskId(NftId productNftId, uint256 idx)
311
+ public
312
+ view
313
+ returns (RiskId riskId)
314
+ {
315
+ return _riskSet.getActiveRiskId(productNftId, idx);
316
+ }
282
317
 
283
- /// @dev Returns the claim info for the given policy NFT ID and claim ID.
284
- function getClaimInfo(NftId policyNftId, ClaimId claimId) public view returns (IPolicy.ClaimInfo memory info) {
285
- (bytes memory data, bool success) = _getData(claimId.toKey32(policyNftId));
286
- if (success) {
287
- return abi.decode(data, (IPolicy.ClaimInfo));
318
+ function getRiskInfo(RiskId riskId)
319
+ public
320
+ view
321
+ returns (IRisk.RiskInfo memory info)
322
+ {
323
+ bytes memory data = _store.getData(riskId.toKey32());
324
+ if (data.length > 0) {
325
+ return abi.decode(data, (IRisk.RiskInfo));
288
326
  }
289
327
  }
290
328
 
291
-
292
- /// @dev Returns the current claim state for the given policy NFT ID and claim ID.
293
- function getClaimState(NftId policyNftId, ClaimId claimId) public view returns (StateId state) {
294
- return getState(claimId.toKey32(policyNftId));
329
+ function getRiskState(RiskId riskId)
330
+ public
331
+ view
332
+ returns (StateId stateId)
333
+ {
334
+ bytes memory data = _store.getData(riskId.toKey32());
335
+ return _store.getState(riskId.toKey32());
295
336
  }
296
337
 
297
-
298
- /// @dev Returns the remaining claimable amount for the given policy NFT ID.
299
- /// The remaining claimable amount is the difference between the sum insured amount and total approved claim amounts so far.
300
- function getRemainingClaimableAmount(NftId policyNftId)
301
- public view returns (Amount remainingClaimableAmount) {
302
- IPolicy.PolicyInfo memory info = getPolicyInfo(policyNftId);
303
- return info.sumInsuredAmount - info.claimAmount;
338
+ function policiesForRisk(RiskId riskId)
339
+ public
340
+ view
341
+ returns (uint256 linkedPolicies)
342
+ {
343
+ return _riskSet.linkedPolicies(riskId);
304
344
  }
305
345
 
306
- //--- payout functions -------------------------------------------------------//
307
-
308
- /// @dev Returns the number of payouts for the given policy NFT ID and claim ID.
309
- function payouts(NftId policyNftId, ClaimId claimId) public view returns (uint24 payoutCount) {
310
- return getClaimInfo(policyNftId, claimId).payoutsCount;
346
+ function getPolicyNftIdForRisk(RiskId riskId, uint256 idx)
347
+ public
348
+ view
349
+ returns (NftId linkedPolicyNftId)
350
+ {
351
+ return _riskSet.getLinkedPolicyNftId(riskId, idx);
311
352
  }
312
353
 
313
354
 
314
- /// @dev Returns the payout ID for the given claim ID and index.
315
- function getPayoutId(ClaimId claimId, uint24 idx) public pure returns (PayoutId payoutId) {
316
- return PayoutIdLib.toPayoutId(claimId, idx + 1);
355
+ function getToken(NftId componentNftId)
356
+ public
357
+ view
358
+ returns (IERC20Metadata token)
359
+ {
360
+ TokenHandler tokenHandler = getTokenHandler(componentNftId);
361
+ if (address(tokenHandler) != address(0)) {
362
+ return tokenHandler.TOKEN();
363
+ }
317
364
  }
318
365
 
319
366
 
320
- /// @dev Returns the payout info for the given policy NFT ID and payout ID.
321
- function getPayoutInfo(NftId policyNftId, PayoutId payoutId) public view returns (IPolicy.PayoutInfo memory info) {
322
- (bytes memory data, bool success) = _getData(payoutId.toKey32(policyNftId));
323
- if (success) { return abi.decode(data, (IPolicy.PayoutInfo)); }
367
+ function getWallet(NftId componentNftId)
368
+ public
369
+ view
370
+ returns (address wallet)
371
+ {
372
+ TokenHandler tokenHandler = getTokenHandler(componentNftId);
373
+ if (address(tokenHandler) != address(0)) {
374
+ return tokenHandler.getWallet();
375
+ }
324
376
  }
325
377
 
326
378
 
327
- /// @dev Returns the payout state for the given policy NFT ID and payout ID.
328
- function getPayoutState(NftId policyNftId, PayoutId payoutId) public view returns (StateId state) {
329
- return getState(payoutId.toKey32(policyNftId));
379
+ function getTokenHandler(NftId componentNftId)
380
+ public
381
+ view
382
+ returns (TokenHandler tokenHandler)
383
+ {
384
+ bytes memory data = _store.getData(toComponentKey(componentNftId));
385
+ if (data.length > 0) {
386
+ return abi.decode(data, (IComponents.ComponentInfo)).tokenHandler;
387
+ }
330
388
  }
331
389
 
332
- //--- premium functions -------------------------------------------------------//
333
390
 
334
- /// @dev Returns the premium info for the given policy NFT ID.
335
- function getPremiumInfo(NftId policyNftId) public view returns (IPolicy.PremiumInfo memory info) {
336
- (bytes memory data, bool success) = _getData(_toPremiumKey(policyNftId));
337
- if (success) { return abi.decode(data, (IPolicy.PremiumInfo)); }
391
+ function getBundleInfo(NftId bundleNftId)
392
+ public
393
+ view
394
+ returns (IBundle.BundleInfo memory info)
395
+ {
396
+ bytes memory data = _store.getData(toBundleKey(bundleNftId));
397
+ if (data.length > 0) {
398
+ return abi.decode(data, (IBundle.BundleInfo));
399
+ }
338
400
  }
339
401
 
340
-
341
- /// @dev Returns the premium state for the given policy NFT ID.
342
- function getPremiumState(NftId policyNftId) public view returns (StateId state) {
343
- return getState(_toPremiumKey(policyNftId));
402
+ function getDistributorTypeInfo(DistributorType distributorType)
403
+ public
404
+ view
405
+ returns (IDistribution.DistributorTypeInfo memory info)
406
+ {
407
+ bytes memory data = _store.getData(distributorType.toKey32());
408
+ if (data.length > 0) {
409
+ return abi.decode(data, (IDistribution.DistributorTypeInfo));
410
+ }
344
411
  }
345
412
 
346
- //--- oracle functions ---------------------------------------------------------//
347
-
348
- /// @dev Returns the request info for the given oracle request ID.
349
- function getRequestInfo(RequestId requestId) public view returns (IOracle.RequestInfo memory requestInfo) {
350
- (bytes memory data, bool success) = _getData(requestId.toKey32());
351
- if (success) { return abi.decode(data, (IOracle.RequestInfo)); }
413
+ function getDistributorInfo(NftId distributorNftId)
414
+ public
415
+ view
416
+ returns (IDistribution.DistributorInfo memory info)
417
+ {
418
+ bytes memory data = _store.getData(toDistributorKey(distributorNftId));
419
+ if (data.length > 0) {
420
+ return abi.decode(data, (IDistribution.DistributorInfo));
421
+ }
352
422
  }
353
423
 
354
- //--- pool functions -----------------------------------------------------------//
355
-
356
- /// @dev Returns the pool info for the given pool NFT ID.
357
- function getPoolInfo(NftId poolNftId) public view returns (IComponents.PoolInfo memory info) {
358
- (bytes memory data, bool success) = _getData(poolNftId.toKey32(POOL()));
359
- if (success) { return abi.decode(data, (IComponents.PoolInfo)); }
424
+ function getBalanceAmount(NftId targetNftId) external view returns (Amount) {
425
+ return _store.getBalanceAmount(targetNftId);
360
426
  }
361
427
 
362
- //--- bundle functions -------------------------------------------------------//
363
-
364
- /// @dev Returns the total number of registered bundles for the given pool.
365
- function bundles(NftId poolNftId) public view returns (uint256 bundleCount) {
366
- return _bundleSet.bundles(poolNftId);
428
+ function getLockedAmount(NftId targetNftId) external view returns (Amount) {
429
+ return _store.getLockedAmount(targetNftId);
367
430
  }
368
431
 
369
-
370
- /// @dev Returns the number of active bundles for the given pool.
371
- function activeBundles(NftId poolNftId) public view returns (uint256 bundleCount) {
372
- return _bundleSet.activeBundles(poolNftId);
432
+ function getFeeAmount(NftId targetNftId) external view returns (Amount) {
433
+ return _store.getFeeAmount(targetNftId);
373
434
  }
374
435
 
375
-
376
- /// @dev Returns the bunde NFT ID for the given pool and index.
377
- function getBundleNftId(NftId poolNftId, uint256 idx) public view returns (NftId bundleNftId) {
378
- return _bundleSet.getBundleNftId(poolNftId, idx);
436
+ function getComponentInfo(NftId componentNftId)
437
+ public
438
+ view
439
+ returns (IComponents.ComponentInfo memory info)
440
+ {
441
+ bytes memory data = _store.getData(toComponentKey(componentNftId));
442
+ if (data.length > 0) {
443
+ return abi.decode(data, (IComponents.ComponentInfo));
444
+ }
379
445
  }
380
446
 
381
-
382
- /// @dev Returns the active bunde NFT ID for the given pool and index.
383
- function getActiveBundleNftId(NftId poolNftId, uint256 idx) public view returns (NftId bundleNftId) {
384
- return _bundleSet.getActiveBundleNftId(poolNftId, idx);
447
+ function getProductInfo(NftId productNftId)
448
+ public
449
+ view
450
+ returns (IComponents.ProductInfo memory info)
451
+ {
452
+ bytes memory data = _store.getData(toProductKey(productNftId));
453
+ if (data.length > 0) {
454
+ return abi.decode(data, (IComponents.ProductInfo));
455
+ }
385
456
  }
386
457
 
387
-
388
- /// @dev Returns the bundle info for the given bundle NFT ID.
389
- function getBundleInfo(NftId bundleNftId) public view returns (IBundle.BundleInfo memory info) {
390
- (bytes memory data, bool success) = _getData(_toBundleKey(bundleNftId));
391
- if (success) { return abi.decode(data, (IBundle.BundleInfo)); }
458
+ function getFeeInfo(NftId productNftId)
459
+ public
460
+ view
461
+ returns (IComponents.FeeInfo memory feeInfo)
462
+ {
463
+ bytes memory data = _store.getData(toFeeKey(productNftId));
464
+ if (data.length > 0) {
465
+ return abi.decode(data, (IComponents.FeeInfo));
466
+ }
392
467
  }
393
468
 
394
-
395
- /// @dev Returns the bundle state for the given bundle NFT ID.
396
- function getBundleState(NftId bundleNftId) public view returns (StateId state) {
397
- return getState(_toBundleKey(bundleNftId));
469
+ function getPoolInfo(NftId poolNftId)
470
+ public
471
+ view
472
+ returns (IComponents.PoolInfo memory info)
473
+ {
474
+ bytes memory data = _store.getData(toPoolKey(poolNftId));
475
+ if (data.length > 0) {
476
+ return abi.decode(data, (IComponents.PoolInfo));
477
+ }
398
478
  }
399
479
 
400
- //--- distribution functions -------------------------------------------------------//
401
-
402
- function getDistributorTypeInfo(DistributorType distributorType) public view returns (IDistribution.DistributorTypeInfo memory info) {
403
- (bytes memory data, bool success) = _getData(distributorType.toKey32());
404
- if (success) { return abi.decode(data, (IDistribution.DistributorTypeInfo)); }
480
+ function getReferralInfo(ReferralId referralId)
481
+ public
482
+ view
483
+ returns (IDistribution.ReferralInfo memory info)
484
+ {
485
+ bytes memory data = _store.getData(referralId.toKey32());
486
+ if (data.length > 0) {
487
+ return abi.decode(data, (IDistribution.ReferralInfo));
488
+ }
405
489
  }
406
490
 
407
-
408
- function getDistributorInfo(NftId distributorNftId) public view returns (IDistribution.DistributorInfo memory info) {
409
- (bytes memory data, bool success) = _getData(distributorNftId.toKey32(DISTRIBUTOR()));
410
- if (success) { return abi.decode(data, (IDistribution.DistributorInfo)); }
491
+ function isReferralValid(NftId distributionNftId, ReferralId referralId)
492
+ external
493
+ view
494
+ returns (bool isValid)
495
+ {
496
+ return _distributionService.referralIsValid(
497
+ distributionNftId,
498
+ referralId);
411
499
  }
412
500
 
413
-
414
- //--- referral functions -------------------------------------------------------//
415
-
416
- function toReferralId(NftId distributionNftId, string memory referralCode) public pure returns (ReferralId referralId) {
417
- return ReferralLib.toReferralId(distributionNftId, referralCode);
501
+ function getRequestInfo(RequestId requestId)
502
+ public
503
+ view
504
+ returns (IOracle.RequestInfo memory requestInfo)
505
+ {
506
+ bytes memory data = _store.getData(requestId.toKey32());
507
+ if (data.length > 0) {
508
+ return abi.decode(data, (IOracle.RequestInfo));
509
+ }
418
510
  }
419
511
 
512
+ function getMetadata(Key32 key)
513
+ public
514
+ view
515
+ returns (IKeyValueStore.Metadata memory metadata)
516
+ {
517
+ return _store.getMetadata(key);
518
+ }
420
519
 
421
- function isReferralValid(NftId distributionNftId, ReferralId referralId) external view returns (bool isValid) {
422
- return _distributionService.referralIsValid(distributionNftId, referralId);
520
+ function getState(Key32 key)
521
+ public
522
+ view
523
+ returns (StateId state)
524
+ {
525
+ return _store.getMetadata(key).state;
423
526
  }
424
527
 
425
528
 
426
- function getReferralInfo(ReferralId referralId) public view returns (IDistribution.ReferralInfo memory info) {
427
- (bytes memory data, bool success) = _getData(referralId.toKey32());
428
- if (success) { return abi.decode(data, (IDistribution.ReferralInfo)); }
529
+ function toReferralId(
530
+ NftId distributionNftId,
531
+ string memory referralCode
532
+ )
533
+ public
534
+ pure
535
+ returns (ReferralId referralId)
536
+ {
537
+ return ReferralLib.toReferralId(
538
+ distributionNftId,
539
+ referralCode);
429
540
  }
430
541
 
431
542
 
@@ -437,196 +548,103 @@ contract InstanceReader {
437
548
  ReferralStatus status
438
549
  )
439
550
  {
440
- return IDistributionService(
441
- _registry.getServiceAddress(
442
- DISTRIBUTION(),
443
- _instance.getRelease())).getDiscountPercentage(
444
- this, // instance reader
445
- referralId);
446
- }
447
-
448
- //--- authorization functions -------------------------------------------------------//
449
-
450
- /// @dev Returns the number of defined roles.
451
- function roles() public view returns (uint256) {
452
- return _instanceAdmin.roles();
453
- }
454
-
455
-
456
- /// @dev Returns the role ID for the given index.
457
- function getRoleId(uint256 idx) public view returns (RoleId roleId) {
458
- return _instanceAdmin.getRoleId(uint64(idx));
459
- }
460
-
461
-
462
- /// @dev Returns the role ID for the instance owner role.
463
- /// This role may be used as a "root" admin role for other custom roles defined for this instance.
464
- function getInstanceOwnerRole() public pure returns (RoleId roleId) {
465
- return INSTANCE_OWNER_ROLE();
466
- }
551
+ IDistribution.ReferralInfo memory info = getReferralInfo(
552
+ referralId);
467
553
 
554
+ if (info.expiryAt.eqz()) {
555
+ return (
556
+ UFixedLib.zero(),
557
+ REFERRAL_ERROR_UNKNOWN());
558
+ }
468
559
 
469
- /// @dev Returns the role info for the given role ID.
470
- function getRoleInfo(RoleId roleId) public view returns (IAccess.RoleInfo memory roleInfo) {
471
- return _instanceAdmin.getRoleInfo(roleId);
472
- }
560
+ if (info.expiryAt < TimestampLib.blockTimestamp()) {
561
+ return (
562
+ UFixedLib.zero(),
563
+ REFERRAL_ERROR_EXPIRED());
564
+ }
473
565
 
566
+ if (info.usedReferrals >= info.maxReferrals) {
567
+ return (
568
+ UFixedLib.zero(),
569
+ REFERRAL_ERROR_EXHAUSTED());
570
+ }
474
571
 
475
- /// @dev Returns true iff the provided role ID is defined for this instance.
476
- function roleExists(RoleId roleId) public view returns (bool exists) {
477
- return _instanceAdmin.roleExists(roleId);
572
+ return (
573
+ info.discountPercentage,
574
+ REFERRAL_OK()
575
+ );
478
576
  }
479
577
 
480
578
 
481
- /// @dev Returns true iff the provided role ID represents a custom role ID.
482
- function isRoleCustom(RoleId roleId) public view returns (bool isCustom) {
483
- return _instanceAdmin.isRoleCustom(roleId);
579
+ function hasRole(address account, RoleId roleId) public view returns (bool isMember) {
580
+ return _instance.getInstanceAdmin().hasRole(account, roleId);
484
581
  }
485
582
 
486
583
 
487
- /// @dev Returns true iff the provided role ID is active.
488
- function isRoleActive(RoleId roleId) public view returns (bool isActive) {
489
- return _instanceAdmin.isRoleActive(roleId);
584
+ function hasAdminRole(address account, RoleId roleId) public view returns (bool isMember) {
585
+ return _instance.getInstanceAdmin().hasAdminRole(account, roleId);
490
586
  }
491
587
 
492
588
 
493
- /// @dev Returns the number of members (accounts) for the given role ID.
494
- function roleMembers(RoleId roleId) public view returns (uint256 numberOfMembers) {
495
- return _instanceAdmin.roleMembers(roleId);
589
+ function isLocked(address target) public view returns (bool) {
590
+ return _instance.getInstanceAdmin().isTargetLocked(target);
496
591
  }
497
592
 
498
-
499
- /// @dev Returns the member (account address) for the given role ID and index.
500
- function getRoleMember(RoleId roleId, uint256 idx) public view returns (address account) {
501
- return _instanceAdmin.getRoleMember(roleId, idx);
593
+ function toPolicyKey(NftId policyNftId) public pure returns (Key32) {
594
+ return policyNftId.toKey32(POLICY());
502
595
  }
503
596
 
504
-
505
- /// @dev Returns true iff the given account is a member of the specified role ID.
506
- function isRoleMember(RoleId roleId, address account) public view returns (bool isMember) {
507
- return _instanceAdmin.isRoleMember(roleId, account);
597
+ function toPremiumKey(NftId policyNftId) public pure returns (Key32) {
598
+ return policyNftId.toKey32(PREMIUM());
508
599
  }
509
600
 
510
-
511
- /// @dev Returns true iff the given account is an admin of the specified role ID.
512
- /// Role admins may grant and revoke the role to other accounts.
513
- function isRoleAdmin(RoleId roleId, address account) public view returns (bool isMember) {
514
- return _instanceAdmin.isRoleAdmin(roleId, account);
601
+ function toDistributorKey(NftId distributorNftId) public pure returns (Key32) {
602
+ return distributorNftId.toKey32(DISTRIBUTOR());
515
603
  }
516
604
 
517
-
518
- /// @dev Returns the number of targets (contracts) defined for this instance.
519
- function targets() public view returns (uint256 targetCount) {
520
- return _instanceAdmin.targets();
605
+ function toBundleKey(NftId poolNftId) public pure returns (Key32) {
606
+ return poolNftId.toKey32(BUNDLE());
521
607
  }
522
608
 
523
-
524
- /// @dev Returns the target address for the given index.
525
- function getTargetAddress(uint256 idx) public view returns (address target) {
526
- return _instanceAdmin.getTargetAddress(idx);
609
+ function toComponentKey(NftId componentNftId) public pure returns (Key32) {
610
+ return componentNftId.toKey32(COMPONENT());
527
611
  }
528
612
 
529
-
530
- /// @dev Returns the target info for the given target address.
531
- function getTargetInfo(address target) public view returns (IAccess.TargetInfo memory targetInfo) {
532
- return _instanceAdmin.getTargetInfo(target);
613
+ function toDistributionKey(NftId distributionNftId) public pure returns (Key32) {
614
+ return distributionNftId.toKey32(DISTRIBUTION());
533
615
  }
534
616
 
535
-
536
- /// @dev Returns true iff the given target is defined for this instance.
537
- function targetExists(address target) public view returns (bool exists) {
538
- return _instanceAdmin.targetExists(target);
617
+ function toPoolKey(NftId poolNftId) public pure returns (Key32) {
618
+ return poolNftId.toKey32(POOL());
539
619
  }
540
620
 
541
-
542
- /// @dev Returns true iff the given target is locked.
543
- function isLocked(address target) public view returns (bool) {
544
- return _instanceAdmin.isTargetLocked(target);
621
+ function toProductKey(NftId productNftId) public pure returns (Key32) {
622
+ return productNftId.toKey32(PRODUCT());
545
623
  }
546
624
 
547
-
548
- /// @dev Returns the number of authorized functions for the given target.
549
- function authorizedFunctions(address target) external view returns (uint256 numberOfFunctions) {
550
- return _instanceAdmin.authorizedFunctions(target);
625
+ function toFeeKey(NftId productNftId) public pure returns (Key32) {
626
+ return productNftId.toKey32(FEE());
551
627
  }
552
628
 
553
-
554
- /// @dev Returns the authorized function info for the given target and index.
555
- function getAuthorizedFunction(address target, uint256 idx) external view returns (IAccess.FunctionInfo memory func, RoleId roleId) {
556
- return _instanceAdmin.getAuthorizedFunction(target, idx);
557
- }
558
-
559
-
560
- /// @dev Returns a function info for the given function signature and function name.
561
- /// The function signature must not be zero and the function name must not be empty.
562
- function toFunction(bytes4 signature, string memory name) public view returns (IAccess.FunctionInfo memory) {
563
- return AccessAdminLib.toFunction(signature, name);
564
- }
565
-
566
- //--- low level function ----------------------------------------------------//
567
-
568
- function getInstanceAdmin() external view returns (InstanceAdmin instanceAdmin) {
569
- return _instanceAdmin;
570
- }
629
+ // low level function
571
630
 
572
631
  function getInstanceStore() external view returns (IKeyValueStore store) {
573
632
  return _store;
574
633
  }
575
634
 
576
-
577
635
  function getBundleSet() external view returns (BundleSet bundleSet) {
578
636
  return _bundleSet;
579
637
  }
580
638
 
581
-
582
639
  function getRiskSet() external view returns (RiskSet riskSet) {
583
640
  return _riskSet;
584
641
  }
585
642
 
586
-
587
- function getMetadata(Key32 key) public view returns (IKeyValueStore.Metadata memory metadata) {
588
- return _store.getMetadata(key);
589
- }
590
-
591
-
592
- function getState(Key32 key) public view returns (StateId state) {
593
- return _store.getState(key);
594
- }
595
-
596
-
597
643
  function toUFixed(uint256 value, int8 exp) public pure returns (UFixed) {
598
644
  return UFixedLib.toUFixed(value, exp);
599
645
  }
600
646
 
601
-
602
647
  function toInt(UFixed value) public pure returns (uint256) {
603
648
  return UFixedLib.toInt(value);
604
649
  }
605
-
606
- //--- internal functions ----------------------------------------------------//
607
-
608
- function _getData(Key32 key) internal view returns (bytes memory data, bool success) {
609
- data = _store.getData(key);
610
- return (data, data.length > 0);
611
- }
612
-
613
-
614
- function _toPolicyKey(NftId policyNftId) internal pure returns (Key32) {
615
- return policyNftId.toKey32(POLICY());
616
- }
617
-
618
-
619
- function _toPremiumKey(NftId policyNftId) internal pure returns (Key32) {
620
- return policyNftId.toKey32(PREMIUM());
621
- }
622
-
623
-
624
- function _toBundleKey(NftId poolNftId) internal pure returns (Key32) {
625
- return poolNftId.toKey32(BUNDLE());
626
- }
627
-
628
-
629
- function _toComponentKey(NftId componentNftId) internal pure returns (Key32) {
630
- return componentNftId.toKey32(COMPONENT());
631
- }
632
650
  }