@etherisc/gif-next 0.0.2-df73b56-462 → 0.0.2-dfb8aa3-070

Sign up to get free protection for your applications and to get access to all the features.
Files changed (406) hide show
  1. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +96 -37
  3. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  4. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  5. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +67 -11
  6. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  7. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  8. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +60 -13
  9. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  10. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +40 -3
  11. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  12. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +19 -0
  13. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +4 -0
  14. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.json +1196 -0
  15. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  16. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +68 -5
  17. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  18. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +154 -94
  19. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  20. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +82 -22
  21. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  22. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +94 -58
  23. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  24. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +136 -86
  25. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +80 -60
  27. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +81 -58
  29. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +29 -0
  31. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +4 -0
  32. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.json +22 -0
  33. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +4 -0
  34. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1538 -0
  35. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
  36. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +470 -0
  37. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
  38. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2072 -0
  39. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
  40. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +470 -0
  41. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
  42. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
  43. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  44. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +156 -96
  45. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  46. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +137 -77
  47. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  48. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +153 -106
  49. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  50. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +241 -129
  51. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  52. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  53. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  54. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +53 -31
  55. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  56. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +29 -84
  57. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  58. package/artifacts/contracts/instance/Instance.sol/Instance.json +62 -40
  59. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  60. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +148 -118
  61. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  62. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +57 -97
  63. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  64. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +275 -77
  65. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  66. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +72 -130
  67. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  68. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +48 -40
  69. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  70. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +175 -104
  71. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  72. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  73. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  74. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  75. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  76. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  77. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +46 -5
  78. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  79. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  80. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  81. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  82. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  83. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  84. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  85. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  86. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  87. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  88. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +135 -75
  89. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  90. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +84 -24
  91. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  92. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  93. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +76 -53
  94. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  95. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +43 -9
  96. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  97. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +89 -53
  98. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  99. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +86 -47
  100. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  101. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +48 -36
  102. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  103. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +89 -66
  104. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  105. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +82 -22
  106. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  107. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +180 -82
  108. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  109. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +90 -58
  110. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  111. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +53 -0
  112. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  113. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +76 -53
  114. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  115. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +200 -115
  116. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  117. package/artifacts/contracts/pool/Pool.sol/Pool.json +89 -53
  118. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  119. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +312 -161
  120. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  121. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +81 -41
  122. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  123. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +66 -32
  124. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  125. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +45 -33
  126. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  127. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +145 -73
  128. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  129. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +82 -22
  130. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  131. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +175 -90
  132. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  133. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +82 -58
  134. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  135. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +29 -0
  136. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  137. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +64 -8
  138. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  139. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +58 -0
  140. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  141. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +80 -51
  142. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  143. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +132 -73
  144. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  145. package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +29 -0
  146. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  147. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +139 -60
  148. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  149. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +67 -47
  150. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  151. package/artifacts/contracts/product/PricingService.sol/PricingService.json +149 -107
  152. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  153. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +61 -45
  154. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  155. package/artifacts/contracts/product/Product.sol/Product.json +145 -73
  156. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  157. package/artifacts/contracts/product/RiskService.sol/RiskService.json +60 -26
  158. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  159. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +42 -30
  160. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  161. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  162. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  163. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +67 -15
  164. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  165. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +114 -35
  166. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  167. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +5 -18
  168. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  169. package/artifacts/contracts/registry/Registry.sol/Registry.json +111 -51
  170. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  171. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +193 -165
  172. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  173. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +73 -172
  174. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  175. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +41 -29
  176. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  177. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +47 -6
  178. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  179. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +121 -223
  180. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  181. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +66 -8
  182. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  183. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  184. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  185. package/artifacts/contracts/shared/Component.sol/Component.json +68 -28
  186. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  187. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +350 -155
  188. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  189. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +83 -63
  190. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  191. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +42 -0
  192. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  193. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +2 -2
  194. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  195. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +55 -28
  196. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  197. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +321 -19
  198. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  199. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +76 -53
  200. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  201. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +36 -0
  202. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  203. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +36 -0
  204. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  205. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +16 -0
  206. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  207. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +1 -1
  208. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  209. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +29 -0
  210. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  211. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  212. package/artifacts/contracts/shared/IService.sol/IService.json +29 -0
  213. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  214. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  215. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +89 -53
  216. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  217. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +42 -1
  218. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  219. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +42 -1
  220. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  221. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  222. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  223. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +18 -2
  224. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  225. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +3 -3
  226. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  227. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +66 -8
  228. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  229. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  230. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  231. package/artifacts/contracts/shared/Service.sol/Service.json +42 -0
  232. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  233. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  234. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  235. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  236. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  237. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +55 -28
  238. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  239. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +29 -21
  240. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  241. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +2 -2
  242. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  243. package/artifacts/contracts/staking/Staking.sol/Staking.json +138 -78
  244. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  245. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +46 -5
  246. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  247. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +68 -42
  248. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  249. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +7 -12
  250. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  251. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +66 -53
  252. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  253. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +45 -33
  254. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  255. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +144 -103
  256. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  257. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +2 -2
  258. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  259. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  260. package/artifacts/contracts/type/Amount.sol/AmountLib.json +32 -8
  261. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  262. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  263. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +28 -4
  264. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  265. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  266. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  267. package/artifacts/contracts/type/Fee.sol/FeeLib.json +2 -2
  268. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  269. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  270. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  271. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  272. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  273. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  274. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  275. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +2 -2
  276. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  277. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +19 -19
  278. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  279. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  280. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  281. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  282. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  283. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +60 -4
  284. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
  286. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  287. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  288. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  289. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  290. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +15 -2
  291. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  292. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  293. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  294. package/artifacts/contracts/type/UFixed.sol/MathLib.json +2 -2
  295. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  296. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +15 -2
  297. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  298. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  299. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  300. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  301. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +28 -12
  302. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  303. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  304. package/contracts/authorization/AccessAdmin.sol +65 -61
  305. package/contracts/authorization/Authorization.sol +111 -39
  306. package/contracts/authorization/IAccess.sol +1 -0
  307. package/contracts/authorization/IAccessAdmin.sol +4 -2
  308. package/contracts/authorization/IAuthorization.sol +13 -7
  309. package/contracts/authorization/IServiceAuthorization.sol +3 -1
  310. package/contracts/authorization/ReleaseAccessManager.sol +38 -0
  311. package/contracts/authorization/ServiceAuthorization.sol +26 -10
  312. package/contracts/distribution/BasicDistribution.sol +2 -1
  313. package/contracts/distribution/Distribution.sol +6 -16
  314. package/contracts/distribution/DistributionService.sol +55 -36
  315. package/contracts/distribution/IDistributionComponent.sol +1 -1
  316. package/contracts/examples/fire/DamageLevel.sol +59 -0
  317. package/contracts/examples/fire/FirePool.sol +73 -0
  318. package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
  319. package/contracts/examples/fire/FireProduct.sol +415 -0
  320. package/contracts/examples/fire/FireProductAuthorization.sol +44 -0
  321. package/contracts/examples/fire/FireUSD.sol +26 -0
  322. package/contracts/examples/unpermissioned/SimpleDistribution.sol +4 -4
  323. package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -4
  324. package/contracts/examples/unpermissioned/SimplePool.sol +4 -4
  325. package/contracts/examples/unpermissioned/SimpleProduct.sol +10 -10
  326. package/contracts/instance/IInstance.sol +4 -1
  327. package/contracts/instance/IInstanceService.sol +0 -20
  328. package/contracts/instance/Instance.sol +20 -17
  329. package/contracts/instance/InstanceAdmin.sol +22 -30
  330. package/contracts/instance/InstanceAuthorizationV3.sol +9 -19
  331. package/contracts/instance/InstanceReader.sol +83 -18
  332. package/contracts/instance/InstanceService.sol +15 -70
  333. package/contracts/instance/module/IComponents.sol +6 -3
  334. package/contracts/instance/module/IPolicy.sol +2 -2
  335. package/contracts/oracle/BasicOracle.sol +0 -1
  336. package/contracts/oracle/IOracleService.sol +2 -1
  337. package/contracts/oracle/Oracle.sol +4 -15
  338. package/contracts/oracle/OracleService.sol +39 -29
  339. package/contracts/pool/BasicPool.sol +14 -26
  340. package/contracts/pool/BasicPoolAuthorization.sol +0 -1
  341. package/contracts/pool/BundleService.sol +75 -20
  342. package/contracts/pool/IBundleService.sol +9 -0
  343. package/contracts/pool/IPoolService.sol +21 -14
  344. package/contracts/pool/Pool.sol +22 -29
  345. package/contracts/pool/PoolService.sol +116 -80
  346. package/contracts/product/ApplicationService.sol +16 -4
  347. package/contracts/product/BasicProduct.sol +6 -6
  348. package/contracts/product/BasicProductAuthorization.sol +0 -1
  349. package/contracts/product/ClaimService.sol +108 -69
  350. package/contracts/product/IClaimService.sol +3 -2
  351. package/contracts/product/IPolicyService.sol +3 -0
  352. package/contracts/product/IPricingService.sol +9 -9
  353. package/contracts/product/IProductComponent.sol +23 -3
  354. package/contracts/product/PolicyService.sol +66 -21
  355. package/contracts/product/PricingService.sol +8 -8
  356. package/contracts/product/Product.sol +81 -52
  357. package/contracts/registry/ChainNft.sol +6 -9
  358. package/contracts/registry/IRegistry.sol +6 -3
  359. package/contracts/registry/IRegistryService.sol +5 -12
  360. package/contracts/registry/ITransferInterceptor.sol +1 -2
  361. package/contracts/registry/Registry.sol +21 -6
  362. package/contracts/registry/RegistryAdmin.sol +7 -23
  363. package/contracts/registry/RegistryService.sol +33 -44
  364. package/contracts/registry/ReleaseLifecycle.sol +6 -3
  365. package/contracts/registry/ReleaseRegistry.sol +201 -191
  366. package/contracts/registry/ServiceAuthorizationV3.sol +14 -19
  367. package/contracts/shared/Component.sol +25 -28
  368. package/contracts/shared/ComponentService.sol +235 -131
  369. package/contracts/shared/ComponentVerifyingService.sol +22 -13
  370. package/contracts/shared/IComponent.sol +6 -2
  371. package/contracts/shared/IComponentService.sol +25 -13
  372. package/contracts/shared/IInstanceLinkedComponent.sol +3 -11
  373. package/contracts/shared/ILifecycle.sol +3 -1
  374. package/contracts/shared/INftOwnable.sol +2 -0
  375. package/contracts/shared/IRegisterable.sol +11 -0
  376. package/contracts/shared/InstanceLinkedComponent.sol +68 -27
  377. package/contracts/shared/KeyValueStore.sol +1 -1
  378. package/contracts/shared/Lifecycle.sol +15 -4
  379. package/contracts/shared/NftOwnable.sol +23 -3
  380. package/contracts/shared/PolicyHolder.sol +4 -0
  381. package/contracts/shared/Registerable.sol +15 -5
  382. package/contracts/shared/Service.sol +4 -7
  383. package/contracts/staking/IStakingService.sol +0 -3
  384. package/contracts/staking/Staking.sol +2 -3
  385. package/contracts/staking/StakingReader.sol +12 -5
  386. package/contracts/staking/StakingService.sol +15 -15
  387. package/contracts/type/Amount.sol +15 -0
  388. package/contracts/type/ClaimId.sol +6 -1
  389. package/contracts/type/NftId.sol +1 -0
  390. package/contracts/type/ObjectType.sol +1 -0
  391. package/contracts/type/PayoutId.sol +10 -10
  392. package/contracts/type/RiskId.sol +15 -1
  393. package/contracts/type/RoleId.sol +0 -12
  394. package/contracts/type/StateId.sol +14 -1
  395. package/contracts/type/UFixed.sol +4 -0
  396. package/contracts/upgradeability/ProxyManager.sol +2 -1
  397. package/package.json +2 -1
  398. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +0 -4
  399. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.json +0 -290
  400. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +0 -4
  401. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +0 -390
  402. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
  403. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
  404. package/contracts/authorization/IModuleAuthorization.sol +0 -21
  405. package/contracts/authorization/ModuleAuthorization.sol +0 -78
  406. package/contracts/shared/InitializableCustom.sol +0 -177
