@etherisc/gif-next 0.0.2-a307d03-692 → 0.0.2-a33f6f4-689

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 (381) hide show
  1. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +32 -32
  3. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +26 -26
  5. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
  6. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  7. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +361 -246
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +1 -1
  9. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +4 -0
  10. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +673 -0
  11. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  12. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +8 -39
  13. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  14. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +96 -23
  15. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  16. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  17. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +278 -184
  18. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  19. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +32 -0
  20. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  21. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  22. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
  23. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  24. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +21 -134
  25. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +96 -41
  27. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +0 -86
  29. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +156 -85
  31. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  32. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +56 -52
  33. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  34. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +0 -86
  35. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  36. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +64 -1
  37. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  38. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  39. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +19 -49
  40. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  41. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +96 -41
  42. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  43. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +67 -105
  44. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  45. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +96 -41
  46. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  47. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  48. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +71 -162
  49. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
  50. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +96 -41
  51. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  52. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +20 -63
  53. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  54. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +24 -67
  55. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
  56. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +96 -41
  57. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  58. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +35 -72
  59. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
  60. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +96 -41
  61. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  62. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  63. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  64. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +93 -15
  65. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  66. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +61 -12
  67. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  68. package/artifacts/contracts/instance/Instance.sol/Instance.json +113 -38
  69. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  70. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +509 -413
  71. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  72. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +96 -41
  73. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  74. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +104 -75
  75. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  76. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +93 -64
  77. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  78. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +26 -36
  79. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  80. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +54 -44
  81. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
  82. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +2 -2
  83. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  84. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  85. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  86. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  87. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  88. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  89. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  90. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  91. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  92. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +1 -1
  93. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +2 -2
  94. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  95. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  96. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  97. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  98. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  99. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  100. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  101. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +14 -35
  102. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  103. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +93 -30
  104. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  105. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  106. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +0 -21
  107. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  108. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  109. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +0 -21
  110. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  111. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +42 -42
  112. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  113. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +31 -31
  114. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  115. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +0 -21
  116. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  117. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +96 -41
  118. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  119. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +58 -58
  120. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  121. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +39 -39
  122. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  123. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  124. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +0 -21
  125. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  126. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  127. package/artifacts/contracts/pool/Pool.sol/Pool.json +0 -21
  128. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
  129. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +2 -2
  130. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  131. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +62 -62
  132. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  133. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +41 -41
  134. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  135. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +90 -24
  136. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  137. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +34 -22
  138. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  139. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +0 -21
  140. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  141. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +96 -41
  142. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  143. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +80 -80
  144. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  145. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +50 -50
  146. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  147. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +42 -0
  148. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  149. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  150. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  151. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +21 -0
  152. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  153. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +0 -21
  154. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  155. package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +31 -4
  156. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  157. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +62 -62
  158. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
  159. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +2 -2
  160. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  161. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +41 -41
  162. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  163. package/artifacts/contracts/product/PricingService.sol/PricingService.json +73 -52
  164. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  165. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +36 -36
  166. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  167. package/artifacts/contracts/product/Product.sol/Product.json +0 -21
  168. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  169. package/artifacts/contracts/product/RiskService.sol/RiskService.json +79 -28
  170. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  171. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +34 -22
  172. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  173. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  174. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  175. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +1 -1
  176. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  177. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  178. package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
  179. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  180. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +440 -350
  181. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +4 -0
  182. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +878 -0
  183. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  184. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -18
  185. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  186. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +19 -19
  187. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
  188. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +474 -369
  189. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  190. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  191. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  192. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +128 -124
  193. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  194. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
  195. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  196. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  197. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  198. package/artifacts/contracts/shared/Component.sol/Component.json +0 -21
  199. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  200. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +242 -96
  201. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  202. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +48 -40
  203. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  204. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  205. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +60 -4
  206. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
  207. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
  208. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +1 -1
  209. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  210. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +0 -21
  211. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  212. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +165 -35
  213. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  214. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +0 -21
  215. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  216. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  217. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  218. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  219. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  220. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  221. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  222. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  223. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -2
  224. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  225. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +0 -21
  226. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  227. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  228. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  229. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  230. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  231. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  232. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  233. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  234. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  235. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  236. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  237. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  238. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  239. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  240. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
  241. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
  242. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  243. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  244. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  245. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +74 -30
  246. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  247. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +71 -0
  248. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  249. package/artifacts/contracts/staking/Staking.sol/Staking.json +123 -84
  250. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +4 -0
  251. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +469 -0
  252. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  253. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  254. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  255. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +41 -37
  256. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  257. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +30 -57
  258. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  259. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +105 -26
  260. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  261. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +27 -23
  262. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  263. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +142 -128
  264. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  265. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +24 -14
  266. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  267. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  268. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  269. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  270. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  271. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  272. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  273. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  274. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  275. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  276. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
  277. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +2 -2
  278. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  279. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  280. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  281. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  282. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  283. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +33 -31
  284. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  286. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  287. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  288. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  289. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  290. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  291. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +9 -4
  292. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  293. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
  294. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  295. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  296. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  297. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  298. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  299. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  300. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  301. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  302. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
  303. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  304. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +56 -2
  305. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  306. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  307. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +4 -4
  308. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  309. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  310. package/contracts/authorization/AccessAdmin.sol +201 -186
  311. package/contracts/authorization/AccessAdminLib.sol +183 -0
  312. package/contracts/authorization/AccessManagerCloneable.sol +40 -31
  313. package/contracts/authorization/Authorization.sol +61 -33
  314. package/contracts/authorization/IAccessAdmin.sol +63 -36
  315. package/contracts/authorization/IAuthorization.sol +6 -0
  316. package/contracts/distribution/BasicDistribution.sol +6 -6
  317. package/contracts/distribution/BasicDistributionAuthorization.sol +1 -1
  318. package/contracts/distribution/Distribution.sol +3 -48
  319. package/contracts/distribution/DistributionService.sol +32 -5
  320. package/contracts/distribution/IDistributionComponent.sol +0 -9
  321. package/contracts/distribution/IDistributionService.sol +4 -2
  322. package/contracts/examples/fire/FirePool.sol +0 -4
  323. package/contracts/examples/fire/FireProduct.sol +1 -6
  324. package/contracts/examples/unpermissioned/SimpleDistribution.sol +32 -8
  325. package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -8
  326. package/contracts/examples/unpermissioned/SimplePool.sol +0 -4
  327. package/contracts/examples/unpermissioned/SimpleProduct.sol +4 -8
  328. package/contracts/instance/IInstance.sol +45 -10
  329. package/contracts/instance/IInstanceService.sol +19 -3
  330. package/contracts/instance/Instance.sol +74 -26
  331. package/contracts/instance/InstanceAdmin.sol +119 -118
  332. package/contracts/instance/InstanceAuthorizationV3.sol +43 -24
  333. package/contracts/instance/InstanceReader.sol +13 -0
  334. package/contracts/instance/InstanceService.sol +128 -73
  335. package/contracts/instance/module/IComponents.sol +0 -1
  336. package/contracts/instance/module/IDistribution.sol +3 -1
  337. package/contracts/oracle/BasicOracle.sol +1 -3
  338. package/contracts/oracle/BasicOracleAuthorization.sol +1 -1
  339. package/contracts/oracle/Oracle.sol +0 -2
  340. package/contracts/pool/BasicPool.sol +0 -2
  341. package/contracts/pool/BasicPoolAuthorization.sol +1 -1
  342. package/contracts/pool/Pool.sol +0 -2
  343. package/contracts/pool/PoolService.sol +1 -3
  344. package/contracts/product/ApplicationService.sol +21 -6
  345. package/contracts/product/BasicProduct.sol +0 -2
  346. package/contracts/product/BasicProductAuthorization.sol +1 -1
  347. package/contracts/product/IApplicationService.sol +3 -0
  348. package/contracts/product/IPricingService.sol +1 -0
  349. package/contracts/product/IRiskService.sol +7 -7
  350. package/contracts/product/PolicyService.sol +0 -18
  351. package/contracts/product/PricingService.sol +5 -0
  352. package/contracts/product/Product.sol +6 -17
  353. package/contracts/product/RiskService.sol +16 -7
  354. package/contracts/registry/RegistryAdmin.sol +133 -229
  355. package/contracts/registry/RegistryAuthorization.sol +267 -0
  356. package/contracts/registry/ReleaseAdmin.sol +30 -22
  357. package/contracts/registry/ReleaseRegistry.sol +39 -33
  358. package/contracts/registry/ServiceAuthorizationV3.sol +6 -1
  359. package/contracts/shared/Component.sol +11 -27
  360. package/contracts/shared/ComponentService.sol +219 -135
  361. package/contracts/shared/ContractLib.sol +28 -0
  362. package/contracts/shared/IComponent.sol +0 -3
  363. package/contracts/shared/IComponentService.sol +21 -9
  364. package/contracts/shared/InitializableERC165.sol +9 -1
  365. package/contracts/shared/InstanceLinkedComponent.sol +0 -2
  366. package/contracts/shared/NftOwnable.sol +1 -1
  367. package/contracts/shared/Registerable.sol +1 -4
  368. package/contracts/shared/TokenHandler.sol +5 -4
  369. package/contracts/staking/IStaking.sol +12 -2
  370. package/contracts/staking/IStakingService.sol +8 -1
  371. package/contracts/staking/Staking.sol +35 -15
  372. package/contracts/staking/{StakeManagerLib.sol → StakingLib.sol} +79 -22
  373. package/contracts/staking/StakingReader.sol +5 -15
  374. package/contracts/staking/StakingService.sol +36 -2
  375. package/contracts/staking/StakingStore.sol +2 -1
  376. package/contracts/type/ObjectType.sol +5 -14
  377. package/contracts/type/RiskId.sol +4 -3
  378. package/contracts/type/Version.sol +39 -0
  379. package/package.json +2 -2
  380. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +0 -4
  381. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +0 -440
