@etherisc/gif-next 0.0.2-7c8d286-020 → 0.0.2-7d488b3-675

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 (358) hide show
  1. package/README.md +1 -1
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
  3. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +32 -48
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
  5. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +26 -34
  6. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
  7. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +246 -361
  9. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +1 -1
  10. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +39 -8
  12. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +23 -96
  14. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  15. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  16. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +184 -278
  17. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  18. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +0 -32
  19. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  20. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  21. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
  22. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  23. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +109 -33
  24. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  25. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +41 -96
  26. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  27. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +65 -0
  28. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  29. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +106 -142
  30. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  31. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +53 -61
  32. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  33. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +65 -0
  34. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  35. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +20 -40
  36. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  37. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  38. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +17 -33
  39. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  40. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +41 -96
  41. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  42. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +59 -75
  43. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  44. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +41 -96
  45. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  46. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  47. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +118 -42
  48. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
  49. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +41 -96
  50. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  51. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +23 -23
  52. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  53. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +27 -43
  54. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
  55. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +41 -96
  56. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  57. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +29 -45
  58. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
  59. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +41 -96
  60. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  61. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  62. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  63. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +7 -85
  64. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  65. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +11 -54
  66. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  67. package/artifacts/contracts/instance/Instance.sol/Instance.json +25 -95
  68. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  69. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +405 -512
  70. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  71. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +41 -96
  72. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  73. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +2 -2
  74. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  75. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +63 -86
  76. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  77. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +36 -26
  78. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  79. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2 -2
  80. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
  81. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +2 -2
  82. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  83. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  84. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  85. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  86. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  87. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  88. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  89. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  90. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  91. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +1 -1
  92. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +2 -2
  93. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  94. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  95. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  96. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  97. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  98. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  99. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  100. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +14 -14
  101. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  102. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +30 -93
  103. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  104. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  105. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  106. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  107. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  108. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +42 -58
  109. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  110. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +31 -39
  111. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  112. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  113. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +41 -96
  114. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  115. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +58 -74
  116. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  117. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +39 -47
  118. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  119. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  120. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  121. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  122. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
  123. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +22 -38
  124. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  125. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +74 -106
  126. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  127. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +47 -63
  128. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  129. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +26 -71
  130. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  131. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +23 -35
  132. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  133. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  134. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +41 -96
  135. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  136. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +80 -96
  137. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  138. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +50 -58
  139. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  140. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +0 -21
  141. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  142. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  143. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  144. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +0 -21
  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/IRiskService.sol/IRiskService.json +0 -21
  148. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  149. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +86 -94
  150. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
  151. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +18 -452
  152. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  153. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +53 -57
  154. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  155. package/artifacts/contracts/product/PricingService.sol/PricingService.json +52 -89
  156. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  157. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +36 -44
  158. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  159. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  160. package/artifacts/contracts/product/RiskService.sol/RiskService.json +26 -55
  161. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  162. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +23 -27
  163. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  164. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  165. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  166. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +1 -1
  167. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  168. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  169. package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
  170. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  171. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +350 -440
  172. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  173. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -18
  174. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  175. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +19 -19
  176. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
  177. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +368 -473
  178. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  179. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  180. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  181. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +124 -128
  182. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  183. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
  184. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  185. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  186. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  187. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  188. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +102 -63
  189. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  190. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +49 -41
  191. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  192. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  193. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +4 -60
  194. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
  195. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
  196. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +1 -1
  197. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  198. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  199. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +24 -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/InitializableERC165.sol/InitializableERC165.json +2 -2
  210. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  211. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  212. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  213. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  214. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  215. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  216. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  217. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  218. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  219. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  220. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  221. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  222. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  223. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  224. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  225. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
  226. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
  227. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  228. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  229. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  230. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +9 -74
  231. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  232. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +3 -74
  233. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +4 -0
  234. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +440 -0
  235. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  236. package/artifacts/contracts/staking/Staking.sol/Staking.json +57 -141
  237. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  238. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  239. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  240. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +34 -50
  241. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  242. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +57 -30
  243. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  244. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +29 -124
  245. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  246. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +23 -35
  247. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  248. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +128 -142
  249. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  250. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +14 -24
  251. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  252. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  253. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  254. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  255. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  256. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  257. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  258. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  259. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  260. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  261. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
  262. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +2 -2
  263. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  264. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  265. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  266. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  267. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  268. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +31 -33
  269. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  270. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  271. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  272. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  273. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  274. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  275. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  276. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  277. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  278. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
  279. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  281. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  282. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  283. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  284. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  286. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  287. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
  288. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  289. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +2 -56
  290. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  291. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  292. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +4 -4
  293. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  294. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  295. package/contracts/accounting/AccountingService.sol +3 -2
  296. package/contracts/authorization/AccessAdmin.sol +186 -201
  297. package/contracts/authorization/AccessManagerCloneable.sol +31 -40
  298. package/contracts/authorization/Authorization.sol +33 -61
  299. package/contracts/authorization/IAccessAdmin.sol +36 -63
  300. package/contracts/authorization/IAuthorization.sol +0 -6
  301. package/contracts/distribution/BasicDistribution.sol +3 -5
  302. package/contracts/distribution/BasicDistributionAuthorization.sol +1 -1
  303. package/contracts/distribution/Distribution.sol +47 -4
  304. package/contracts/distribution/DistributionService.sol +6 -10
  305. package/contracts/distribution/IDistributionComponent.sol +9 -0
  306. package/contracts/distribution/IDistributionService.sol +5 -3
  307. package/contracts/instance/IInstance.sol +8 -43
  308. package/contracts/instance/IInstanceService.sol +2 -14
  309. package/contracts/instance/Instance.sol +13 -62
  310. package/contracts/instance/InstanceAdmin.sol +107 -120
  311. package/contracts/instance/InstanceAuthorizationV3.sol +21 -43
  312. package/contracts/instance/InstanceReader.sol +1 -1
  313. package/contracts/instance/InstanceService.sol +60 -118
  314. package/contracts/oracle/BasicOracleAuthorization.sol +1 -1
  315. package/contracts/oracle/OracleService.sol +4 -4
  316. package/contracts/pool/BasicPoolAuthorization.sol +1 -1
  317. package/contracts/pool/PoolLib.sol +1 -94
  318. package/contracts/pool/PoolService.sol +89 -91
  319. package/contracts/product/ApplicationService.sol +1 -10
  320. package/contracts/product/BasicProductAuthorization.sol +1 -1
  321. package/contracts/product/ClaimService.sol +0 -8
  322. package/contracts/product/IApplicationService.sol +0 -2
  323. package/contracts/product/IPricingService.sol +0 -1
  324. package/contracts/product/IRiskService.sol +0 -3
  325. package/contracts/product/PolicyService.sol +53 -35
  326. package/contracts/product/PolicyServiceLib.sol +1 -55
  327. package/contracts/product/PricingService.sol +0 -5
  328. package/contracts/product/RiskService.sol +0 -10
  329. package/contracts/registry/RegistryAdmin.sol +229 -133
  330. package/contracts/registry/ReleaseAdmin.sol +22 -30
  331. package/contracts/registry/ReleaseRegistry.sol +33 -39
  332. package/contracts/registry/ServiceAuthorizationV3.sol +3 -88
  333. package/contracts/shared/Component.sol +6 -6
  334. package/contracts/shared/ComponentService.sol +29 -33
  335. package/contracts/shared/ContractLib.sol +0 -28
  336. package/contracts/shared/IComponentService.sol +6 -4
  337. package/contracts/shared/InitializableERC165.sol +1 -9
  338. package/contracts/shared/NftOwnable.sol +1 -2
  339. package/contracts/shared/Registerable.sol +4 -1
  340. package/contracts/shared/TokenHandler.sol +4 -5
  341. package/contracts/staking/IStaking.sol +2 -12
  342. package/contracts/staking/IStakingService.sol +1 -11
  343. package/contracts/staking/{StakingLib.sol → StakeManagerLib.sol} +22 -79
  344. package/contracts/staking/Staking.sol +13 -33
  345. package/contracts/staking/StakingReader.sol +15 -5
  346. package/contracts/staking/StakingService.sol +2 -39
  347. package/contracts/staking/StakingStore.sol +1 -2
  348. package/contracts/type/ObjectType.sol +14 -5
  349. package/contracts/type/Version.sol +0 -39
  350. package/package.json +1 -1
  351. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +0 -4
  352. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +0 -673
  353. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +0 -4
  354. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +0 -878
  355. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +0 -4
  356. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +0 -469
  357. package/contracts/authorization/AccessAdminLib.sol +0 -183
  358. package/contracts/registry/RegistryAuthorization.sol +0 -267