@@ -1,38 +1,35 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
+
4
6
  import {Amount, AmountLib} from "../type/Amount.sol";
5
7
  import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
8
+ import {ContractLib} from "../shared/ContractLib.sol";
6
9
  import {Fee, FeeLib} from "../type/Fee.sol";
7
10
  import {IComponents} from "../instance/module/IComponents.sol";
8
11
  import {IComponentService} from "./IComponentService.sol";
9
12
  import {IInstance} from "../instance/IInstance.sol";
10
13
  import {IInstanceLinkedComponent} from "./IInstanceLinkedComponent.sol";
14
+ import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
11
15
  import {InstanceReader} from "../instance/InstanceReader.sol";
12
16
  import {InstanceStore} from "../instance/InstanceStore.sol";
13
17
  import {IInstanceService} from "../instance/IInstanceService.sol";
18
+ import {IRegisterable} from "../shared/IRegisterable.sol";
14
19
  import {IPoolComponent} from "../pool/IPoolComponent.sol";
15
20
  import {IProductComponent} from "../product/IProductComponent.sol";
16
21
  import {IRegistry} from "../registry/IRegistry.sol";
17
22
  import {IRegistryService} from "../registry/IRegistryService.sol";
18
23
  import {KEEP_STATE} from "../type/StateId.sol";
