@etherisc/gif-next 0.0.2-fe88ad7-208 → 0.0.2-ff8087d-237

Sign up to get free protection for your applications and to get access to all the features.
Files changed (378) hide show
  1. package/README.md +8 -13
  2. package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
  3. package/artifacts/contracts/components/Component.sol/Component.json +873 -0
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +903 -202
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
  7. package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → IComponent.sol/IComponent.json} +237 -83
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +879 -31
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +879 -59
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +720 -16
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +760 -195
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  17. package/artifacts/contracts/components/Product.sol/Product.json +564 -141
  18. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +1 -1
  19. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +15 -15
  20. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  21. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +69 -79
  22. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  23. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
  24. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  25. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1474 -483
  26. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  27. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +248 -218
  28. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  29. package/artifacts/contracts/instance/Instance.sol/Instance.json +1152 -794
  30. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  31. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +462 -179
  32. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  33. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +414 -267
  34. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  35. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +482 -346
  36. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  37. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +355 -91
  38. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  39. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +11 -40
  40. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
  41. package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +263 -164
  42. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  43. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  44. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  45. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +40 -10
  46. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  47. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
  48. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  49. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +58 -75
  50. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  51. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
  52. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
  53. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  54. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  55. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  56. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  57. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  58. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
  59. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +1124 -0
  60. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
  61. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +688 -0
  62. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  63. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +641 -303
  64. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  65. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +343 -79
  66. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
  67. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +1384 -0
  68. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
  69. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +752 -0
  70. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  71. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +1434 -280
  72. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  73. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +469 -73
  74. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
  75. package/artifacts/contracts/instance/service/{IComponentOwnerService.sol/IComponentOwnerService.json → IApplicationService.sol/IApplicationService.json} +342 -189
  76. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  77. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +310 -249
  78. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
  79. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +743 -0
  80. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +757 -144
  82. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  83. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +262 -275
  84. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  85. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +703 -125
  86. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  87. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +71 -165
  88. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +632 -344
  90. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  91. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +367 -91
  92. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  93. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +1119 -224
  94. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  95. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +361 -73
  96. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  97. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +297 -210
  98. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  99. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +298 -78
  100. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  101. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
  102. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  103. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +117 -5
  104. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  105. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +99 -217
  106. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  107. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
  108. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  109. package/artifacts/contracts/registry/Registry.sol/Registry.json +131 -27
  110. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  111. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +18 -18
  112. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  113. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +205 -250
  114. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  115. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +287 -81
  116. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  117. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +81 -68
  118. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  119. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +138 -50
  120. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  121. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  122. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +41 -3
  123. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  124. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +27 -29
  125. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
  126. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +189 -0
  127. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  128. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +8 -34
  129. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
  130. package/artifacts/contracts/{experiment/inheritance/IA.sol/ISharedA.json → shared/IRegistryLinked.sol/IRegistryLinked.json} +15 -17
  131. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  132. package/artifacts/contracts/shared/IService.sol/IService.json +71 -165
  133. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  134. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -152
  135. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  136. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +107 -27
  137. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
  138. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +302 -0
  139. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  140. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +283 -63
  141. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  142. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +116 -51
  143. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
  144. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +71 -0
  145. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  146. package/artifacts/contracts/shared/Service.sol/Service.json +173 -153
  147. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  148. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +24 -6
  149. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  150. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  151. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  152. package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -152
  153. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  154. package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
  155. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  156. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +116 -51
  157. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  158. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
  159. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  160. package/artifacts/contracts/test/TestService.sol/TestService.json +191 -203
  161. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  162. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  163. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  164. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  165. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +8 -190
  166. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  167. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  168. package/artifacts/contracts/types/Amount.sol/AmountLib.dbg.json +4 -0
  169. package/artifacts/contracts/types/Amount.sol/AmountLib.json +281 -0
  170. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  171. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
  172. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  173. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
  174. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +179 -0
  175. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  176. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
  177. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  178. package/artifacts/contracts/types/Fee.sol/FeeLib.json +74 -19
  179. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  180. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
  181. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  182. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
  183. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  184. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  185. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  186. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  187. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  188. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
  189. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +209 -0
  190. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  191. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
  192. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  193. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
  194. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  195. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  196. package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
  197. package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
  198. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  199. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  200. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  201. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +38 -7
  202. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  203. package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
  204. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  205. package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
  206. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  207. package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
  208. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  209. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
  210. package/contracts/components/Component.sol +272 -0
  211. package/contracts/components/Distribution.sol +204 -82
  212. package/contracts/components/IComponent.sol +90 -0
  213. package/contracts/components/IDistributionComponent.sol +44 -17
  214. package/contracts/components/IPoolComponent.sol +90 -42
  215. package/contracts/components/IProductComponent.sol +15 -9
  216. package/contracts/components/Pool.sol +217 -186
  217. package/contracts/components/Product.sol +246 -166
  218. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +2 -12
  219. package/contracts/instance/BundleManager.sol +17 -20
  220. package/contracts/instance/Cloneable.sol +7 -2
  221. package/contracts/instance/IInstance.sol +67 -25
  222. package/contracts/instance/IInstanceService.sol +34 -11
  223. package/contracts/instance/Instance.sol +158 -116
  224. package/contracts/instance/InstanceAccessManager.sol +389 -165
  225. package/contracts/instance/InstanceReader.sol +87 -36
  226. package/contracts/instance/InstanceService.sol +295 -161
  227. package/contracts/instance/InstanceServiceManager.sol +1 -1
  228. package/contracts/instance/ObjectManager.sol +10 -29
  229. package/contracts/instance/base/ComponentService.sol +130 -0
  230. package/contracts/instance/base/KeyValueStore.sol +13 -36
  231. package/contracts/instance/base/Lifecycle.sol +26 -6
  232. package/contracts/instance/module/IAccess.sol +22 -16
  233. package/contracts/instance/module/IBundle.sol +8 -5
  234. package/contracts/instance/module/IComponents.sol +41 -0
  235. package/contracts/instance/module/IDistribution.sol +3 -0
  236. package/contracts/instance/module/IPolicy.sol +43 -11
  237. package/contracts/instance/module/ISetup.sol +7 -20
  238. package/contracts/instance/service/ApplicationService.sol +356 -0
  239. package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
  240. package/contracts/instance/service/BundleService.sol +244 -119
  241. package/contracts/instance/service/BundleServiceManager.sol +1 -1
  242. package/contracts/instance/service/ClaimService.sol +443 -0
  243. package/contracts/instance/service/ClaimServiceManager.sol +35 -0
  244. package/contracts/instance/service/DistributionService.sol +360 -41
  245. package/contracts/instance/service/DistributionServiceManager.sol +1 -1
  246. package/contracts/instance/service/IApplicationService.sol +79 -0
  247. package/contracts/instance/service/IBundleService.sol +93 -20
  248. package/contracts/instance/service/IClaimService.sol +90 -0
  249. package/contracts/instance/service/IDistributionService.sol +89 -0
  250. package/contracts/instance/service/IPolicyService.sol +44 -51
  251. package/contracts/instance/service/IPoolService.sol +97 -3
  252. package/contracts/instance/service/PolicyService.sol +233 -364
  253. package/contracts/instance/service/PolicyServiceManager.sol +2 -2
  254. package/contracts/instance/service/PoolService.sol +319 -40
  255. package/contracts/instance/service/PoolServiceManager.sol +1 -1
  256. package/contracts/instance/service/ProductService.sol +90 -50
  257. package/contracts/instance/service/ProductServiceManager.sol +2 -2
  258. package/contracts/registry/ChainNft.sol +8 -0
  259. package/contracts/registry/IRegistry.sol +18 -8
  260. package/contracts/registry/IRegistryService.sol +21 -13
  261. package/contracts/registry/ITransferInterceptor.sol +1 -0
  262. package/contracts/registry/Registry.sol +142 -71
  263. package/contracts/registry/RegistryAccessManager.sol +31 -25
  264. package/contracts/registry/RegistryService.sol +93 -134
  265. package/contracts/registry/RegistryServiceManager.sol +13 -13
  266. package/contracts/registry/ReleaseManager.sol +103 -127
  267. package/contracts/registry/TokenRegistry.sol +19 -13
  268. package/contracts/shared/ERC165.sol +14 -12
  269. package/contracts/shared/INftOwnable.sol +11 -10
  270. package/contracts/shared/IPolicyHolder.sol +40 -0
  271. package/contracts/shared/IRegisterable.sol +4 -6
  272. package/contracts/shared/IRegistryLinked.sol +11 -0
  273. package/contracts/shared/IService.sol +6 -4
  274. package/contracts/shared/IVersionable.sol +4 -47
  275. package/contracts/shared/NftOwnable.sol +64 -80
  276. package/contracts/shared/PolicyHolder.sol +94 -0
  277. package/contracts/shared/ProxyManager.sol +100 -25
  278. package/contracts/shared/Registerable.sol +24 -39
  279. package/contracts/shared/RegistryLinked.sol +43 -0
  280. package/contracts/shared/Service.sol +36 -22
  281. package/contracts/shared/TokenHandler.sol +14 -6
  282. package/contracts/shared/Versionable.sol +4 -92
  283. package/contracts/test/TestRegisterable.sol +1 -1
  284. package/contracts/test/TestService.sol +1 -1
  285. package/contracts/types/Amount.sol +109 -0
  286. package/contracts/types/Blocknumber.sol +1 -0
  287. package/contracts/types/ClaimId.sol +75 -0
  288. package/contracts/types/DistributorType.sol +2 -2
  289. package/contracts/types/Fee.sol +17 -8
  290. package/contracts/types/NftId.sol +8 -0
  291. package/contracts/types/ObjectType.sol +11 -6
  292. package/contracts/types/PayoutId.sol +82 -0
  293. package/contracts/types/Referral.sol +4 -0
  294. package/contracts/types/RoleId.sol +18 -11
  295. package/contracts/types/Seconds.sol +54 -0
  296. package/contracts/types/StateId.sol +7 -2
  297. package/contracts/types/Timestamp.sol +18 -13
  298. package/contracts/types/UFixed.sol +1 -0
  299. package/contracts/types/Version.sol +1 -0
  300. package/package.json +3 -3
  301. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
  302. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
  303. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -397
  304. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +0 -4
  305. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +0 -66
  306. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +0 -4
  307. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +0 -24
  308. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +0 -4
  309. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +0 -42
  310. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +0 -4
  311. package/artifacts/contracts/experiment/errors/Require.sol/Require.json +0 -105
  312. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +0 -4
  313. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +0 -105
  314. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +0 -4
  315. package/artifacts/contracts/experiment/inheritance/A.sol/A.json +0 -128
  316. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +0 -4
  317. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +0 -42
  318. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +0 -4
  319. package/artifacts/contracts/experiment/inheritance/B.sol/B.json +0 -76
  320. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +0 -4
  321. package/artifacts/contracts/experiment/inheritance/C.sol/C.json +0 -89
  322. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +0 -4
  323. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.json +0 -128
  324. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +0 -4
  325. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +0 -4
  326. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.json +0 -50
  327. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +0 -4
  328. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.json +0 -63
  329. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +0 -4
  330. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +0 -59
  331. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +0 -4
  332. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +0 -124
  333. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +0 -4
  334. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +0 -74
  335. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +0 -4
  336. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +0 -124
  337. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +0 -4
  338. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +0 -207
  339. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +0 -4
  340. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +0 -10
  341. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +0 -4
  342. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +0 -10
  343. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
  344. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
  345. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
  346. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
  347. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
  348. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
  349. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
  350. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
  351. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -814
  352. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
  353. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
  354. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +0 -442
  355. package/contracts/components/BaseComponent.sol +0 -159
  356. package/contracts/components/IBaseComponent.sol +0 -34
  357. package/contracts/experiment/cloning/Cloner.sol +0 -47
  358. package/contracts/experiment/errors/Require.sol +0 -38
  359. package/contracts/experiment/errors/Revert.sol +0 -44
  360. package/contracts/experiment/inheritance/A.sol +0 -53
  361. package/contracts/experiment/inheritance/B.sol +0 -28
  362. package/contracts/experiment/inheritance/C.sol +0 -34
  363. package/contracts/experiment/inheritance/IA.sol +0 -13
  364. package/contracts/experiment/inheritance/IB.sol +0 -10
  365. package/contracts/experiment/inheritance/IC.sol +0 -12
  366. package/contracts/experiment/statemachine/Dummy.sol +0 -27
  367. package/contracts/experiment/statemachine/ISM.sol +0 -25
  368. package/contracts/experiment/statemachine/SM.sol +0 -57
  369. package/contracts/experiment/statemachine/SimpleStateMachine.sol +0 -31
  370. package/contracts/experiment/types/TypeA.sol +0 -47
  371. package/contracts/experiment/types/TypeB.sol +0 -29
  372. package/contracts/instance/IInstanceBase.sol +0 -26
  373. package/contracts/instance/InstanceBase.sol +0 -41
  374. package/contracts/instance/base/ComponentServiceBase.sol +0 -82
  375. package/contracts/instance/base/IInstanceBase.sol +0 -23
  376. package/contracts/instance/service/ComponentOwnerService.sol +0 -315
  377. package/contracts/instance/service/IComponentOwnerService.sol +0 -20
  378. package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -472,8 +472,8 @@
