@etherisc/gif-next 0.0.2-f634e5c-828 → 0.0.2-f677999-878

Sign up to get free protection for your applications and to get access to all the features.
Files changed (442) hide show
  1. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +4 -0
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +1007 -0
  3. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +4 -0
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +744 -0
  5. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +4 -0
  6. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +791 -0
  7. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +148 -62
  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 +233 -5
  12. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +149 -21
  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 +82 -12
  17. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  18. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +68 -13
  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 +79 -67
  24. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  25. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +152 -33
  26. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  27. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +51 -39
  28. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  29. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +231 -186
  30. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  31. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +57 -51
  32. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  33. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +38 -26
  34. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  35. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +119 -73
  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 +102 -42
  39. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  40. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +127 -40
  41. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  42. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +257 -190
  43. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  44. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +152 -33
  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 +150 -56
  48. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +4 -0
  49. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +589 -0
  50. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  51. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +95 -63
  52. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  53. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +111 -48
  54. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +4 -0
  55. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +589 -0
  56. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  57. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +315 -150
  58. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +4 -0
  59. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +589 -0
  60. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  61. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +88 -45
  62. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  63. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +54 -21
  64. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  65. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +53 -3
  66. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  67. package/artifacts/contracts/instance/Instance.sol/Instance.json +80 -40
  68. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  69. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +344 -99
  70. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  71. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +127 -40
  72. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  73. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +351 -198
  74. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  75. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +65 -58
  76. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  77. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +20 -22
  78. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  79. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +422 -352
  80. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
  81. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +96 -53
  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 +16 -5
  91. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +4 -0
  92. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +168 -0
  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 +68 -56
  101. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  102. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +126 -35
  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/IOracleComponent.sol/IOracleComponent.json +38 -26
  106. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  107. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +27 -3
  108. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  109. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +52 -40
  110. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  111. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +75 -68
  112. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  113. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +25 -27
  114. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  115. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +51 -39
  116. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  117. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +127 -40
  118. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  119. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +102 -201
  120. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  121. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +33 -55
  122. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  123. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +38 -80
  124. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  125. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +38 -26
  126. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  127. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +120 -175
  128. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  129. package/artifacts/contracts/pool/Pool.sol/Pool.json +51 -39
  130. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +4 -0
  131. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +456 -0
  132. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  133. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +236 -281
  134. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  135. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +61 -47
  136. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  137. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +57 -50
  138. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  139. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +16 -18
  140. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  141. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +157 -130
  142. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  143. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +152 -33
  144. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  145. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +244 -187
  146. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  147. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +55 -65
  148. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  149. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +27 -3
  150. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  151. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +142 -20
  152. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  153. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +105 -68
  154. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  155. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +27 -3
  156. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  157. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +144 -117
  158. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  159. package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +37 -7
  160. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  161. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +193 -173
  162. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +4 -0
  163. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +293 -0
  164. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  165. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +45 -47
  166. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  167. package/artifacts/contracts/product/PricingService.sol/PricingService.json +85 -78
  168. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  169. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +31 -33
  170. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  171. package/artifacts/contracts/product/Product.sol/Product.json +157 -130
  172. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  173. package/artifacts/contracts/product/RiskService.sol/RiskService.json +102 -81
  174. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  175. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +33 -19
  176. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  177. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  178. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +26 -2
  179. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  180. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +31 -7
  181. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +4 -0
  182. package/artifacts/contracts/registry/IRelease.sol/IRelease.json +24 -0
  183. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  184. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  185. package/artifacts/contracts/registry/Registry.sol/Registry.json +64 -40
  186. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  187. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +250 -221
  188. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  189. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +51 -44
  190. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  191. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +11 -13
  192. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +4 -0
  193. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +1849 -0
  194. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  195. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  196. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  197. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +315 -49
  198. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  199. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
  200. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  201. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +4 -4
  202. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  203. package/artifacts/contracts/shared/Component.sol/Component.json +51 -39
  204. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  205. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +105 -442
  206. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  207. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +40 -70
  208. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  209. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +27 -16
  210. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  211. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +57 -4
  212. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
  213. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
  214. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +4 -0
  215. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.json +40 -0
  216. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  217. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +38 -26
  218. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  219. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +27 -291
  220. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  221. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +38 -26
  222. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  223. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  224. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  225. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  226. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  227. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +120 -1
  228. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  229. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  230. package/artifacts/contracts/shared/IService.sol/IService.json +27 -3
  231. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  232. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  233. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +51 -39
  234. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  235. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  236. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  237. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  238. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  239. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  240. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  241. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  242. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  243. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +118 -62
  244. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  245. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  246. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  247. package/artifacts/contracts/shared/Service.sol/Service.json +27 -16
  248. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  249. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +63 -162
  250. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
  251. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +118 -29
  252. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  253. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +32 -32
  254. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  255. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +38 -26
  256. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  257. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +56 -3
  258. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  259. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +32 -32
  260. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  261. package/artifacts/contracts/staking/Staking.sol/Staking.json +90 -57
  262. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  263. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  264. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  265. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +27 -19
  266. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  267. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +4 -4
  268. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  269. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +87 -51
  270. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  271. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +18 -20
  272. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  273. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +128 -128
  274. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  275. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +22 -22
  276. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  277. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  278. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  279. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  281. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  282. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  283. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  284. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  285. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  286. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
  287. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +2 -2
  288. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  289. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  290. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  291. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  292. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  293. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +2 -2
  294. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  295. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  296. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  297. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  298. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  299. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  300. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  301. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +30 -6
  302. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  303. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +79 -15
  304. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  305. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  306. package/artifacts/contracts/type/Selector.sol/SelectorLib.json +21 -2
  307. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  308. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +2 -2
  309. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  310. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  311. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  312. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +2 -2
  313. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  314. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  315. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -21
  316. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  317. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +47 -2
  318. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  319. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  320. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +2 -2
  321. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  322. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  323. package/contracts/accounting/AccountingService.sol +262 -0
  324. package/contracts/accounting/AccountingServiceManager.sol +38 -0
  325. package/contracts/accounting/IAccountingService.sol +45 -0
  326. package/contracts/authorization/AccessAdmin.sol +156 -82
  327. package/contracts/authorization/AccessManagerCloneable.sol +136 -3
  328. package/contracts/authorization/Authorization.sol +277 -229
  329. package/contracts/authorization/IAccessAdmin.sol +13 -7
  330. package/contracts/authorization/IAuthorization.sol +15 -1
  331. package/contracts/distribution/BasicDistribution.sol +11 -9
  332. package/contracts/distribution/BasicDistributionAuthorization.sol +21 -8
  333. package/contracts/distribution/Distribution.sol +37 -32
  334. package/contracts/distribution/DistributionService.sol +59 -33
  335. package/contracts/distribution/DistributionServiceManager.sol +1 -1
  336. package/contracts/distribution/IDistributionService.sol +16 -13
  337. package/contracts/examples/fire/FirePool.sol +6 -2
  338. package/contracts/examples/fire/FirePoolAuthorization.sol +2 -1
  339. package/contracts/examples/fire/FireProduct.sol +9 -3
  340. package/contracts/examples/fire/FireProductAuthorization.sol +2 -1
  341. package/contracts/examples/unpermissioned/SimpleDistribution.sol +29 -9
  342. package/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol +28 -0
  343. package/contracts/examples/unpermissioned/SimplePool.sol +7 -9
  344. package/contracts/examples/unpermissioned/SimplePoolAuthorization.sol +28 -0
  345. package/contracts/examples/unpermissioned/SimpleProduct.sol +36 -4
  346. package/contracts/examples/unpermissioned/SimpleProductAuthorization.sol +28 -0
  347. package/contracts/instance/BundleSet.sol +4 -4
  348. package/contracts/instance/IInstance.sol +6 -7
  349. package/contracts/instance/IInstanceService.sol +2 -0
  350. package/contracts/instance/Instance.sol +19 -11
  351. package/contracts/instance/InstanceAdmin.sol +213 -64
  352. package/contracts/instance/InstanceAuthorizationV3.sol +18 -23
  353. package/contracts/instance/InstanceReader.sol +91 -35
  354. package/contracts/instance/InstanceService.sol +43 -31
  355. package/contracts/instance/InstanceServiceManager.sol +1 -1
  356. package/contracts/instance/InstanceStore.sol +13 -2
  357. package/contracts/instance/RiskSet.sol +11 -12
  358. package/contracts/instance/base/ObjectLifecycle.sol +4 -2
  359. package/contracts/instance/base/ObjectSet.sol +7 -8
  360. package/contracts/instance/base/ObjectSetHelperLib.sol +30 -0
  361. package/contracts/instance/module/IComponents.sol +3 -2
  362. package/contracts/instance/module/IDistribution.sol +5 -2
  363. package/contracts/instance/module/IRisk.sol +2 -0
  364. package/contracts/oracle/BasicOracleAuthorization.sol +3 -12
  365. package/contracts/oracle/Oracle.sol +1 -1
  366. package/contracts/oracle/OracleService.sol +16 -15
  367. package/contracts/oracle/OracleServiceManager.sol +1 -1
  368. package/contracts/pool/BasicPoolAuthorization.sol +21 -13
  369. package/contracts/pool/BundleService.sol +35 -63
  370. package/contracts/pool/BundleServiceManager.sol +1 -1
  371. package/contracts/pool/IBundleService.sol +13 -20
  372. package/contracts/pool/IPoolService.sol +50 -38
  373. package/contracts/pool/Pool.sol +9 -9
  374. package/contracts/pool/PoolLib.sol +216 -0
  375. package/contracts/pool/PoolService.sol +307 -162
  376. package/contracts/pool/PoolServiceManager.sol +1 -1
  377. package/contracts/product/ApplicationService.sol +3 -3
  378. package/contracts/product/ApplicationServiceManager.sol +1 -1
  379. package/contracts/product/BasicProduct.sol +2 -0
  380. package/contracts/product/BasicProductAuthorization.sol +24 -10
  381. package/contracts/product/ClaimService.sol +157 -139
  382. package/contracts/product/ClaimServiceManager.sol +1 -1
  383. package/contracts/product/IClaimService.sol +14 -2
  384. package/contracts/product/IPolicyService.sol +11 -6
  385. package/contracts/product/IProductComponent.sol +4 -1
  386. package/contracts/product/IRiskService.sol +5 -8
  387. package/contracts/product/PolicyService.sol +95 -146
  388. package/contracts/product/PolicyServiceLib.sol +65 -0
  389. package/contracts/product/PolicyServiceManager.sol +1 -1
  390. package/contracts/product/PricingService.sol +23 -19
  391. package/contracts/product/PricingServiceManager.sol +3 -3
  392. package/contracts/product/Product.sol +55 -13
  393. package/contracts/product/RiskService.sol +66 -29
  394. package/contracts/product/RiskServiceManager.sol +1 -1
  395. package/contracts/registry/IRegistry.sol +8 -15
  396. package/contracts/registry/IRelease.sol +26 -0
  397. package/contracts/registry/Registry.sol +7 -2
  398. package/contracts/registry/RegistryAdmin.sol +129 -226
  399. package/contracts/registry/RegistryService.sol +3 -3
  400. package/contracts/registry/RegistryServiceManager.sol +1 -1
  401. package/contracts/registry/ReleaseAdmin.sol +245 -0
  402. package/contracts/registry/ReleaseLifecycle.sol +2 -0
  403. package/contracts/registry/ReleaseRegistry.sol +124 -99
  404. package/contracts/registry/ServiceAuthorizationV3.sol +85 -14
  405. package/contracts/registry/TokenRegistry.sol +6 -8
  406. package/contracts/shared/Component.sol +32 -27
  407. package/contracts/shared/ComponentService.sol +89 -266
  408. package/contracts/shared/ComponentServiceManager.sol +1 -1
  409. package/contracts/shared/ComponentVerifyingService.sol +1 -1
  410. package/contracts/shared/ContractLib.sol +32 -3
  411. package/contracts/shared/IComponent.sol +3 -9
  412. package/contracts/shared/IComponentService.sol +1 -23
  413. package/contracts/shared/IRegisterable.sol +15 -4
  414. package/contracts/shared/IService.sol +3 -5
  415. package/contracts/shared/InstanceLinkedComponent.sol +3 -3
  416. package/contracts/shared/NftOwnable.sol +4 -4
  417. package/contracts/shared/PolicyHolder.sol +1 -1
  418. package/contracts/shared/Registerable.sol +45 -19
  419. package/contracts/shared/RegistryLinked.sol +1 -1
  420. package/contracts/shared/Service.sol +8 -27
  421. package/contracts/shared/TokenHandler.sol +40 -88
  422. package/contracts/staking/IStaking.sol +0 -8
  423. package/contracts/staking/IStakingService.sol +8 -0
  424. package/contracts/staking/StakeManagerLib.sol +1 -1
  425. package/contracts/staking/Staking.sol +34 -13
  426. package/contracts/staking/StakingReader.sol +1 -1
  427. package/contracts/staking/StakingService.sol +32 -42
  428. package/contracts/staking/StakingServiceManager.sol +5 -4
  429. package/contracts/type/ObjectType.sol +46 -21
  430. package/contracts/type/RiskId.sol +9 -3
  431. package/contracts/type/RoleId.sol +24 -4
  432. package/contracts/type/Selector.sol +5 -0
  433. package/contracts/type/Timestamp.sol +0 -5
  434. package/contracts/type/Version.sol +15 -5
  435. package/contracts/upgradeability/ProxyManager.sol +1 -1
  436. package/package.json +2 -2
  437. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +0 -4
  438. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.json +0 -1196
  439. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +0 -4
  440. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +0 -129
  441. package/contracts/authorization/ReleaseAccessManager.sol +0 -38
  442. package/contracts/instance/module/IAccess.sol +0 -46