@@ -2,11 +2,12 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {AccessManagerUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagerUpgradeable.sol";
5
+ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
5
6
  import {IAccessManager} from "@openzeppelin/contracts/access/manager/IAccessManager.sol";
6
7
 
7
8
  import {InitializableERC165} from "../shared/InitializableERC165.sol";
8
9
  import {RegistryLinked} from "../shared/RegistryLinked.sol";
9
- import {VersionPart} from "../type/Version.sol";
10
+ import {VersionPart, VersionLib} from "../type/Version.sol";
10
11
 
11
12
 
12
13
  /// @dev An AccessManager based on OpenZeppelin that is cloneable and has a central lock property.
@@ -27,7 +28,6 @@ contract AccessManagerCloneable is
27
28
  VersionPart private _release;
28
29
  bool private _isLocked;
29
30
 
30
-
31
31
  modifier onlyAdminRole() {
32
32
  (bool isMember, ) = hasRole(ADMIN_ROLE, msg.sender);
33
33
  if(!isMember) {
@@ -36,14 +36,12 @@ contract AccessManagerCloneable is
36
36
  _;
37
37
  }
38
38
 
39
-
40
39
  function initialize(address admin)
41
- public
40
+ external
42
41
  initializer()
43
42
  {
44
- __ERC165_init();
45
43
  __AccessManager_init(admin);
46
-
44
+ _initializeERC165();
47
45
  _registerInterface(type(IAccessManager).interfaceId);
48
46
  }
49
47
 
@@ -58,27 +56,22 @@ contract AccessManagerCloneable is
58
56
  onlyAdminRole
59
57
  reinitializer(uint64(release.toInt()))
60
58
  {
61
- _checkAndSetRegistry(registry);
62
- _checkAndSetRelease(release);
59
+ _completeSetup(registry, release, true);
63
60
  }
64
61
 
65
- // /// @dev Completes the setup of the access manager.
66
- // /// Links the access manager to the registry and sets the release version.
67
- // function completeSetup(
68
- // address registry,
69
- // VersionPart release,
70
- // bool verifyRelease
71
- // )
72
- // public
73
- // onlyAdminRole
74
- // reinitializer(uint64(release.toInt()))
75
- // {
76
- // _checkAndSetRegistry(registry);
77
-
78
- // if (verifyRelease) {
79
- // _checkAndSetRelease(release);
80
- // }
81
- // }
62
+ /// @dev Completes the setup of the access manager.
63
+ /// Links the access manager to the registry and sets the release version.
64
+ function completeSetup(
65
+ address registry,
66
+ VersionPart release,
67
+ bool verifyRelease
68
+ )
69
+ public
70
+ onlyAdminRole
71
+ reinitializer(uint64(release.toInt()))
72
+ {
73
+ _completeSetup(registry, release, verifyRelease);
74
+ }
82
75
 
83
76
  /// @dev Returns true if the caller is authorized to call the target with the given selector and the manager lock is not set to locked.
84
77
  /// Feturn values as in OpenZeppelin AccessManager.
@@ -96,12 +89,12 @@ contract AccessManagerCloneable is
96
89
  uint32 delay
97
90
  )
98
91
  {
92
+ (immediate, delay) = super.canCall(caller, target, selector);
93
+
99
94
  // locking of all contracts under control of this access manager
100
- if (_isLocked) {
95
+ if (isLocked()) {
101
96
  revert ErrorAccessManagerTargetAdminLocked(target);
102
97
  }
103
-
104
- (immediate, delay) = super.canCall(caller, target, selector);
105
98
  }
106
99
 
107
100
 
@@ -133,18 +126,11 @@ contract AccessManagerCloneable is
133
126
  }
134
127
 
135
128
 
136
- function _checkAndSetRelease(VersionPart release)
137
- internal
138
- {
139
- if (!release.isValidRelease()) {
140
- revert ErrorAccessManagerInvalidRelease(release);
141
- }
142
-
143
- _release = release;
144
- }
145
-
146
-
147
- function _checkAndSetRegistry(address registry)
129
+ function _completeSetup(
130
+ address registry,
131
+ VersionPart release,
132
+ bool verifyRelease
133
+ )
148
134
  internal
149
135
  {
150
136
  // checks
@@ -152,7 +138,12 @@ contract AccessManagerCloneable is
152
138
  revert ErrorAccessManagerRegistryAlreadySet(address(getRegistry()) );
153
139
  }
154
140
 
141
+ if (verifyRelease && !release.isValidRelease()) {
142
+ revert ErrorAccessManagerInvalidRelease(release);
143
+ }
144
+
155
145
  // effects
156
146
  __RegistryLinked_init(registry);
147
+ _release = release;
157
148
  }
