@etherisc/gif-next 0.0.2-b2910e7-757 → 0.0.2-b312c9a-831

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 (352) hide show
  1. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +4 -0
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +1000 -0
  3. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +4 -0
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +746 -0
  5. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +4 -0
  6. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +767 -0
  7. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +2 -2
  9. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +4 -0
  10. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.json +24 -0
  11. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  12. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +2 -2
  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/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  17. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  18. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +1 -1
  19. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  20. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
  21. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  22. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +24 -42
  23. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  24. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +2 -2
  25. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +0 -18
  27. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +58 -58
  29. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +30 -30
  31. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  32. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +0 -18
  33. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  34. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  35. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  36. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +40 -14
  37. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  38. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +24 -24
  39. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  40. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +86 -60
  41. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  42. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +17 -17
  43. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  44. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  45. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +39 -26
  46. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +4 -0
  47. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +470 -0
  48. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  49. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +16 -34
  50. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  51. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +33 -20
  52. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +4 -0
  53. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +502 -0
  54. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  55. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +50 -24
  56. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +4 -0
  57. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +470 -0
  58. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  59. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +147 -42
  60. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  61. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +46 -0
  62. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  63. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +22 -2
  64. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  65. package/artifacts/contracts/instance/Instance.sol/Instance.json +64 -13
  66. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  67. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +83 -70
  68. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  69. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +40 -27
  70. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  71. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +298 -65
  72. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  73. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +44 -24
  74. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  75. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +12 -12
  76. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  77. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2 -2
  78. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +4 -0
  79. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +810 -0
  80. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  81. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  82. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  83. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  84. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  85. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  86. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  87. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  88. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  89. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  90. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  91. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  92. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  93. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  94. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  95. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  96. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  97. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +14 -32
  98. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  99. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +2 -2
  100. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  101. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  102. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +0 -18
  103. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  104. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  105. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +0 -18
  106. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  107. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +70 -62
  108. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  109. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +36 -16
  110. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  111. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +0 -18
  112. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  113. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +2 -2
  114. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  115. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +68 -177
  116. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  117. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +35 -63
  118. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  119. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +0 -42
  120. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  121. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +0 -18
  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/Pool.sol/Pool.json +0 -18
  125. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  126. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +62 -78
  127. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  128. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +32 -24
  129. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  130. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +44 -25
  131. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  132. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +6 -10
  133. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  134. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +0 -18
  135. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  136. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +2 -2
  137. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  138. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +2 -2
  139. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  140. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +2 -2
  141. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  142. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +34 -7
  143. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  144. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  145. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +31 -18
  146. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  147. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  148. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +0 -18
  149. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  150. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  151. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +119 -122
  152. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  153. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +45 -37
  154. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  155. package/artifacts/contracts/product/PricingService.sol/PricingService.json +2 -2
  156. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  157. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +2 -2
  158. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  159. package/artifacts/contracts/product/Product.sol/Product.json +0 -18
  160. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  161. package/artifacts/contracts/product/RiskService.sol/RiskService.json +20 -20
  162. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  163. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +11 -11
  164. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  165. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  166. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.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 +58 -58
  172. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  173. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +2 -2
  174. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  175. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +2 -2
  176. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  177. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  178. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  179. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +2 -2
  180. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  181. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
  182. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  183. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  184. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  185. package/artifacts/contracts/shared/Component.sol/Component.json +0 -18
  186. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  187. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +70 -428
  188. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  189. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +36 -64
  190. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  191. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  192. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +383 -6
  193. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +4 -0
  194. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.json +24 -0
  195. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +4 -0
  196. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.json +30 -0
  197. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  198. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +0 -18
  199. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  200. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +0 -270
  201. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  202. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +0 -18
  203. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  204. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  205. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  206. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  207. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  208. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  209. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  210. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  211. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  212. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +0 -18
  213. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  214. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  215. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  216. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  217. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  218. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  219. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  220. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  221. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  222. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
  223. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  224. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  225. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  226. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  227. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  228. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
  229. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
  230. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  231. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  232. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  233. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +0 -18
  234. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  235. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  236. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +2 -2
  237. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  238. package/artifacts/contracts/staking/Staking.sol/Staking.json +26 -26
  239. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  240. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  241. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  242. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +14 -14
  243. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  244. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
  245. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  246. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +2 -2
  247. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  248. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +2 -2
  249. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  250. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2 -2
  251. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  252. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +2 -2
  253. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  254. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  255. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  256. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  257. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  258. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  259. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  260. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  261. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  262. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  263. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +4 -0
  264. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +33 -0
  265. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  266. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +23 -4
  267. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  268. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  269. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  270. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +2 -2
  271. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  272. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  273. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  274. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  275. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  276. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  277. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  278. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +43 -5
  279. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
  281. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  282. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  283. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  284. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  286. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  287. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  288. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  289. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  290. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  291. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  292. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  293. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +2 -2
  294. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  295. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  296. package/contracts/accounting/AccountingService.sol +264 -0
  297. package/contracts/accounting/AccountingServiceManager.sol +38 -0
  298. package/contracts/accounting/IAccountingService.sol +45 -0
  299. package/contracts/authorization/AccessAdmin.sol +21 -1
  300. package/contracts/distribution/BasicDistribution.sol +4 -4
  301. package/contracts/distribution/Distribution.sol +27 -24
  302. package/contracts/distribution/DistributionService.sol +10 -7
  303. package/contracts/examples/fire/FirePool.sol +6 -2
  304. package/contracts/examples/fire/FirePoolAuthorization.sol +1 -0
  305. package/contracts/examples/fire/FireProduct.sol +5 -0
  306. package/contracts/examples/fire/FireProductAuthorization.sol +1 -0
  307. package/contracts/examples/unpermissioned/SimpleDistribution.sol +6 -7
  308. package/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol +28 -0
  309. package/contracts/examples/unpermissioned/SimplePool.sol +7 -8
  310. package/contracts/examples/unpermissioned/SimplePoolAuthorization.sol +28 -0
  311. package/contracts/examples/unpermissioned/SimpleProduct.sol +7 -0
  312. package/contracts/examples/unpermissioned/SimpleProductAuthorization.sol +28 -0
  313. package/contracts/instance/BundleSet.sol +38 -34
  314. package/contracts/instance/IInstance.sol +6 -0
  315. package/contracts/instance/IInstanceService.sol +5 -1
  316. package/contracts/instance/Instance.sol +14 -5
  317. package/contracts/instance/InstanceAdmin.sol +3 -1
  318. package/contracts/instance/InstanceAuthorizationV3.sol +42 -14
  319. package/contracts/instance/InstanceReader.sol +85 -1
  320. package/contracts/instance/InstanceService.sol +18 -7
  321. package/contracts/instance/RiskSet.sol +119 -0
  322. package/contracts/instance/base/ObjectSet.sol +24 -25
  323. package/contracts/instance/module/IRisk.sol +1 -0
  324. package/contracts/oracle/OracleService.sol +87 -70
  325. package/contracts/pool/BundleService.sol +9 -69
  326. package/contracts/pool/IBundleService.sol +0 -19
  327. package/contracts/pool/IPoolService.sol +0 -19
  328. package/contracts/pool/PoolService.sol +49 -54
  329. package/contracts/product/ApplicationService.sol +12 -12
  330. package/contracts/product/BasicProductAuthorization.sol +1 -2
  331. package/contracts/product/IApplicationService.sol +5 -2
  332. package/contracts/product/IPolicyService.sol +14 -6
  333. package/contracts/product/PolicyService.sol +233 -192
  334. package/contracts/product/Product.sol +2 -7
  335. package/contracts/product/RiskService.sol +14 -3
  336. package/contracts/registry/RegistryAdmin.sol +7 -12
  337. package/contracts/registry/ServiceAuthorizationV3.sol +43 -39
  338. package/contracts/shared/Component.sol +5 -20
  339. package/contracts/shared/ComponentService.sol +79 -205
  340. package/contracts/shared/ContractLib.sol +181 -11
  341. package/contracts/shared/IComponent.sol +0 -5
  342. package/contracts/shared/IComponentService.sol +1 -19
  343. package/contracts/shared/InstanceLinkedComponent.sol +1 -1
  344. package/contracts/shared/TokenHandler.sol +1 -9
  345. package/contracts/staking/Staking.sol +10 -0
  346. package/contracts/staking/StakingService.sol +0 -13
  347. package/contracts/type/Key32.sol +2 -2
  348. package/contracts/type/Key32Set.sol +62 -0
  349. package/contracts/type/NftId.sol +6 -0
  350. package/contracts/type/ObjectType.sol +10 -0
  351. package/contracts/type/RiskId.sol +18 -6
  352. package/package.json +1 -1
