@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
@@ -1,314 +1,100 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
+
4
6
  import {IAccess} from "../authorization/IAccess.sol";
7
+ import {ObjectType} from "../type/ObjectType.sol";
5
8
  import {IServiceAuthorization} from "./IServiceAuthorization.sol";
6
-
7
- import {ADMIN_ROLE_NAME, PUBLIC_ROLE_NAME} from "./AccessAdmin.sol";
8
- import {InitializableERC165} from "../shared/InitializableERC165.sol";
9
- import {ObjectType, ObjectTypeLib, ALL} from "../type/ObjectType.sol";
10
- import {RoleId, RoleIdLib, ADMIN_ROLE, PUBLIC_ROLE} from "../type/RoleId.sol";
11
9
  import {SelectorLib} from "../type/Selector.sol";
12
- import {Str, StrLib} from "../type/String.sol";
10
+ import {StrLib} from "../type/String.sol";
13
11
  import {TimestampLib} from "../type/Timestamp.sol";
14
12
  import {VersionPart, VersionPartLib} from "../type/Version.sol";
15
13
 
16
-
17
- /// @dev Base contract for release specific service authorization contracts and for Authorization contracts.
14
+ /// @dev Base contract for release specific service authorization contracts.
18
15
  contract ServiceAuthorization is
19
- InitializableERC165,
20
16
  IServiceAuthorization