158
149
  }
@@ -3,32 +3,27 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {IAccess} from "./IAccess.sol";
5
5
  import {IAuthorization} from "./IAuthorization.sol";
6
-
7
- import {InitializableERC165} from "../shared/InitializableERC165.sol";
8
- import {ObjectType, ObjectTypeLib} from "../type/ObjectType.sol";
6
+ import {ObjectType, ObjectTypeLib, PRODUCT, ORACLE, DISTRIBUTION, POOL} from "../type/ObjectType.sol";
9
7
  import {RoleId, RoleIdLib, ADMIN_ROLE} from "../type/RoleId.sol";
10
8
  import {SelectorLib} from "../type/Selector.sol";
11
9
  import {Str, StrLib} from "../type/String.sol";
12
10
  import {TimestampLib} from "../type/Timestamp.sol";
13
11
  import {VersionPart, VersionPartLib} from "../type/Version.sol";
14
12
 
15
- contract Authorization is
16
- InitializableERC165,
17
- IAuthorization
13
+ contract Authorization
14
+ is IAuthorization
18
15
  {
19
16
  uint256 public constant GIF_RELEASE = 3;
20
17
 
21
18
  string public constant ROLE_NAME_SUFFIX = "Role";
22
19
  string public constant SERVICE_ROLE_NAME_SUFFIX = "ServiceRole";
23
20
 
24
- uint64 internal _nextGifContractRoleId;
25
21
  ObjectType[] internal _serviceDomains;
26
22
  mapping(ObjectType domain => Str target) internal _serviceTarget;
27
23
 
28
24
  string internal _mainTargetName = "Component";
29
25
  string internal _tokenHandlerName = "ComponentTH";
30
26
 
31
- ObjectType internal _domain;
32
27
  Str internal _mainTarget;
33
28
  Str internal _tokenHandlerTarget;
34
29
  Str[] internal _targets;
@@ -45,9 +40,7 @@ contract Authorization is
45
40
 
46
41
  constructor(
47
42
  string memory mainTargetName,
48
- ObjectType targetDomain,
49
- bool isComponent,
50
- bool includeTokenHandler
43
+ ObjectType targetDomain
51
44
  )
52
45
  {
53
46
  // checks
@@ -55,52 +48,45 @@ contract Authorization is
55
48
  revert ErrorAuthorizationMainTargetNameEmpty();
56
49
  }
57
50
 
58
- if (targetDomain == ObjectTypeLib.zero()) {
51
+ if (targetDomain.eqz()) {
59
52
  revert ErrorAuthorizationTargetDomainZero();
60
53
  }
61
54
 
62
55
  // effects
63
- _initializeERC165();
64
-
65
- _domain = targetDomain;
56
+ // setup main target, main role id and main role info
66
57
  _mainTargetName = mainTargetName;
67
- _mainTarget = StrLib.toStr(mainTargetName);
68
- _nextGifContractRoleId = 10;
58
+ _tokenHandlerName = string(abi.encodePacked(mainTargetName, "TH"));
69
59
 
70
- if (isComponent) {
71
- if (targetDomain.eqz()) {
72
- revert ErrorAuthorizationTargetDomainZero();
73
- }
60
+ RoleId mainRoleId = RoleIdLib.toComponentRoleId(targetDomain, 0);
61
+ string memory mainRolName = _toTargetRoleName(mainTargetName);
74
62
 
75
- RoleId mainRoleId = RoleIdLib.toComponentRoleId(targetDomain, 0);
76
- string memory mainRolName = _toTargetRoleName(_mainTargetName);
63
+ _addTargetWithRole(
64
+ _mainTargetName,
65
+ mainRoleId,
66
+ mainRolName);
77
67
 
78
- _addTargetWithRole(
79
- _mainTargetName,
80
- mainRoleId,
81
- mainRolName);
82
- } else {
83
- _addGifContractTarget(_mainTargetName);
68
+ _mainTarget = StrLib.toStr(mainTargetName);
69
+ _targetRole[_mainTarget] = mainRoleId;
70
+
71
+ // add token handler target for components
72
+ if (targetDomain == PRODUCT()
73
+ || targetDomain == DISTRIBUTION()
74
+ || targetDomain == ORACLE()
75
+ || targetDomain == POOL()
76
+ ) {
77
+ _addTarget(_tokenHandlerName);
84
78
  }
79
+
80
+ // setup token handler target
81
+ _tokenHandlerTarget = StrLib.toStr(_tokenHandlerName);
82
+
85
83
  // setup use case specific parts
86
84
  _setupServiceTargets();
87
85
  _setupRoles(); // not including main target role
88
86
  _setupTargets(); // not including main target (and token handler target)
89
- _setupTargetAuthorizations(); // not including token handler target
90
87
 
91
- // setup component token handler
92
- if (includeTokenHandler) {
93
- _tokenHandlerName = string(abi.encodePacked(mainTargetName, "TH"));
94
- _tokenHandlerTarget = StrLib.toStr(_tokenHandlerName);
95
- _addTarget(_tokenHandlerName);
96
- _setupTokenHandlerAuthorizations();
97
- }
98
-
99
- _registerInterfaceNotInitializing(type(IAuthorization).interfaceId);
100
- }
101
-
102
- function getDomain() external view returns(ObjectType targetDomain) {
103
- return _domain;
88
+ _setupTokenHandlerAuthorizations();
89
+ _setupTargetAuthorizations(); // not including token handler target
104
90
  }
105
91
 
106
92
  function getServiceDomains() external view returns(ObjectType[] memory serviceDomains) {
@@ -161,7 +147,7 @@ contract Authorization is
161
147
  return target == _mainTarget || _targetExists[target];
162
148
  }
163
149
 
164
- function getTargetRole(Str target) public view returns(RoleId roleId) {
150
+ function getTargetRole(Str target) external view returns(RoleId roleId) {
165
151
  return _targetRole[target];
166
152
  }
167
153
 
@@ -197,20 +183,6 @@ contract Authorization is
197
183
  /// Overwrite this function for use case specific authorizations.
198
184
  function _setupTargetAuthorizations() internal virtual {}
199
185
 
200
- function _addGifContractTarget(string memory contractName) internal {
201
-
202
- RoleId contractRoleId = RoleIdLib.toRoleId(_nextGifContractRoleId++);
203
- string memory contractRoleName = string(
204
- abi.encodePacked(
205
- contractName,
206
- ROLE_NAME_SUFFIX));
207
-
208
- _addTargetWithRole(
209
- contractName,
210
- contractRoleId,
211
- contractRoleName);
212
- }
213
-
214
186
  /// @dev Add the service target role for the specified service domain
215
187
  function _addServiceTargetWithRole(ObjectType serviceDomain) internal {
216
188
  // add service domain
@@ -220,7 +192,7 @@ contract Authorization is
220
192
  string memory serviceTargetName = ObjectTypeLib.toVersionedName(
221
193
  ObjectTypeLib.toName(serviceDomain),
222
194
  "Service",
223
- getRelease());
195
+ getRelease().toInt());
224
196
 
225
197
  _serviceTarget[serviceDomain] = StrLib.toStr(serviceTargetName);
226
198
 
@@ -228,7 +200,7 @@ contract Authorization is
228
200
  string memory serviceRoleName = ObjectTypeLib.toVersionedName(
229
201
  ObjectTypeLib.toName(serviceDomain),
230
202
  "ServiceRole",
231
- getRelease());
203
+ getRelease().toInt());
232
204
 
233
205
  _addTargetWithRole(
234
206
  serviceTargetName,
@@ -263,7 +235,7 @@ contract Authorization is
263
235
  ObjectTypeLib.toVersionedName(
264
236
  ObjectTypeLib.toName(serviceDomain),
265
237
  SERVICE_ROLE_NAME_SUFFIX,
266
- getRelease()));
238
+ getRelease().toInt()));
267
239
  }