@@ -3,11 +3,7 @@ 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
- import {Amount, AmountLib} from "../type/Amount.sol";
8
- import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
9
- import {ContractLib} from "../shared/ContractLib.sol";
10
- import {Fee, FeeLib} from "../type/Fee.sol";
6
+ import {IAccountingService} from "../accounting/IAccountingService.sol";
11
7
  import {IComponent} from "../shared/IComponent.sol";
12
8
  import {IComponents} from "../instance/module/IComponents.sol";
13
9
  import {IComponentService} from "./IComponentService.sol";
@@ -27,8 +23,8 @@ import {Amount, AmountLib} from "../type/Amount.sol";
27
23
  import {ContractLib} from "../shared/ContractLib.sol";
28
24
  import {Fee, FeeLib} from "../type/Fee.sol";
29
25
  import {KEEP_STATE} from "../type/StateId.sol";
30
- import {NftId} from "../type/NftId.sol";
31
- import {ObjectType, REGISTRY, BUNDLE, COMPONENT, DISTRIBUTION, DISTRIBUTOR, INSTANCE, ORACLE, POOL, PRODUCT, STAKING} from "../type/ObjectType.sol";
26
+ import {NftId, NftIdLib} from "../type/NftId.sol";
27
+ import {ObjectType, ACCOUNTING, REGISTRY, COMPONENT, DISTRIBUTION, INSTANCE, ORACLE, POOL, PRODUCT} from "../type/ObjectType.sol";
32
28
  import {Service} from "../shared/Service.sol";
