@etherisc/gif-next 0.0.2-ac2f4a6-957 → 0.0.2-ac4bee9-682

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 (303) hide show
  1. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +2 -2
  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/IAccess.sol/IAccess.dbg.json +1 -1
  6. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  7. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  8. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  9. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +1 -1
  10. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  11. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  12. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +32 -110
  13. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  14. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +2 -2
  15. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  16. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +8 -38
  17. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  18. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +110 -78
  19. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  20. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +78 -46
  21. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  22. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +11 -23
  23. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  24. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  25. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  26. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +38 -147
  27. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  28. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +49 -17
  29. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  30. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +92 -190
  31. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  32. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +2 -2
  33. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  34. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  35. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +43 -84
  36. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  37. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +33 -87
  38. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  39. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +155 -141
  40. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  41. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +391 -205
  42. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  43. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  44. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  45. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  46. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +2 -2
  47. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  48. package/artifacts/contracts/instance/Instance.sol/Instance.json +18 -2
  49. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  50. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +4 -4
  51. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  52. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +2 -2
  53. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  54. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +69 -74
  55. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  56. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +21 -5
  57. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  58. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +46 -22
  59. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  60. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +36 -46
  61. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  62. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  63. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  64. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  65. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  66. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  67. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  68. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  69. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  70. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  71. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  72. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  73. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  74. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  75. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +22 -100
  76. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  77. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +2 -2
  78. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  79. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  80. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +11 -23
  81. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  82. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  83. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +8 -38
  84. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  85. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +32 -16
  86. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  87. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +46 -22
  88. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  89. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +8 -53
  90. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  91. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +49 -17
  92. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  93. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +115 -111
  94. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  95. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +67 -51
  96. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  97. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +19 -15
  98. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  99. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +11 -62
  100. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  101. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +77 -75
  102. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  103. package/artifacts/contracts/pool/Pool.sol/Pool.json +8 -77
  104. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  105. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +139 -129
  106. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  107. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +53 -33
  108. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  109. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +20 -4
  110. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  111. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +43 -19
  112. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  113. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +13 -38
  114. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  115. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +2 -2
  116. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  117. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +74 -66
  118. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  119. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +67 -47
  120. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  121. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  122. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  123. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +7 -1
  124. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  125. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  126. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +16 -23
  127. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  128. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  129. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +71 -57
  130. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  131. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +55 -35
  132. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  133. package/artifacts/contracts/product/PricingService.sol/PricingService.json +54 -38
  134. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  135. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +56 -32
  136. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  137. package/artifacts/contracts/product/Product.sol/Product.json +13 -38
  138. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  139. package/artifacts/contracts/product/RiskService.sol/RiskService.json +18 -2
  140. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  141. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +40 -16
  142. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  143. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  144. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +24 -0
  145. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  146. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  147. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  148. package/artifacts/contracts/registry/Registry.sol/Registry.json +62 -38
  149. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  150. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +107 -94
  151. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  152. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +32 -16
  153. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  154. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +39 -15
  155. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  156. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  157. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +12 -12
  158. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  159. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
  160. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  161. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  162. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  163. package/artifacts/contracts/shared/Component.sol/Component.json +8 -38
  164. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  165. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +145 -70
  166. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  167. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +62 -42
  168. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  169. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  170. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +21 -2
  171. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  172. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +11 -23
  173. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  174. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +67 -0
  175. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  176. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +11 -23
  177. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  178. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  179. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  180. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  181. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  182. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  183. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  184. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  185. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  186. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +8 -38
  187. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  188. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  189. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  190. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  191. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  192. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  193. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  194. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  195. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
  196. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  197. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  198. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  199. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  200. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +388 -35
  201. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +4 -0
  202. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +395 -0
  203. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  204. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +88 -24
  205. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  206. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +29 -59
  207. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  208. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  209. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +2 -2
  210. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  211. package/artifacts/contracts/staking/Staking.sol/Staking.json +80 -152
  212. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  213. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  214. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +50 -46
  215. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  216. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
  217. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  218. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +36 -20
  219. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  220. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +43 -19
  221. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  222. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2 -2
  223. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  224. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +2 -2
  225. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  226. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  227. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  228. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  229. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  230. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  231. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  232. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  233. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  234. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  235. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  236. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  237. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  238. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  239. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  240. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  241. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  242. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  243. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  244. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  245. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  246. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  247. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  248. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  249. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  250. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  251. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  252. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  253. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +18 -2
  254. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  255. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  256. package/contracts/distribution/DistributionService.sol +5 -5
  257. package/contracts/examples/fire/FirePool.sol +19 -8
  258. package/contracts/examples/fire/FireProduct.sol +24 -11
  259. package/contracts/examples/unpermissioned/SimpleDistribution.sol +8 -0
  260. package/contracts/examples/unpermissioned/SimplePool.sol +34 -2
  261. package/contracts/examples/unpermissioned/SimpleProduct.sol +15 -21
  262. package/contracts/instance/IInstanceService.sol +2 -3
  263. package/contracts/instance/InstanceAdmin.sol +3 -3
  264. package/contracts/instance/InstanceReader.sol +1 -1
  265. package/contracts/instance/InstanceService.sol +15 -12
  266. package/contracts/instance/module/IComponents.sol +1 -2
  267. package/contracts/instance/module/IPolicy.sol +2 -1
  268. package/contracts/oracle/OracleService.sol +10 -9
  269. package/contracts/pool/BasicPool.sol +24 -3
  270. package/contracts/pool/BasicPoolAuthorization.sol +12 -1
  271. package/contracts/pool/BundleService.sol +14 -22
  272. package/contracts/pool/IBundleService.sol +2 -5
  273. package/contracts/pool/IPoolComponent.sol +1 -7
  274. package/contracts/pool/IPoolService.sol +23 -18
  275. package/contracts/pool/Pool.sol +112 -102
  276. package/contracts/pool/PoolService.sol +150 -74
  277. package/contracts/product/BasicProduct.sol +7 -11
  278. package/contracts/product/ClaimService.sol +3 -1
  279. package/contracts/product/IPolicyService.sol +3 -1
  280. package/contracts/product/PolicyService.sol +26 -14
  281. package/contracts/product/PricingService.sol +4 -1
  282. package/contracts/product/Product.sol +10 -33
  283. package/contracts/registry/IRegistry.sol +2 -0
  284. package/contracts/registry/Registry.sol +9 -1
  285. package/contracts/registry/RegistryAdmin.sol +22 -8
  286. package/contracts/registry/ReleaseRegistry.sol +2 -18
  287. package/contracts/registry/ServiceAuthorizationV3.sol +10 -1
  288. package/contracts/shared/Component.sol +45 -81
  289. package/contracts/shared/ComponentService.sol +62 -18
  290. package/contracts/shared/ComponentVerifyingService.sol +15 -13
  291. package/contracts/shared/ContractLib.sol +17 -1
  292. package/contracts/shared/IComponent.sol +5 -12
  293. package/contracts/shared/IComponentService.sol +13 -3
  294. package/contracts/shared/InstanceLinkedComponent.sol +1 -9
  295. package/contracts/shared/Registerable.sol +0 -2
  296. package/contracts/shared/RegistryLinked.sol +6 -12
  297. package/contracts/shared/TokenHandler.sol +324 -66
  298. package/contracts/shared/TokenHandlerDeployerLib.sol +10 -2
  299. package/contracts/staking/IStaking.sol +9 -4
  300. package/contracts/staking/Staking.sol +29 -21
  301. package/contracts/staking/StakingService.sol +68 -8
  302. package/contracts/type/RiskId.sol +1 -1
  303. package/package.json +3 -3