@@ -5,17 +5,14 @@ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessMana
5
5
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
6
6
 
7
7
  import {Amount} from "../type/Amount.sol";
8
- import {ContractLib} from "./ContractLib.sol";
9
8
  import {IComponent} from "./IComponent.sol";
10
9
  import {IComponents} from "../instance/module/IComponents.sol";
11
10
  import {IComponentService} from "./IComponentService.sol";
12
- import {IRegistry} from "../registry/IRegistry.sol";
13
- import {IRelease} from "../registry/IRelease.sol";
14
11
  import {NftId} from "../type/NftId.sol";
15
- import {ObjectType, COMPONENT, STAKING} from "../type/ObjectType.sol";
12
+ import {ObjectType, COMPONENT} from "../type/ObjectType.sol";
16
13
  import {Registerable} from "../shared/Registerable.sol";
17
14
  import {TokenHandler} from "../shared/TokenHandler.sol";
18
- import {Version, VersionLib, VersionPart} from "../type/Version.sol";
15
+ import {Version, VersionLib} from "../type/Version.sol";
19
16
 
20
17
 
21
18
  abstract contract Component is
@@ -27,7 +24,6 @@ abstract contract Component is
27
24
 
28
25
  struct ComponentStorage {
29
26
  string _name; // unique (per instance) component name
30
- IERC20Metadata _token; // token for this component
31
27
  bool _isInterceptor;
32
28
  bytes _data;
33
29
  IComponentService _componentService;
@@ -43,6 +39,7 @@ abstract contract Component is
43
39
 
44
40
 
45
41
  function _getComponentStorage() private pure returns (ComponentStorage storage $) {
42
+ // solhint-disable-next-line no-inline-assembly
46
43
  assembly {
47
44
  $.slot := COMPONENT_LOCATION_V1
48
45
  }
@@ -54,7 +51,6 @@ abstract contract Component is
54
51
  address registry,
55
52
  NftId parentNftId,
56
53
  string memory name,
57
- address token,
58
54
  ObjectType componentType,
59
55
  bool isInterceptor,
60
56
  address initialOwner,
@@ -65,20 +61,6 @@ abstract contract Component is
65
61
  virtual
66
62
  onlyInitializing()
67
63
  {
68
- address tokenRegistry = IRegistry(registry).getTokenRegistryAddress();
69
- VersionPart release = IRelease(authority).getRelease();
70
-
71
- // special case for staking: component intitialization happens before
72
- // GIF core contract setup is complete. at that time token registry
73
- // is not yet available. therefore we skip the check for staking.
74
- if (componentType != STAKING()) {
75
-
76
- // check if provided token is whitelisted and active
77
- if (!ContractLib.isActiveToken(tokenRegistry, token, block.chainid, release)) {
78
- revert ErrorComponentTokenInvalid(token);
79
- }
80
- }
81
-
82
64
  if (bytes(name).length == 0) {
83
65
  revert ErrorComponentNameLengthZero();
84
66
  }
@@ -95,7 +77,6 @@ abstract contract Component is
95
77
  // set component state
96
78
  ComponentStorage storage $ = _getComponentStorage();
97
79
  $._name = name;
98
- $._token = IERC20Metadata(token);
99
80
  $._isInterceptor = isInterceptor;
100
81
  $._data = componentData;
101
82
  $._componentService = IComponentService(_getServiceAddress(COMPONENT()));
@@ -125,7 +106,7 @@ abstract contract Component is
125
106
  }
126
107
 
127
108
  function getToken() public view virtual returns (IERC20Metadata token) {
128
- return getComponentInfo().token;
109
+ return getTokenHandler().TOKEN();
129
110
  }
130
111
 
131
112
  function getName() public view override returns(string memory name) {
@@ -183,10 +164,14 @@ abstract contract Component is
183
164
  function _nftTransferFrom(address from, address to, uint256 tokenId, address operator)
184
165
  internal
185
166
  virtual
186
- { }
167
+ // solhint-disable-next-line no-empty-blocks
168
+ {
169
+ // empty default implementation
170
+ }
187
171
 
188
172
 
189
- /// @dev depending on the source of the component information this function needs to be overwritten.
173
+ /// @dev Sets the components wallet to the specified address.
174
+ /// Depending on the source of the component information this function needs to be overwritten.
190
175
  /// eg for instance linked components that externally store this information with the instance store contract
191
176
  function _setWallet(
192
177
  address newWallet
@@ -201,7 +186,7 @@ abstract contract Component is
201
186
  internal
202
187
  virtual
203
188
  {
204
- _getComponentStorage()._componentService.setComponentLocked(address(this), locked);
189
+ _getComponentStorage()._componentService.setLocked(locked);
205
190
  }
206
191
 
207
192
 
@@ -212,7 +197,6 @@ abstract contract Component is
212
197
 
213
198
  return IComponents.ComponentInfo({
214
199
  name: $._name,
215
- token: $._token,
216
200
  tokenHandler: TokenHandler(address(0)),
217
201
  data: $._data // user specific component data
218
202
  });
@@ -19,6 +19,7 @@ import {IRegisterable} from "../shared/IRegisterable.sol";
19
19
  import {IRegistry} from "../registry/IRegistry.sol";
20
20
  import {IRegistryService} from "../registry/IRegistryService.sol";
21
21
 
22
+ import {AccessManagerCloneable} from "../authorization/AccessManagerCloneable.sol";
22
23
  import {Amount, AmountLib} from "../type/Amount.sol";
23
24
  import {ContractLib} from "../shared/ContractLib.sol";
24
25
  import {Fee, FeeLib} from "../type/Fee.sol";
@@ -42,6 +43,31 @@ contract ComponentService is
42
43
  IRegistryService private _registryService;
43
44
  IInstanceService private _instanceService;
44
45
 
46
+ modifier onlyComponent(address component) {
47
+ _checkSupportsInterface(component);
48
+ _;
49
+ }
50
+
51
+ modifier onlyInstance() {
52
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
53
+ if (instanceNftId.eqz()) {
54
+ revert ErrorComponentServiceNotRegistered(msg.sender);
55
+ }
56
+
57
+ ObjectType objectType = getRegistry().getObjectInfo(instanceNftId).objectType;
58
+ if (objectType != INSTANCE()) {
59
+ revert ErrorComponentServiceNotInstance(msg.sender, objectType);
60
+ }
61
+
62
+ VersionPart instanceVersion = IInstance(msg.sender).getRelease();
63
+ if (instanceVersion != getVersion().toMajorPart()) {
64
+ revert ErrorComponentServiceInstanceVersionMismatch(msg.sender, instanceVersion);
65
+ }
66
+
67
+ _;
68
+ }
69
+
70
+
45
71
  function _initialize(
46
72
  address owner,
47
73
  bytes memory data
@@ -66,46 +92,37 @@ contract ComponentService is
66
92
 
67
93
  //-------- component ----------------------------------------------------//
68
94
 
69
- /// @inheritdoc IComponentService
70
- function registerComponent(address componentAddress)
95
+ function registerComponent(address component)
71
96
  external
72
97
  virtual
73
- restricted()
98
+ onlyComponent(component)
74
99
  returns (NftId componentNftId)
75
100
  {
76
- (NftId productNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
77
-
78
- (
79
- IInstanceLinkedComponent component,
80
- IRegistry.ObjectInfo memory componentInfo // initial component info
81
- ) = _getAndVerifyRegisterableComponent(
82
- componentAddress,
83
- productNftId);
84
- ObjectType componentType = componentInfo.objectType;
101
+ // type specific registration
102
+ IRegistry.ObjectInfo memory componentObjectInfo = IInstanceLinkedComponent(component).getInitialInfo();
103
+ ObjectType componentType = componentObjectInfo.objectType;
104
+ IComponent productComponent = IComponent(getRegistry().getObjectAddress(componentObjectInfo.parentNftId));
85
105
 
86
106
  if (componentType == POOL()) {
87
- IPoolComponent pool = IPoolComponent(componentAddress);
88
- return _registerPool(instance, productNftId, pool, componentInfo);
107
+ return _registerPool(component, address(productComponent.getToken()));
89
108
  }
90
109
  if (componentType == DISTRIBUTION()) {
91
- return _registerDistribution(instance, productNftId, component, componentInfo);
110
+ return _registerDistribution(component, address(productComponent.getToken()));
92
111
  }
93
112
  if (componentType == ORACLE()) {
94
- return _registerOracle(instance, productNftId, component, componentInfo);
113
+ return _registerOracle(component, address(productComponent.getToken()));
95
114
  }
96
115
 
97
116
  // fail
98
- revert ErrorComponentServiceComponentTypeNotSupported(componentAddress, componentType);
117
+ revert ErrorComponentServiceTypeNotSupported(component, componentType);
99
118
  }
100
119
 
101
- /// @inheritdoc IComponentService
102
120
  function approveTokenHandler(
103
121
  IERC20Metadata token,
104
122
  Amount amount
105
123
  )
106
124
  external
107
125
  virtual
108
- restricted()
109
126
  {
110
127
  // checks
111
128
  (NftId componentNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
@@ -116,11 +133,10 @@ contract ComponentService is
116
133
  tokenHandler.approve(token, amount);
117
134
  }
118
135
 
119
- /// @inheritdoc IComponentService
136
+
120
137
  function setWallet(address newWallet)
121
138
  external
122
139
  virtual
123
- restricted()
124
140
  {
125
141
  // checks
126
142
  (NftId componentNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
@@ -132,14 +148,17 @@ contract ComponentService is
132
148
  }
133
149
 
134
150
  /// @inheritdoc IComponentService
135
- function setComponentLocked(address componentAddress, bool locked)
151
+ function setLocked(bool locked)
136
152
  external
137
153
  virtual
138
154
  restricted()
139
155
  {
140
- // TODO inactive component can lock/unlock other components?
141
156
  (, IInstance instance) = _getAndVerifyComponent(COMPONENT(), false);
142
- instance.setLockedFromService(componentAddress, locked);
157
+
158
+ address component = msg.sender;
159
+ instance.getInstanceAdmin().setComponentLocked(
160
+ component,
161
+ locked);
143
162
  }
144
163
 
145
164
  /// @inheritdoc IComponentService
@@ -195,37 +214,24 @@ contract ComponentService is
195
214
 
196
215
  //-------- product ------------------------------------------------------//
197
216
 
198
- function registerProduct(address productAddress)
217
+ function registerProduct(address productAddress, address token)
199
218
  external
200
219
  virtual
201
- restricted()
202
220
  nonReentrant()
221
+ onlyComponent(productAddress)
203
222
  returns (NftId productNftId)
204
223
  {
205
- // TODO proper instance verification, will be done in next PR
206
- //(NftId instanceNftId,, IInstance instance) = _getAndVerifyCallingInstance();
207
- NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
208
- IInstance instance = IInstance(msg.sender);
209
-
210
- (
211
- ,
212
- IRegistry.ObjectInfo memory productInfo // initial product info
213
- ) = _getAndVerifyRegisterableComponent(
224
+ // register/create component setup
225
+ InstanceAdmin instanceAdmin;
226
+ InstanceStore instanceStore;
227
+ (, instanceAdmin, instanceStore,, productNftId) = _register(
214
228
  productAddress,
215
- instanceNftId);
229
+ PRODUCT(),
230
+ token);
216
231
 
217
- if(productInfo.objectType != PRODUCT()) {
218
- revert ErrorComponentServiceComponentTypeNotSupported(productAddress, productInfo.objectType);
219
- }
220
-
221
- InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
222
- InstanceStore instanceStore = instance.getInstanceStore();
223
-
224
- // register/create component info
232
+ // get product
225
233
  IProductComponent product = IProductComponent(productAddress);
226
- productNftId = _register(instanceAdmin, instanceStore, product, productInfo);
227
-
228
- // create product in instance instanceStore
234
+
229
235
  IComponents.ProductInfo memory initialProductInfo = product.getInitialProductInfo();
230
236
  // force initialization of linked components with empty values to
231
237
  // ensure no components are linked upon initialization of the product
@@ -250,7 +256,6 @@ contract ComponentService is
250
256
  )
251
257
  external
252
258
  virtual
253
- restricted()
254
259
  nonReentrant()
255
260
  {
256
261
  (NftId productNftId, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
@@ -280,26 +285,24 @@ contract ComponentService is
280
285
  //-------- distribution -------------------------------------------------//
281
286
 
282
287
  /// @dev registers the sending component as a distribution component
283
- function _registerDistribution(
284
- IInstance instance,
285
- NftId productNftId,
286
- IInstanceLinkedComponent distribution,
287
- IRegistry.ObjectInfo memory info
288
- )
288
+ function _registerDistribution(address distributioAddress, address token)
289
289
  internal
290
290
  virtual
291
291
  nonReentrant()
292
292
  returns (NftId distributionNftId)
293
293
  {
294
- InstanceReader reader = instance.getInstanceReader();
295
- InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
296
- InstanceStore instanceStore = instance.getInstanceStore();
297
-
298
294
  // register/create component info
299
- distributionNftId = _register(instanceAdmin, instanceStore, distribution, info);
295
+ InstanceReader instanceReader;
296
+ InstanceAdmin instanceAdmin;
297
+ InstanceStore instanceStore;
298
+ NftId productNftId;
299
+ (instanceReader, instanceAdmin, instanceStore, productNftId, distributionNftId) = _register(
300
+ distributioAddress,
301
+ DISTRIBUTION(),
302
+ token);
300
303
 
301
304
  // check product is still expecting a distribution registration
302
- IComponents.ProductInfo memory productInfo = reader.getProductInfo(productNftId);
305
+ IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
303
306
  if (!productInfo.hasDistribution) {
304
307
  revert ErrorProductServiceNoDistributionExpected(productNftId);
305
308
  }
@@ -319,7 +322,6 @@ contract ComponentService is
319
322
  )
320
323
  external
321
324
  virtual
322
- restricted()
323
325
  {
324
326
  (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveComponent(DISTRIBUTION());
325
327
  (NftId productNftId, IComponents.FeeInfo memory feeInfo) = _getLinkedFeeInfo(
@@ -348,25 +350,24 @@ contract ComponentService is
348
350
 
349
351
  //-------- oracle -------------------------------------------------------//
350
352
 
351
- function _registerOracle(
352
- IInstance instance,
353
- NftId productNftId,
354
- IInstanceLinkedComponent oracle,
355
- IRegistry.ObjectInfo memory info
356
- )
353
+ function _registerOracle(address oracleAddress, address token)
357
354
  internal
358
355
  virtual
359
356
  returns (NftId oracleNftId)
360
357
  {
361
- InstanceReader reader = instance.getInstanceReader();
362
- InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
363
- InstanceStore instanceStore = instance.getInstanceStore();
358
+ // register/create component setup
359
+ InstanceReader instanceReader;
360
+ InstanceAdmin instanceAdmin;
361
+ InstanceStore instanceStore;
362
+ NftId productNftId;
364
363
 
365
- // register/create component info
366
- oracleNftId = _register(instanceAdmin, instanceStore, oracle, info);
364
+ (instanceReader, instanceAdmin, instanceStore, productNftId, oracleNftId) = _register(
365
+ oracleAddress,
366
+ ORACLE(),
367
+ token);
367
368
 
368
369
  // check product is still expecting an oracle registration
369
- IComponents.ProductInfo memory productInfo = reader.getProductInfo(productNftId);
370
+ IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
370
371
  if (productInfo.expectedNumberOfOracles == 0) {
371
372
  revert ErrorProductServiceNoOraclesExpected(productNftId);
372
373
  }
@@ -382,30 +383,30 @@ contract ComponentService is
382
383
 
383
384
  //-------- pool ---------------------------------------------------------//
384
385
 
385
- function _registerPool(
386
- IInstance instance,
387
- NftId productNftId,
388
- IPoolComponent pool,
389
- IRegistry.ObjectInfo memory info
390
- )
386
+ function _registerPool(address poolAddress, address token)
391
387
  internal
392
388
  virtual
393
389
  returns (NftId poolNftId)
394
390
  {
395
- InstanceReader reader = instance.getInstanceReader();
396
- InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
397
- InstanceStore instanceStore = instance.getInstanceStore();
391
+ // register/create component setup
392
+ InstanceReader instanceReader;
393
+ InstanceAdmin instanceAdmin;
394
+ InstanceStore instanceStore;
395
+ NftId productNftId;
398
396
 
399
- // register/create component info
400
- poolNftId = _register(instanceAdmin, instanceStore, pool, info);
397
+ (instanceReader, instanceAdmin, instanceStore, productNftId, poolNftId) = _register(
398
+ poolAddress,
399
+ POOL(),
400
+ token);
401
401
 
402
402
  // check product is still expecting a pool registration
403
- IComponents.ProductInfo memory productInfo = reader.getProductInfo(productNftId);
403
+ IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
404
404
  if (productInfo.poolNftId.gtz()) {
405
405
  revert ErrorProductServicePoolAlreadyRegistered(productNftId, productInfo.poolNftId);
406
406
  }
407
407
 
408
408
  // create info
409
+ IPoolComponent pool = IPoolComponent(poolAddress);
409
410
  instanceStore.createPool(
410
411
  poolNftId,
411
412
  pool.getInitialPoolInfo());
@@ -422,7 +423,6 @@ contract ComponentService is
422
423
  Fee memory performanceFee // pool fee on profits from capital investors
423
424
  )
424
425
  external
425
- restricted()
426
426
  virtual
427
427
  {
428
428
  (NftId poolNftId, IInstance instance) = _getAndVerifyActiveComponent(POOL());
@@ -460,48 +460,84 @@ contract ComponentService is
460
460
 
461
461
  /// @dev Registers the component represented by the provided address.
462
462
  function _register(
463
- InstanceAdmin instanceAdmin,
464
- InstanceStore instanceStore,
465
- IInstanceLinkedComponent component,
466
- IRegistry.ObjectInfo memory info
463
+ address componentAddress, // address of component to register
464
+ ObjectType requiredType, // required type for component for registration
465
+ address token
467
466
  )
468
467
  internal
469
468
  virtual
470
- returns (NftId componentNftId)
469
+ returns (
470
+ InstanceReader instanceReader,
471
+ InstanceAdmin instanceAdmin,
472
+ InstanceStore instanceStore,
473
+ NftId parentNftId,
474
+ NftId componentNftId
475
+ )
471
476
  {
472
- // register component with registry
473
- componentNftId =
474
- info.objectType == PRODUCT() ?
475
- _registryService.registerProduct(component, info.initialOwner).nftId :
476
- _registryService.registerProductLinkedComponent(component, info.objectType, info.initialOwner).nftId;
477
+ NftId instanceNftId;
478
+ IInstance instance;
479
+ IInstanceLinkedComponent component;
480
+ address initialOwner;
481
+
482
+ (
483
+ instanceNftId,
484
+ instance,
485
+ parentNftId,
486
+ component,
487
+ initialOwner
488
+ ) = _getAndVerifyRegisterableComponent(
489
+ getRegistry(),
490
+ componentAddress,
491
+ requiredType);
492
+
493
+ if (! instance.isTokenRegistryDisabled()) {
494
+ // check if provided token is whitelisted and active
495
+ if (!ContractLib.isActiveToken(
496
+ getRegistry().getTokenRegistryAddress(),
497
+ token,
498
+ block.chainid,
499
+ AccessManagerCloneable(authority()).getRelease())
500
+ ) {
501
+ revert ErrorComponentServiceTokenInvalid(token);
502
+ }
503
+ }
504
+
505
+ // get instance supporting contracts (as function return values)
506
+ instanceReader = instance.getInstanceReader();
507
+ instanceAdmin = instance.getInstanceAdmin();
508
+ instanceStore = instance.getInstanceStore();
509
+
510
+ // register with registry
511
+ if (requiredType == PRODUCT()) {
512
+ componentNftId = _registryService.registerProduct(
513
+ component, initialOwner).nftId;
514
+ } else {
515
+ componentNftId = _registryService.registerProductLinkedComponent(
516
+ component, requiredType, initialOwner).nftId;
517
+ }
477
518
 
478
519
  // deploy and wire token handler
479
- // TODO deploy token handler in instance contract ?!
480
- IComponents.ComponentInfo memory componentInfo = component.getInitialComponentInfo();
481
- IERC20Metadata token = componentInfo.token;
482
- componentInfo.tokenHandler = TokenHandlerDeployerLib.deployTokenHandler(
483
- address(getRegistry()),
484
- address(component), // initially, component is its own wallet
485
- address(token),
486
- address(instanceAdmin.authority()));
487
-
488
- // register component with instance
489
- instanceStore.createComponent(
490
- componentNftId,
491
- componentInfo);
520
+ {
521
+ IComponents.ComponentInfo memory componentInfo = component.getInitialComponentInfo();
522
+ componentInfo.tokenHandler = TokenHandlerDeployerLib.deployTokenHandler(
523
+ address(getRegistry()),
524
+ componentAddress, // initially, component is its own wallet
525
+ token,
526
+ address(instanceAdmin.authority()));
527
+
528
+ // register component with instance
529
+ instanceStore.createComponent(
530
+ componentNftId,
531
+ componentInfo);
532
+ }
492
533
 
493
534
  // link component contract to nft id
494
535
  component.linkToRegisteredNftId();
495
536
 
496
537
  // authorize
497
- instanceAdmin.initializeComponentAuthorization(component);
538
+ instanceAdmin.initializeComponentAuthorization(componentAddress, requiredType);
498
539
 
499
- emit LogComponentServiceRegistered(
500
- componentNftId,
501
- info.objectType,
502
- address(component),
503
- address(token),
504
- info.initialOwner);
540
+ emit LogComponentServiceRegistered(instanceNftId, componentNftId, requiredType, componentAddress, token, initialOwner);
505
541
  }
506
542
 
507
543
 
@@ -535,47 +571,89 @@ contract ComponentService is
535
571
  info = instanceReader.getFeeInfo(productNftId);
536
572
  }
537
573
 
574
+
538
575
  /// @dev Based on the provided component address required type the component
539
576
  /// and related instance contract this function reverts iff:
577
+ /// - the sender is not registered
540
578
  /// - the component contract does not support IInstanceLinkedComponent
541
- /// - the component parent does not match with the required parent
542
- /// - the component version does not match with the service release
579
+ /// - the component type does not match with the required type
543
580
  /// - the component has already been registered
544
581
  function _getAndVerifyRegisterableComponent(
582
+ IRegistry registry,
545
583
  address componentAddress,
546
- NftId requiredParent
584
+ ObjectType requiredType
547
585
  )
548
586
  internal
549
587
  view
550
588
  returns (
589
+ NftId instanceNftId,
590
+ IInstance instance,
591
+ NftId parentNftId,
551
592
  IInstanceLinkedComponent component,
552
- IRegistry.ObjectInfo memory info
593
+ address initialOwner
553
594
  )
554
595
  {
555
- // check component interface
556
- if (!ContractLib.supportsInterface(componentAddress, type(IInstanceLinkedComponent).interfaceId)) {
557
- revert ErrorComponentServiceNotInstanceLinkedComponent(componentAddress);
596
+ // check sender (instance or product) is registered
597
+ IRegistry.ObjectInfo memory senderInfo = registry.getObjectInfo(msg.sender);
598
+ if (senderInfo.nftId.eqz()) {
599
+ revert ErrorComponentServiceSenderNotRegistered(msg.sender);
558
600
  }
559
601
 
602
+ // the sender is the parent of the component to be registered
603
+ // an instance caller wanting to register a product - or -
604
+ // a product caller wantint go register a distribution, oracle or pool
605
+ parentNftId = senderInfo.nftId;
606
+
607
+ // check component is of required type
560
608
  component = IInstanceLinkedComponent(componentAddress);
561
- info = component.getInitialInfo();
609
+ IRegistry.ObjectInfo memory info = component.getInitialInfo();
610
+ if(info.objectType != requiredType) {
611
+ revert ErrorComponentServiceInvalidType(componentAddress, requiredType, info.objectType);
612
+ }
562
613
 
563
- // check component parent
564
- if(info.parentNftId != requiredParent) {
565
- revert ErrorComponentServiceComponentParentInvalid(componentAddress, requiredParent, info.parentNftId);
614
+ // check component has not already been registered
615
+ if (getRegistry().getNftIdForAddress(componentAddress).gtz()) {
616
+ revert ErrorComponentServiceAlreadyRegistered(componentAddress);
566
617
  }
567
618
 
568
- // check component release
569
- // TODO check version with registry
570
- //if(info.version != getRelease()) {
571
- if(component.getRelease() != getRelease()) {
572
- revert ErrorComponentServiceComponentReleaseMismatch(componentAddress, getRelease(), component.getRelease());
619
+ // component release matches servie release
620
+ address parentAddress = registry.getObjectAddress(parentNftId);
621
+ if (component.getRelease() != getRelease()) {
622
+ revert ErrorComponentServiceReleaseMismatch(componentAddress, component.getRelease(), getRelease());
623
+ // component release matches parent release
624
+ } else if (component.getRelease() != IRegisterable(parentAddress).getRelease()){
625
+ revert ErrorComponentServiceReleaseMismatch(componentAddress, component.getRelease(), IRegisterable(parentAddress).getRelease());
573
626
  }
574
627
 
575
- // check component has not already been registered
576
- if (getRegistry().getNftIdForAddress(componentAddress).gtz()) {
577
- revert ErrorComponentServiceComponentAlreadyRegistered(componentAddress);
628
+ // check component belongs to same product cluster
629
+ // parent of product must be instance, parent of other componet types must be product
630
+ if (info.parentNftId != senderInfo.nftId) {
631
+ revert ErrorComponentServiceSenderNotComponentParent(senderInfo.nftId, info.parentNftId);
578
632
  }
633
+
634
+ // verify parent is registered instance
635
+ if (requiredType == PRODUCT()) {
636
+ if (senderInfo.objectType != INSTANCE()) {
637
+ revert ErrorComponentServiceParentNotInstance(senderInfo.nftId, senderInfo.objectType);
638
+ }
639
+
640
+ instanceNftId = senderInfo.nftId;
641
+ // verify parent is registered product
642
+ } else {
643
+ if (senderInfo.objectType != PRODUCT()) {
644
+ revert ErrorComponentServiceParentNotProduct(senderInfo.nftId, senderInfo.objectType);
645
+ }
646
+
647
+ instanceNftId = senderInfo.parentNftId;
648
+ }
649
+
650
+ // get initial owner and instance
651
+ initialOwner = info.initialOwner;
652
+ instance = IInstance(registry.getObjectAddress(instanceNftId));
653
+ }
654
+
655
+ function _setLocked(InstanceAdmin instanceAdmin, address componentAddress, bool locked) internal {
656
+ instanceAdmin.setTargetLocked(componentAddress, locked);
579
657
  }
580
658
 
581
659
  function _getAndVerifyActiveComponent(ObjectType expectedType)
@@ -621,4 +699,10 @@ contract ComponentService is
621
699
  function _getDomain() internal pure virtual override returns(ObjectType) {
622
700
  return COMPONENT();
623
701
  }
702
+
703
+ function _checkSupportsInterface(address component) internal view {
704
+ if (!ContractLib.supportsInterface(component, type(IInstanceLinkedComponent).interfaceId)) {
705
+ revert ErrorComponentServiceNotInstanceLinkedComponent(component);
706
+ }
707
+ }
624
708
  }