33
29
  import {TokenHandler} from "../shared/TokenHandler.sol";
34
30
  import {TokenHandlerDeployerLib} from "../shared/TokenHandlerDeployerLib.sol";
@@ -42,6 +38,7 @@ contract ComponentService is
42
38
  bool private constant INCREASE = true;
43
39
  bool private constant DECREASE = false;
44
40
 
41
+ IAccountingService private _accountingService;
45
42
  IRegistryService private _registryService;
46
43
  IInstanceService private _instanceService;
47
44
 
@@ -79,12 +76,13 @@ contract ComponentService is
79
76
  initializer()
80
77
  {
81
78
  (
82
- address registryAddress,
83
- address authority
79
+ address authority,
80
+ address registry
84
81
  ) = abi.decode(data, (address, address));
85
82
 
86
- _initializeService(registryAddress, authority, owner);
83
+ __Service_init(authority, registry, owner);
87
84
 
85
+ _accountingService = IAccountingService(_getServiceAddress(ACCOUNTING()));
88
86
  _registryService = IRegistryService(_getServiceAddress(REGISTRY()));
89
87
  _instanceService = IInstanceService(_getServiceAddress(INSTANCE()));
90
88
 
@@ -132,24 +130,6 @@ contract ComponentService is
132
130
  }