@@ -9,8 +9,9 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
9
9
  import {Amount, AmountLib} from "../type/Amount.sol";
10
10
  import {IComponent} from "./IComponent.sol";
11
11
  import {IComponents} from "../instance/module/IComponents.sol";
12
+ import {IComponentService} from "./IComponentService.sol";
12
13
  import {NftId, NftIdLib} from "../type/NftId.sol";
13
- import {ObjectType, PRODUCT} from "../type/ObjectType.sol";
14
+ import {ObjectType, COMPONENT} from "../type/ObjectType.sol";
14
15
  import {Registerable} from "../shared/Registerable.sol";
15
16
  import {TokenHandler} from "../shared/TokenHandler.sol";
16
17
  import {VersionPartLib} from "../type/Version.sol";
@@ -26,9 +27,9 @@ abstract contract Component is
26
27
  struct ComponentStorage {
27
28
  string _name; // unique (per instance) component name
28
29
  IERC20Metadata _token; // token for this component
29
- address _wallet;
30
30
  bool _isInterceptor;
31
31
  bytes _data;
32
+ IComponentService _componentService;
32
33
  }
33
34
 
34
35
 
@@ -83,74 +84,43 @@ abstract contract Component is
83
84
  ComponentStorage storage $ = _getComponentStorage();