@@ -3,11 +3,10 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
5
 
6
- import {AccessAdmin} from "../authorization/AccessAdmin.sol";
7
6
  import {Amount, AmountLib} from "../type/Amount.sol";
8
- import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
9
7
  import {ContractLib} from "../shared/ContractLib.sol";
10
8
  import {Fee, FeeLib} from "../type/Fee.sol";
9
+ import {IAccountingService} from "../accounting/IAccountingService.sol";
11
10
  import {IComponent} from "../shared/IComponent.sol";
12
11
  import {IComponents} from "../instance/module/IComponents.sol";
13
12
  import {IComponentService} from "./IComponentService.sol";
@@ -17,51 +16,54 @@ import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
17
16
  import {InstanceReader} from "../instance/InstanceReader.sol";
18
17
  import {InstanceStore} from "../instance/InstanceStore.sol";
19
18
  import {IInstanceService} from "../instance/IInstanceService.sol";
20
- import {IRegisterable} from "../shared/IRegisterable.sol";
21
19
  import {IPoolComponent} from "../pool/IPoolComponent.sol";
22
20
  import {IProductComponent} from "../product/IProductComponent.sol";
21
+ import {IRegisterable} from "../shared/IRegisterable.sol";
23
22
  import {IRegistry} from "../registry/IRegistry.sol";