472
472
  "type": "function"
473
473
  }
474
474
  ],
475
- "bytecode": "0x610a2a61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106101625760003560e01c80637a858b97116100cd578063bc1b392d11610086578063bc1b392d146102c7578063bdbb4630146102ce578063c8a4ac9c146102d5578063cc8b7b73146102e8578063ea6515c4146102fb578063eb646d711461030e57600080fd5b80637a858b971461025f57806389fa8ed71461027257806393aa872514610287578063a391c15b1461028e578063b4773329146102a1578063b67d77c5146102b457600080fd5b8063313ce5671161011f578063313ce567146101f957806332148d731461020057806344aa68361461021357806345ebb61e14610226578063753b14a514610239578063771602f71461024c57600080fd5b8063059f8b161461016757806308c76ec414610182578063118fc88c146101955780631488c845146101b85780631a12cd47146101cb57806321e5749b146101e6575b600080fd5b61016f610316565b6040519081526020015b60405180910390f35b61016f610190366004610797565b610325565b6101a86101a33660046107cd565b6103ad565b6040519015158152602001610179565b61016f6101c63660046107ef565b6103ba565b6101d3601281565b60405160009190910b8152602001610179565b6101a86101f43660046107cd565b61049c565b601261016f565b6101a861020e3660046107cd565b6104a6565b61016f61022136600461081a565b6104b0565b61016f61023436600461081a565b6104bd565b6101a861024736600461081a565b6104d5565b61016f61025a3660046107cd565b6104de565b6101a861026d36600461081a565b6104ea565b60025b60405160ff9091168152602001610179565b6000610275565b61016f61029c3660046107cd565b6104f4565b6101a86102af3660046107cd565b610500565b61016f6102c23660046107cd565b61050b565b600061016f565b6001610275565b61016f6102e33660046107cd565b610517565b61016f6102f63660046107cd565b610523565b6101a86103093660046107cd565b61052f565b61016f61053a565b6103226012600a61092d565b81565b600060011960ff8316016103745761036d60026103446012600a61092d565b61034e919061094f565b6103589085610971565b60016103666012600a61092d565b6000610552565b90506103a7565b60ff821661038e5761036d8360016103666012600a61092d565b61036d8360016103a06012600a61092d565b6001610552565b92915050565b60008282115b9392505050565b6000806103c8836012610984565b60000b121561041e5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031303a4558504f4e454e545f544f4f5f534d414c4c0060448201526064015b60405180910390fd5b604061042b836012610984565b60000b131561047c5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031313a4558504f4e454e545f544f4f5f4c41524745006044820152606401610415565b610487826012610984565b61049290600a6109a5565b6103b390846109b4565b60008282106103b3565b60008183146103b3565b60006103a7826002610325565b60006104cb6012600a61092d565b6103a790836109b4565b600081156103a7565b60006103b383836105af565b60008115156103a7565b60006103b383836105bb565b6000828211156103b3565b60006103b3838361061f565b60006103b3838361067b565b60006103b38383610690565b6000828210156103b3565b60026105486012600a61092d565b610322919061094f565b6000806105608686866106ae565b90506001836002811115610576576105766109cb565b14801561059357506000848061058e5761058e610939565b868809115b156105a6576105a3600182610971565b90505b95945050505050565b60006103b38284610971565b600080821161060c5760405162461bcd60e51b815260206004820152601a60248201527f4552524f523a55464d2d3032303a44495649534f525f5a45524f0000000000006044820152606401610415565b6103b383670de0b6b3a7640000846106ae565b6000828211156106715760405162461bcd60e51b815260206004820152601d60248201527f4552524f523a55464d2d3031303a4e454741544956455f524553554c540000006044820152606401610415565b6103b382846109e1565b60006103b38383670de0b6b3a76400006106ae565b6000828210156106a45761036d838361061f565b6103b3828461061f565b60008080600019858709858702925082811083820303915050806000036106e8578382816106de576106de610939565b04925050506103b3565b80841161072f5760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401610415565b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b600080604083850312156107aa57600080fd5b82359150602083013560ff811681146107c257600080fd5b809150509250929050565b600080604083850312156107e057600080fd5b50508035926020909101359150565b6000806040838503121561080257600080fd5b8235915060208301358060000b81146107c257600080fd5b60006020828403121561082c57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561088457816000190482111561086a5761086a610833565b8085161561087757918102915b93841c939080029061084e565b509250929050565b60008261089b575060016103a7565b816108a8575060006103a7565b81600181146108be57600281146108c8576108e4565b60019150506103a7565b60ff8411156108d9576108d9610833565b50506001821b6103a7565b5060208310610133831016604e8410600b8410161715610907575081810a6103a7565b6109118383610849565b806000190482111561092557610925610833565b029392505050565b60006103b3838361088c565b634e487b7160e01b600052601260045260246000fd5b60008261096c57634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156103a7576103a7610833565b600081810b9083900b01607f8113607f19821217156103a7576103a7610833565b60006103b360ff84168361088c565b80820281158282048414176103a7576103a7610833565b634e487b7160e01b600052602160045260246000fd5b818103818111156103a7576103a761083356fea2646970667358221220f659b86edd0962c8a443cf254dd05085c2f84aebd873f9d04820daa9354e580d64736f6c63430008140033",
476
- "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106101625760003560e01c80637a858b97116100cd578063bc1b392d11610086578063bc1b392d146102c7578063bdbb4630146102ce578063c8a4ac9c146102d5578063cc8b7b73146102e8578063ea6515c4146102fb578063eb646d711461030e57600080fd5b80637a858b971461025f57806389fa8ed71461027257806393aa872514610287578063a391c15b1461028e578063b4773329146102a1578063b67d77c5146102b457600080fd5b8063313ce5671161011f578063313ce567146101f957806332148d731461020057806344aa68361461021357806345ebb61e14610226578063753b14a514610239578063771602f71461024c57600080fd5b8063059f8b161461016757806308c76ec414610182578063118fc88c146101955780631488c845146101b85780631a12cd47146101cb57806321e5749b146101e6575b600080fd5b61016f610316565b6040519081526020015b60405180910390f35b61016f610190366004610797565b610325565b6101a86101a33660046107cd565b6103ad565b6040519015158152602001610179565b61016f6101c63660046107ef565b6103ba565b6101d3601281565b60405160009190910b8152602001610179565b6101a86101f43660046107cd565b61049c565b601261016f565b6101a861020e3660046107cd565b6104a6565b61016f61022136600461081a565b6104b0565b61016f61023436600461081a565b6104bd565b6101a861024736600461081a565b6104d5565b61016f61025a3660046107cd565b6104de565b6101a861026d36600461081a565b6104ea565b60025b60405160ff9091168152602001610179565b6000610275565b61016f61029c3660046107cd565b6104f4565b6101a86102af3660046107cd565b610500565b61016f6102c23660046107cd565b61050b565b600061016f565b6001610275565b61016f6102e33660046107cd565b610517565b61016f6102f63660046107cd565b610523565b6101a86103093660046107cd565b61052f565b61016f61053a565b6103226012600a61092d565b81565b600060011960ff8316016103745761036d60026103446012600a61092d565b61034e919061094f565b6103589085610971565b60016103666012600a61092d565b6000610552565b90506103a7565b60ff821661038e5761036d8360016103666012600a61092d565b61036d8360016103a06012600a61092d565b6001610552565b92915050565b60008282115b9392505050565b6000806103c8836012610984565b60000b121561041e5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031303a4558504f4e454e545f544f4f5f534d414c4c0060448201526064015b60405180910390fd5b604061042b836012610984565b60000b131561047c5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031313a4558504f4e454e545f544f4f5f4c41524745006044820152606401610415565b610487826012610984565b61049290600a6109a5565b6103b390846109b4565b60008282106103b3565b60008183146103b3565b60006103a7826002610325565b60006104cb6012600a61092d565b6103a790836109b4565b600081156103a7565b60006103b383836105af565b60008115156103a7565b60006103b383836105bb565b6000828211156103b3565b60006103b3838361061f565b60006103b3838361067b565b60006103b38383610690565b6000828210156103b3565b60026105486012600a61092d565b610322919061094f565b6000806105608686866106ae565b90506001836002811115610576576105766109cb565b14801561059357506000848061058e5761058e610939565b868809115b156105a6576105a3600182610971565b90505b95945050505050565b60006103b38284610971565b600080821161060c5760405162461bcd60e51b815260206004820152601a60248201527f4552524f523a55464d2d3032303a44495649534f525f5a45524f0000000000006044820152606401610415565b6103b383670de0b6b3a7640000846106ae565b6000828211156106715760405162461bcd60e51b815260206004820152601d60248201527f4552524f523a55464d2d3031303a4e454741544956455f524553554c540000006044820152606401610415565b6103b382846109e1565b60006103b38383670de0b6b3a76400006106ae565b6000828210156106a45761036d838361061f565b6103b3828461061f565b60008080600019858709858702925082811083820303915050806000036106e8578382816106de576106de610939565b04925050506103b3565b80841161072f5760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401610415565b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b600080604083850312156107aa57600080fd5b82359150602083013560ff811681146107c257600080fd5b809150509250929050565b600080604083850312156107e057600080fd5b50508035926020909101359150565b6000806040838503121561080257600080fd5b8235915060208301358060000b81146107c257600080fd5b60006020828403121561082c57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561088457816000190482111561086a5761086a610833565b8085161561087757918102915b93841c939080029061084e565b509250929050565b60008261089b575060016103a7565b816108a8575060006103a7565b81600181146108be57600281146108c8576108e4565b60019150506103a7565b60ff8411156108d9576108d9610833565b50506001821b6103a7565b5060208310610133831016604e8410600b8410161715610907575081810a6103a7565b6109118383610849565b806000190482111561092557610925610833565b029392505050565b60006103b3838361088c565b634e487b7160e01b600052601260045260246000fd5b60008261096c57634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156103a7576103a7610833565b600081810b9083900b01607f8113607f19821217156103a7576103a7610833565b60006103b360ff84168361088c565b80820281158282048414176103a7576103a7610833565b634e487b7160e01b600052602160045260246000fd5b818103818111156103a7576103a761083356fea2646970667358221220f659b86edd0962c8a443cf254dd05085c2f84aebd873f9d04820daa9354e580d64736f6c63430008140033",
475
+ "bytecode": "0x610a2a61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106101625760003560e01c80637a858b97116100cd578063bc1b392d11610086578063bc1b392d146102c7578063bdbb4630146102ce578063c8a4ac9c146102d5578063cc8b7b73146102e8578063ea6515c4146102fb578063eb646d711461030e57600080fd5b80637a858b971461025f57806389fa8ed71461027257806393aa872514610287578063a391c15b1461028e578063b4773329146102a1578063b67d77c5146102b457600080fd5b8063313ce5671161011f578063313ce567146101f957806332148d731461020057806344aa68361461021357806345ebb61e14610226578063753b14a514610239578063771602f71461024c57600080fd5b8063059f8b161461016757806308c76ec414610182578063118fc88c146101955780631488c845146101b85780631a12cd47146101cb57806321e5749b146101e6575b600080fd5b61016f610316565b6040519081526020015b60405180910390f35b61016f610190366004610797565b610325565b6101a86101a33660046107cd565b6103ad565b6040519015158152602001610179565b61016f6101c63660046107ef565b6103ba565b6101d3601281565b60405160009190910b8152602001610179565b6101a86101f43660046107cd565b61049c565b601261016f565b6101a861020e3660046107cd565b6104a6565b61016f61022136600461081a565b6104b0565b61016f61023436600461081a565b6104bd565b6101a861024736600461081a565b6104d5565b61016f61025a3660046107cd565b6104de565b6101a861026d36600461081a565b6104ea565b60025b60405160ff9091168152602001610179565b6000610275565b61016f61029c3660046107cd565b6104f4565b6101a86102af3660046107cd565b610500565b61016f6102c23660046107cd565b61050b565b600061016f565b6001610275565b61016f6102e33660046107cd565b610517565b61016f6102f63660046107cd565b610523565b6101a86103093660046107cd565b61052f565b61016f61053a565b6103226012600a61092d565b81565b600060011960ff8316016103745761036d60026103446012600a61092d565b61034e919061094f565b6103589085610971565b60016103666012600a61092d565b6000610552565b90506103a7565b60ff821661038e5761036d8360016103666012600a61092d565b61036d8360016103a06012600a61092d565b6001610552565b92915050565b60008282115b9392505050565b6000806103c8836012610984565b60000b121561041e5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031303a4558504f4e454e545f544f4f5f534d414c4c0060448201526064015b60405180910390fd5b604061042b836012610984565b60000b131561047c5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031313a4558504f4e454e545f544f4f5f4c41524745006044820152606401610415565b610487826012610984565b61049290600a6109a5565b6103b390846109b4565b60008282106103b3565b60008183146103b3565b60006103a7826002610325565b60006104cb6012600a61092d565b6103a790836109b4565b600081156103a7565b60006103b383836105af565b60008115156103a7565b60006103b383836105bb565b6000828211156103b3565b60006103b3838361061f565b60006103b3838361067b565b60006103b38383610690565b6000828210156103b3565b60026105486012600a61092d565b610322919061094f565b6000806105608686866106ae565b90506001836002811115610576576105766109cb565b14801561059357506000848061058e5761058e610939565b868809115b156105a6576105a3600182610971565b90505b95945050505050565b60006103b38284610971565b600080821161060c5760405162461bcd60e51b815260206004820152601a60248201527f4552524f523a55464d2d3032303a44495649534f525f5a45524f0000000000006044820152606401610415565b6103b383670de0b6b3a7640000846106ae565b6000828211156106715760405162461bcd60e51b815260206004820152601d60248201527f4552524f523a55464d2d3031303a4e454741544956455f524553554c540000006044820152606401610415565b6103b382846109e1565b60006103b38383670de0b6b3a76400006106ae565b6000828210156106a45761036d838361061f565b6103b3828461061f565b60008080600019858709858702925082811083820303915050806000036106e8578382816106de576106de610939565b04925050506103b3565b80841161072f5760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401610415565b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b600080604083850312156107aa57600080fd5b82359150602083013560ff811681146107c257600080fd5b809150509250929050565b600080604083850312156107e057600080fd5b50508035926020909101359150565b6000806040838503121561080257600080fd5b8235915060208301358060000b81146107c257600080fd5b60006020828403121561082c57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561088457816000190482111561086a5761086a610833565b8085161561087757918102915b93841c939080029061084e565b509250929050565b60008261089b575060016103a7565b816108a8575060006103a7565b81600181146108be57600281146108c8576108e4565b60019150506103a7565b60ff8411156108d9576108d9610833565b50506001821b6103a7565b5060208310610133831016604e8410600b8410161715610907575081810a6103a7565b6109118383610849565b806000190482111561092557610925610833565b029392505050565b60006103b3838361088c565b634e487b7160e01b600052601260045260246000fd5b60008261096c57634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156103a7576103a7610833565b600081810b9083900b01607f8113607f19821217156103a7576103a7610833565b60006103b360ff84168361088c565b80820281158282048414176103a7576103a7610833565b634e487b7160e01b600052602160045260246000fd5b818103818111156103a7576103a761083356fea2646970667358221220bf133d0c138c18bc61ded1b407424a979556fd8b0354b7c8f51b313c2d08fa2264736f6c63430008140033",
476
+ "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106101625760003560e01c80637a858b97116100cd578063bc1b392d11610086578063bc1b392d146102c7578063bdbb4630146102ce578063c8a4ac9c146102d5578063cc8b7b73146102e8578063ea6515c4146102fb578063eb646d711461030e57600080fd5b80637a858b971461025f57806389fa8ed71461027257806393aa872514610287578063a391c15b1461028e578063b4773329146102a1578063b67d77c5146102b457600080fd5b8063313ce5671161011f578063313ce567146101f957806332148d731461020057806344aa68361461021357806345ebb61e14610226578063753b14a514610239578063771602f71461024c57600080fd5b8063059f8b161461016757806308c76ec414610182578063118fc88c146101955780631488c845146101b85780631a12cd47146101cb57806321e5749b146101e6575b600080fd5b61016f610316565b6040519081526020015b60405180910390f35b61016f610190366004610797565b610325565b6101a86101a33660046107cd565b6103ad565b6040519015158152602001610179565b61016f6101c63660046107ef565b6103ba565b6101d3601281565b60405160009190910b8152602001610179565b6101a86101f43660046107cd565b61049c565b601261016f565b6101a861020e3660046107cd565b6104a6565b61016f61022136600461081a565b6104b0565b61016f61023436600461081a565b6104bd565b6101a861024736600461081a565b6104d5565b61016f61025a3660046107cd565b6104de565b6101a861026d36600461081a565b6104ea565b60025b60405160ff9091168152602001610179565b6000610275565b61016f61029c3660046107cd565b6104f4565b6101a86102af3660046107cd565b610500565b61016f6102c23660046107cd565b61050b565b600061016f565b6001610275565b61016f6102e33660046107cd565b610517565b61016f6102f63660046107cd565b610523565b6101a86103093660046107cd565b61052f565b61016f61053a565b6103226012600a61092d565b81565b600060011960ff8316016103745761036d60026103446012600a61092d565b61034e919061094f565b6103589085610971565b60016103666012600a61092d565b6000610552565b90506103a7565b60ff821661038e5761036d8360016103666012600a61092d565b61036d8360016103a06012600a61092d565b6001610552565b92915050565b60008282115b9392505050565b6000806103c8836012610984565b60000b121561041e5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031303a4558504f4e454e545f544f4f5f534d414c4c0060448201526064015b60405180910390fd5b604061042b836012610984565b60000b131561047c5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031313a4558504f4e454e545f544f4f5f4c41524745006044820152606401610415565b610487826012610984565b61049290600a6109a5565b6103b390846109b4565b60008282106103b3565b60008183146103b3565b60006103a7826002610325565b60006104cb6012600a61092d565b6103a790836109b4565b600081156103a7565b60006103b383836105af565b60008115156103a7565b60006103b383836105bb565b6000828211156103b3565b60006103b3838361061f565b60006103b3838361067b565b60006103b38383610690565b6000828210156103b3565b60026105486012600a61092d565b610322919061094f565b6000806105608686866106ae565b90506001836002811115610576576105766109cb565b14801561059357506000848061058e5761058e610939565b868809115b156105a6576105a3600182610971565b90505b95945050505050565b60006103b38284610971565b600080821161060c5760405162461bcd60e51b815260206004820152601a60248201527f4552524f523a55464d2d3032303a44495649534f525f5a45524f0000000000006044820152606401610415565b6103b383670de0b6b3a7640000846106ae565b6000828211156106715760405162461bcd60e51b815260206004820152601d60248201527f4552524f523a55464d2d3031303a4e454741544956455f524553554c540000006044820152606401610415565b6103b382846109e1565b60006103b38383670de0b6b3a76400006106ae565b6000828210156106a45761036d838361061f565b6103b3828461061f565b60008080600019858709858702925082811083820303915050806000036106e8578382816106de576106de610939565b04925050506103b3565b80841161072f5760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401610415565b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b600080604083850312156107aa57600080fd5b82359150602083013560ff811681146107c257600080fd5b809150509250929050565b600080604083850312156107e057600080fd5b50508035926020909101359150565b6000806040838503121561080257600080fd5b8235915060208301358060000b81146107c257600080fd5b60006020828403121561082c57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561088457816000190482111561086a5761086a610833565b8085161561087757918102915b93841c939080029061084e565b509250929050565b60008261089b575060016103a7565b816108a8575060006103a7565b81600181146108be57600281146108c8576108e4565b60019150506103a7565b60ff8411156108d9576108d9610833565b50506001821b6103a7565b5060208310610133831016604e8410600b8410161715610907575081810a6103a7565b6109118383610849565b806000190482111561092557610925610833565b029392505050565b60006103b3838361088c565b634e487b7160e01b600052601260045260246000fd5b60008261096c57634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156103a7576103a7610833565b600081810b9083900b01607f8113607f19821217156103a7576103a7610833565b60006103b360ff84168361088c565b80820281158282048414176103a7576103a7610833565b634e487b7160e01b600052602160045260246000fd5b818103818111156103a7576103a761083356fea2646970667358221220bf133d0c138c18bc61ded1b407424a979556fd8b0354b7c8f51b313c2d08fa2264736f6c63430008140033",
477
477
  "linkReferences": {},