84
85
  $._name = name;
85
86
  $._token = IERC20Metadata(token);
86
- $._wallet = address(this);
87
87
  $._isInterceptor = isInterceptor;
88
88
  $._data = componentData;
89
+ $._componentService = IComponentService(_getServiceAddress(COMPONENT()));
89
90
 
90
91
  _registerInterface(type(IAccessManaged).interfaceId);
91
92
  _registerInterface(type(IComponent).interfaceId);
92
93
  }
93
94
 
94
95
 
95
- function approveTokenHandler(Amount spendingLimitAmount)
96
- external
97
- virtual
98
- onlyOwner
96
+ function approveTokenHandler(IERC20Metadata token, Amount amount)
97
+ public
98
+ onlyOwner()
99
99
  {
100
- approveTokenHandler(address(getToken()), spendingLimitAmount);
100
+ _approveTokenHandler(token, amount);
101
101
  }
102
102
 
103
- /// @dev Approves the component's token hander to spend tokens up to the specified limit.
104
- /// When the spending limit amount equals AmountLib.max it is set to type(uint256).max.
105
- function approveTokenHandler(address token, Amount spendingLimitAmount)
106
- public
107
- virtual
108
- onlyOwner
109
- {
110
- if(getWallet() != address(this)) {
111
- revert ErrorComponentWalletNotComponent();
112
- }
113
103
 
114
- uint256 spendingLimit = spendingLimitAmount.toInt();
115
- bool isMaxAmount = false;
116
- if (spendingLimitAmount == AmountLib.max()) {
117
- spendingLimit = type(uint256).max;
118
- isMaxAmount = true;
119
- }
104
+ // TODO cleanup
105
+ // /// @dev Approves the component's token hander to spend tokens up to the specified limit.
106
+ // /// When the spending limit amount equals AmountLib.max it is set to type(uint256).max.
107
+ // function approveTokenHandler(address token, Amount spendingLimitAmount)
108
+ // public
109
+ // virtual
110
+ // onlyOwner
111
+ // {
112
+ // _approveTokenHandler(token, spendingLimitAmount);
113
+ // }
120
114
 
121
- emit LogComponentTokenHandlerApproved(address(getTokenHandler()), spendingLimitAmount, isMaxAmount);
122
115
 
123
- IERC20Metadata(token).approve(
124
- address(getTokenHandler()),
125
- spendingLimit);
126
- }
127
-
128
- function setWallet(address newWallet)
129
- external
130
- virtual
131
- override
132
- onlyOwner
133
- {
134
- // checks
135
- address currentWallet = getWallet();
136
- uint256 currentBalance = getToken().balanceOf(currentWallet);
137
-
138
- // effects
139
- _setWallet(newWallet);
140
-
141
- // interactions
142
- if (currentBalance > 0) {
143
- // move tokens from old to new wallet
144
- emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
145
-
146
- if (currentWallet == address(this)) {
147
- // transfer from the component requires an allowance
148
- getTokenHandler().distributeTokens(currentWallet, newWallet, AmountLib.toAmount(currentBalance));
149
- } else {
150
- getTokenHandler().collectTokens(currentWallet, newWallet, AmountLib.toAmount(currentBalance));
151
- }
152
- }
153
- }
116
+ // function setWallet(address newWallet)
117
+ // external
118
+ // virtual
119
+ // override
120
+ // onlyOwner
121
+ // {
122
+ // _setWallet(newWallet);
123
+ // }
154
124
 
155
125
  /// @dev callback function for nft transfers
156
126
  /// may only be called by chain nft contract.
@@ -164,7 +134,7 @@ abstract contract Component is
164
134
 
165
135
 
166
136
  function getWallet() public view virtual returns (address walletAddress) {
167
- return getComponentInfo().wallet;
137
+ return getTokenHandler().getWallet();
168
138
  }
169
139
 
170
140
  function getTokenHandler() public virtual view returns (TokenHandler tokenHandler) {
@@ -208,12 +178,15 @@ abstract contract Component is
208
178
  }
209
179
 
210
180
 
211
- /// @dev internal function for nft transfers.
212
- /// handling logic that deals with nft transfers need to overwrite this function
213
- function _nftMint(address to, uint256 tokenId)
181
+ function _approveTokenHandler(IERC20Metadata token, Amount amount)
214
182
  internal