24
23
  import {IRegistryService} from "../registry/IRegistryService.sol";
24
+
25
+ import {Amount, AmountLib} from "../type/Amount.sol";
26
+ import {ContractLib} from "../shared/ContractLib.sol";
27
+ import {Fee, FeeLib} from "../type/Fee.sol";
25
28
  import {KEEP_STATE} from "../type/StateId.sol";
26
29
  import {NftId} from "../type/NftId.sol";
27
- import {ObjectType, REGISTRY, BUNDLE, COMPONENT, DISTRIBUTION, DISTRIBUTOR, INSTANCE, ORACLE, POOL, PRODUCT, STAKING} from "../type/ObjectType.sol";
30
+ import {ObjectType, ACCOUNTING, REGISTRY, COMPONENT, DISTRIBUTION, INSTANCE, ORACLE, POOL, PRODUCT} from "../type/ObjectType.sol";
31
+ import {Service} from "../shared/Service.sol";
28
32
  import {TokenHandler} from "../shared/TokenHandler.sol";
29
33
  import {TokenHandlerDeployerLib} from "../shared/TokenHandlerDeployerLib.sol";
30
34
  import {VersionPart} from "../type/Version.sol";
31
35
 
36
+
32
37
  contract ComponentService is
33
- ComponentVerifyingService,
38
+ Service,
34
39
  IComponentService