268
240
 
269
241
 
@@ -4,12 +4,7 @@ pragma solidity ^0.8.20;
4
4
  import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
5
5
 
6
6
  import {IAccess} from "./IAccess.sol";
7
- import {IAuthorization} from "./IAuthorization.sol";
8
7
  import {IRegistryLinked} from "../shared/IRegistryLinked.sol";
9
- import {IRelease} from "../registry/IRelease.sol";
10
-
11
- import {NftId} from "../type/NftId.sol";
12
- import {ObjectType} from "../type/ObjectType.sol";
13
8
  import {RoleId} from "../type/RoleId.sol";
14
9
  import {Selector} from "../type/Selector.sol";
15
10
  import {Str} from "../type/String.sol";
@@ -18,80 +13,59 @@ import {VersionPart} from "../type/Version.sol";
18
13
  interface IAccessAdmin is
19
14
  IAccessManaged,
20
15
  IAccess,
21
- IRegistryLinked,
22
- IRelease
16
+ IRegistryLinked
23
17
  {
24
18
 
25
19
  // roles, targets and functions
26
- event LogAccessAdminRoleCreated(string admin, RoleId roleId, RoleType roleType, RoleId roleAdminId, string name);
27
- event LogAccessAdminTargetCreated(string admin, address target, string name);
20
+ event LogAccessAdminRoleCreated(RoleId roleId, RoleType roleType, RoleId roleAdminId, string name);
21
+ event LogAccessAdminTargetCreated(address target, string name);
28
22
 
29
- event LogAccessAdminRoleGranted(string admin, address account, string roleName);
30
- event LogAccessAdminRoleRevoked(string admin, address account, string roleName);
31
- event LogAccessAdminFunctionGranted(string admin, address target, string func);
23
+ event LogAccessAdminRoleGranted(address account, string roleName);
24
+ event LogAccessAdminRoleRevoked(address account, string roleName);
25
+ event LogAccessAdminFunctionGranted(address target, string functionName, string roleName);
32
26
 
33
27
  // only deployer modifier
34
- error ErrorAccessAdminNotDeployer();
28
+ error ErrorNotDeployer();
35
29
 
36
30
  // only role admin modifier
37
- error ErrorAccessAdminNotAdminOfRole(RoleId adminRoleId, address account);
31
+ error ErrorNotAdminOfRole(RoleId adminRoleId);
38
32
 
39
33
  // only role owner modifier
40
- error ErrorAccessAdminNotRoleOwner(RoleId roleId, address account);
41
-
42
- // initialization
43
- error ErrorAccessAdminNotRegistry(address registry);
44
- error ErrorAccessAdminAuthorityNotContract(address authority);
45
- error ErrorAccessAdminAccessManagerNotAccessManager(address authority);
46
- error ErrorAccessAdminAccessManagerEmptyName();
47
-
48
- // check target
49
- error ErrorAccessAdminTargetNotCreated(address target);
50
- error ErrorAccessAdminTargetNotRegistered(address target);
51
- error ErrorAccessAdminTargetTypeMismatch(address target, ObjectType expectedType, ObjectType actualType);
52
-
53
- // check authorization
54
- error ErrorAccessAdminAlreadyInitialized(address authorization);
55
- error ErrorAccessAdminNotAuthorization(address authorization);
56
- error ErrorAccessAdminDomainMismatch(address authorization, ObjectType expectedDomain, ObjectType actualDomain);
57
- error ErrorAccessAdminReleaseMismatch(address authorization, VersionPart expectedRelease, VersionPart actualRelease);
58
-
59
- // link to nft
60
- error ErrorAccessAdminNotRegistered(address registerable);
34
+ error ErrorNotRoleOwner(RoleId roleId);
61
35
 
62
36
  // initialize authority
63
- error ErrorAccessAdminAdminRoleMissing();
37
+ error ErrorAdminRoleMissing();
64
38
 
65
39
  // create role
66
- error ErrorAccessAdminRoleAlreadyCreated(RoleId roleId, string name);
67
- error ErrorAccessAdminRoleAdminNotExisting(RoleId adminRoleId);
68
- error ErrorAccessAdminRoleNameEmpty(RoleId roleId);
69
- error ErrorAccessAdminRoleNameAlreadyExists(RoleId roleId, string name, RoleId existingRoleId);
40
+ error ErrorRoleAlreadyCreated(RoleId roleId, string name);
41
+ error ErrorRoleAdminNotExisting(RoleId adminRoleId);
42
+ error ErrorRoleNameEmpty(RoleId roleId);
43
+ error ErrorRoleNameAlreadyExists(RoleId roleId, string name, RoleId existingRoleId);
70
44
 
71
45
  // grant/revoke/renounce role
72
- error ErrorAccessAdminRoleUnknown(RoleId roleId);
73
- error ErrorAccessAdminRoleIsLocked(RoleId roleId);
74
- error ErrorAccessAdminRoleIsPaused(RoleId roleId);
75
- error ErrorAccessAdminRoleMembersLimitReached(RoleId roleId, uint256 memberCountLimit);
76
- error ErrorAccessAdminRoleMemberNotContract(RoleId roleId, address notContract);
77
- error ErrorAccessAdminRoleMemberRemovalDisabled(RoleId roleId, address expectedMember);
46
+ error ErrorRoleUnknown(RoleId roleId);
47
+ error ErrorRoleIsLocked(RoleId roleId);
48
+ error ErrorRoleIsPaused(RoleId roleId);
49
+ error ErrorRoleMembersLimitReached(RoleId roleId, uint256 memberCountLimit);
50
+ error ErrorRoleMemberNotContract(RoleId roleId, address notContract);
51
+ error ErrorRoleMemberRemovalDisabled(RoleId roleId, address expectedMember);
78
52
 
79
53
  // create target
80
- error ErrorAccessAdminTargetAlreadyCreated(address target, string name);
81
- error ErrorAccessAdminTargetNameEmpty(address target);
82
- error ErrorAccessAdminTargetNameAlreadyExists(address target, string name, address existingTarget);
83
- error ErrorAccessAdminTargetNotAccessManaged(address target);
84
- error ErrorAccessAdminTargetAuthorityMismatch(address expectedAuthority, address actualAuthority);
54
+ error ErrorTargetAlreadyCreated(address target, string name);
55
+ error ErrorTargetNameEmpty(address target);
56
+ error ErrorTargetNameAlreadyExists(address target, string name, address existingTarget);
57
+ error ErrorTargetNotAccessManaged(address target);
58
+ error ErrorTargetAuthorityMismatch(address expectedAuthority, address actualAuthority);
85
59
 
86
60
  // lock target
87
- error ErrorAccessAdminTagetNotLockable();
88
- error ErrorAccessAdminTargetAlreadyLocked(address target, bool isLocked);
61
+ error ErrorTagetNotLockable();
62
+ error ErrorTargetAlreadyLocked(address target, bool isLocked);
89
63
 
90
64
  // authorize target functions
91
- error ErrorAccessAdminAuthorizeForAdminRoleInvalid(address target);
65
+ error ErrorAuthorizeForAdminRoleInvalid(address target);
92
66
 
93
67
  // check target
94
- error ErrorAccessAdminTargetUnknown(address target);
68
+ error ErrorTargetUnknown(address target);
95
69
 
96
70
  /// @dev Set the disabled status of the speicified role.
97
71
  /// Role disabling only prevents the role from being granted to new accounts.
@@ -136,11 +110,7 @@ interface IAccessAdmin is
136
110
 
137
111
  //--- view functions ----------------------------------------------------//
138
112
 
139
- function getAuthorization() external view returns (IAuthorization authorization);
140
- function getLinkedNftId() external view returns (NftId linkedNftId);
141
- function getLinkedOwner() external view returns (address linkedOwner);
142
-
143
- function isLocked() external view returns (bool locked);
113
+ function getRelease() external view returns (VersionPart release);
144
114
 
145
115
  function roles() external view returns (uint256 numberOfRoles);
146
116
  function getRoleId(uint256 idx) external view returns (RoleId roleId);
@@ -148,8 +118,8 @@ interface IAccessAdmin is
148
118
  function getPublicRole() external view returns (RoleId roleId);
149
119
 
150
120
  function roleExists(RoleId roleId) external view returns (bool exists);
151
- function getRoleForName(string memory name) external view returns (RoleId roleId);
152
121
  function getRoleInfo(RoleId roleId) external view returns (RoleInfo memory roleInfo);
122
+ function getRoleForName(Str name) external view returns (RoleNameInfo memory);
153
123
 
154
124
  function hasRole(address account, RoleId roleId) external view returns (bool);
155
125
  function hasAdminRole(address account, RoleId roleId) external view returns (bool);
@@ -157,14 +127,17 @@ interface IAccessAdmin is
157
127
  function getRoleMember(RoleId roleId, uint256 idx) external view returns (address account);
158
128
 
159
129
  function targetExists(address target) external view returns (bool exists);
160
- function getTargetForName(Str name) external view returns (address target);
130
+ function isTargetLocked(address target) external view returns (bool locked);
161
131
  function targets() external view returns (uint256 numberOfTargets);
162
132
  function getTargetAddress(uint256 idx) external view returns (address target);
163
133
  function getTargetInfo(address target) external view returns (TargetInfo memory targetInfo);
164
- function isTargetLocked(address target) external view returns (bool locked);
134
+ function getTargetForName(Str name) external view returns (address target);
165
135
 
166
136
  function authorizedFunctions(address target) external view returns (uint256 numberOfFunctions);
167
137
  function getAuthorizedFunction(address target, uint256 idx) external view returns (FunctionInfo memory func, RoleId roleId);
138
+ function canCall(address caller, address target, Selector selector) external view returns (bool can);
168
139
 
140
+ function toRole(RoleId adminRoleId, RoleType roleType, uint32 maxMemberCount, string memory name) external view returns (RoleInfo memory);
141
+ function toFunction(bytes4 selector, string memory name) external view returns (FunctionInfo memory);
169
142
  function deployer() external view returns (address);
170
143
  }