19
24
  import {NftId} from "../type/NftId.sol";
20
- import {ObjectType, REGISTRY, COMPONENT, DISTRIBUTION, INSTANCE, ORACLE, POOL, PRODUCT} from "../type/ObjectType.sol";
21
- import {RoleId, DISTRIBUTION_OWNER_ROLE, ORACLE_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE} from "../type/RoleId.sol";
25
+ import {ObjectType, REGISTRY, BUNDLE, COMPONENT, DISTRIBUTION, DISTRIBUTOR, INSTANCE, ORACLE, POOL, PRODUCT} from "../type/ObjectType.sol";
26
+ import {RoleId} from "../type/RoleId.sol";
22
27
  import {TokenHandlerDeployerLib} from "../shared/TokenHandlerDeployerLib.sol";
23
28
 
24
29
  contract ComponentService is
25
30
  ComponentVerifyingService,
26
31
  IComponentService
27
32
  {
28
- error ErrorComponentServiceAlreadyRegistered(address component);
29
- error ErrorComponentServiceNotComponent(address component);
30
- error ErrorComponentServiceInvalidType(address component, ObjectType requiredType, ObjectType componentType);
31
- error ErrorComponentServiceSenderNotOwner(address component, address initialOwner, address sender);
32
- error ErrorComponentServiceExpectedRoleMissing(NftId instanceNftId, RoleId requiredRole, address sender);
33
- error ErrorComponentServiceComponentLocked(address component);
34
- error ErrorComponentServiceSenderNotService(address sender);
35
- error ErrorComponentServiceComponentTypeInvalid(address component, ObjectType expectedType, ObjectType foundType);
36
33
 
37
34
  bool private constant INCREASE = true;
38
35
  bool private constant DECREASE = false;
@@ -40,6 +37,14 @@ contract ComponentService is
40
37
  IRegistryService private _registryService;
41
38
  IInstanceService private _instanceService;
42
39
 
40
+ modifier onlyComponent(address component) {
41
+ if (!ContractLib.supportsInterface(component, type(IInstanceLinkedComponent).interfaceId)) {
42
+ revert ErrorComponentServiceNotInstanceLinkedComponent(component);
43
+ }
44
+ _;
45
+ }
46
+
47
+
43
48
  function _initialize(
44
49
  address owner,
45
50
  bytes memory data
@@ -63,6 +68,29 @@ contract ComponentService is
63
68
 
64
69
  //-------- component ----------------------------------------------------//
65
70
 
71
+ function registerComponent(address component)
72
+ external
73
+ virtual
74
+ onlyComponent(component)
75
+ returns (NftId componentNftId)
76
+ {
77
+ // type specific registration
78
+ ObjectType componentType = IInstanceLinkedComponent(component).getInitialInfo().objectType;
79
+ if (componentType == POOL()) {
80
+ return _registerPool(component);
81
+ }
82
+ if (componentType == DISTRIBUTION()) {
83
+ return _registerDistribution(component);
84
+ }
85
+ if (componentType == ORACLE()) {
86
+ return _registerOracle(component);
87
+ }
88
+
89
+ // fail
90
+ revert ErrorComponentServiceTypeNotSupported(component, componentType);
91
+ }
92
+
93
+
66
94
  function setWallet(address newWallet) external virtual {
67
95
  (NftId componentNftId,, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
68
96
  IComponents.ComponentInfo memory info = instance.getInstanceReader().getComponentInfo(componentNftId);
@@ -125,29 +153,29 @@ contract ComponentService is
125
153
 
126
154
  //-------- product ------------------------------------------------------//
127
155
 
128
- function registerProduct()
156
+ function registerProduct(address productAddress)
129
157
  external
130
158
  virtual
159
+ onlyComponent(productAddress)
160
+ returns (NftId productNftId)
131
161
  {
132
- address contractAddress = msg.sender;
133
-
134
162
  // register/create component setup
135
- (
136
- InstanceReader instanceReader,
137
- InstanceStore instanceStore,
138
- NftId productNftId
139
- ) = _register(
140
- contractAddress,
141
- PRODUCT(),
142
- PRODUCT_OWNER_ROLE());
143
-
144
- // create product info
145
- IComponents.ProductInfo memory productInfo = IProductComponent(contractAddress).getInitialProductInfo();
146
- instanceStore.createProduct(productNftId, productInfo);
163
+ InstanceAdmin instanceAdmin;
164
+ InstanceStore instanceStore;
165
+ (, instanceAdmin, instanceStore,, productNftId) = _register(
166
+ productAddress,
167
+ PRODUCT());
168
+
169
+ // get product
170
+ IProductComponent product = IProductComponent(productAddress);
171
+
172
+ // create info
173
+ instanceStore.createProduct(
174
+ productNftId,
175
+ product.getInitialProductInfo());
147
176
 
148
- // link distribution and pool to product
149
- _linkToProduct(instanceReader, instanceStore, productInfo.distributionNftId, productNftId);
150
- _linkToProduct(instanceReader, instanceStore, productInfo.poolNftId, productNftId);
177
+ // authorize
178
+ instanceAdmin.initializeComponentAuthorization(product);
151
179
  }
152
180
 
153
181
 
@@ -192,6 +220,7 @@ contract ComponentService is
192
220
  // TODO re-enable once role granting is stable and fixed
193
221
  // restricted()
194
222
  {
223
+ _checkNftType(productNftId, PRODUCT());
195
224
  _changeTargetBalance(INCREASE, instanceStore, productNftId, AmountLib.zero(), feeAmount);
196
225
  }
197
226
 
@@ -202,23 +231,43 @@ contract ComponentService is
202
231
  // TODO re-enable once role granting is stable and fixed
203
232
  // restricted()
204
233
  {
234
+ _checkNftType(productNftId, PRODUCT());
205
235
  _changeTargetBalance(DECREASE, instanceStore, productNftId, AmountLib.zero(), feeAmount);
206
236
  }
207
237
 
208
238
  //-------- distribution -------------------------------------------------//
209
239
 
210
240
  /// @dev registers the sending component as a distribution component
211
- function registerDistribution()
212
- external
241
+ function _registerDistribution(address distributioAddress)
242
+ internal
213
243
  virtual
244
+ returns (NftId distributionNftId)
214
245
  {
215
- address contractAddress = msg.sender;
216
-
217
246
  // register/create component info
218
- _register(
219
- contractAddress,
220
- DISTRIBUTION(),
221
- DISTRIBUTION_OWNER_ROLE());
247
+ InstanceReader instanceReader;
248
+ InstanceAdmin instanceAdmin;
249
+ InstanceStore instanceStore;
250
+ NftId productNftId;
251
+ (instanceReader, instanceAdmin, instanceStore, productNftId, distributionNftId) = _register(
252
+ distributioAddress,
253
+ DISTRIBUTION());
254
+
255
+ // check product is still expecting a distribution registration
256
+ IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
257
+ if (!productInfo.hasDistribution) {
258
+ revert ErrorProductServiceNoDistributionExpected(productNftId);
259
+ }
260
+ if (productInfo.distributionNftId.gtz()) {
261
+ revert ErrorProductServiceDistributionAlreadyRegistered(productNftId, productInfo.distributionNftId);
262
+ }
263
+
264
+ // set distribution in product info
265
+ productInfo.distributionNftId = distributionNftId;
266
+ instanceStore.updateProduct(productNftId, productInfo, KEEP_STATE());
267
+
268
+ // authorize
269
+ instanceAdmin.initializeComponentAuthorization(
270
+ IInstanceLinkedComponent(distributioAddress));
222
271
  }
223
272
 
224
273
 
@@ -265,6 +314,7 @@ contract ComponentService is
265
314
  // TODO re-enable once role granting is stable and fixed
266
315
  // restricted()
267
316
  {
317
+ _checkNftType(distributionNftId, DISTRIBUTION());
268
318
  _changeTargetBalance(INCREASE, instanceStore, distributionNftId, amount, feeAmount);
269
319
  }
270
320
 
@@ -280,6 +330,7 @@ contract ComponentService is
280
330
  // TODO re-enable once role granting is stable and fixed
281
331
  // restricted()
282
332
  {
333
+ _checkNftType(distributionNftId, DISTRIBUTION());
283
334
  _changeTargetBalance(DECREASE, instanceStore, distributionNftId, amount, feeAmount);
284
335
  }
285
336
 
@@ -296,6 +347,7 @@ contract ComponentService is
296
347
  // TODO re-enable once role granting is stable and fixed
297
348
  // restricted()
298
349
  {
350
+ _checkNftType(distributorNftId, DISTRIBUTOR());
299
351
  _changeTargetBalance(INCREASE, instanceStore, distributorNftId, amount, feeAmount);
300
352
  }
301
353
 
@@ -310,51 +362,81 @@ contract ComponentService is
310
362
  // TODO re-enable once role granting is stable and fixed
311
363
  // restricted()
312
364
  {
365
+ _checkNftType(distributorNftId, DISTRIBUTOR());
313
366
  _changeTargetBalance(DECREASE, instanceStore, distributorNftId, amount, feeAmount);
314
367
  }
315
368
 
316
369
  //-------- oracle -------------------------------------------------------//
317
370
 
318
- function registerOracle()
319
- external
371
+ function _registerOracle(address oracleAddress)
372
+ internal
320
373
  virtual
374
+ returns (NftId oracleNftId)
321
375
  {
322
- address contractAddress = msg.sender;
323
-
324
376
  // register/create component setup
325
- (
326
- , // instance reader
327
- InstanceStore instanceStore,
328
- NftId componentNftId
329
- ) = _register(
330
- contractAddress,
331
- ORACLE(),
332
- ORACLE_OWNER_ROLE());
377
+ InstanceReader instanceReader;
378
+ InstanceAdmin instanceAdmin;
379
+ InstanceStore instanceStore;
380
+ NftId productNftId;
381
+
382
+ (instanceReader, instanceAdmin, instanceStore, productNftId, oracleNftId) =_register(
383
+ oracleAddress,
384
+ ORACLE());
385
+
386
+ // check product is still expecting an oracle registration
387
+ IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
388
+ if (productInfo.expectedNumberOfOracles == 0) {
389
+ revert ErrorProductServiceNoOraclesExpected(productNftId);
390
+ }
391
+ if (productInfo.numberOfOracles == productInfo.expectedNumberOfOracles) {
392
+ revert ErrorProductServiceOraclesAlreadyRegistered(productNftId, productInfo.expectedNumberOfOracles);
393
+ }
394
+
395
+ // update/add oracle to product info
396
+ productInfo.oracleNftId[productInfo.numberOfOracles] = oracleNftId;
397
+ productInfo.numberOfOracles++;
398
+ instanceStore.updateProduct(productNftId, productInfo, KEEP_STATE());
399
+
400
+ // authorize
401
+ instanceAdmin.initializeComponentAuthorization(
402
+ IInstanceLinkedComponent(oracleAddress));
333
403
  }
334
404
 
335
405
  //-------- pool ---------------------------------------------------------//
336
406
 
337
- function registerPool()
338
- external
407
+ function _registerPool(address poolAddress)
408
+ internal
339
409
  virtual
410
+ returns (NftId poolNftId)
340
411
  {
341
- address contractAddress = msg.sender;
342
-
343
412
  // register/create component setup
344
- (
345
- , // instance reader
346
- InstanceStore instanceStore,
347
- NftId componentNftId
348
- ) = _register(
349
- contractAddress,
350
- POOL(),
351
- POOL_OWNER_ROLE());
413
+ InstanceReader instanceReader;
414
+ InstanceAdmin instanceAdmin;
415
+ InstanceStore instanceStore;
416
+ NftId productNftId;
417
+
418
+ (instanceReader, instanceAdmin, instanceStore, productNftId, poolNftId) =_register(
419
+ poolAddress,
420
+ POOL());
421
+
422
+ // check product is still expecting a pool registration
423
+ IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
424
+ if (productInfo.poolNftId.gtz()) {
425
+ revert ErrorProductServicePoolAlreadyRegistered(productNftId, productInfo.poolNftId);
426
+ }
352
427
 
353
428
  // create info
429
+ IPoolComponent pool = IPoolComponent(poolAddress);
354
430
  instanceStore.createPool(
355
- componentNftId,
356
- IPoolComponent(
357
- contractAddress).getInitialPoolInfo());
431
+ poolNftId,
432
+ pool.getInitialPoolInfo());
433
+
434
+ // update pool in product info
435
+ productInfo.poolNftId = poolNftId;
436
+ instanceStore.updateProduct(productNftId, productInfo, KEEP_STATE());
437
+
438
+ // authorize
439
+ instanceAdmin.initializeComponentAuthorization(pool);
358
440
  }
359
441
 
360
442
 
@@ -409,6 +491,7 @@ contract ComponentService is
409
491
  // TODO re-enable once role granting is stable and fixed
410
492
  // restricted()
411
493
  {
494
+ _checkNftType(poolNftId, POOL());
412
495
  _changeTargetBalance(INCREASE, instanceStore, poolNftId, amount, feeAmount);
413
496
  }
414
497
 
@@ -423,6 +506,7 @@ contract ComponentService is
423
506
  // TODO re-enable once role granting is stable and fixed
424
507
  // restricted()
425
508
  {
509
+ _checkNftType(poolNftId, POOL());
426
510
  _changeTargetBalance(DECREASE, instanceStore, poolNftId, amount, feeAmount);
427
511
  }
428
512
 
@@ -439,6 +523,7 @@ contract ComponentService is
439
523
  // TODO re-enable once role granting is stable and fixed
440
524
  // restricted()
441
525
  {
526
+ _checkNftType(bundleNftId, BUNDLE());
442
527
  _changeTargetBalance(INCREASE, instanceStore, bundleNftId, amount, feeAmount);
443
528
  }
444
529
 
@@ -453,6 +538,7 @@ contract ComponentService is
453
538
  // TODO re-enable once role granting is stable and fixed
454
539
  // restricted()
455
540
  {
541
+ _checkNftType(bundleNftId, BUNDLE());
456
542
  _changeTargetBalance(DECREASE, instanceStore, bundleNftId, amount, feeAmount);
457
543
  }
458
544
 
@@ -480,76 +566,67 @@ contract ComponentService is
480
566
  }
481
567
  }
482
568
 
483
- /// @dev registers the component represented by the provided address
569
+ /// @dev Registers the component represented by the provided address.
484
570
  function _register(
485
571
  address componentAddress, // address of component to register
486
- ObjectType requiredType, // required type for component for registration
487
- RoleId requiredRole // role required for comonent owner for registration
572
+ ObjectType requiredType // required type for component for registration
488
573
  )
489
574
  internal
490
575
  virtual
491
576
  returns (
492
577
  InstanceReader instanceReader,
578
+ InstanceAdmin instanceAdmin,
493
579
  InstanceStore instanceStore,
580
+ NftId parentNftId,
494
581
  NftId componentNftId
495
582
  )
496
583
  {
584
+ NftId instanceNftId;
585
+ IInstance instance;
586
+ IInstanceLinkedComponent component;
587
+ address initialOwner;
588
+
497
589
  (
498
- IInstance instance,
499
- IInstanceLinkedComponent component,
500
- address owner
590
+ instanceNftId,
591
+ instance,
592
+ parentNftId,
593
+ component,
594
+ initialOwner
501
595
  ) = _getAndVerifyRegisterableComponent(
596
+ getRegistry(),
502
597
  componentAddress,
503
- requiredType,
504
- requiredRole);
598
+ requiredType);
505
599
 
506
- // register component with registry
507
- componentNftId = _registryService.registerComponent(
508
- component,
509
- requiredType,
510
- owner).nftId;
511
-
512
- component.linkToRegisteredNftId();
513
-
514
- // save amended component info with instance
600
+ // get instance supporting contracts (as function return values)
515
601
  instanceReader = instance.getInstanceReader();
602
+ instanceAdmin = instance.getInstanceAdmin();
516
603
  instanceStore = instance.getInstanceStore();
517
604
 
605
+ // register with registry
606
+ if (requiredType == PRODUCT()) {
607
+ componentNftId = _registryService.registerProduct(
608
+ component, initialOwner).nftId;
609
+ } else {
610
+ componentNftId = _registryService.registerProductLinkedComponent(
611
+ component, requiredType, initialOwner).nftId;
612
+ }
613
+
614
+ // deploy and wire token handler
518
615
  IComponents.ComponentInfo memory componentInfo = component.getInitialComponentInfo();
616
+ IERC20Metadata token = componentInfo.token;
519
617
  componentInfo.tokenHandler = TokenHandlerDeployerLib.deployTokenHandler(
520
- address(componentInfo.token),
521
- address(instance.getInstanceAdmin().authority()));
618
+ address(token),
619
+ address(instanceAdmin.authority()));
522
620
 