35
40
  {
36
-
37
41
  bool private constant INCREASE = true;
38
42
  bool private constant DECREASE = false;
39
43
 
44
+ IAccountingService private _accountingService;
40
45
  IRegistryService private _registryService;
41
46
  IInstanceService private _instanceService;
42
47
 
43
48
  modifier onlyComponent(address component) {
44
- if (!ContractLib.supportsInterface(component, type(IInstanceLinkedComponent).interfaceId)) {
45
- revert ErrorComponentServiceNotInstanceLinkedComponent(component);
46
- }
49
+ _checkSupportsInterface(component);
47
50
  _;
48
51
  }
49
52
 
50
53
  modifier onlyInstance() {
51
- address instanceAddress = msg.sender;
52
54
  NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
53
55
  if (instanceNftId.eqz()) {
54
- revert ErrorComponentServiceNotRegistered(instanceAddress);
56
+ revert ErrorComponentServiceNotRegistered(msg.sender);
55
57
  }
56
58
 
57
59
  ObjectType objectType = getRegistry().getObjectInfo(instanceNftId).objectType;
58
60
  if (objectType != INSTANCE()) {
59
- revert ErrorComponentServiceNotInstance(instanceAddress, objectType);
61
+ revert ErrorComponentServiceNotInstance(msg.sender, objectType);
60
62
  }
61
63
 
62
- VersionPart instanceVersion = IInstance(instanceAddress).getRelease();
64
+ VersionPart instanceVersion = IInstance(msg.sender).getRelease();
63
65
  if (instanceVersion != getVersion().toMajorPart()) {
64
- revert ErrorComponentServiceInstanceVersionMismatch(instanceAddress, instanceVersion);
66
+ revert ErrorComponentServiceInstanceVersionMismatch(msg.sender, instanceVersion);
65
67
  }
66
68
 
67
69
  _;
@@ -83,6 +85,7 @@ contract ComponentService is
83
85
 
84
86
  _initializeService(registryAddress, authority, owner);
85
87
 
88
+ _accountingService = IAccountingService(_getServiceAddress(ACCOUNTING()));
86
89
  _registryService = IRegistryService(_getServiceAddress(REGISTRY()));
87
90
  _instanceService = IInstanceService(_getServiceAddress(INSTANCE()));
88
91
 
@@ -121,7 +124,7 @@ contract ComponentService is
121
124
  virtual
122
125
  {
123
126
  // checks
124
- (NftId componentNftId,, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
127
+ (NftId componentNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
125
128
  TokenHandler tokenHandler = instance.getInstanceReader().getComponentInfo(
126
129
  componentNftId).tokenHandler;
127
130
 
@@ -138,11 +141,9 @@ contract ComponentService is
138
141
  virtual
139
142
  {
140
143
  // checks
141
- NftId stakingNftId = getRegistry().getNftIdForAddress(msg.sender);
142
- (IRegistry.ObjectInfo memory objectInfo,) = _getAndVerifyComponentInfo(
143
- stakingNftId,
144
- STAKING(),
145
- true);
144
+ ContractLib.getAndVerifyStaking(
145
+ getRegistry(),
146
+ msg.sender); // only active
146
147
 
147
148
  // effects
148
149
  TokenHandler tokenHandler = IComponent(msg.sender).getTokenHandler();
@@ -155,7 +156,7 @@ contract ComponentService is
155
156
  virtual
156
157
  {
157
158
  // checks
158
- (NftId componentNftId,, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
159
+ (NftId componentNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
159
160
  TokenHandler tokenHandler = instance.getInstanceReader().getComponentInfo(
160
161
  componentNftId).tokenHandler;
161
162
 
@@ -181,7 +182,7 @@ contract ComponentService is
181
182
  virtual
182
183
  onlyComponent(msg.sender)
183
184
  {
184
- (,, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
185
+ (, IInstance instance) = _getAndVerifyComponent(COMPONENT(), false);
185
186
  _setLocked(instance.getInstanceAdmin(), componentAddress, locked);
186
187
  }
187
188
 
@@ -190,7 +191,7 @@ contract ComponentService is
190
191
  virtual
191
192
  returns (Amount withdrawnAmount)
192
193
  {
193
- (NftId componentNftId,, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
194
+ (NftId componentNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
194
195
  IComponents.ComponentInfo memory info = instance.getInstanceReader().getComponentInfo(componentNftId);
195
196
  address componentWallet = info.tokenHandler.getWallet();
196
197
 
@@ -208,7 +209,7 @@ contract ComponentService is
208
209
  }
209
210
 
210
211
  // decrease fee counters by withdrawnAmount
211
- _changeTargetBalance(DECREASE, instance.getInstanceStore(), componentNftId, AmountLib.zero(), withdrawnAmount);
212
+ _accountingService.decreaseComponentFees(instance.getInstanceStore(), componentNftId, withdrawnAmount);
212
213
 
213
214
  // transfer amount to component owner
214
215
  address componentOwner = getRegistry().ownerOf(componentNftId);
@@ -252,7 +253,7 @@ contract ComponentService is
252
253
  external
253
254
  virtual
254
255
  {
255
- (NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
256
+ (NftId productNftId, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
256
257
  IComponents.ProductInfo memory productInfo = instance.getInstanceReader().getProductInfo(productNftId);
257
258
  bool feesChanged = false;
258
259
 
@@ -276,31 +277,6 @@ contract ComponentService is
276
277
  }
277
278
  }
278
279
 
279
- function increaseProductFees(
280
- InstanceStore instanceStore,
281
- NftId productNftId,
282
- Amount feeAmount
283
- )
284
- external
285
- virtual
286
- // TODO re-enable once role granting is stable and fixed
287
- // restricted()
288
- {
289
- _checkNftType(productNftId, PRODUCT());
290
- _changeTargetBalance(INCREASE, instanceStore, productNftId, AmountLib.zero(), feeAmount);
291
- }
292
-
293
-
294
- function decreaseProductFees(InstanceStore instanceStore, NftId productNftId, Amount feeAmount)
295
- external
296
- virtual
297
- // TODO re-enable once role granting is stable and fixed
298
- // restricted()
299
- {
300
- _checkNftType(productNftId, PRODUCT());
301
- _changeTargetBalance(DECREASE, instanceStore, productNftId, AmountLib.zero(), feeAmount);
302
- }
303
-
304
280
  //-------- distribution -------------------------------------------------//
305
281
 
306
282
  /// @dev registers the sending component as a distribution component
@@ -344,7 +320,7 @@ contract ComponentService is
344
320
  external
345
321
  virtual
346
322
  {
347
- (NftId distributionNftId,, IInstance instance) = _getAndVerifyActiveComponent(DISTRIBUTION());
323
+ (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveComponent(DISTRIBUTION());
348
324
  (NftId productNftId, IComponents.ProductInfo memory productInfo) = _getLinkedProductInfo(
349
325
  instance.getInstanceReader(), distributionNftId);
350
326
  bool feesChanged = false;
@@ -369,69 +345,6 @@ contract ComponentService is
369
345
  }
370
346
  }
371
347
 
372
- function increaseDistributionBalance(
373
- InstanceStore instanceStore,
374
- NftId distributionNftId,
375
- Amount amount,
376
- Amount feeAmount
377
- )
378
- external
379
- virtual
380
- // TODO re-enable once role granting is stable and fixed
381
- // restricted()
382
- {
383
- _checkNftType(distributionNftId, DISTRIBUTION());
384
- _changeTargetBalance(INCREASE, instanceStore, distributionNftId, amount, feeAmount);
385
- }
386
-
387
-
388
- function decreaseDistributionBalance(
389
- InstanceStore instanceStore,
390
- NftId distributionNftId,
391
- Amount amount,
392
- Amount feeAmount
393
- )
394
- external
395
- virtual
396
- // TODO re-enable once role granting is stable and fixed
397
- // restricted()
398
- {
399
- _checkNftType(distributionNftId, DISTRIBUTION());
400
- _changeTargetBalance(DECREASE, instanceStore, distributionNftId, amount, feeAmount);
401
- }
402
-
403
- //-------- distributor -------------------------------------------------------//
404
-
405
- function increaseDistributorBalance(
406
- InstanceStore instanceStore,
407
- NftId distributorNftId,
408
- Amount amount,
409
- Amount feeAmount
410
- )
411
- external
412
- virtual
413
- // TODO re-enable once role granting is stable and fixed
414
- // restricted()
415
- {
416
- _checkNftType(distributorNftId, DISTRIBUTOR());
417
- _changeTargetBalance(INCREASE, instanceStore, distributorNftId, amount, feeAmount);
418
- }
419
-
420
- function decreaseDistributorBalance(
421
- InstanceStore instanceStore,
422
- NftId distributorNftId,
423
- Amount amount,
424
- Amount feeAmount
425
- )
426
- external
427
- virtual
428
- // TODO re-enable once role granting is stable and fixed
429
- // restricted()
430
- {
431
- _checkNftType(distributorNftId, DISTRIBUTOR());
432
- _changeTargetBalance(DECREASE, instanceStore, distributorNftId, amount, feeAmount);
433
- }
434
-
435
348
  //-------- oracle -------------------------------------------------------//
436
349
 
437
350
  function _registerOracle(address oracleAddress)
@@ -445,7 +358,7 @@ contract ComponentService is
445
358
  InstanceStore instanceStore;
446
359
  NftId productNftId;
447
360
 
448
- (instanceReader, instanceAdmin, instanceStore, productNftId, oracleNftId) =_register(
361
+ (instanceReader, instanceAdmin, instanceStore, productNftId, oracleNftId) = _register(
449
362
  oracleAddress,
450
363
  ORACLE());
451
364
 
@@ -481,7 +394,7 @@ contract ComponentService is
481
394
  InstanceStore instanceStore;
482
395
  NftId productNftId;
483
396
 
484
- (instanceReader, instanceAdmin, instanceStore, productNftId, poolNftId) =_register(
397
+ (instanceReader, instanceAdmin, instanceStore, productNftId, poolNftId) = _register(
485
398
  poolAddress,
486
399
  POOL());
487
400
 
@@ -514,7 +427,8 @@ contract ComponentService is
514
427
  external
515
428
  virtual
516
429
  {
517
- (NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
430
+ (NftId poolNftId, IInstance instance) = _getAndVerifyActiveComponent(POOL());
431
+
518
432
  (NftId productNftId, IComponents.ProductInfo memory productInfo) = _getLinkedProductInfo(
519
433
  instance.getInstanceReader(), poolNftId);
520
434
  bool feesChanged = false;
@@ -546,92 +460,6 @@ contract ComponentService is
546
460
  }
547
461
  }
548
462
 
549
- function increasePoolBalance(
550
- InstanceStore instanceStore,
551
- NftId poolNftId,
552
- Amount amount,
553
- Amount feeAmount
554
- )
555
- public
556
- virtual
557
- // TODO re-enable once role granting is stable and fixed
558
- // restricted()
559
- {
560
- _checkNftType(poolNftId, POOL());
561
- _changeTargetBalance(INCREASE, instanceStore, poolNftId, amount, feeAmount);
562
- }
563
-
564
- function decreasePoolBalance(
565
- InstanceStore instanceStore,
566
- NftId poolNftId,
567
- Amount amount,
568
- Amount feeAmount
569
- )
570
- public
571
- virtual
572
- // TODO re-enable once role granting is stable and fixed
573
- // restricted()
574
- {
575
- _checkNftType(poolNftId, POOL());
576
- _changeTargetBalance(DECREASE, instanceStore, poolNftId, amount, feeAmount);
577
- }
578
-
579
- //-------- bundle -------------------------------------------------------//
580
-
581
- function increaseBundleBalance(
582
- InstanceStore instanceStore,
583
- NftId bundleNftId,
584
- Amount amount,
585
- Amount feeAmount
586
- )
587
- external
588
- virtual
589
- // TODO re-enable once role granting is stable and fixed
590
- // restricted()
591
- {
592
- _checkNftType(bundleNftId, BUNDLE());
593
- _changeTargetBalance(INCREASE, instanceStore, bundleNftId, amount, feeAmount);
594
- }
595
-
596
- function decreaseBundleBalance(
597
- InstanceStore instanceStore,
598
- NftId bundleNftId,
599
- Amount amount,
600
- Amount feeAmount
601
- )
602
- external
603
- virtual
604
- // TODO re-enable once role granting is stable and fixed
605
- // restricted()
606
- {
607
- _checkNftType(bundleNftId, BUNDLE());
608
- _changeTargetBalance(DECREASE, instanceStore, bundleNftId, amount, feeAmount);
609
- }
610
-
611
-
612
- //-------- internal functions ------------------------------------------//
613
-
614
- function _changeTargetBalance(
615
- bool increase,
616
- InstanceStore instanceStore,
617
- NftId targetNftId,
618
- Amount amount,
619
- Amount feeAmount
620
- )
621
- internal
622
- virtual
623
- {
624
- Amount totalAmount = amount + feeAmount;
625
-
626
- if(increase) {
627
- if(totalAmount.gtz()) { instanceStore.increaseBalance(targetNftId, totalAmount); }
628
- if(feeAmount.gtz()) { instanceStore.increaseFees(targetNftId, feeAmount); }
629
- } else {
630
- if(totalAmount.gtz()) { instanceStore.decreaseBalance(targetNftId, totalAmount); }
631
- if(feeAmount.gtz()) { instanceStore.decreaseFees(targetNftId, feeAmount); }
632
- }
633
- }
634
-
635
463
  /// @dev Registers the component represented by the provided address.
636
464
  function _register(
637
465
  address componentAddress, // address of component to register
@@ -727,7 +555,7 @@ contract ComponentService is
727
555
  IComponents.ProductInfo memory info
728
556
  )
729
557
  {
730
- productNftId = _getProductNftId(componentNftId);
558
+ productNftId = getRegistry().getObjectInfo(componentNftId).parentNftId;
731
559
  info = instanceReader.getProductInfo(productNftId);
732
560
  }
733
561
 
@@ -806,14 +634,60 @@ contract ComponentService is
806
634
 
807
635
  // get initial owner and instance
808
636
  initialOwner = info.initialOwner;
809
- instance = _getInstance(registry, instanceNftId);
637
+ instance = IInstance(registry.getObjectAddress(instanceNftId));
810
638
  }
811
639
 
812
640
  function _setLocked(InstanceAdmin instanceAdmin, address componentAddress, bool locked) internal {
813
641
  instanceAdmin.setTargetLocked(componentAddress, locked);
814
642
  }
815
643
 
644
+ function _getAndVerifyActiveComponent(ObjectType expectedType)
645
+ internal
646
+ view
647
+ returns (
648
+ NftId componentNftId,
649
+ IInstance instance
650
+ )
651
+ {
652
+ return _getAndVerifyComponent(expectedType, true); // only active
653
+ }
654
+
655
+ function _getAndVerifyComponent(ObjectType expectedType, bool isActive)
656
+ internal
657
+ view
658
+ returns (
659
+ NftId componentNftId,
660
+ IInstance instance
661
+ )
662
+ {
663
+ IRegistry.ObjectInfo memory info;
664
+ address instanceAddress;
665
+
666
+ if (expectedType != COMPONENT()) {
667
+ (info, instanceAddress) = ContractLib.getAndVerifyComponent(
668
+ getRegistry(),
669
+ msg.sender, // caller
670
+ expectedType,
671
+ isActive);
672
+ } else {
673
+ (info, instanceAddress) = ContractLib.getAndVerifyAnyComponent(
674
+ getRegistry(),
675
+ msg.sender,
676
+ isActive);
677
+ }
678
+
679
+ // get component nft id and instance
680
+ componentNftId = info.nftId;
681
+ instance = IInstance(instanceAddress);
682
+ }
683
+
816
684
  function _getDomain() internal pure virtual override returns(ObjectType) {
817
685
  return COMPONENT();
818
686
  }
687
+
688
+ function _checkSupportsInterface(address component) internal view {
689
+ if (!ContractLib.supportsInterface(component, type(IInstanceLinkedComponent).interfaceId)) {
690
+ revert ErrorComponentServiceNotInstanceLinkedComponent(component);
691
+ }
692
+ }
819
693
  }
@@ -2,28 +2,142 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
5
- import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
6
5
 
7
- import {IPolicyHolder} from "./IPolicyHolder.sol";
6
+ // import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
8
7
  import {IRegistry} from "../registry/IRegistry.sol";
8
+ import {IPolicyHolder} from "../shared/IPolicyHolder.sol";
9
+ import {NftId} from "../type/NftId.sol";
10
+ import {ObjectType, PRODUCT, DISTRIBUTION, ORACLE, POOL, STAKING} from "../type/ObjectType.sol";
11
+
12
+ interface ITargetHelper {
13
+ function isTargetLocked(address target) external view returns (bool);
14
+ }
15
+
16
+ interface IInstanceAdminHelper {
17
+ function getInstanceAdmin() external view returns (ITargetHelper);
18
+ }
9
19
 
10
20
  library ContractLib {
11
21
 
12
- function isPolicyHolder(address target) external view returns (bool) {
13
- return ERC165Checker.supportsInterface(target, type(IPolicyHolder).interfaceId);
22
+ error ErrorContractLibNotRegistered(address target);
23
+ error ErrorContractLibNotComponent(NftId componentNftId, ObjectType objectType);
24
+ error ErrorContractLibNotStaking(NftId componentNftId, ObjectType objectType);
25
+ error ErrorContractLibComponentTypeMismatch(NftId componentNftId, ObjectType expectedType, ObjectType actualType);
26
+ error ErrorContractLibComponentInactive(NftId componentNftId);
27
+
28
+
29
+ function getAndVerifyComponent(
30
+ IRegistry registry,
31
+ address target,
32
+ ObjectType expectedType,
33
+ bool onlyActive
34
+ )
35
+ external
36
+ view
37
+ returns (
38
+ IRegistry.ObjectInfo memory info,
39
+ address instance
40
+ )
41
+ {
42
+ // check target is component
43
+ info = _getObjectInfo(registry, target);
44
+ if(info.objectType != expectedType) {
45
+ revert ErrorContractLibComponentTypeMismatch(
46
+ info.nftId,
47
+ expectedType,
48
+ info.objectType);
49
+ }
50
+
51
+ // get instance and check component is active
52
+ instance = _getInstance(registry, info);
53
+ _checkComponentActive(instance, target, info.nftId, onlyActive);
14
54
  }
15
55
 
16
56
 
17
- function isAccessManaged(address target) external view returns (bool) {
18
- if (!isContract(target)) {
19
- return false;
57
+ function getInfoAndInstance(
58
+ IRegistry registry,
59
+ NftId componentNftId,
60
+ bool onlyActive
61
+ )
62
+ external
63
+ view
64
+ returns (
65
+ IRegistry.ObjectInfo memory info,
66
+ address instance
67
+ )
68
+ {
69
+ info = registry.getObjectInfo(componentNftId);
70
+ instance = _getInstance(registry, info);
71
+ _checkComponentActive(instance, info.objectAddress, info.nftId, onlyActive);
72
+ }
73
+
74
+
75
+ function getAndVerifyStaking(
76
+ IRegistry registry,
77
+ address target
78
+ )
79
+ external
80
+ view
81
+ returns (
82
+ IRegistry.ObjectInfo memory info
83
+ )
84
+ {
85
+ // check target is component
86
+ info = _getObjectInfo(registry, target);
87
+ if(info.objectType != STAKING()) {
88
+ revert ErrorContractLibNotStaking(
89
+ info.nftId,
90
+ info.objectType);
20
91
  }
92
+ }
93
+
94
+
95
+ function getAndVerifyAnyComponent(
96
+ IRegistry registry,
97
+ address target,
98
+ bool onlyActive
99
+ )
100
+ external
101
+ view
102
+ returns (
103
+ IRegistry.ObjectInfo memory info,
104
+ address instance
105
+ )
106
+ {
107
+ // check target is component
108
+ info = _getObjectInfo(registry, target);
109
+ if(!(info.objectType == PRODUCT()
110
+ || info.objectType == POOL()
111
+ || info.objectType == DISTRIBUTION()
112
+ || info.objectType == ORACLE())
113
+ ) {
114
+ revert ErrorContractLibNotComponent(
115
+ info.nftId,
116
+ info.objectType);
117
+ }
118
+
119
+ // get instance and check component is active
120
+ instance = _getInstance(registry, info);
121
+ _checkComponentActive(instance, target, info.nftId, onlyActive);
122
+ }
21
123
 
22
- (bool success, ) = target.staticcall(
23
- abi.encodeWithSelector(
24
- IAccessManaged.authority.selector));
25
124
 
26
- return success;
125
+ function getInstanceForComponent(
126
+ IRegistry registry,
127
+ NftId componentNftId
128
+ )
129
+ public
130
+ view
131
+ returns (address instance)
132
+ {
133
+ NftId productNftId = registry.getObjectInfo(componentNftId).parentNftId;
134
+ NftId instanceNftId = registry.getObjectInfo(productNftId).parentNftId;
135
+ return registry.getObjectInfo(instanceNftId).objectAddress;
136
+ }
137
+
138
+
139
+ function isPolicyHolder(address target) external view returns (bool) {
140
+ return ERC165Checker.supportsInterface(target, type(IPolicyHolder).interfaceId);
27
141
  }
28
142
 
29
143
 
@@ -51,4 +165,60 @@ library ContractLib {
51
165
  function supportsInterface(address target, bytes4 interfaceId) public view returns (bool) {
52
166
  return ERC165Checker.supportsInterface(target, interfaceId);
53
167
  }
168
+
169
+
170
+ function _checkComponentActive(
171
+ address instance,
172
+ address target,
173
+ NftId componentNftId,
174
+ bool onlyActive
175
+ )
176
+ internal
177
+ view
178
+ {
179
+ if (onlyActive) {
180
+ if (IInstanceAdminHelper(
181
+ instance).getInstanceAdmin().isTargetLocked(
182
+ target)
183
+ ) {
184
+ revert ErrorContractLibComponentInactive(componentNftId);
185
+ }
186
+ }
187
+ }
188
+
189
+
190
+ function _getInstance(
191
+ IRegistry registry,
192
+ IRegistry.ObjectInfo memory info
193
+ )
194
+ internal
195
+ view
196
+ returns (address instance)
197
+ {
198
+ if (info.objectType == PRODUCT()) {
199
+ return registry.getObjectAddress(
200
+ info.parentNftId);
201
+ }
202
+
203
+ return registry.getObjectAddress(
204
+ registry.getObjectInfo(
205
+ info.parentNftId).parentNftId);
206
+ }
207
+
208
+
209
+ function _getObjectInfo(
210
+ IRegistry registry,
211
+ address target
212
+ )
213
+ internal
214
+ view
215
+ returns (IRegistry.ObjectInfo memory info)
216
+ {
217
+ NftId componentNftId = registry.getNftIdForAddress(target);
218
+ if (componentNftId.eqz()) {
219
+ revert ErrorContractLibNotRegistered(target);
220
+ }
221
+
222
+ info = registry.getObjectInfo(componentNftId);
223
+ }
54
224
  }
@@ -33,11 +33,6 @@ interface IComponent is
33
33
  event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
34
34
  event LogComponentTokenHandlerApproved(address tokenHandler, address token, Amount limit, bool isMaxAmount);
35
35
 
36
- /// @dev Approves token hanlder to spend up to the specified amount of tokens.
37
- /// Reverts if component wallet is not token handler itself.
38
- /// Only component owner (nft holder) is authorizes to call this function.
39
- function approveTokenHandler(IERC20Metadata token, Amount spendingLimitAmount) external;
40
-
41
36
  /// @dev returns the name of this component
42
37
  /// to successfully register the component with an instance the name MUST be unique in the linked instance
43
38
  function getName() external view returns (string memory name);