478
478
  "deployedLinkReferences": {}
479
479
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e3835a250be08f0bfa602231335aca3a.json"
3
+ "buildInfo": "../../../build-info/e28d745f6ca3cff1f09ff773f5e44053.json"
4
4
  }
@@ -170,8 +170,8 @@
170
170
  "type": "function"
171
171
  }
172
172
  ],
173
- "bytecode": "0x61039161003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea264697066735822122096e4b37266f82e0aaf6f30afa90c545c35f82576ca3b67d630233921e58f525b64736f6c63430008140033",
174
- "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea264697066735822122096e4b37266f82e0aaf6f30afa90c545c35f82576ca3b67d630233921e58f525b64736f6c63430008140033",
173
+ "bytecode": "0x61039161003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea2646970667358221220801f2c14b03a7330f0c0f9dce2a4a4bea8603a2ffbea5bb26b7564e07c0d257564736f6c63430008140033",
174
+ "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea2646970667358221220801f2c14b03a7330f0c0f9dce2a4a4bea8603a2ffbea5bb26b7564e07c0d257564736f6c63430008140033",
175
175
  "linkReferences": {},
176
176
  "deployedLinkReferences": {}
177
177
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e3835a250be08f0bfa602231335aca3a.json"
3
+ "buildInfo": "../../../build-info/e28d745f6ca3cff1f09ff773f5e44053.json"
4
4
  }