621
+ // register component with instance
523
622
  instanceStore.createComponent(
524
- component.getNftId(),
623
+ componentNftId,
525
624
  componentInfo);
526
625
 
527
- // setup initial component authorization
528
- _instanceService.initializeAuthorization(
529
- instance.getNftId(),
530
- component);
626
+ // link component contract to nft id
627
+ component.linkToRegisteredNftId();
531
628
 
532
- // TODO add logging
533
- }
534
-
535
-
536
- /// @dev link the component info corresponding to the componentNftId to the provided productNftId
537
- function _linkToProduct(
538
- InstanceReader instanceReader,
539
- InstanceStore instanceStore,
540
- NftId componentNftId,
541
- NftId productNftId
542
- )
543
- internal
544
- {
545
- // only link components that are registered
546
- if(componentNftId.eqz()) {
547
- return;
548
- }
549
-
550
- IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(componentNftId);
551
- componentInfo.productNftId = productNftId;
552
- instanceStore.updateComponent(componentNftId, componentInfo, KEEP_STATE());
629
+ emit LogComponentServiceRegistered(instanceNftId, componentNftId, requiredType, address(component), address(token), initialOwner);
553
630
  }
554
631
 
555
632
 
@@ -568,12 +645,6 @@ contract ComponentService is
568
645
  }