21
17
  {
22
-
23
- string public constant COMMIT_HASH = "1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a";
24
-
25
18
  uint256 public constant COMMIT_HASH_LENGTH = 40;
26
19
  uint256 public constant GIF_INITIAL_VERSION = 3;
27
20
 
28
- string public constant SERVICE_NAME_SUFFIX = "Service";
29
- string public constant ROLE_NAME_SUFFIX = "_Role";
21
+ uint256 public immutable VERSION;
22
+ string public COMMIT_HASH;
30
23
 
31
- ObjectType public immutable DOMAIN;
32
- uint256 internal immutable _release;
33
- string internal _commitHash;
34
-
35
- string internal _mainTargetName;
36
- Str internal _mainTarget;
37
-
38
- // services
39
24
  ObjectType[] internal _serviceDomains;
40
25
  mapping(ObjectType domain => address service) internal _serviceAddress;
26
+ mapping(ObjectType domain => ObjectType[] authorizedDomains) internal _authorizedDomains;
27
+ mapping(ObjectType domain => mapping(ObjectType authorizedDomain => IAccess.FunctionInfo[] functions)) internal _authorizedFunctions;
41
28
 
42
- // roles
43
- RoleId[] internal _roles;
44
- mapping(RoleId role => RoleInfo info) internal _roleInfo;
45
-
46
- // targets
47
- Str[] internal _targets;
48
- mapping(Str target => bool exists) internal _targetExists;
49
- mapping(Str target => RoleId roleId) internal _targetRole;
50
- mapping(Str target => RoleId[] authorizedRoles) internal _authorizedRoles;
51
- mapping(Str target => mapping(RoleId authorizedRole => IAccess.FunctionInfo[] functions)) internal _authorizedFunctions;
52
-
53
-
54
- constructor(
55
- string memory mainTargetName,
56
- ObjectType domain,
57
- uint8 release,
58
- string memory commitHash
59
- )
60
- {
61
- // checks
62
- if (bytes(mainTargetName).length == 0) {
63
- revert ErrorAuthorizationMainTargetNameEmpty();
64
- }
65
-
66
- if (domain == ObjectTypeLib.zero()) {
67
- revert ErrorAuthorizationTargetDomainZero();
68
- }
69
-
70
- if (release < VersionPartLib.releaseMin().toInt() || release >= VersionPartLib.releaseMax().toInt()) {
71
- revert ErrorAuthorizationReleaseInvalid(release);
72
- }
73
-
74
- if (bytes(commitHash).length != COMMIT_HASH_LENGTH) {
75
- revert ErrorAuthorizationCommitHashInvalid(commitHash);
76
- }
77
-
78
- // effects
79
- _initializeERC165();
80
- _registerInterfaceNotInitializing(type(IServiceAuthorization).interfaceId);
81
-
82
- _mainTargetName = mainTargetName;
83
- _mainTarget = StrLib.toStr(mainTargetName);
84
-
85
- DOMAIN = domain;
86
- _release = release;
87
- _commitHash = commitHash;
29
+ constructor(string memory commitHash, uint256 version) {
30
+ assert(bytes(commitHash).length == COMMIT_HASH_LENGTH);
31
+ assert(version >= GIF_INITIAL_VERSION);
88
32
 
89
- // setup of roles defined in OpenZeppelin AccessManager
90
- _addRole(ADMIN_ROLE(), _toRoleInfo(ADMIN_ROLE(), RoleType.Core, 1, ADMIN_ROLE_NAME()));
91
- _addRole(PUBLIC_ROLE(), _toRoleInfo(ADMIN_ROLE(), RoleType.Core, 1, PUBLIC_ROLE_NAME()));
92
-
93
- // defines service domains relevant for the authorization
33
+ COMMIT_HASH = commitHash;
34
+ VERSION = version;
94
35
  _setupDomains();
95
36
  _setupDomainAuthorizations();
96
37
  }
97
38
 
98
- /// @inheritdoc IServiceAuthorization
99
- function getDomain() public view returns(ObjectType targetDomain) {
100
- return DOMAIN;
101
- }
102
-
103
- /// @inheritdoc IServiceAuthorization
104
- function getRelease() public view returns(VersionPart release) {
105
- return VersionPartLib.toVersionPart(_release);
106
- }
107
-
108
- /// @inheritdoc IServiceAuthorization
109
39
  function getCommitHash() external view returns(string memory commitHash) {
110
- return _commitHash;
40
+ return COMMIT_HASH;
111
41
  }
112
42
 
113
- /// @inheritdoc IServiceAuthorization
114
- function getMainTargetName() public view returns (string memory name) {
115
- return _mainTargetName;
43
+ function getRelease() external view returns(VersionPart release) {
44
+ return VersionPartLib.toVersionPart(VERSION);
116
45
  }
117
46
 
118
- /// @inheritdoc IServiceAuthorization
119
- function getMainTarget() external view returns(Str target) {
120
- return _mainTarget;
121
- }
122
-
123
- /// @inheritdoc IServiceAuthorization
124
47
  function getServiceDomains() external view returns(ObjectType[] memory serviceDomains) {
125
48
  return _serviceDomains;
126
49
  }
127
50
 
128
- /// @inheritdoc IServiceAuthorization
129
- function getServiceDomain(uint256 idx) external view returns(ObjectType serviceDomain) {
51
+ function getServiceDomain(uint idx) external view returns(ObjectType serviceDomain) {
130
52
  return _serviceDomains[idx];
131
53
  }
132
54
 
133
- /// @inheritdoc IServiceAuthorization
134
- function getServiceTarget(ObjectType serviceDomain) public view returns(Str target) {
135
- string memory serviceTargetName = ObjectTypeLib.toVersionedName(
136
- ObjectTypeLib.toName(serviceDomain),
137
- "Service",
138
- getRelease());
139
-
140
- return StrLib.toStr(serviceTargetName);
141
- }
142
-
143
- /// @inheritdoc IServiceAuthorization
144
- function getServiceRole(ObjectType serviceDomain) public view returns(RoleId serviceRoleId) {
145
- // special case domain ALL
146
- if (serviceDomain == ALL()) {
147
- return PUBLIC_ROLE();
148
- }
149
-
150
- Str target = getServiceTarget(serviceDomain);
151
- return getTargetRole(target);
152
- }
153
-
154
- /// @inheritdoc IServiceAuthorization
155
55
  function getServiceAddress(ObjectType serviceDomain) external view returns(address service) {
156
56
  return _serviceAddress[serviceDomain];
157
57
  }
158
58
 
159
- /// @inheritdoc IServiceAuthorization
160
- function getTargetRole(Str target) public view returns(RoleId roleId) {
161
- return _targetRole[target];
162
- }
163
-
164
- /// @inheritdoc IServiceAuthorization
165
- function roleExists(RoleId roleId) public view returns(bool exists) {
166
- return _roleInfo[roleId].roleType != RoleType.Undefined;
167
- }
168
-
169
- /// @inheritdoc IServiceAuthorization
170
- function getRoles() external view returns(RoleId[] memory roles) {
171
- return _roles;
59
+ function getAuthorizedDomains(ObjectType serviceDomain) external view returns(ObjectType[] memory authorizatedDomains) {
60
+ return _authorizedDomains[serviceDomain];
172
61
  }
173
62
 
174
- /// @inheritdoc IServiceAuthorization
175
- function getRoleInfo(RoleId roleId) external view returns (RoleInfo memory info) {
176
- return _roleInfo[roleId];
63
+ function getAuthorizedFunctions(ObjectType serviceDomain, ObjectType authorizedDomain) external view returns(IAccess.FunctionInfo[] memory authorizatedFunctions) {
64
+ return _authorizedFunctions[serviceDomain][authorizedDomain];
177
65
  }
178
66
 
179
- /// @inheritdoc IServiceAuthorization
180
- function getRoleName(RoleId roleId) external view returns (string memory roleName) {
181
- return _roleInfo[roleId].name.toString();
67
+ // ERC165
68
+ function supportsInterface(bytes4 interfaceId) public pure returns (bool) {
69
+ return (
70
+ interfaceId == type(IServiceAuthorization).interfaceId ||
71
+ interfaceId == type(IERC165).interfaceId
72
+ );
182
73
  }
183
74
 
184
- /// @inheritdoc IServiceAuthorization
185
- function getAuthorizedRoles(Str target) external view returns(RoleId[] memory roleIds) {
186
- return _authorizedRoles[target];
187
- }
188
-
189
- /// @inheritdoc IServiceAuthorization
190
- function getAuthorizedFunctions(Str target, RoleId roleId) external view returns(FunctionInfo[] memory authorizatedFunctions) {
191
- return _authorizedFunctions[target][roleId];
192
- }
193
75
 
194
- /// @dev Defines service domains relevant for the authorization.
195
- /// When used for ReleaseAdmin the list defines the services to be registered for the release.
196
- /// IMPORTANT: Both the list of the service domains as well as the ordering of the domains is important.
197
- /// Trying to register services not in this list or register services in a different order will result in an error.
198
- // solhint-disable-next-line no-empty-blocks
76
+ /// @dev Overwrite this function for a specific realease.
199
77
  function _setupDomains() internal virtual {}
200
78
 
201
79
  /// @dev Overwrite this function for a specific realease.
202
- // solhint-disable-next-line no-empty-blocks
203
80
  function _setupDomainAuthorizations() internal virtual {}
204
81
 
205
82
  /// @dev Use this method to to add an authorized domain.
206
83
  /// The services will need to be registered in the order they are added using this function.
207
- function _authorizeServiceDomain(ObjectType serviceDomain, address serviceAddress) internal {
84
+ function _authorizeDomain(ObjectType serviceDomain, address serviceAddress) internal {
208
85
  _serviceDomains.push(serviceDomain);
209
86
  _serviceAddress[serviceDomain] = serviceAddress;
210
-
211
- string memory serviceName = ObjectTypeLib.toVersionedName(
212
- ObjectTypeLib.toName(serviceDomain),
213
- SERVICE_NAME_SUFFIX,
214
- getRelease());
215
-
216
- _addTargetWithRole(
217
- serviceName,
218
- RoleIdLib.toServiceRoleId(serviceDomain, getRelease()),
219
- string(abi.encodePacked(serviceName, ROLE_NAME_SUFFIX)));
220
- }
221
-
222
-
223
- /// @dev Use this method to to add an authorized target together with its target role.
224
- function _addTargetWithRole(
225
- string memory targetName,
226
- RoleId roleId,
227
- string memory roleName
228
- )
229
- internal
230
- {
231
- // add target
232
- Str target = StrLib.toStr(targetName);
233
- _targets.push(target);
234
-
235
- _targetExists[target] = true;
236
-
237
- // link role to target if defined
238
- if (roleId != RoleIdLib.zero()) {
239
- // add role if new
240
- if (!roleExists(roleId)) {
241
- _addContractRole(roleId, roleName);
242
- }
243
-
244
- // link target to role
245
- _targetRole[target] = roleId;
246
- }
247
- }
248
-
249
-
250
- /// @dev Add a contract role for the provided role id and name.
251
- function _addContractRole(RoleId roleId, string memory name) internal {
252
- _addRole(
253
- roleId,
254
- _toRoleInfo(
255
- ADMIN_ROLE(),
256
- RoleType.Contract,
257
- 1,
258
- name));
259
87
  }
260
88
 
261
-
262
- /// @dev Use this method to to add an authorized role.
263
- function _addRole(RoleId roleId, RoleInfo memory info) internal {
264
- _roles.push(roleId);
265
- _roleInfo[roleId] = info;
266
- }
267
-
268
-
269
- /// @dev creates a role info object from the provided parameters
270
- function _toRoleInfo(RoleId adminRoleId, RoleType roleType, uint32 maxMemberCount, string memory name) internal view returns (RoleInfo memory info) {
271
- return RoleInfo({
272
- name: StrLib.toStr(name),
273
- adminRoleId: adminRoleId,
274
- roleType: roleType,
275
- maxMemberCount: maxMemberCount,
276
- createdAt: TimestampLib.blockTimestamp(),
277
- pausedAt: TimestampLib.max()});
278
- }
279
-
280
-
281
89
  /// @dev Use this method to authorize the specified domain to access the service domain.
282
- function _authorizeForService(
283
- ObjectType serviceDomain,
284
- ObjectType authorizedDomain
285
- )
90
+ function _authorizeForService(ObjectType serviceDomain, ObjectType authorizedDomain)
286
91
  internal
287
92
  returns (IAccess.FunctionInfo[] storage authorizatedFunctions)
288
93
  {
289
- Str serviceTarget = getServiceTarget(serviceDomain);
290
- RoleId authorizedRoleId = getServiceRole(authorizedDomain);
291
-
292
- return _authorizeForTarget(serviceTarget.toString(), authorizedRoleId);
94
+ _authorizedDomains[serviceDomain].push(authorizedDomain);
95
+ return _authorizedFunctions[serviceDomain][authorizedDomain];
293
96
  }
294
97
 
295
-
296
- /// @dev Use this method to authorize the specified role to access the target.
297
- function _authorizeForTarget(string memory target, RoleId authorizedRoleId)
298
- internal
299
- returns (IAccess.FunctionInfo[] storage authorizatedFunctions)
300
- {
301
- Str targetStr = StrLib.toStr(target);
302
-
303
- // add authorized role if not already added
304
- if (_authorizedFunctions[targetStr][authorizedRoleId].length == 0) {
305
- _authorizedRoles[targetStr].push(authorizedRoleId);
306
- }
307
-
308
- return _authorizedFunctions[targetStr][authorizedRoleId];
309
- }
310
-
311
-
312
98
  /// @dev Use this method to authorize a specific function authorization
313
99
  function _authorize(IAccess.FunctionInfo[] storage functions, bytes4 selector, string memory name) internal {
314
100
  functions.push(
@@ -8,7 +8,7 @@ import {Authorization} from "../authorization/Authorization.sol";
8
8
  import {BasicDistribution} from "./BasicDistribution.sol";
9
9
  import {Distribution} from "./Distribution.sol";
10
10
  import {COMPONENT, DISTRIBUTION} from "../type/ObjectType.sol";
11
- import {PUBLIC_ROLE} from "../type/RoleId.sol";
11
+ import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
12
12
  import {TokenHandler} from "../shared/TokenHandler.sol";
13
13
 
14
14
 
@@ -16,22 +16,15 @@ contract BasicDistributionAuthorization
16
16
  is Authorization
17
17
  {
18
18
 
19
- constructor(string memory distributionName)
20
- Authorization(
21
- distributionName,
22
- DISTRIBUTION(),
23
- 3,
24
- COMMIT_HASH,
25
- true,
26
- true)
19
+ constructor(string memory distributionlName)
20
+ Authorization(distributionlName, DISTRIBUTION(), true, true)
27
21
  {}
28
22
 
29
23
  function _setupServiceTargets()
30
24
  internal
31
25
  virtual override
32
26
  {
33
- _authorizeServiceDomain(COMPONENT(), address(11));
34
- _authorizeServiceDomain(DISTRIBUTION(), address(11));
27
+ _addServiceTargetWithRole(COMPONENT());
35
28
  }
36
29
 
37
30
  function _setupTokenHandlerAuthorizations() internal virtual override {
@@ -37,7 +37,6 @@ abstract contract Distribution is
37
37
  external
38
38
  virtual
39
39
  restricted()
40
- // solhint-disable-next-line no-empty-blocks
41
40
  {
42
41
  // default is no action
43
42
  }
@@ -82,7 +81,7 @@ abstract contract Distribution is
82
81
 
83
82
 
84
83
  function calculateRenewalFeeAmount(
85
- ReferralId, // referralId
84
+ ReferralId referralId,
86
85
  uint256 netPremiumAmount
87
86
  )
88
87
  external
@@ -13,19 +13,18 @@ import {IComponents} from "../instance/module/IComponents.sol";
13
13
  import {IPolicy} from "../instance/module/IPolicy.sol";
14
14
 
15
15
  import {Amount, AmountLib} from "../type/Amount.sol";
16
+ import {ContractLib} from "../shared/ContractLib.sol";
17
+ import {Service} from "../shared/Service.sol";
16
18
  import {DistributorType, DistributorTypeLib} from "../type/DistributorType.sol";
17
19
  import {NftId, NftIdLib} from "../type/NftId.sol";
18
20
  import {KEEP_STATE} from "../type/StateId.sol";
19
21
  import {ObjectType, ACCOUNTING, COMPONENT, DISTRIBUTION, INSTANCE, DISTRIBUTION, DISTRIBUTOR, REGISTRY} from "../type/ObjectType.sol";
20
22
  import {InstanceReader} from "../instance/InstanceReader.sol";
21
23
  import {InstanceStore} from "../instance/InstanceStore.sol";
22
- // TODO PoolLib feels wrong, should likely go in a component type independent lib
23
- import {PoolLib} from "../pool/PoolLib.sol";
24
- import {ReferralId, ReferralStatus, ReferralLib, REFERRAL_OK, REFERRAL_ERROR_UNKNOWN, REFERRAL_ERROR_EXPIRED, REFERRAL_ERROR_EXHAUSTED} from "../type/Referral.sol";
24
+ import {ReferralId, ReferralLib} from "../type/Referral.sol";
25
25
  import {Seconds} from "../type/Seconds.sol";
26
- import {Service} from "../shared/Service.sol";
27
26
  import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
28
- import {UFixed, UFixedLib} from "../type/UFixed.sol";
27
+ import {UFixed} from "../type/UFixed.sol";
29
28
 
30
29
 
31
30
  contract DistributionService is
@@ -76,8 +75,7 @@ contract DistributionService is
76
75
  restricted()
77
76
  returns (DistributorType distributorType)
78
77
  {
79
- // _getAndVerifyActiveDistribution
80
- (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveDistribution();
78
+ (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveDistribution(getRegistry());
81
79
 
82
80
  {
83
81
  NftId productNftId = getRegistry().getParentNftId(distributionNftId);
@@ -91,7 +89,7 @@ contract DistributionService is
91
89
  }
92
90
  UFixed maxDiscountPercentageLimit = variableDistributionFees - variableFeesPartsTotal;
93
91
 
94
- if (maxDiscountPercentage > maxDiscountPercentageLimit) {
92
+ if (maxDiscountPercentage.gt(maxDiscountPercentageLimit)) {
95
93
  revert ErrorDistributionServiceMaxDiscountTooHigh(maxDiscountPercentage.toInt1000(), maxDiscountPercentageLimit.toInt1000());
96
94
  }
97
95
  }
@@ -123,7 +121,7 @@ contract DistributionService is
123
121
  restricted()
124
122
  returns (NftId distributorNftId)
125
123
  {
126
- (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveDistribution();
124
+ (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveDistribution(getRegistry());
127
125
  _checkDistributionType(instance.getInstanceReader(), distributorType, distributionNftId);
128
126
 
129
127
  distributorNftId = _registryService.registerDistributor(
@@ -156,7 +154,7 @@ contract DistributionService is
156
154
  restricted()
157
155
  {
158
156
  _checkNftType(distributorNftId, DISTRIBUTOR());
159
- (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveDistribution();
157
+ (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveDistribution(getRegistry());
160
158
  _checkDistributionType(instance.getInstanceReader(), newDistributorType, distributionNftId);
161
159
 
162
160
  IDistribution.DistributorInfo memory distributorInfo = instance.getInstanceReader().getDistributorInfo(distributorNftId);
@@ -180,7 +178,7 @@ contract DistributionService is
180
178
  onlyNftOfType(distributorNftId, DISTRIBUTOR())
181
179
  returns (ReferralId referralId)
182
180
  {
183
- (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveDistribution();
181
+ (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveDistribution(getRegistry());
184
182
 
185
183
  if (bytes(code).length == 0) {
186
184
  revert ErrorDistributionServiceInvalidReferral(code);
@@ -241,7 +239,8 @@ contract DistributionService is
241
239
  onlyNftOfType(distributionNftId, DISTRIBUTION())
242
240
  {
243
241
  if (referralIsValid(distributionNftId, referralId)) {
244
- IInstance instance = _getInstanceForDistribution(getRegistry(), distributionNftId);
242
+ IRegistry registry = getRegistry();
243
+ IInstance instance = IInstance(ContractLib.getInstanceForComponent(getRegistry(), distributionNftId));
245
244
 
246
245
  // update book keeping for referral info
247
246
  IDistribution.ReferralInfo memory referralInfo = instance.getInstanceReader().getReferralInfo(referralId);
@@ -260,7 +259,8 @@ contract DistributionService is
260
259
  restricted()
261
260
  onlyNftOfType(distributionNftId, DISTRIBUTION())
262
261
  {
263
- IInstance instance = _getInstanceForDistribution(getRegistry(), distributionNftId);
262
+ IRegistry registry = getRegistry();
263
+ IInstance instance = IInstance(ContractLib.getInstanceForComponent(registry, distributionNftId));
264
264
  InstanceReader reader = instance.getInstanceReader();
265
265
  InstanceStore store = instance.getInstanceStore();
266
266
 
@@ -297,7 +297,7 @@ contract DistributionService is
297
297
  onlyNftOfType(distributorNftId, DISTRIBUTOR())
298
298
  returns (Amount withdrawnAmount)
299
299
  {
300
- (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveDistribution();
300
+ (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveDistribution(getRegistry());
301
301
  InstanceReader reader = instance.getInstanceReader();
302
302
 
303
303
  IComponents.ComponentInfo memory distributionInfo = reader.getComponentInfo(distributionNftId);
@@ -307,10 +307,10 @@ contract DistributionService is
307
307
 
308
308
  // determine withdrawn amount
309
309
  withdrawnAmount = amount;
310
- if (withdrawnAmount >= AmountLib.max()) {
310
+ if (withdrawnAmount.gte(AmountLib.max())) {
311
311
  withdrawnAmount = commissionAmount;
312
312
  } else {
313
- if (withdrawnAmount > commissionAmount) {
313
+ if (withdrawnAmount.gt(commissionAmount)) {
314
314
  revert ErrorDistributionServiceCommissionWithdrawAmountExceedsLimit(withdrawnAmount, commissionAmount);
315
315
  }
316
316
  }
@@ -342,7 +342,8 @@ contract DistributionService is
342
342
  return false;
343
343
  }
344
344
 
345
- IInstance instance = _getInstanceForDistribution(getRegistry(), distributionNftId);
345
+ IRegistry registry = getRegistry();
346
+ IInstance instance = IInstance(ContractLib.getInstanceForComponent(registry, distributionNftId));
346
347
  IDistribution.ReferralInfo memory info = instance.getInstanceReader().getReferralInfo(referralId);
347
348
 
348
349
  if (info.distributorNftId.eqz()) {
@@ -358,48 +359,6 @@ contract DistributionService is
358
359
  isValid = isValid && info.usedReferrals < info.maxReferrals;
359
360
  }
360
361
 
361
-
362
- function getDiscountPercentage(
363
- InstanceReader instanceReader,
364
- ReferralId referralId
365
- )
366
- external
367
- virtual
368
- view
369
- returns (
370
- UFixed discountPercentage,
371
- ReferralStatus status
372
- )
373
- {
374
- IDistribution.ReferralInfo memory info = instanceReader.getReferralInfo(
375
- referralId);
376
-
377
- if (info.expiryAt.eqz()) {
378
- return (
379
- UFixedLib.zero(),
380
- REFERRAL_ERROR_UNKNOWN());
381
- }
382
-
383
- if (info.expiryAt < TimestampLib.blockTimestamp()) {
384
- return (
385
- UFixedLib.zero(),
386
- REFERRAL_ERROR_EXPIRED());
387
- }
388
-
389
- if (info.usedReferrals >= info.maxReferrals) {
390
- return (
391
- UFixedLib.zero(),
392
- REFERRAL_ERROR_EXHAUSTED());
393
- }
394
-
395
- return (
396
- info.discountPercentage,
397
- REFERRAL_OK()
398
- );
399
-
400
- }
401
-
402
-
403
362
  function _checkDistributionType(InstanceReader instanceReader, DistributorType distributorType, NftId expectedDistributionNftId)
404
363
  internal
405
364
  view
@@ -412,30 +371,29 @@ contract DistributionService is
412
371
  }
413
372
  }
414
373
 
415
-
416
- function _getInstanceForDistribution(IRegistry registry, NftId distributionNftId)
417
- internal
418
- view
419
- returns(IInstance instance)
420
- {
421
- // TODO refactor to ComponentLib or similar
422
- return PoolLib.getInstanceForComponent(registry, distributionNftId);
423
- }
424
-
425
-
426
- function _getAndVerifyActiveDistribution()
374
+ function _getAndVerifyActiveDistribution(
375
+ IRegistry registry
376
+ )
427
377
  internal
428
- virtual
429
378
  view
430
379
  returns (
431
- NftId poolNftId,
380
+ NftId didstributionNftId,
432
381
  IInstance instance
433
382
  )
434
383
  {
435
- return PoolLib.getAndVerifyActiveComponent(getRegistry(), msg.sender, DISTRIBUTION());
384
+ (
385
+ IRegistry.ObjectInfo memory info,
386
+ address instanceAddress
387
+ ) = ContractLib.getAndVerifyComponent(
388
+ registry,
389
+ msg.sender,
390
+ DISTRIBUTION(),
391
+ true); // only active pools
392
+
393
+ didstributionNftId = info.nftId;
394
+ instance = IInstance(instanceAddress);
436
395
  }
437
396
 
438
-
439
397
  function _getDomain() internal pure override returns(ObjectType) {
440
398
  return DISTRIBUTION();
441
399
  }
@@ -1,14 +1,12 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {IInstanceLinkedComponent} from "../shared/IInstanceLinkedComponent.sol";
5
-
6
4
  import {Amount} from "../type/Amount.sol";
5
+ import {IInstanceLinkedComponent} from "../shared/IInstanceLinkedComponent.sol";
7
6
  import {NftId} from "../type/NftId.sol";
8
7
  import {ReferralId, ReferralStatus} from "../type/Referral.sol";
9
8
  import {UFixed} from "../type/UFixed.sol";
10
9
 
11
-
12
10
  interface IDistributionComponent is IInstanceLinkedComponent {
13
11
 
14
12
  event LogDistributorUpdated(address to, address operator);
@@ -1,17 +1,15 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {Amount} from "../type/Amount.sol";
5
+ import {NftId} from "../type/NftId.sol";
4
6
  import {IPolicy} from "../instance/module/IPolicy.sol";
5
7
  import {IService} from "../shared/IService.sol";
6
-
7
- import {Amount} from "../type/Amount.sol";
8
+ import {UFixed} from "../type/UFixed.sol";
8
9
  import {DistributorType} from "../type/DistributorType.sol";
9
- import {InstanceReader} from "../instance/InstanceReader.sol";
10
- import {NftId} from "../type/NftId.sol";
11
- import {ReferralId, ReferralStatus} from "../type/Referral.sol";
10
+ import {ReferralId} from "../type/Referral.sol";
12
11
  import {Seconds} from "../type/Seconds.sol";
13
12
  import {Timestamp} from "../type/Timestamp.sol";
14
- import {UFixed} from "../type/UFixed.sol";
15
13
 
16
14
 
17
15
  interface IDistributionService is IService {
@@ -102,8 +100,4 @@ interface IDistributionService is IService {
102
100
  /// @param amount the amount to withdraw. If set to AMOUNT_MAX, the full commission available is withdrawn
103
101
  /// @return withdrawnAmount the effective withdrawn amount
104
102
  function withdrawCommission(NftId distributorNftId, Amount amount) external returns (Amount withdrawnAmount);
105
-
106
- /// @dev Returns the discount percentage for the provided referral code.
107
- /// The function retuns both the percentage and the status of the referral code.
108
- function getDiscountPercentage(InstanceReader instanceReader, ReferralId referralId) external view returns (UFixed discountPercentage, ReferralStatus status);
109
103
  }