@@ -1,8 +1,6 @@
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
-
6
4
  import {IAccess} from "../authorization/IAccess.sol";
7
5
  import {ObjectType} from "../type/ObjectType.sol";
8
6
  import {RoleId} from "../type/RoleId.sol";
@@ -10,16 +8,12 @@ import {Str} from "../type/String.sol";
10
8
  import {VersionPart} from "../type/Version.sol";
11
9
 
12
10
  interface IAuthorization is
13
- IERC165,
14
11
  IAccess
15
12
  {
16
13
 
17
14
  error ErrorAuthorizationMainTargetNameEmpty();
18
15
  error ErrorAuthorizationTargetDomainZero();
19
16
 
20
- /// @dev Returns the main domain of the authorization.
21
- function getDomain() external view returns(ObjectType targetDomain);
22
-
23
17
  /// @dev Returns the list of service targets.
24
18
  function getServiceDomains() external view returns(ObjectType[] memory serviceDomains);
25
19
 
@@ -7,7 +7,7 @@ import {Distribution} from "./Distribution.sol";
7
7
  import {DistributorType} from "../type/DistributorType.sol";
8
8
  import {DISTRIBUTOR} from "../type/ObjectType.sol";
9
9
  import {Fee} from "../type/Fee.sol";
10
- import {NftId, NftIdLib} from "../type/NftId.sol";
10
+ import {NftId} from "../type/NftId.sol";
11
11
  import {ReferralId} from "../type/Referral.sol";
12
12
  import {Seconds} from "../type/Seconds.sol";
13
13
  import {Timestamp} from "../type/Timestamp.sol";
@@ -95,7 +95,6 @@ contract BasicDistribution is
95
95
  * referral codes need to be unique
96
96
  */
97
97
  function createReferral(
98
- NftId distributorNftId,
99
98
  string memory code,
100
99
  UFixed discountPercentage,
101
100
  uint32 maxReferrals,
@@ -105,10 +104,10 @@ contract BasicDistribution is
105
104
  external
106
105
  virtual
107
106
  restricted()
108
- onlyNftOwner(distributorNftId)
107
+ onlyDistributor()
109
108
  returns (ReferralId referralId)
110
109
  {
111
- _checkNftType(distributorNftId, DISTRIBUTOR());
110
+ NftId distributorNftId = getDistributorNftId(msg.sender);
112
111
  return _createReferral(
113
112
  distributorNftId,
114
113
  code,
@@ -134,7 +133,6 @@ contract BasicDistribution is
134
133
  registry,
135
134
  instanceNftId,
136
135
  authorization,
137
- false,
138
136
  initialOwner,
139
137
  name,
140
138
  token,
@@ -17,7 +17,7 @@ contract BasicDistributionAuthorization
17
17
  {
18
18
 
19
19
  constructor(string memory distributionlName)
20
- Authorization(distributionlName, DISTRIBUTION(), true, true)
20
+ Authorization(distributionlName, DISTRIBUTION())
21
21
  {}
22
22
 
23
23
  function _setupServiceTargets()
@@ -10,7 +10,7 @@ import {Amount} from "../type/Amount.sol";
10
10
  import {COMPONENT, DISTRIBUTION, DISTRIBUTOR} from "../type/ObjectType.sol";
11
11
  import {DistributorType} from "../type/DistributorType.sol";
12
12
  import {Fee} from "../type/Fee.sol";
13
- import {NftId} from "../type/NftId.sol";
13
+ import {NftId, NftIdLib} from "../type/NftId.sol";
14
14
  import {ReferralId, ReferralStatus, ReferralLib} from "../type/Referral.sol";
15
15
  import {InstanceLinkedComponent} from "../shared/InstanceLinkedComponent.sol";
16
16
  import {Seconds} from "../type/Seconds.sol";
@@ -28,8 +28,17 @@ abstract contract Distribution is
28
28
  struct DistributionStorage {
29
29
  IComponentService _componentService;
30
30
  IDistributionService _distributionService;
31
+ mapping(address distributor => NftId distributorNftId) _distributorNftId;
31
32
  }
32
33
 
34
+ modifier onlyDistributor() {
35
+ if (!isDistributor(msg.sender)) {
36
+ revert ErrorDistributionNotDistributor(msg.sender);
37
+ }
38
+ _;
39
+ }
40
+
41
+
33
42
  function processRenewal(
34
43
  ReferralId referralId,
35
44
  uint256 feeAmount
@@ -47,6 +56,7 @@ abstract contract Distribution is
47
56
  external
48
57
  virtual
49
58
  restricted()
59
+ onlyDistributor()
50
60
  onlyNftOfType(distributorNftId, DISTRIBUTOR())
51
61
  onlyNftOwner(distributorNftId)
52
62
  returns (Amount withdrawnAmount)
@@ -54,6 +64,27 @@ abstract contract Distribution is
54
64
  return _withdrawCommission(distributorNftId, amount);
55
65
  }
56
66
 
67
+
68
+ function isDistributor(address candidate)
69
+ public
70
+ view
71
+ returns (bool)
72
+ {
73
+ DistributionStorage storage $ = _getDistributionStorage();
74
+ return $._distributorNftId[candidate].gtz();
75
+ }
76
+
77
+
78
+ function getDistributorNftId(address distributor)
79
+ public
80
+ view
81
+ returns (NftId distributorNftId)
82
+ {
83
+ DistributionStorage storage $ = _getDistributionStorage();
84
+ return $._distributorNftId[distributor];
85
+ }
86
+
87
+
57
88
  function getDiscountPercentage(string memory referralCode)
58
89
  external
59
90
  view
@@ -104,7 +135,6 @@ abstract contract Distribution is
104
135
  address registry,
105
136
  NftId productNftId,
106
137
  IAuthorization authorization,
107
- bool isInterceptor,
108
138
  address initialOwner,
109
139
  string memory name,
110
140
  address token,
@@ -118,10 +148,10 @@ abstract contract Distribution is
118
148
  registry,
119
149
  productNftId,
120
150
  name,
121
- token,
151
+ token,
122
152
  DISTRIBUTION(),
123
153
  authorization,
124
- isInterceptor,
154
+ true,
125
155
  initialOwner,
126
156
  componentData);
127
157
 
@@ -185,11 +215,16 @@ abstract contract Distribution is
185
215
  returns(NftId distributorNftId)
186
216
  {
187
217
  DistributionStorage storage $ = _getDistributionStorage();
218
+ if($._distributorNftId[distributor].gtz()) {
219
+ revert ErrorDistributionAlreadyDistributor(distributor, $._distributorNftId[distributor]);
220
+ }
188
221
 
189
222
  distributorNftId = $._distributionService.createDistributor(
190
223
  distributor,
191
224
  distributorType,
192
225
  data);
226
+
227
+ $._distributorNftId[distributor] = distributorNftId;
193
228
  }
194
229
 
195
230
  /// @dev Uptates the distributor type for the specified distributor.
@@ -238,6 +273,14 @@ abstract contract Distribution is
238
273
  return _getDistributionStorage()._distributionService.withdrawCommission(distributorNftId, amount);
239
274
  }
240
275
 
276
+ function _nftTransferFrom(address from, address to, uint256 tokenId, address operator) internal virtual override {
277
+ // keep track of distributor nft owner
278
+ emit LogDistributorUpdated(to, operator);
279
+ DistributionStorage storage $ = _getDistributionStorage();
280
+ $._distributorNftId[from] = NftIdLib.zero();
281
+ $._distributorNftId[to] = NftIdLib.toNftId(tokenId);
282
+ }
283
+
241
284
  function _getDistributionStorage() private pure returns (DistributionStorage storage $) {
242
285
  assembly {
243
286
  $.slot := DISTRIBUTION_STORAGE_LOCATION_V1