569
646
 
570
647
 
571
- function _createSelectors(bytes4 selector) internal pure returns (bytes4[] memory selectors) {
572
- selectors = new bytes4[](1);
573
- selectors[0] = selector;
574
- }
575
-
576
-
577
648
  function _getLinkedProductInfo(
578
649
  InstanceReader instanceReader,
579
650
  NftId componentNftId
@@ -585,37 +656,45 @@ contract ComponentService is
585
656
  IComponents.ProductInfo memory info
586
657
  )
587
658
  {
588
- productNftId = instanceReader.getComponentInfo(componentNftId).productNftId;
659
+ productNftId = _getProductNftId(componentNftId);
589
660
  info = instanceReader.getProductInfo(productNftId);
590
661
  }
591
662
 
592
663
 
593
- /// @dev based on the provided component address required type and role returns the component and related instance contract
594
- /// the function reverts iff:
595
- /// - the component has already been registered
664
+ /// @dev Based on the provided component address required type the component
665
+ /// and related instance contract this function reverts iff:
666
+ /// - the sender is not registered
596
667
  /// - the component contract does not support IInstanceLinkedComponent
597
668
  /// - the component type does not match with the required type
598
- /// - the initial component owner misses the required role (with the instance access manager)
669
+ /// - the component has already been registered
599
670
  function _getAndVerifyRegisterableComponent(
671
+ IRegistry registry,
600
672
  address componentAddress,
601
- ObjectType requiredType,
602
- RoleId requiredRole
673
+ ObjectType requiredType
603
674
  )