@@ -42,8 +42,8 @@
42
42
  "type": "function"
43
43
  }
44
44
  ],
45
- "bytecode": "0x60fb610039600b82828239805160001a60731461002c57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80638e4ad86c146042578063ac43d834146067575b600080fd5b6050604d3660046085565b90565b60405160ff90911681526020015b60405180910390f35b60786072366004609d565b60ff1690565b604051908152602001605e565b600060208284031215609657600080fd5b5035919050565b60006020828403121560ae57600080fd5b813560ff8116811460be57600080fd5b939250505056fea264697066735822122074bb6f75f2cab9692d05e41844bf40283045a9440c662c37a97b2502d38207ed64736f6c63430008140033",
46
- "deployedBytecode": "0x7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80638e4ad86c146042578063ac43d834146067575b600080fd5b6050604d3660046085565b90565b60405160ff90911681526020015b60405180910390f35b60786072366004609d565b60ff1690565b604051908152602001605e565b600060208284031215609657600080fd5b5035919050565b60006020828403121560ae57600080fd5b813560ff8116811460be57600080fd5b939250505056fea264697066735822122074bb6f75f2cab9692d05e41844bf40283045a9440c662c37a97b2502d38207ed64736f6c63430008140033",
45
+ "bytecode": "0x60fb610039600b82828239805160001a60731461002c57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80638e4ad86c146042578063ac43d834146067575b600080fd5b6050604d3660046085565b90565b60405160ff90911681526020015b60405180910390f35b60786072366004609d565b60ff1690565b604051908152602001605e565b600060208284031215609657600080fd5b5035919050565b60006020828403121560ae57600080fd5b813560ff8116811460be57600080fd5b939250505056fea2646970667358221220cdee50fe6c9714f8463d3a3d707ceac1b02f5c17b070c998ecfbac805f95cace64736f6c63430008140033",
46
+ "deployedBytecode": "0x7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80638e4ad86c146042578063ac43d834146067575b600080fd5b6050604d3660046085565b90565b60405160ff90911681526020015b60405180910390f35b60786072366004609d565b60ff1690565b604051908152602001605e565b600060208284031215609657600080fd5b5035919050565b60006020828403121560ae57600080fd5b813560ff8116811460be57600080fd5b939250505056fea2646970667358221220cdee50fe6c9714f8463d3a3d707ceac1b02f5c17b070c998ecfbac805f95cace64736f6c63430008140033",
47
47
  "linkReferences": {},