133
131
 
134
132
 
135
- function approveStakingTokenHandler(
136
- IERC20Metadata token,
137
- Amount amount
138
- )
139
- external
140
- virtual
141
- {
142
- // checks
143
- ContractLib.getAndVerifyStaking(
144
- getRegistry(),
145
- msg.sender); // only active
146
-
147
- // effects
148
- TokenHandler tokenHandler = IComponent(msg.sender).getTokenHandler();
149
- tokenHandler.approve(token, amount);
150
- }
151
-
152
-
153
133
  function setWallet(address newWallet)
154
134
  external
155
135
  virtual
@@ -185,35 +165,52 @@ contract ComponentService is
185
165
  _setLocked(instance.getInstanceAdmin(), componentAddress, locked);
186
166
  }
187
167
 
168
+ /// @inheritdoc IComponentService
188
169
  function withdrawFees(Amount amount)
189
170
  external
190
171
  virtual
191
172
  returns (Amount withdrawnAmount)
192
173
  {
174
+ // checks
193
175
  (NftId componentNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
194
- IComponents.ComponentInfo memory info = instance.getInstanceReader().getComponentInfo(componentNftId);
195
- address componentWallet = info.tokenHandler.getWallet();
176
+ InstanceReader instanceReader = instance.getInstanceReader();
196
177
 
197
178
  // determine withdrawn amount
179
+ Amount maxAvailableAmount = instanceReader.getFeeAmount(componentNftId);
198
180
  withdrawnAmount = amount;
199
- if (withdrawnAmount.gte(AmountLib.max())) {
200
- withdrawnAmount = instance.getInstanceReader().getFeeAmount(componentNftId);
201
- } else if (withdrawnAmount.eqz()) {
181
+
182
+ // max amount -> withraw all available fees
183
+ if (amount == AmountLib.max()) {
184
+ withdrawnAmount = maxAvailableAmount;
185
+ }
186
+
187
+ // check modified withdrawn amount
188
+ if (withdrawnAmount.eqz()) {
202
189
  revert ErrorComponentServiceWithdrawAmountIsZero();
203
- } else {
204
- Amount withdrawLimit = instance.getInstanceReader().getFeeAmount(componentNftId);
205
- if (withdrawnAmount.gt(withdrawLimit)) {
206
- revert ErrorComponentServiceWithdrawAmountExceedsLimit(withdrawnAmount, withdrawLimit);
207
- }
190
+ } else if (withdrawnAmount > maxAvailableAmount) {
191
+ revert ErrorComponentServiceWithdrawAmountExceedsLimit(withdrawnAmount, maxAvailableAmount);
208
192
  }
209
193
 
194
+ // effects
210
195
  // decrease fee counters by withdrawnAmount
211
- _changeTargetBalance(DECREASE, instance.getInstanceStore(), componentNftId, AmountLib.zero(), withdrawnAmount);
196
+ _accountingService.decreaseComponentFees(
197
+ instance.getInstanceStore(),
198
+ componentNftId,
199
+ withdrawnAmount);
212
200
 
213
- // transfer amount to component owner
214
201
  address componentOwner = getRegistry().ownerOf(componentNftId);
215
- emit LogComponentServiceComponentFeesWithdrawn(componentNftId, componentOwner, address(info.token), withdrawnAmount);
216
- info.tokenHandler.distributeTokens(componentWallet, componentOwner, withdrawnAmount);
202
+ TokenHandler tokenHandler = instanceReader.getTokenHandler(componentNftId);
203
+ emit LogComponentServiceComponentFeesWithdrawn(
204
+ componentNftId,
205
+ componentOwner,
206
+ address(tokenHandler.TOKEN()),
207
+ withdrawnAmount);
208
+
209
+ // interactions
210
+ // transfer amount to component owner
211
+ tokenHandler.pushFeeToken(
212
+ componentOwner,
213
+ withdrawnAmount);
217
214
  }
218
215
 
219
216
 
@@ -235,14 +232,22 @@ contract ComponentService is
235
232
 
236
233
  // get product
237
234
  IProductComponent product = IProductComponent(productAddress);
235
+
236
+ IComponents.ProductInfo memory initialProductInfo = product.getInitialProductInfo();
237
+ // force initialization of linked components with empty values to
238
+ // ensure no components are linked upon initialization of the product
239
+ initialProductInfo.poolNftId = NftIdLib.zero();
240
+ initialProductInfo.distributionNftId = NftIdLib.zero();
241
+ initialProductInfo.oracleNftId = new NftId[](initialProductInfo.expectedNumberOfOracles);
238
242
 
239
243
  // create info
240
244
  instanceStore.createProduct(
241
245
  productNftId,
242
- product.getInitialProductInfo());
246
+ initialProductInfo);
243
247
 
244
- // authorize
245
- instanceAdmin.initializeComponentAuthorization(product);
248
+ instanceStore.createFee(
249
+ productNftId,
250
+ product.getInitialFeeInfo());
246
251
  }