215
183
  virtual
216
- { }
184
+ {
185
+ _getComponentStorage()._componentService.approveTokenHandler(
186
+ token,
187
+ amount);
188
+ }
189
+
217
190
 
218
191
  /// @dev internal function for nft transfers.
219
192
  /// handling logic that deals with nft transfers need to overwrite this function
@@ -225,21 +198,13 @@ abstract contract Component is
225
198
 
226
199
  /// @dev depending on the source of the component information this function needs to be overwritten.
227
200
  /// eg for instance linked components that externally store this information with the instance store contract
228
- function _setWallet(address newWallet) internal virtual {
229
- ComponentStorage storage $ = _getComponentStorage();
230
- address currentWallet = $._wallet;
231
-
232
- if (newWallet == address(0)) {
233
- revert ErrorComponentWalletAddressZero();
234
- }
235
-
236
- if (newWallet == currentWallet) {
237
- revert ErrorComponentWalletAddressIsSameAsCurrent();
238
- }
239
-
240
- $._wallet = newWallet;
241
- emit LogComponentWalletAddressChanged(currentWallet, newWallet);
242
-
201
+ function _setWallet(
202
+ address newWallet
203
+ )
204
+ internal
205
+ virtual
206
+ {
207
+ _getComponentStorage()._componentService.setWallet(newWallet);
243
208
  }
244
209
 
245
210
 
@@ -252,14 +217,13 @@ abstract contract Component is
252
217
  name: $._name,
253
218
  token: $._token,
254
219
  tokenHandler: TokenHandler(address(0)),
255
- wallet: $._wallet, // initial wallet address
256
220
  data: $._data // user specific component data
257
221
  });
258
222
  }
259
223
 
260
- function _approveTokenHandler(uint256 amount) internal {
261
- ComponentStorage storage $ = _getComponentStorage();
262
- $._token.approve(address(getComponentInfo().tokenHandler), amount);
224
+ /// @dev returns the service address for the specified domain
225
+ /// gets address via lookup from registry using the major version form the linked instance
226
+ function _getServiceAddress(ObjectType domain) internal view returns (address) {
227
+ return getRegistry().getServiceAddress(domain, getRelease());
263
228
  }
264
-
265
229
  }
@@ -7,6 +7,7 @@ import {Amount, AmountLib} from "../type/Amount.sol";
7
7
  import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
8
8
  import {ContractLib} from "../shared/ContractLib.sol";
9
9
  import {Fee, FeeLib} from "../type/Fee.sol";
10
+ import {IComponent} from "../shared/IComponent.sol";
10
11
  import {IComponents} from "../instance/module/IComponents.sol";
11
12
  import {IComponentService} from "./IComponentService.sol";
12
13
  import {IInstance} from "../instance/IInstance.sol";
@@ -22,8 +23,9 @@ import {IRegistry} from "../registry/IRegistry.sol";
22
23
  import {IRegistryService} from "../registry/IRegistryService.sol";
23
24
  import {KEEP_STATE} from "../type/StateId.sol";
24
25
  import {NftId} from "../type/NftId.sol";
25
- import {ObjectType, REGISTRY, COMPONENT, DISTRIBUTION, INSTANCE, ORACLE, POOL, PRODUCT} from "../type/ObjectType.sol";
26
+ import {ObjectType, REGISTRY, BUNDLE, COMPONENT, DISTRIBUTION, DISTRIBUTOR, INSTANCE, ORACLE, POOL, PRODUCT, STAKING} from "../type/ObjectType.sol";
26
27
  import {RoleId} from "../type/RoleId.sol";
28
+ import {TokenHandler} from "../shared/TokenHandler.sol";
27
29
  import {TokenHandlerDeployerLib} from "../shared/TokenHandlerDeployerLib.sol";
28
30
 
29
31
  contract ComponentService is
@@ -90,27 +92,54 @@ contract ComponentService is
90
92
  revert ErrorComponentServiceTypeNotSupported(component, componentType);
91
93
  }
92
94
 