604
675
  internal
605
676
  view
606
677
  returns (
678
+ NftId instanceNftId,
607
679
  IInstance instance,
680
+ NftId parentNftId,
608
681
  IInstanceLinkedComponent component,
609
- address owner
682
+ address initialOwner
610
683
  )
611
684
  {
612
- // check this is a component
613
- component = IInstanceLinkedComponent(componentAddress);
614
- if(!component.supportsInterface(type(IInstanceLinkedComponent).interfaceId)) {
615
- revert ErrorComponentServiceNotComponent(componentAddress);
685
+ // check sender (instance or product) is registered
686
+ IRegistry.ObjectInfo memory senderInfo = registry.getObjectInfo(msg.sender);
687
+ if (senderInfo.nftId.eqz()) {
688
+ revert ErrorComponentServiceSenderNotRegistered(msg.sender);
616
689
  }
617
690
 
691
+ // the sender is the parent of the component to be registered
692
+ // an instance caller wanting to register a product - or -
693
+ // a product caller wantint go register a distribution, oracle or pool
694
+ parentNftId = senderInfo.nftId;
695
+
618
696
  // check component is of required type
697
+ component = IInstanceLinkedComponent(componentAddress);
619
698
  IRegistry.ObjectInfo memory info = component.getInitialInfo();
620
699
  if(info.objectType != requiredType) {
621
700
  revert ErrorComponentServiceInvalidType(componentAddress, requiredType, info.objectType);
@@ -626,15 +705,40 @@ contract ComponentService is
626
705
  revert ErrorComponentServiceAlreadyRegistered(componentAddress);
627
706
  }
628
707
 
629
- // check instance has assigned required role to inital owner
630
- instance = _getInstance(info.parentNftId);
631
- owner = info.initialOwner;
708
+ // check release matches
709
+ address parentAddress = registry.getObjectAddress(parentNftId);
710
+ if (component.getRelease() != IRegisterable(parentAddress).getRelease()) {
711
+ revert ErrorComponentServiceReleaseMismatch(componentAddress, component.getRelease(), IRegisterable(parentAddress).getRelease());
712
+ }
632
713
 
633
- if(!instance.getInstanceAdmin().hasRole(owner, requiredRole)) {
634
- revert ErrorComponentServiceExpectedRoleMissing(info.parentNftId, requiredRole, owner);
714
+ // check component belongs to same product cluster
715
+ // parent of product must be instance, parent of other componet types must be product
716
+ if (info.parentNftId != senderInfo.nftId) {
717
+ revert ErrorComponentServiceSenderNotComponentParent(senderInfo.nftId, info.parentNftId);
635
718
  }
719
+
720
+ // verify parent is registered instance
721
+ if (requiredType == PRODUCT()) {
722
+ if (senderInfo.objectType != INSTANCE()) {
723
+ revert ErrorComponentServiceParentNotInstance(senderInfo.nftId, senderInfo.objectType);
724
+ }
725
+
726
+ instanceNftId = senderInfo.nftId;
727
+ // verify parent is registered product
728
+ } else {
729
+ if (senderInfo.objectType != PRODUCT()) {
730
+ revert ErrorComponentServiceParentNotProduct(senderInfo.nftId, senderInfo.objectType);
731
+ }
732
+
733
+ instanceNftId = senderInfo.parentNftId;
734
+ }
735
+
736
+ // get initial owner and instance
737
+ initialOwner = info.initialOwner;
738
+ instance = _getInstance(registry, instanceNftId);
636
739
  }
637
740
 
741
+
638
742
  function _getDomain() internal pure virtual override returns(ObjectType) {
639
743
  return COMPONENT();
640
744
  }
@@ -12,7 +12,6 @@ import {Service} from "../shared/Service.sol";
12
12
  abstract contract ComponentVerifyingService is
13
13
  Service
14
14
  {
15
-
16
15
  error ErrorComponentVerifyingServiceComponentTypeInvalid(NftId componentNftId, ObjectType expectedType, ObjectType actualType);
17
16
  error ErrorComponentVerifyingServiceComponentIsLocked(NftId componentNftId);
18
17
 
@@ -83,7 +82,7 @@ abstract contract ComponentVerifyingService is
83
82
  }
84
83
  }
85
84
 
86
- instance = _getInstance(info.parentNftId);
85
+ instance = _getInstanceForComponent(registry, info);
87
86
 
88
87
  // ensure component is not locked
89
88
  if (onlyActive) {
@@ -94,24 +93,34 @@ abstract contract ComponentVerifyingService is
94
93
  }
95
94
 
96
95
 
97
- /// @dev returns the linked product nft id for the specified component
98
- function _getProductNftId(
99
- InstanceReader instanceReader,
100
- NftId componentNftId
101
- )
96
+ function _getInstanceForComponent(IRegistry registry, IRegistry.ObjectInfo memory componentInfo)
102
97
  internal
103
- virtual
104
98
  view
105
- returns (NftId productNftId)
99
+ returns (IInstance instance)
106
100
  {
107
- return instanceReader.getComponentInfo(componentNftId).productNftId;
101
+ // parent of product is instance
102
+ if (componentInfo.objectType == PRODUCT()) {
103
+ instance = _getInstance(registry, componentInfo.parentNftId);
104
+ // parent of other types is product
105
+ } else {
106
+ instance = _getInstance(
107
+ registry,
108
+ registry.getObjectInfo(
109
+ componentInfo.parentNftId).parentNftId);
110
+ }
111
+ }
112
+
113
+
114
+ /// @dev returns the product nft id from the registry.
115
+ /// assumes the component nft id is valid and represents a product linked component.
116
+ function _getProductNftId(NftId componentNftId) internal view returns (NftId productNftId) {
117
+ productNftId = getRegistry().getObjectInfo(componentNftId).parentNftId;
108
118
  }
109
119
 
110
120
 
111
121
  /// @dev returns an IInstance contract reference for the specified instance nft id
112
- function _getInstance(NftId instanceNftId) internal view returns (IInstance) {
122
+ function _getInstance(IRegistry registry, NftId instanceNftId) internal view returns (IInstance) {
113
123
  return IInstance(
114
- getRegistry().getObjectInfo(
115
- instanceNftId).objectAddress);
124
+ registry.getObjectAddress(instanceNftId));
116
125
  }
117
126
  }
@@ -17,17 +17,21 @@ interface IComponent is
17
17
  IRegisterable,
18
18
  ITransferInterceptor
19
19
  {
20
+ error ErrorComponentProductNftIdZero();
21
+ error ErrorComponentProductNftIdNonzero();
22
+ error ErrorComponentNameLengthZero();
23
+
20
24
  error ErrorComponentNotChainNft(address caller);
21
25
 
26
+ error ErrorComponentTokenAddressNonzero();
22
27
  error ErrorComponentTokenAddressZero();
23
- error ErrorComponentNameLengthZero();
24
28
  error ErrorComponentWalletAddressZero();
25
29
  error ErrorComponentWalletAddressIsSameAsCurrent();
26
30
  error ErrorComponentWalletNotComponent();
27
31
 
28
32
  event LogComponentWalletAddressChanged(address oldWallet, address newWallet);
29
33
  event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
30
- event LogComponentTokenHandlerApproved(address token, Amount limit);
34
+ event LogComponentTokenHandlerApproved(address token, Amount limit, bool isMaxAmount);
31
35
 
32
36
  /// @dev approves token hanlder to spend up to the specified amount of tokens
33
37
  /// reverts if component wallet is not component itself