247
252
 
248
253
 
@@ -255,54 +260,29 @@ contract ComponentService is
255
260
  nonReentrant()
256
261
  {
257
262
  (NftId productNftId, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
258
- IComponents.ProductInfo memory productInfo = instance.getInstanceReader().getProductInfo(productNftId);
263
+ IComponents.FeeInfo memory feeInfo = instance.getInstanceReader().getFeeInfo(productNftId);
259
264
  bool feesChanged = false;
260
265
 
261
266
  // update product fee if required
262
- if(!FeeLib.eq(productInfo.productFee, productFee)) {
263
- _logUpdateFee(productNftId, "ProductFee", productInfo.productFee, productFee);
264
- productInfo.productFee = productFee;
267
+ if(!FeeLib.eq(feeInfo.productFee, productFee)) {
268
+ _logUpdateFee(productNftId, "ProductFee", feeInfo.productFee, productFee);
269
+ feeInfo.productFee = productFee;
265
270
  feesChanged = true;
266
271
  }
267
272
 
268
273
  // update processing fee if required
269
- if(!FeeLib.eq(productInfo.processingFee, processingFee)) {
270
- _logUpdateFee(productNftId, "ProcessingFee", productInfo.processingFee, processingFee);
271
- productInfo.processingFee = processingFee;
274
+ if(!FeeLib.eq(feeInfo.processingFee, processingFee)) {
275
+ _logUpdateFee(productNftId, "ProcessingFee", feeInfo.processingFee, processingFee);
276
+ feeInfo.processingFee = processingFee;
272
277
  feesChanged = true;
273
278
  }
274
279
 
275
280
  if(feesChanged) {
276
- instance.getInstanceStore().updateProduct(productNftId, productInfo, KEEP_STATE());
281
+ instance.getInstanceStore().updateFee(productNftId, feeInfo);
277
282
  emit LogComponentServiceProductFeesUpdated(productNftId);
278
283
  }
279
284
  }
280
285
 
281
- function increaseProductFees(
282
- InstanceStore instanceStore,
283
- NftId productNftId,
284
- Amount feeAmount
285
- )
286
- external
287
- virtual
288
- // TODO re-enable once role granting is stable and fixed
289
- // restricted()
290
- {
291
- _checkNftType(productNftId, PRODUCT());
292
- _changeTargetBalance(INCREASE, instanceStore, productNftId, AmountLib.zero(), feeAmount);
293
- }
294
-
295
-
296
- function decreaseProductFees(InstanceStore instanceStore, NftId productNftId, Amount feeAmount)
297
- external
298
- virtual
299
- // TODO re-enable once role granting is stable and fixed
300
- // restricted()
301
- {
302
- _checkNftType(productNftId, PRODUCT());
303
- _changeTargetBalance(DECREASE, instanceStore, productNftId, AmountLib.zero(), feeAmount);
304
- }
305
-
306
286
  //-------- distribution -------------------------------------------------//
307
287
 
308
288
  /// @dev registers the sending component as a distribution component
@@ -333,10 +313,6 @@ contract ComponentService is
333
313
  // set distribution in product info
334
314
  productInfo.distributionNftId = distributionNftId;
335
315
  instanceStore.updateProduct(productNftId, productInfo, KEEP_STATE());
336
-
337
- // authorize
338
- instanceAdmin.initializeComponentAuthorization(
339
- IInstanceLinkedComponent(distributioAddress));
340
316
  }
341
317
 
342
318
 
@@ -348,93 +324,30 @@ contract ComponentService is
348
324
  virtual
349
325
  {
350
326
  (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveComponent(DISTRIBUTION());
351
- (NftId productNftId, IComponents.ProductInfo memory productInfo) = _getLinkedProductInfo(
327
+ (NftId productNftId, IComponents.FeeInfo memory feeInfo) = _getLinkedFeeInfo(
352
328
  instance.getInstanceReader(), distributionNftId);
353
329
  bool feesChanged = false;
354
330
 
355
331
  // update distributino fee if required
356
- if(!FeeLib.eq(productInfo.distributionFee, distributionFee)) {
357
- _logUpdateFee(productNftId, "DistributionFee", productInfo.distributionFee, distributionFee);
358
- productInfo.distributionFee = distributionFee;
332
+ if(!FeeLib.eq(feeInfo.distributionFee, distributionFee)) {
333
+ _logUpdateFee(productNftId, "DistributionFee", feeInfo.distributionFee, distributionFee);
334
+ feeInfo.distributionFee = distributionFee;
359
335
  feesChanged = true;
360
336
  }
361
337
 
362
338
  // update min distribution owner fee if required
363
- if(!FeeLib.eq(productInfo.minDistributionOwnerFee, minDistributionOwnerFee)) {
364
- _logUpdateFee(productNftId, "MinDistributionOwnerFee", productInfo.minDistributionOwnerFee, minDistributionOwnerFee);
365
- productInfo.minDistributionOwnerFee = minDistributionOwnerFee;
339
+ if(!FeeLib.eq(feeInfo.minDistributionOwnerFee, minDistributionOwnerFee)) {
340
+ _logUpdateFee(productNftId, "MinDistributionOwnerFee", feeInfo.minDistributionOwnerFee, minDistributionOwnerFee);
341
+ feeInfo.minDistributionOwnerFee = minDistributionOwnerFee;
366
342
  feesChanged = true;
367
343
  }
368
344
 
369
345
  if(feesChanged) {
370
- instance.getInstanceStore().updateProduct(productNftId, productInfo, KEEP_STATE());
346
+ instance.getInstanceStore().updateFee(productNftId, feeInfo);
371
347
  emit LogComponentServiceDistributionFeesUpdated(distributionNftId);
372
348
  }
373
349
  }
374
350
 
375
- function increaseDistributionBalance(
376
- InstanceStore instanceStore,
377
- NftId distributionNftId,
378
- Amount amount,
379
- Amount feeAmount
380
- )
381
- external
382
- virtual
383
- // TODO re-enable once role granting is stable and fixed
384
- // restricted()
385
- {
386
- _checkNftType(distributionNftId, DISTRIBUTION());
387
- _changeTargetBalance(INCREASE, instanceStore, distributionNftId, amount, feeAmount);
388
- }
389
-
390
-
391
- function decreaseDistributionBalance(
392
- InstanceStore instanceStore,
393
- NftId distributionNftId,
394
- Amount amount,
395
- Amount feeAmount
396
- )
397
- external
398
- virtual
399
- // TODO re-enable once role granting is stable and fixed
400
- // restricted()
401
- {
402
- _checkNftType(distributionNftId, DISTRIBUTION());
403
- _changeTargetBalance(DECREASE, instanceStore, distributionNftId, amount, feeAmount);
404
- }
405
-
406
- //-------- distributor -------------------------------------------------------//
407
-
408
- function increaseDistributorBalance(
409
- InstanceStore instanceStore,
410
- NftId distributorNftId,
411
- Amount amount,
412
- Amount feeAmount
413
- )
414
- external
415
- virtual
416
- // TODO re-enable once role granting is stable and fixed
417
- // restricted()
418
- {
419
- _checkNftType(distributorNftId, DISTRIBUTOR());
420
- _changeTargetBalance(INCREASE, instanceStore, distributorNftId, amount, feeAmount);
421
- }
422
-
423
- function decreaseDistributorBalance(
424
- InstanceStore instanceStore,
425
- NftId distributorNftId,
426
- Amount amount,
427
- Amount feeAmount
428
- )
429
- external
430
- virtual
431
- // TODO re-enable once role granting is stable and fixed
432
- // restricted()
433
- {
434
- _checkNftType(distributorNftId, DISTRIBUTOR());
435
- _changeTargetBalance(DECREASE, instanceStore, distributorNftId, amount, feeAmount);
436
- }
437
-
438
351
  //-------- oracle -------------------------------------------------------//
439
352
 
440
353
  function _registerOracle(address oracleAddress)
@@ -465,10 +378,6 @@ contract ComponentService is
465
378
  productInfo.oracleNftId[productInfo.numberOfOracles] = oracleNftId;
466
379
  productInfo.numberOfOracles++;
467
380
  instanceStore.updateProduct(productNftId, productInfo, KEEP_STATE());
468
-
469
- // authorize
470
- instanceAdmin.initializeComponentAuthorization(
471
- IInstanceLinkedComponent(oracleAddress));
472
381
  }
473
382
 
474
383
  //-------- pool ---------------------------------------------------------//
@@ -503,9 +412,6 @@ contract ComponentService is
503
412
  // update pool in product info
504
413
  productInfo.poolNftId = poolNftId;
505
414
  instanceStore.updateProduct(productNftId, productInfo, KEEP_STATE());
506
-
507
- // authorize
508
- instanceAdmin.initializeComponentAuthorization(pool);
509
415
  }
510
416
 
511
417
 
@@ -519,123 +425,37 @@ contract ComponentService is
519
425
  {
520
426
  (NftId poolNftId, IInstance instance) = _getAndVerifyActiveComponent(POOL());
521
427
 
522
- (NftId productNftId, IComponents.ProductInfo memory productInfo) = _getLinkedProductInfo(
428
+ (NftId productNftId, IComponents.FeeInfo memory feeInfo) = _getLinkedFeeInfo(
523
429
  instance.getInstanceReader(), poolNftId);
524
430
  bool feesChanged = false;
525
431
 
526
432
  // update pool fee if required
527
- if(!FeeLib.eq(productInfo.poolFee, poolFee)) {
528
- _logUpdateFee(productNftId, "PoolFee", productInfo.poolFee, poolFee);
529
- productInfo.poolFee = poolFee;
433
+ if(!FeeLib.eq(feeInfo.poolFee, poolFee)) {
434
+ _logUpdateFee(productNftId, "PoolFee", feeInfo.poolFee, poolFee);
435
+ feeInfo.poolFee = poolFee;
530
436
  feesChanged = true;
531
437
  }
532
438
 
533
439
  // update staking fee if required
534
- if(!FeeLib.eq(productInfo.stakingFee, stakingFee)) {
535
- _logUpdateFee(productNftId, "StakingFee", productInfo.stakingFee, stakingFee);
536
- productInfo.stakingFee = stakingFee;
440
+ if(!FeeLib.eq(feeInfo.stakingFee, stakingFee)) {
441
+ _logUpdateFee(productNftId, "StakingFee", feeInfo.stakingFee, stakingFee);
442
+ feeInfo.stakingFee = stakingFee;
537
443
  feesChanged = true;
538
444
  }
539
445
 
540
446
  // update performance fee if required
541
- if(!FeeLib.eq(productInfo.performanceFee, performanceFee)) {
542
- _logUpdateFee(productNftId, "PerformanceFee", productInfo.performanceFee, performanceFee);
543
- productInfo.performanceFee = performanceFee;
447
+ if(!FeeLib.eq(feeInfo.performanceFee, performanceFee)) {
448
+ _logUpdateFee(productNftId, "PerformanceFee", feeInfo.performanceFee, performanceFee);
449
+ feeInfo.performanceFee = performanceFee;
544
450
  feesChanged = true;
545
451
  }
546
452
 
547
453
  if(feesChanged) {
548
- instance.getInstanceStore().updateProduct(productNftId, productInfo, KEEP_STATE());
454
+ instance.getInstanceStore().updateFee(productNftId, feeInfo);
549
455
  emit LogComponentServicePoolFeesUpdated(poolNftId);
550
456
  }
551
457
  }
552
458
 
553
- function increasePoolBalance(
554
- InstanceStore instanceStore,
555
- NftId poolNftId,
556
- Amount amount,
557
- Amount feeAmount
558
- )
559
- public
560
- virtual
561
- // TODO re-enable once role granting is stable and fixed
562
- // restricted()
563
- {
564
- _checkNftType(poolNftId, POOL());
565
- _changeTargetBalance(INCREASE, instanceStore, poolNftId, amount, feeAmount);
566
- }
567
-
568
- function decreasePoolBalance(
569
- InstanceStore instanceStore,
570
- NftId poolNftId,
571
- Amount amount,
572
- Amount feeAmount
573
- )
574
- public
575
- virtual
576
- // TODO re-enable once role granting is stable and fixed
577
- // restricted()
578
- {
579
- _checkNftType(poolNftId, POOL());
580
- _changeTargetBalance(DECREASE, instanceStore, poolNftId, amount, feeAmount);
581
- }
582
-
583
- //-------- bundle -------------------------------------------------------//
584
-
585
- function increaseBundleBalance(
586
- InstanceStore instanceStore,
587
- NftId bundleNftId,
588
- Amount amount,
589
- Amount feeAmount
590
- )
591
- external
592
- virtual
593
- // TODO re-enable once role granting is stable and fixed
594
- // restricted()
595
- {
596
- _checkNftType(bundleNftId, BUNDLE());
597
- _changeTargetBalance(INCREASE, instanceStore, bundleNftId, amount, feeAmount);
598
- }
599
-
600
- function decreaseBundleBalance(
601
- InstanceStore instanceStore,
602
- NftId bundleNftId,
603
- Amount amount,
604
- Amount feeAmount
605
- )
606
- external
607
- virtual
608
- // TODO re-enable once role granting is stable and fixed
609
- // restricted()
610
- {
611
- _checkNftType(bundleNftId, BUNDLE());
612
- _changeTargetBalance(DECREASE, instanceStore, bundleNftId, amount, feeAmount);
613
- }
614
-
615
-
616
- //-------- internal functions ------------------------------------------//
617
-
618
- function _changeTargetBalance(
619
- bool increase,
620
- InstanceStore instanceStore,
621
- NftId targetNftId,
622
- Amount amount,
623
- Amount feeAmount
624
- )
625
- internal
626
- virtual
627
- {
628
- Amount totalAmount = amount + feeAmount;
629
-
630
- if(increase) {
631
- if(totalAmount.gtz()) { instanceStore.increaseBalance(targetNftId, totalAmount); }
632
- if(feeAmount.gtz()) { instanceStore.increaseFees(targetNftId, feeAmount); }
633
- } else {
634
- if(totalAmount.gtz()) { instanceStore.decreaseBalance(targetNftId, totalAmount); }
635
- if(feeAmount.gtz()) { instanceStore.decreaseFees(targetNftId, feeAmount); }
636
- }
637
- }
638
-
639
459
  /// @dev Registers the component represented by the provided address.
640
460
  function _register(
641
461
  address componentAddress, // address of component to register
@@ -690,9 +510,6 @@ contract ComponentService is
690
510
  address(token),
691
511
  address(instanceAdmin.authority()));
692
512
 
693
- // set token handler allowance to max
694
- // componentInfo.tokenHandler.approve(token, AmountLib.max());
695
-
696
513
  // register component with instance
697
514
  instanceStore.createComponent(
698
515
  componentNftId,
@@ -701,6 +518,9 @@ contract ComponentService is
701
518
  // link component contract to nft id
702
519
  component.linkToRegisteredNftId();
703
520
 
521
+ // authorize
522
+ instanceAdmin.initializeComponentAuthorization(component);
523
+
704
524
  emit LogComponentServiceRegistered(instanceNftId, componentNftId, requiredType, address(component), address(token), initialOwner);
705
525
  }
706
526
 
@@ -720,7 +540,7 @@ contract ComponentService is
720
540
  }
721
541
 
722
542
 
723
- function _getLinkedProductInfo(
543
+ function _getLinkedFeeInfo(
724
544
  InstanceReader instanceReader,
725
545
  NftId componentNftId
726
546
  )
@@ -728,11 +548,11 @@ contract ComponentService is
728
548
  view
729
549
  returns(
730
550
  NftId productNftId,
731
- IComponents.ProductInfo memory info
551
+ IComponents.FeeInfo memory info
732
552
  )
733
553
  {
734
- productNftId = getRegistry().getObjectInfo(componentNftId).parentNftId;
735
- info = instanceReader.getProductInfo(productNftId);
554
+ productNftId = getRegistry().getParentNftId(componentNftId);
555
+ info = instanceReader.getFeeInfo(productNftId);
736
556
  }
737
557
 
738
558
 
@@ -780,9 +600,12 @@ contract ComponentService is
780
600
  revert ErrorComponentServiceAlreadyRegistered(componentAddress);
781
601
  }
782
602
 
783
- // check release matches
603
+ // component release matches servie release
784
604
  address parentAddress = registry.getObjectAddress(parentNftId);
785
- if (component.getRelease() != IRegisterable(parentAddress).getRelease()) {
605
+ if (component.getRelease() != getRelease()) {
606
+ revert ErrorComponentServiceReleaseMismatch(componentAddress, component.getRelease(), getRelease());
607
+ // component release matches parent release
608
+ } else if (component.getRelease() != IRegisterable(parentAddress).getRelease()){
786
609
  revert ErrorComponentServiceReleaseMismatch(componentAddress, component.getRelease(), IRegisterable(parentAddress).getRelease());
787
610
  }
788
611
 
@@ -17,7 +17,7 @@ contract ComponentServiceManager is ProxyManager {
17
17
  )
18
18
  {
19
19
  ComponentService svc = new ComponentService();
20
- bytes memory data = abi.encode(registry, authority);
20
+ bytes memory data = abi.encode(authority, registry);
21
21
  IVersionable versionable = initialize(
22
22
  registry,
23
23
  address(svc),
@@ -116,7 +116,7 @@ abstract contract ComponentVerifyingService is
116
116
  /// @dev returns the product nft id from the registry.
117
117
  /// assumes the component nft id is valid and represents a product linked component.
118
118
  function _getProductNftId(NftId componentNftId) internal view returns (NftId productNftId) {
119
- productNftId = getRegistry().getObjectInfo(componentNftId).parentNftId;
119
+ productNftId = getRegistry().getParentNftId(componentNftId);
120
120
  }
121
121
 
122
122
 
@@ -2,12 +2,14 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
5
+ import {IAccessManager} from "@openzeppelin/contracts/access/manager/IAccessManager.sol";
5
6
 
6
7
  // import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
7
8
  import {IRegistry} from "../registry/IRegistry.sol";
8
9
  import {IPolicyHolder} from "../shared/IPolicyHolder.sol";
9
10
  import {NftId} from "../type/NftId.sol";
10
11
  import {ObjectType, PRODUCT, DISTRIBUTION, ORACLE, POOL, STAKING} from "../type/ObjectType.sol";
12
+ import {VersionPart} from "../type/Version.sol";
11
13
 
12
14
  interface ITargetHelper {
13
15
  function isTargetLocked(address target) external view returns (bool);
@@ -17,6 +19,10 @@ interface IInstanceAdminHelper {
17
19
  function getInstanceAdmin() external view returns (ITargetHelper);
18
20
  }
19
21
 
22
+ interface ITokenRegistryHelper {
23
+ function isActive(uint256 chainId, address token, VersionPart release) external view returns (bool);
24
+ }
25
+
20
26
  library ContractLib {
21
27
 
22
28
  error ErrorContractLibNotRegistered(address target);
@@ -25,7 +31,6 @@ library ContractLib {
25
31
  error ErrorContractLibComponentTypeMismatch(NftId componentNftId, ObjectType expectedType, ObjectType actualType);
26
32
  error ErrorContractLibComponentInactive(NftId componentNftId);
27
33
 
28
-
29
34
  function getAndVerifyComponent(
30
35
  IRegistry registry,
31
36
  address target,
@@ -130,17 +135,41 @@ library ContractLib {
130
135
  view
131
136
  returns (address instance)
132
137
  {
133
- NftId productNftId = registry.getObjectInfo(componentNftId).parentNftId;
134
- NftId instanceNftId = registry.getObjectInfo(productNftId).parentNftId;
138
+ NftId productNftId = registry.getParentNftId(componentNftId);
139
+ NftId instanceNftId = registry.getParentNftId(productNftId);
135
140
  return registry.getObjectInfo(instanceNftId).objectAddress;
136
141
  }
137
142
 
138
143
 
144
+ function isActiveToken(
145
+ address tokenRegistryAddress,
146
+ address token,
147
+ uint256 chainId,
148
+ VersionPart release
149
+ )
150
+ external
151
+ view
152
+ returns (bool)
153
+ {
154
+ return ITokenRegistryHelper(
155
+ tokenRegistryAddress).isActive(
156
+ chainId, token, release);
157
+ }
158
+
139
159
  function isPolicyHolder(address target) external view returns (bool) {
140
160
  return ERC165Checker.supportsInterface(target, type(IPolicyHolder).interfaceId);
141
161
  }
142
162
 
143
163
 
164
+ function isAuthority(address authority) public view returns (bool) {
165
+ if (!isContract(authority)) {
166
+ return false;
167
+ }
168
+
169
+ return supportsInterface(authority, type(IAccessManager).interfaceId);
170
+ }
171
+
172
+
144
173
  function isRegistry(address registry) public view returns (bool) {
145
174
  if (!isContract(registry)) {
146
175
  return false;