93
-
94
- function setWallet(address newWallet) external virtual {
95
+ function approveTokenHandler(
96
+ IERC20Metadata token,
97
+ Amount amount
98
+ )
99
+ external
100
+ virtual
101
+ {
102
+ // checks
95
103
  (NftId componentNftId,, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
96
- IComponents.ComponentInfo memory info = instance.getInstanceReader().getComponentInfo(componentNftId);
97
- address currentWallet = info.wallet;
104
+ TokenHandler tokenHandler = instance.getInstanceReader().getComponentInfo(
105
+ componentNftId).tokenHandler;
98
106
 
99
- if (newWallet == address(0)) {
100
- revert ErrorComponentServiceNewWalletAddressZero();
101
- }
107
+ // effects
108
+ tokenHandler.approve(token, amount);
109
+ }
102
110
 
103
- if (currentWallet == address(0)) {
104
- revert ErrorComponentServiceWalletAddressZero();
105
- }
106
111
 
107
- if (newWallet == currentWallet) {
108
- revert ErrorComponentServiceWalletAddressIsSameAsCurrent();
109
- }
112
+ function approveStakingTokenHandler(
113
+ IERC20Metadata token,
114
+ Amount amount
115
+ )
116
+ external
117
+ virtual
118
+ {
119
+ // checks
120
+ NftId stakingNftId = getRegistry().getNftIdForAddress(msg.sender);
121
+ (IRegistry.ObjectInfo memory objectInfo,) = _getAndVerifyComponentInfo(
122
+ stakingNftId,
123
+ STAKING(),
124
+ true);
125
+
126
+ // effects
127
+ TokenHandler tokenHandler = IComponent(msg.sender).getTokenHandler();
128
+ tokenHandler.approve(token, amount);
129
+ }
130
+
110
131
 
111
- info.wallet = newWallet;
112
- instance.getInstanceStore().updateComponent(componentNftId, info, KEEP_STATE());
113
- emit LogComponentServiceWalletAddressChanged(componentNftId, currentWallet, newWallet);
132
+ function setWallet(address newWallet)
133
+ external
134
+ virtual
135
+ {
136
+ // checks
137
+ (NftId componentNftId,, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
138
+ TokenHandler tokenHandler = instance.getInstanceReader().getComponentInfo(
139
+ componentNftId).tokenHandler;
140
+
141
+ // effects
142
+ tokenHandler.setWallet(newWallet);
114
143
  }
115
144
 
116
145
  // TODO implement
@@ -126,7 +155,7 @@ contract ComponentService is
126
155
  {
127
156
  (NftId componentNftId,, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
128
157
  IComponents.ComponentInfo memory info = instance.getInstanceReader().getComponentInfo(componentNftId);
129
- address componentWallet = info.wallet;
158
+ address componentWallet = info.tokenHandler.getWallet();
130
159
 
131
160
  // determine withdrawn amount
132
161
  withdrawnAmount = amount;
@@ -220,6 +249,7 @@ contract ComponentService is
220
249
  // TODO re-enable once role granting is stable and fixed
221
250
  // restricted()
222
251
  {
252
+ _checkNftType(productNftId, PRODUCT());
223
253
  _changeTargetBalance(INCREASE, instanceStore, productNftId, AmountLib.zero(), feeAmount);
224
254
  }
225
255
 
@@ -230,6 +260,7 @@ contract ComponentService is
230
260
  // TODO re-enable once role granting is stable and fixed
231
261
  // restricted()
232
262
  {
263
+ _checkNftType(productNftId, PRODUCT());
233
264
  _changeTargetBalance(DECREASE, instanceStore, productNftId, AmountLib.zero(), feeAmount);
234
265
  }
235
266
 
@@ -312,6 +343,7 @@ contract ComponentService is
312
343
  // TODO re-enable once role granting is stable and fixed
313
344
  // restricted()
314
345
  {
346
+ _checkNftType(distributionNftId, DISTRIBUTION());
315
347
  _changeTargetBalance(INCREASE, instanceStore, distributionNftId, amount, feeAmount);
316
348
  }
317
349
 
@@ -327,6 +359,7 @@ contract ComponentService is
327
359
  // TODO re-enable once role granting is stable and fixed
328
360
  // restricted()
329
361
  {
362
+ _checkNftType(distributionNftId, DISTRIBUTION());
330
363
  _changeTargetBalance(DECREASE, instanceStore, distributionNftId, amount, feeAmount);
331
364
  }
332
365
 
@@ -343,6 +376,7 @@ contract ComponentService is
343
376
  // TODO re-enable once role granting is stable and fixed
344
377
  // restricted()
345
378
  {
379
+ _checkNftType(distributorNftId, DISTRIBUTOR());
346
380
  _changeTargetBalance(INCREASE, instanceStore, distributorNftId, amount, feeAmount);
347
381
  }
348
382
 
@@ -357,6 +391,7 @@ contract ComponentService is
357
391
  // TODO re-enable once role granting is stable and fixed
358
392
  // restricted()
359
393
  {
394
+ _checkNftType(distributorNftId, DISTRIBUTOR());
360
395
  _changeTargetBalance(DECREASE, instanceStore, distributorNftId, amount, feeAmount);
361
396
  }
362
397
 
@@ -485,6 +520,7 @@ contract ComponentService is
485
520
  // TODO re-enable once role granting is stable and fixed
486
521
  // restricted()
487
522
  {
523
+ _checkNftType(poolNftId, POOL());
488
524
  _changeTargetBalance(INCREASE, instanceStore, poolNftId, amount, feeAmount);
489
525
  }
490
526
 
@@ -499,6 +535,7 @@ contract ComponentService is
499
535
  // TODO re-enable once role granting is stable and fixed
500
536
  // restricted()
501
537
  {
538
+ _checkNftType(poolNftId, POOL());
502
539
  _changeTargetBalance(DECREASE, instanceStore, poolNftId, amount, feeAmount);
503
540
  }
504
541
 
@@ -515,6 +552,7 @@ contract ComponentService is
515
552
  // TODO re-enable once role granting is stable and fixed
516
553
  // restricted()
517
554
  {
555
+ _checkNftType(bundleNftId, BUNDLE());
518
556
  _changeTargetBalance(INCREASE, instanceStore, bundleNftId, amount, feeAmount);
519
557
  }
520
558
 
@@ -529,6 +567,7 @@ contract ComponentService is
529
567
  // TODO re-enable once role granting is stable and fixed
530
568
  // restricted()
531
569
  {
570
+ _checkNftType(bundleNftId, BUNDLE());
532
571
  _changeTargetBalance(DECREASE, instanceStore, bundleNftId, amount, feeAmount);
533
572
  }
534
573
 
@@ -605,8 +644,13 @@ contract ComponentService is
605
644
  IComponents.ComponentInfo memory componentInfo = component.getInitialComponentInfo();
606
645
  IERC20Metadata token = componentInfo.token;
607
646
  componentInfo.tokenHandler = TokenHandlerDeployerLib.deployTokenHandler(
647
+ address(getRegistry()),
648
+ address(component), // initially, component is its own wallet
608
649
  address(token),
609
650
  address(instanceAdmin.authority()));
651
+
652
+ // set token handler allowance to max
653
+ // componentInfo.tokenHandler.approve(token, AmountLib.max());
610
654
 
611
655
  // register component with instance
612
656
  instanceStore.createComponent(
@@ -5,7 +5,7 @@ import {IInstance} from "../instance/IInstance.sol";
5
5
  import {InstanceReader} from "../instance/InstanceReader.sol";
6
6
  import {IRegistry} from "../registry/IRegistry.sol";
7
7
  import {NftId} from "../type/NftId.sol";
8
- import {ObjectType, COMPONENT, DISTRIBUTION, ORACLE, POOL, PRODUCT} from "../type/ObjectType.sol";
8
+ import {ObjectType, COMPONENT, DISTRIBUTION, ORACLE, POOL, PRODUCT, STAKING} from "../type/ObjectType.sol";
9
9
  import {Service} from "../shared/Service.sol";
10
10
 
11
11
 
@@ -27,12 +27,12 @@ abstract contract ComponentVerifyingService is
27
27
  view
28
28
  returns(
29
29
  NftId componentNftId,
30
- IRegistry.ObjectInfo memory componentInfo,
30
+ IRegistry.ObjectInfo memory objectInfo,
31
31
  IInstance instance
32
32
  )
33
33
  {
34
34
  componentNftId = getRegistry().getNftIdForAddress(msg.sender);
35
- (componentInfo, instance) = _getAndVerifyComponentInfo(
35
+ (objectInfo, instance) = _getAndVerifyComponentInfo(
36
36
  componentNftId,
37
37
  expectedType,
38
38
  true); // only active
@@ -82,7 +82,15 @@ abstract contract ComponentVerifyingService is
82
82
  }
83
83
  }
84
84
 
85
- instance = _getInstanceForComponent(registry, info);
85
+ if (info.objectType == STAKING()) {
86
+ return (info, instance);
87
+ }
88
+
89
+ if (info.objectType == PRODUCT()) {
90
+ instance = _getInstance(registry, info.parentNftId);
91
+ } else {
92
+ instance = _getInstanceForComponent(registry, info.parentNftId);
93
+ }
86
94
 
87
95
  // ensure component is not locked
88
96
  if (onlyActive) {
@@ -93,21 +101,15 @@ abstract contract ComponentVerifyingService is
93
101
  }
94
102
 
95
103
 
96
- function _getInstanceForComponent(IRegistry registry, IRegistry.ObjectInfo memory componentInfo)
104
+ function _getInstanceForComponent(IRegistry registry, NftId productNftId)
97
105
  internal
98
106
  view
99
107
  returns (IInstance instance)
100
108
  {
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(
109
+ return _getInstance(
107
110
  registry,
108
111
  registry.getObjectInfo(
109
- componentInfo.parentNftId).parentNftId);
110
- }
112
+ productNftId).parentNftId);
111
113
  }
112
114
 
113
115
 
@@ -5,6 +5,7 @@ import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165C
5
5
  import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
6
6
 
7
7
  import {IPolicyHolder} from "./IPolicyHolder.sol";
8
+ import {IRegistry} from "../registry/IRegistry.sol";
8
9
 
9
10
  library ContractLib {
10
11
 
@@ -12,6 +13,7 @@ library ContractLib {
12
13
  return ERC165Checker.supportsInterface(target, type(IPolicyHolder).interfaceId);
13
14
  }
14
15
 
16
+
15
17
  function isAccessManaged(address target) external view returns (bool) {
16
18
  if (!isContract(target)) {
17
19
  return false;
@@ -24,7 +26,21 @@ library ContractLib {
24
26
  return success;
25
27
  }
26
28
 
29
+
30
+ function isRegistry(address registry) public view returns (bool) {
31
+ if (!isContract(registry)) {
32
+ return false;
33
+ }
34
+
35
+ return supportsInterface(registry, type(IRegistry).interfaceId);
36
+ }
37
+
38
+
27
39
  function isContract(address target) public view returns (bool) {
40
+ if (target == address(0)) {
41
+ return false;
42
+ }
43
+
28
44
  uint256 size;
29
45
  assembly {
30
46
  size := extcodesize(target)
@@ -32,7 +48,7 @@ library ContractLib {
32
48
  return size > 0;
33
49
  }
34
50
 
35
- function supportsInterface(address target, bytes4 interfaceId) external view returns (bool) {
51
+ function supportsInterface(address target, bytes4 interfaceId) public view returns (bool) {
36
52
  return ERC165Checker.supportsInterface(target, interfaceId);
37
53
  }
38
54
  }
@@ -31,19 +31,12 @@ interface IComponent is
31
31
 
32
32
  event LogComponentWalletAddressChanged(address oldWallet, address newWallet);
33
33
  event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
34
- event LogComponentTokenHandlerApproved(address token, Amount limit, bool isMaxAmount);
34
+ event LogComponentTokenHandlerApproved(address tokenHandler, address token, Amount limit, bool isMaxAmount);
35
35
 
36
- /// @dev approves token hanlder to spend up to the specified amount of tokens
37
- /// reverts if component wallet is not component itself
38
- /// only component owner (nft holder) is authorizes to call this function
39
- function approveTokenHandler(Amount spendingLimitAmount) external;
40
-
41
- /// @dev sets the wallet address for the component.
42
- /// if the current wallet has tokens, these will be transferred.
43
- /// if the new wallet address is externally owned, an approval from the
44
- /// owner of the external wallet to the tokenhandler of the component that
45
- /// covers the current component balance must exist
46
- function setWallet(address walletAddress) external;
36
+ /// @dev Approves token hanlder to spend up to the specified amount of tokens.
37
+ /// Reverts if component wallet is not token handler itself.
38
+ /// Only component owner (nft holder) is authorizes to call this function.
39
+ function approveTokenHandler(IERC20Metadata token, Amount spendingLimitAmount) external;
47
40
 
48
41
  /// @dev returns the name of this component
49
42
  /// to successfully register the component with an instance the name MUST be unique in the linked instance
@@ -1,6 +1,7 @@
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";
4
5
 
5
6
  import {Amount} from "../type/Amount.sol";
6
7
  import {Fee} from "../type/Fee.sol";
@@ -43,6 +44,7 @@ interface IComponentService is
43
44
 
44
45
  event LogComponentServiceRegistered(NftId instanceNftId, NftId componentNftId, ObjectType componentType, address component, address token, address initialOwner);
45
46
  event LogComponentServiceWalletAddressChanged(NftId componentNftId, address currentWallet, address newWallet);
47
+ event LogComponentServiceWalletTokensTransferred(NftId componentNftId, address currentWallet, address newWallet, uint256 currentBalance);
46
48
  event LogComponentServiceComponentFeesWithdrawn(NftId componentNftId, address recipient, address token, Amount withdrawnAmount);
47
49
  event LogComponentServiceProductFeesUpdated(NftId productNftId);
48
50
  event LogComponentServiceDistributionFeesUpdated(NftId distributionNftId);
@@ -58,13 +60,21 @@ interface IComponentService is
58
60
 
59
61
  //-------- component ----------------------------------------------------//
60
62
 
61
- /// @dev sets the components associated wallet address
63
+ /// @dev Approves the callers token handler to spend up to the specified amount of tokens.
64
+ /// Reverts if the component's token handler wallet is not the token handler itself.
65
+ function approveTokenHandler(IERC20Metadata token, Amount amount) external;
66
+
67
+ /// @dev Approves the staking token handler.
68
+ /// Reverts if the staking token handler wallet is not the token handler itself.
69
+ function approveStakingTokenHandler(IERC20Metadata token, Amount amount) external;
70
+
71
+ /// @dev Sets the components associated wallet address
62
72
  function setWallet(address newWallet) external;
63
73
 
64
- /// @dev locks the component associated with the caller
74
+ /// @dev Locks the component associated with the caller
65
75
  function lock() external;
66
76
 
67
- /// @dev unlocks the component associated with the caller
77
+ /// @dev Unlocks the component associated with the caller
68
78
  function unlock() external;
69
79
 
70
80
  /// @dev Withdraw fees from the distribution component. Only component owner is allowed to withdraw fees.
@@ -181,7 +181,7 @@ abstract contract InstanceLinkedComponent is
181
181
  info = _getInstanceReader().getComponentInfo(getNftId());
182
182
 
183
183
  // check if also registered with instance
184
- if (info.wallet != address(0)) {
184
+ if (address(info.tokenHandler) != address(0)) {
185
185
  return info;
186
186
  }
187
187
  }
@@ -202,12 +202,4 @@ abstract contract InstanceLinkedComponent is
202
202
  {
203
203
  return _getInstanceLinkedComponentStorage()._componentService.withdrawFees(amount);
204
204
  }
205
-
206
-
207
- /// @dev returns the service address for the specified domain
208
- /// gets address via lookup from registry using the major version form the linked instance
209
- function _getServiceAddress(ObjectType domain) internal view returns (address service) {
210
- VersionPart release = _getInstanceLinkedComponentStorage()._instance.getRelease();
211
- return getRegistry().getServiceAddress(domain, release);
212
- }
213
205
  }
@@ -1,8 +1,6 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5
-
6
4
  import {NftId, NftIdLib} from "../type/NftId.sol";
7
5
  import {NftOwnable} from "../shared/NftOwnable.sol";
8
6
  import {ObjectType} from "../type/ObjectType.sol";
@@ -2,6 +2,8 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5
+
6
+ import {ContractLib} from "../shared/ContractLib.sol";
5
7
  import {IRegistry} from "../registry/IRegistry.sol";
6
8
  import {IRegistryLinked} from "./IRegistryLinked.sol";
7
9
 
@@ -16,25 +18,17 @@ contract RegistryLinked is
16
18
  /// @dev initialization for upgradable contracts
17
19
  // used in _initializeRegisterable
18
20
  function _initializeRegistryLinked(
19
- address registryAddress
21
+ address registry
20
22
  )
21
23
  internal
22
24
  virtual
23
25
  onlyInitializing()
24
26
  {
25
- if (registryAddress.code.length == 0) {
26
- revert ErrorNotRegistry(registryAddress);
27
+ if (!ContractLib.isRegistry(registry)) {
28
+ revert ErrorNotRegistry(registry);
27
29
  }
28
30
 
29
- _registry = IRegistry(registryAddress);
30
-
31
- try _registry.supportsInterface(type(IRegistry).interfaceId) returns (bool isRegistry) {
32
- if (!isRegistry) {
33
- revert ErrorNotRegistry(registryAddress);
34
- }
35
- } catch {
36
- revert ErrorNotRegistry(registryAddress);
37
- }
31
+ _registry = IRegistry(registry);
38
32
  }
39
33
 
40
34