48
48
  "deployedLinkReferences": {}
49
49
  }
@@ -0,0 +1,272 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
5
+ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
6
+ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
7
+ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8
+
9
+ import {IComponent} from "./IComponent.sol";
10
+ import {IComponents} from "../instance/module/IComponents.sol";
11
+ import {IProductService} from "../instance/service/IProductService.sol";
12
+ import {IInstanceService} from "../instance/IInstanceService.sol";
13
+ import {IInstance} from "../instance/IInstance.sol";
14
+ import {InstanceAccessManager} from "../instance/InstanceAccessManager.sol";
15
+ import {InstanceReader} from "../instance/InstanceReader.sol";
16
+ import {IRegistry} from "../registry/IRegistry.sol";
17
+ import {NftId} from "../types/NftId.sol";
18
+ import {ObjectType, INSTANCE, PRODUCT} from "../types/ObjectType.sol";
19
+ import {VersionPart} from "../types/Version.sol";
20
+ import {Registerable} from "../shared/Registerable.sol";
21
+ import {RoleId, RoleIdLib} from "../types/RoleId.sol";
22
+ import {IAccess} from "../instance/module/IAccess.sol";
23
+ import {TokenHandler} from "../shared/TokenHandler.sol";
24
+ import {VersionPart} from "../types/Version.sol";
25
+
26
+ // TODO discuss to inherit from oz accessmanaged
27
+ // then add (Distribution|Pool|Product)Upradeable that also intherit from Versionable
28
+ // same pattern as for Service which is also upgradeable
29
+ abstract contract Component is
30
+ Registerable,
31
+ IComponent,
32
+ AccessManagedUpgradeable
33
+ {
34
+ // keccak256(abi.encode(uint256(keccak256("gif-next.contracts.component.Component.sol")) - 1)) & ~bytes32(uint256(0xff));
35
+ bytes32 public constant COMPONENT_LOCATION_V1 = 0xffe8d4462baed26a47154f4b8f6db497d2f772496965791d25bd456e342b7f00;
36
+
37
+ struct ComponentStorage {
38
+ string _name; // unique (per instance) component name
39
+ IERC20Metadata _token; // token for this component
40
+ IInstance _instance; // instance for this component
41
+ address _wallet; // wallet for this component (default = component contract itself)
42
+ InstanceReader _instanceReader; // instance reader for this component
43
+ bool _isNftInterceptor; // declares if component is involved in nft transfers
44
+ NftId _productNftId; // only relevant for components that are linked to a aproduct
45
+ }
46
+
47
+ function _getComponentStorage() private pure returns (ComponentStorage storage $) {
48
+ assembly {
49
+ $.slot := COMPONENT_LOCATION_V1
50
+ }
51
+ }
52
+
53
+ modifier onlyChainNft() {
54
+ if(msg.sender != getRegistry().getChainNftAddress()) {
55
+ revert ErrorComponentNotChainNft(msg.sender);
56
+ }
57
+ _;
58
+ }
59
+
60
+ function initializeComponent(
61
+ address registry,
62
+ NftId instanceNftId,
63
+ string memory name,
64
+ address token,
65
+ ObjectType componentType,
66
+ bool isInterceptor,
67
+ address initialOwner,
68
+ bytes memory registryData // writeonly data that will saved in the object info record of the registry
69
+ )
70
+ public
71
+ virtual
72
+ onlyInitializing()
73
+ {
74
+ initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, registryData);
75
+
76
+ // set and check linked instance
77
+ ComponentStorage storage $ = _getComponentStorage();
78
+ $._instance = IInstance(
79
+ getRegistry().getObjectInfo(instanceNftId).objectAddress);
80
+
81
+ if(!$._instance.supportsInterface(type(IInstance).interfaceId)) {
82
+ revert ErrorComponentNotInstance(instanceNftId);
83
+ }
84
+
85
+ // initialize AccessManagedUpgradeable
86
+ __AccessManaged_init($._instance.authority());
87
+
88
+ // set component state
89
+ $._name = name;
90
+ $._isNftInterceptor = isInterceptor;
91
+ $._instanceReader = $._instance.getInstanceReader();
92
+ $._wallet = address(this);
93
+ $._token = IERC20Metadata(token);
94
+
95
+ registerInterface(type(IAccessManaged).interfaceId);
96
+ registerInterface(type(IComponent).interfaceId);
97
+ }
98
+
99
+ function lock() external onlyOwner {
100
+ IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(true);
101
+ }
102
+
103
+ function unlock() external onlyOwner {
104
+ IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(false);
105
+ }
106
+
107
+ function approveTokenHandler(uint256 spendingLimitAmount) external onlyOwner {
108
+ IComponents.ComponentInfo memory info = getComponentInfo();
109
+
110
+ if(info.wallet != address(this)) {
111
+ revert ErrorComponentWalletNotComponent();
112
+ }
113
+
114
+ info.token.approve(
115
+ address(info.tokenHandler),
116
+ spendingLimitAmount);
117
+
118
+ emit LogComponentTokenHandlerApproved(spendingLimitAmount);
119
+ }
120
+
121
+ function setWallet(address newWallet)
122
+ external
123
+ override
124
+ onlyOwner
125
+ {
126
+ ComponentStorage storage $ = _getComponentStorage();
127
+
128
+ address currentWallet = $._wallet;
129
+ uint256 currentBalance = $._token.balanceOf(currentWallet);
130
+
131
+ // checks
132
+ if (newWallet == address(0)) {
133
+ revert ErrorComponentWalletAddressZero();
134
+ }
135
+
136
+ if (newWallet == currentWallet) {
137
+ revert ErrorComponentWalletAddressIsSameAsCurrent();
138
+ }
139
+
140
+ if (currentBalance > 0) {
141
+ if (currentWallet == address(this)) {
142
+ // move tokens from component smart contract to external wallet
143
+ } else {
144
+ // move tokens from external wallet to component smart contract or another external wallet
145
+ uint256 allowance = $._token.allowance(currentWallet, address(this));
146
+ if (allowance < currentBalance) {
147
+ revert ErrorComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
148
+ }
149
+ }
150
+ }
151
+
152
+ // effects
153
+ $._wallet = newWallet;
154
+ emit LogComponentWalletAddressChanged(currentWallet, newWallet);
155
+
156
+ // interactions
157
+ if (currentBalance > 0) {
158
+ // transfer tokens from current wallet to new wallet
159
+ if (currentWallet == address(this)) {
160
+ // transferFrom requires self allowance too
161
+ $._token.approve(address(this), currentBalance);
162
+ }
163
+
164
+ SafeERC20.safeTransferFrom($._token, currentWallet, newWallet, currentBalance);
165
+ emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
166
+ }
167
+ }
168
+
169
+ function setProductNftId(NftId productNftId)
170
+ external
171
+ override
172
+ {
173
+ ComponentStorage storage $ = _getComponentStorage();
174
+
175
+ // verify caller is product service
176
+ if(msg.sender != _getServiceAddress(PRODUCT())) {
177
+ revert ErrorComponentNotProductService(msg.sender);
178
+ }
179
+
180
+ // verify component is not yet linked to a product
181
+ if($._productNftId.gtz()) {
182
+ revert ErrorComponentProductNftAlreadySet();
183
+ }
184
+
185
+ $._productNftId = productNftId;
186
+ }
187
+
188
+ function nftMint(address to, uint256 tokenId)
189
+ external
190
+ virtual
191
+ onlyChainNft
192
+ {}
193
+
194
+ /// @dev callback function for nft transfers
195
+ /// may only be called by chain nft contract.
196
+ /// do not override this function to implement business logic for handling transfers
197
+ /// override internal function _nftTransferFrom instead
198
+ function nftTransferFrom(address from, address to, uint256 tokenId)
199
+ external
200
+ virtual
201
+ onlyChainNft
202
+ {
203
+ _nftTransferFrom(from, to, tokenId);
204
+ }
205
+
206
+ function getWallet() public view override returns (address walletAddress)
207
+ {
208
+ return _getComponentStorage()._wallet;
209
+ }
210
+
211
+ function getToken() public view override returns (IERC20Metadata token) {
212
+ return _getComponentStorage()._token;
213
+ }
214
+
215
+ function getTokenHandler() public view returns (TokenHandler tokenHandler) {
216
+ return getComponentInfo().tokenHandler;
217
+ }
218
+
219
+ function isNftInterceptor() public view override returns(bool isInterceptor) {
220
+ return _getComponentStorage()._isNftInterceptor;
221
+ }
222
+
223
+ function getInstance() public view override returns (IInstance instance) {
224
+ return _getComponentStorage()._instance;
225
+ }
226
+
227
+ function getName() public view override returns(string memory name) {
228
+ return _getComponentStorage()._name;
229
+ }
230
+
231
+ function getProductNftId() public view override returns (NftId productNftId) {
232
+ return _getComponentStorage()._productNftId;
233
+ }
234
+
235
+ function getComponentInfo() public view returns (IComponents.ComponentInfo memory info) {
236
+ info = _getInstanceReader().getComponentInfo(getNftId());
237
+
238
+ // fallback to initial info (wallet is always != address(0))
239
+ if(info.wallet == address(0)) {
240
+ info = _getInitialInfo();
241
+ }
242
+ }
243
+
244
+ /// @dev defines initial component specification
245
+ /// overwrite this function according to your use case
246
+ function _getInitialInfo()
247
+ internal
248
+ view
249
+ virtual
250
+ returns (IComponents.ComponentInfo memory info)
251
+ { }
252
+
253
+
254
+ /// @dev internal function for nft transfers.
255
+ /// handling logic that deals with nft transfers need to overwrite this function
256
+ function _nftTransferFrom(address from, address to, uint256 tokenId)
257
+ internal
258
+ virtual
259
+ { }
260
+
261
+ /// @dev returns reader for linked instance
262
+ function _getInstanceReader() internal view returns (InstanceReader reader) {
263
+ return _getComponentStorage()._instanceReader;
264
+ }
265
+
266
+ /// @dev returns the service address for the specified domain
267
+ /// gets address via lookup from registry using the major version form the linked instance
268
+ function _getServiceAddress(ObjectType domain) internal view returns (address service) {
269
+ VersionPart majorVersion = _getComponentStorage()._instance.getMajorVersion();
270
+ return getRegistry().getServiceAddress(domain, majorVersion);
271
+ }
272
+ }