@etherisc/gif-next 0.0.2-bc11089-132 → 0.0.2-bca28f1-935

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) hide show
  1. package/README.md +73 -1
  2. package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
  3. package/artifacts/contracts/components/Component.sol/Component.json +897 -0
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +896 -235
  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} +137 -86
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +798 -0
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +662 -43
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +661 -5
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +603 -204
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  17. package/artifacts/contracts/components/Product.sol/Product.json +529 -122
  18. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
  33. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  35. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  36. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  37. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  38. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  39. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  40. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
  41. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  42. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  43. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +706 -56
  44. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  45. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +152 -19
  46. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  47. package/artifacts/contracts/instance/Instance.sol/Instance.json +560 -272
  48. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +103 -176
  50. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +61 -97
  52. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  53. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +460 -191
  54. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  55. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +187 -85
  56. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  57. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
  58. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
  59. package/artifacts/contracts/{shared/RegisterableUpgradable.sol/RegisterableUpgradable.json → instance/base/ComponentService.sol/ComponentService.json} +321 -9
  60. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  61. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  62. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  63. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
  64. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  65. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  66. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +24 -13
  68. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  69. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  70. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  71. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  72. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  73. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  74. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
  75. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +1117 -0
  76. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  77. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +495 -100
  78. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  79. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +172 -26
  80. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +554 -62
  82. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  83. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +197 -23
  84. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
  85. package/artifacts/contracts/instance/{base/ComponentServiceBase.sol/ComponentServiceBase.json → service/IApplicationService.sol/IApplicationService.json} +221 -104
  86. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  87. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +181 -52
  88. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +229 -19
  90. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  91. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +152 -32
  92. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  93. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +32 -19
  94. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  95. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +32 -19
  96. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  97. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +481 -87
  98. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  99. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +203 -25
  100. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  101. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +301 -62
  102. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  103. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +169 -23
  104. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  105. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +301 -62
  106. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  107. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +169 -15
  108. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  109. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  110. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  111. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +225 -133
  112. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  113. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +185 -77
  114. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  115. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  116. package/artifacts/contracts/registry/Registry.sol/Registry.json +238 -235
  117. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
  118. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
  119. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  120. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +243 -129
  121. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  122. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +181 -97
  123. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
  124. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
  125. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  126. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +150 -29
  127. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  128. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  129. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +41 -3
  130. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  131. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +37 -0
  132. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
  133. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
  134. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  135. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +18 -5
  136. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
  137. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +69 -0
  138. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  139. package/artifacts/contracts/shared/IService.sol/IService.json +32 -19
  140. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  141. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -2
  142. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  143. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +156 -11
  144. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
  145. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +269 -0
  146. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  147. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +156 -6
  148. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  149. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +152 -11
  150. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
  151. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +105 -0
  152. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  153. package/artifacts/contracts/shared/Service.sol/Service.json +178 -19
  154. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  155. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  156. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  157. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  158. package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -2
  159. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  160. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  161. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +152 -11
  162. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  163. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  164. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  165. package/artifacts/contracts/test/TestService.sol/TestService.json +196 -37
  166. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  167. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  168. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  169. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +8 -8
  170. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  171. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  172. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  173. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  174. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  175. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
  176. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  177. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  178. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
  179. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  180. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
  181. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  182. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  183. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  184. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  185. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  186. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  187. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
  188. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  189. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
  190. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  191. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  192. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  193. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  194. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  195. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  196. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  197. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  198. package/contracts/components/Component.sol +236 -0
  199. package/contracts/components/Distribution.sol +209 -64
  200. package/contracts/components/IComponent.sol +50 -0
  201. package/contracts/components/IDistributionComponent.sol +59 -3
  202. package/contracts/components/IPoolComponent.sol +50 -29
  203. package/contracts/components/IProductComponent.sol +7 -3
  204. package/contracts/components/Pool.sol +135 -152
  205. package/contracts/components/Product.sol +103 -117
  206. package/contracts/instance/BundleManager.sol +7 -11
  207. package/contracts/instance/IInstance.sol +35 -11
  208. package/contracts/instance/IInstanceService.sol +23 -2
  209. package/contracts/instance/Instance.sol +67 -62
  210. package/contracts/instance/InstanceAccessManager.sol +31 -38
  211. package/contracts/instance/InstanceReader.sol +3 -25
  212. package/contracts/instance/InstanceService.sol +198 -56
  213. package/contracts/instance/InstanceServiceManager.sol +5 -8
  214. package/contracts/instance/ObjectManager.sol +7 -24
  215. package/contracts/instance/base/ComponentService.sol +134 -0
  216. package/contracts/instance/module/IAccess.sol +4 -5
  217. package/contracts/instance/module/ISetup.sol +5 -4
  218. package/contracts/instance/service/ApplicationService.sol +268 -0
  219. package/contracts/instance/service/BundleService.sol +52 -14
  220. package/contracts/instance/service/BundleServiceManager.sol +5 -8
  221. package/contracts/instance/service/DistributionService.sol +208 -49
  222. package/contracts/instance/service/DistributionServiceManager.sol +6 -9
  223. package/contracts/instance/service/IApplicationService.sol +82 -0
  224. package/contracts/instance/service/IBundleService.sol +12 -3
  225. package/contracts/instance/service/IDistributionService.sol +53 -0
  226. package/contracts/instance/service/IPolicyService.sol +17 -16
  227. package/contracts/instance/service/PolicyService.sol +148 -132
  228. package/contracts/instance/service/PoolService.sol +27 -42
  229. package/contracts/instance/service/PoolServiceManager.sol +5 -8
  230. package/contracts/instance/service/ProductService.sol +100 -40
  231. package/contracts/registry/ChainNft.sol +1 -1
  232. package/contracts/registry/IRegistry.sol +37 -19
  233. package/contracts/registry/IRegistryService.sol +30 -13
  234. package/contracts/registry/Registry.sol +233 -217
  235. package/contracts/registry/RegistryAccessManager.sol +216 -0
  236. package/contracts/registry/RegistryService.sol +81 -162
  237. package/contracts/registry/RegistryServiceManager.sol +18 -36
  238. package/contracts/registry/ReleaseManager.sol +331 -0
  239. package/contracts/registry/TokenRegistry.sol +11 -9
  240. package/contracts/shared/ERC165.sol +12 -11
  241. package/contracts/shared/INftOwnable.sol +12 -6
  242. package/contracts/shared/IPolicyHolder.sol +26 -0
  243. package/contracts/shared/IRegisterable.sol +4 -6
  244. package/contracts/shared/IRegistryLinked.sol +15 -0
  245. package/contracts/shared/IService.sol +2 -1
  246. package/contracts/shared/IVersionable.sol +2 -2
  247. package/contracts/shared/NftOwnable.sol +113 -57
  248. package/contracts/shared/PolicyHolder.sol +81 -0
  249. package/contracts/shared/ProxyManager.sol +6 -5
  250. package/contracts/shared/Registerable.sol +15 -24
  251. package/contracts/shared/RegistryLinked.sol +64 -0
  252. package/contracts/shared/Service.sol +18 -13
  253. package/contracts/shared/Versionable.sol +3 -2
  254. package/contracts/test/TestRegisterable.sol +1 -1
  255. package/contracts/test/TestService.sol +4 -3
  256. package/contracts/types/DistributorType.sol +2 -2
  257. package/contracts/types/ObjectType.sol +6 -2
  258. package/contracts/types/RoleId.sol +4 -5
  259. package/package.json +3 -3
  260. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
  261. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
  262. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -384
  263. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
  264. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
  265. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
  266. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
  267. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
  268. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
  269. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
  270. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
  271. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
  272. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
  273. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
  274. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
  275. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
  276. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
  277. package/contracts/components/BaseComponent.sol +0 -148
  278. package/contracts/components/IBaseComponent.sol +0 -32
  279. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +0 -23
  280. package/contracts/instance/IInstanceBase.sol +0 -26
  281. package/contracts/instance/InstanceBase.sol +0 -41
  282. package/contracts/instance/base/ComponentServiceBase.sol +0 -72
  283. package/contracts/instance/base/IInstanceBase.sol +0 -23
  284. package/contracts/instance/service/ComponentOwnerService.sol +0 -317
  285. package/contracts/instance/service/IComponentOwnerService.sol +0 -20
  286. package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -0,0 +1,236 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
5
+ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
6
+ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
7
+
8
+ import {IComponent} from "./IComponent.sol";
9
+ import {IProductService} from "../instance/service/IProductService.sol";
10
+ import {IInstanceService} from "../instance/IInstanceService.sol";
11
+ import {IInstance} from "../instance/IInstance.sol";
12
+ import {InstanceAccessManager} from "../instance/InstanceAccessManager.sol";
13
+ import {InstanceReader} from "../instance/InstanceReader.sol";
14
+ import {IRegistry} from "../registry/IRegistry.sol";
15
+ import {NftId} from "../types/NftId.sol";
16
+ import {ObjectType, INSTANCE, PRODUCT} from "../types/ObjectType.sol";
17
+ import {VersionPart} from "../types/Version.sol";
18
+ import {Registerable} from "../shared/Registerable.sol";
19
+ import {RoleId, RoleIdLib} from "../types/RoleId.sol";
20
+ import {IAccess} from "../instance/module/IAccess.sol";
21
+
22
+ // TODO discuss to inherit from oz accessmanaged
23
+ // then add (Distribution|Pool|Product)Upradeable that also intherit from Versionable
24
+ // same pattern as for Service which is also upgradeable
25
+ abstract contract Component is
26
+ Registerable,
27
+ IComponent,
28
+ AccessManagedUpgradeable
29
+ {
30
+ // keccak256(abi.encode(uint256(keccak256("gif-next.contracts.component.Component.sol")) - 1)) & ~bytes32(uint256(0xff));
31
+ bytes32 public constant CONTRACT_LOCATION_V1 = 0xffe8d4462baed26a47154f4b8f6db497d2f772496965791d25bd456e342b7f00;
32
+
33
+ struct ComponentStorage {
34
+ IInstance _instance; // instance for this component
35
+ InstanceReader _instanceReader; // instance reader for this component
36
+ string _name; // unique (per instance) component name
37
+ IERC20Metadata _token; // token for this component
38
+ address _wallet; // wallet for this component (default = component contract itself)
39
+ bool _isNftInterceptor; // declares if component is involved in nft transfers
40
+ IInstanceService _instanceService; // instance service for this component
41
+
42
+ NftId _productNftId; // only relevant for components that are linked to a aproduct
43
+ IProductService _productService; // product service for component, might not be relevant for some component types (eg oracles)
44
+ }
45
+
46
+
47
+ modifier onlyChainNft() {
48
+ if(msg.sender != getRegistry().getChainNftAddress()) {
49
+ revert ErrorComponentNotChainNft(msg.sender);
50
+ }
51
+ _;
52
+ }
53
+
54
+
55
+ modifier onlyProductService() {
56
+ if(msg.sender != address(_getComponentStorage()._productService)) {
57
+ revert ErrorComponentNotProductService(msg.sender);
58
+ }
59
+ _;
60
+ }
61
+
62
+ function _getComponentStorage() private pure returns (ComponentStorage storage $) {
63
+ assembly {
64
+ $.slot := CONTRACT_LOCATION_V1
65
+ }
66
+ }
67
+
68
+ function initializeComponent(
69
+ address registry,
70
+ NftId instanceNftId,
71
+ string memory name,
72
+ address token,
73
+ ObjectType componentType,
74
+ bool isInterceptor,
75
+ address initialOwner,
76
+ bytes memory data
77
+ )
78
+ public
79
+ virtual
80
+ onlyInitializing()
81
+ {
82
+ ComponentStorage storage $ = _getComponentStorage();
83
+ initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
84
+
85
+ // set unique name of component
86
+ $._name = name;
87
+ $._isNftInterceptor = isInterceptor;
88
+
89
+ // set and check linked instance
90
+ IRegistry.ObjectInfo memory instanceInfo = getRegistry().getObjectInfo(instanceNftId);
91
+ $._instance = IInstance(instanceInfo.objectAddress);
92
+ if(!$._instance.supportsInterface(type(IInstance).interfaceId)) {
93
+ revert ErrorComponentNotInstance(instanceNftId, instanceInfo.objectAddress);
94
+ }
95
+
96
+ // initialize AccessManagedUpgradeable
97
+ __AccessManaged_init($._instance.authority());
98
+
99
+ // set linked services
100
+ VersionPart gifVersion = $._instance.getMajorVersion();
101
+ $._instanceService = IInstanceService(getRegistry().getServiceAddress(INSTANCE(), gifVersion));
102
+ $._instanceReader = $._instance.getInstanceReader();
103
+ $._productService = IProductService(getRegistry().getServiceAddress(PRODUCT(), gifVersion));
104
+
105
+ // set wallet and token
106
+ $._wallet = address(this);
107
+ $._token = IERC20Metadata(token);
108
+
109
+ registerInterface(type(IComponent).interfaceId);
110
+ }
111
+
112
+ /// @dev callback function for nft transfers. may only be called by chain nft contract.
113
+ /// default implementation is empty. overriding functions MUST add onlyChainNft modifier
114
+ function nftTransferFrom(address from, address to, uint256 tokenId)
115
+ external
116
+ virtual override
117
+ onlyChainNft()
118
+ { }
119
+
120
+ // TODO discuss replacement with modifier restricted from accessmanaged
121
+ function lock() external onlyOwner override {
122
+ _getComponentStorage()._instanceService.setTargetLocked(getName(), true);
123
+ }
124
+
125
+ function unlock() external onlyOwner override {
126
+ _getComponentStorage()._instanceService.setTargetLocked(getName(), false);
127
+ }
128
+
129
+ // only product service may set product nft id during registration of product setup
130
+ function setProductNftId(NftId productNftId)
131
+ external
132
+ override
133
+ onlyProductService()
134
+ {
135
+ ComponentStorage storage $ = _getComponentStorage();
136
+
137
+ if($._productNftId.gtz()) {
138
+ revert ErrorComponentProductNftAlreadySet();
139
+ }
140
+
141
+ $._productNftId = productNftId;
142
+ }
143
+
144
+ /// @dev Sets the wallet address for the component.
145
+ /// if the current wallet has tokens, these will be transferred.
146
+ /// if the new wallet address is externally owned, an approval from the
147
+ /// owner of the external wallet for the component to move all tokens must exist.
148
+ function setWallet(address newWallet)
149
+ external
150
+ override
151
+ onlyOwner
152
+ {
153
+ ComponentStorage storage $ = _getComponentStorage();
154
+
155
+ address currentWallet = $._wallet;
156
+ uint256 currentBalance = $._token.balanceOf(currentWallet);
157
+
158
+ // checks
159
+ if (newWallet == address(0)) {
160
+ revert ErrorComponentWalletAddressZero();
161
+ }
162
+ if (newWallet == currentWallet) {
163
+ revert ErrorComponentWalletAddressIsSameAsCurrent(newWallet);
164
+ }
165
+
166
+ if (currentBalance > 0) {
167
+ if (currentWallet == address(this)) {
168
+ // move tokens from component smart contract to external wallet
169
+ } else {
170
+ // move tokens from external wallet to component smart contract or another external wallet
171
+ uint256 allowance = $._token.allowance(currentWallet, address(this));
172
+ if (allowance < currentBalance) {
173
+ revert ErrorComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
174
+ }
175
+ }
176
+ }
177
+
178
+ // effects
179
+ $._wallet = newWallet;
180
+ emit LogComponentWalletAddressChanged(newWallet);
181
+
182
+ // interactions
183
+ if (currentBalance > 0) {
184
+ // transfer tokens from current wallet to new wallet
185
+ if (currentWallet == address(this)) {
186
+ // transferFrom requires self allowance too
187
+ $._token.approve(address(this), currentBalance);
188
+ }
189
+
190
+ SafeERC20.safeTransferFrom($._token, currentWallet, newWallet, currentBalance);
191
+ emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
192
+ }
193
+ }
194
+
195
+ function getWallet()
196
+ public
197
+ view
198
+ override
199
+ returns (address walletAddress)
200
+ {
201
+ return _getComponentStorage()._wallet;
202
+ }
203
+
204
+ function getToken() public view override returns (IERC20Metadata token) {
205
+ return _getComponentStorage()._token;
206
+ }
207
+
208
+ function isNftInterceptor() public view override returns(bool isInterceptor) {
209
+ return _getComponentStorage()._isNftInterceptor;
210
+ }
211
+
212
+ function getInstance() public view override returns (IInstance instance) {
213
+ return _getComponentStorage()._instance;
214
+ }
215
+
216
+ function getInstanceReader() public view returns (InstanceReader reader) {
217
+ return _getComponentStorage()._instanceReader;
218
+ }
219
+
220
+ function getName() public view override returns(string memory name) {
221
+ return _getComponentStorage()._name;
222
+ }
223
+
224
+ function getProductNftId() public view override returns (NftId productNftId) {
225
+ return _getComponentStorage()._productNftId;
226
+ }
227
+
228
+ function getInstanceService() public view returns (IInstanceService) {
229
+ return _getComponentStorage()._instanceService;
230
+ }
231
+
232
+ function getProductService() public view returns (IProductService) {
233
+ return _getComponentStorage()._productService;
234
+ }
235
+
236
+ }
@@ -4,10 +4,10 @@ pragma solidity ^0.8.19;
4
4
  import {DISTRIBUTION} from "../types/ObjectType.sol";
5
5
  import {IDistributionService} from "../instance/service/IDistributionService.sol";
6
6
  import {IProductService} from "../instance/service/IProductService.sol";
7
- import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
8
- import {ReferralId} from "../types/Referral.sol";
7
+ import {NftId, zeroNftId, NftIdLib, toNftId} from "../types/NftId.sol";
8
+ import {ReferralId, ReferralStatus, ReferralLib} from "../types/Referral.sol";
9
9
  import {Fee, FeeLib} from "../types/Fee.sol";
10
- import {BaseComponent} from "./BaseComponent.sol";
10
+ import {Component} from "./Component.sol";
11
11
  import {IDistributionComponent} from "./IDistributionComponent.sol";
12
12
  import {IRegistry} from "../registry/IRegistry.sol";
13
13
  import {IRegisterable} from "../shared/IRegisterable.sol";
@@ -15,58 +15,152 @@ import {ISetup} from "../instance/module/ISetup.sol";
15
15
  import {Registerable} from "../shared/Registerable.sol";
16
16
  import {TokenHandler} from "../shared/TokenHandler.sol";
17
17
  import {InstanceReader} from "../instance/InstanceReader.sol";
18
+ import {UFixed} from "../types/UFixed.sol";
19
+ import {DistributorType} from "../types/DistributorType.sol";
20
+ import {Timestamp} from "../types/Timestamp.sol";
21
+ import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
18
22
 
19
- contract Distribution is
20
- BaseComponent,
23
+
24
+ abstract contract Distribution is
25
+ Component,
21
26
  IDistributionComponent
22
27
  {
23
- using NftIdLib for NftId;
24
-
25
- Fee internal _initialDistributionFee;
26
- bool internal _isVerifying;
27
-
28
- TokenHandler internal _tokenHandler;
29
-
30
- IDistributionService private _distributionService;
31
- IProductService private _productService;
28
+ // keccak256(abi.encode(uint256(keccak256("etherisc.storage.Distribution")) - 1)) & ~bytes32(uint256(0xff));
29
+ bytes32 public constant DISTRIBUTION_STORAGE_LOCATION_V1 = 0xaab7c5ea03d290056d6c060e0833d3ebcbe647f7694616a2ec52738a64b2f900;
32
30
 
33
- modifier onlyProductService() {
34
- require(
35
- msg.sender == address(_productService),
36
- "ERROR:POL-002:NOT_PRODUCT_SERVICE");
37
- _;
31
+ struct DistributionStorage {
32
+ Fee _distributionFee;
33
+ TokenHandler _tokenHandler;
34
+ IDistributionService _distributionService;
35
+ mapping(address distributor => NftId distributorNftId) _distributorNftId;
38
36
  }
39
37
 
40
- constructor(
38
+ function initializeDistribution(
41
39
  address registry,
42
40
  NftId instanceNftId,
43
- // TODO refactor into tokenNftId
41
+ string memory name,
44
42
  address token,
45
- bool verifying,
46
43
  Fee memory distributionFee,
47
- address initialOwner
44
+ address initialOwner,
45
+ bytes memory data
48
46
  )
49
- BaseComponent(registry, instanceNftId, token, DISTRIBUTION(), true, initialOwner)
47
+ public
48
+ virtual
49
+ onlyInitializing()
50
50
  {
51
- _isVerifying = verifying;
52
- _initialDistributionFee = distributionFee;
51
+ initializeComponent(registry, instanceNftId, name, token, DISTRIBUTION(), true, initialOwner, data);
53
52
 
54
- _tokenHandler = TokenHandler(token);
53
+ DistributionStorage storage $ = _getDistributionStorage();
54
+ // TODO add validation
55
+ $._distributionFee = distributionFee;
56
+ $._tokenHandler = new TokenHandler(token);
57
+ $._distributionService = getInstance().getDistributionService();
55
58
 
56
- _distributionService = _instance.getDistributionService();
57
- _productService = _instance.getProductService();
58
-
59
- _registerInterface(type(IDistributionComponent).interfaceId);
59
+ registerInterface(type(IDistributionComponent).interfaceId);
60
60
  }
61
61
 
62
-
63
62
  function setFees(
64
63
  Fee memory distributionFee
65
64
  )
66
65
  external
67
66
  override
67
+ onlyOwner
68
+ restricted()
69
+ {
70
+ _getDistributionStorage()._distributionService.setFees(distributionFee);
71
+ }
72
+
73
+ function getDistributionFee() external view returns (Fee memory distributionFee) {
74
+ DistributionStorage storage $ = _getDistributionStorage();
75
+ return $._distributionFee;
76
+ }
77
+
78
+ function createDistributorType(
79
+ string memory name,
80
+ UFixed minDiscountPercentage,
81
+ UFixed maxDiscountPercentage,
82
+ UFixed commissionPercentage,
83
+ uint32 maxReferralCount,
84
+ uint32 maxReferralLifetime,
85
+ bool allowSelfReferrals,
86
+ bool allowRenewals,
87
+ bytes memory data
88
+ )
89
+ public
90
+ returns (DistributorType distributorType)
91
+ {
92
+ DistributionStorage storage $ = _getDistributionStorage();
93
+ distributorType = $._distributionService.createDistributorType(
94
+ name,
95
+ minDiscountPercentage,
96
+ maxDiscountPercentage,
97
+ commissionPercentage,
98
+ maxReferralCount,
99
+ maxReferralLifetime,
100
+ allowSelfReferrals,
101
+ allowRenewals,
102
+ data);
103
+ }
104
+
105
+ function createDistributor(
106
+ address distributor,
107
+ DistributorType distributorType,
108
+ bytes memory data
109
+ )
110
+ public
111
+ returns(NftId distributorNftId)
112
+ {
113
+ DistributionStorage storage $ = _getDistributionStorage();
114
+ require($._distributorNftId[distributor].eqz(), "ERROR:DST-030:ALREADY_DISTRIBUTOR");
115
+
116
+ distributorNftId = $._distributionService.createDistributor(
117
+ distributor,
118
+ distributorType,
119
+ data);
120
+
121
+ $._distributorNftId[distributor] = distributorNftId;
122
+ }
123
+
124
+ function updateDistributorType(
125
+ NftId distributorNftId,
126
+ DistributorType distributorType,
127
+ bytes memory data
128
+ )
129
+ public
130
+ // TODO figure out what we need for authz
131
+ // and add it
68
132
  {
69
- _distributionService.setFees(distributionFee);
133
+ DistributionStorage storage $ = _getDistributionStorage();
134
+ $._distributionService.updateDistributorType(
135
+ distributorNftId,
136
+ distributorType,
137
+ data);
138
+ }
139
+
140
+ /**
141
+ * @dev lets distributors create referral codes.
142
+ * referral codes need to be unique
143
+ */
144
+ function createReferral(
145
+ NftId distributorNftId,
146
+ string memory code,
147
+ UFixed discountPercentage,
148
+ uint32 maxReferrals,
149
+ Timestamp expiryAt,
150
+ bytes memory data
151
+ )
152
+ public
153
+ // TODO add authz (only active distributor)
154
+ returns (ReferralId referralId)
155
+ {
156
+ DistributionStorage storage $ = _getDistributionStorage();
157
+ referralId = $._distributionService.createReferral(
158
+ distributorNftId,
159
+ code,
160
+ discountPercentage,
161
+ maxReferrals,
162
+ expiryAt,
163
+ data);
70
164
  }
71
165
 
72
166
  function calculateFeeAmount(
@@ -81,9 +175,53 @@ contract Distribution is
81
175
  ISetup.DistributionSetupInfo memory setupInfo = getSetupInfo();
82
176
  Fee memory fee = setupInfo.distributionFee;
83
177
  (feeAmount,) = FeeLib.calculateFee(fee, netPremiumAmount);
178
+ // TODO: use this?
179
+ // return _distributionService.calculateFeeAmount(referralId, premiumAmount);
180
+ }
181
+
182
+ function isDistributor(address candidate)
183
+ public
184
+ view
185
+ returns (bool)
186
+ {
187
+ DistributionStorage storage $ = _getDistributionStorage();
188
+ return $._distributorNftId[candidate].gtz();
189
+ }
190
+
191
+ function getDistributorNftId(address distributor)
192
+ public
193
+ view
194
+ returns (NftId distributorNftId)
195
+ {
196
+ DistributionStorage storage $ = _getDistributionStorage();
197
+ return $._distributorNftId[distributor];
198
+ }
199
+
200
+ function getDiscountPercentage(string memory referralCode)
201
+ external
202
+ view
203
+ returns (
204
+ UFixed discountPercentage,
205
+ ReferralStatus status
206
+ )
207
+ {
208
+ ReferralId referralId = getReferralId(referralCode);
209
+ return getInstanceReader().getDiscountPercentage(referralId);
84
210
  }
85
211
 
86
212
 
213
+ function getReferralId(
214
+ string memory referralCode
215
+ )
216
+ public
217
+ view
218
+ returns (ReferralId referralId)
219
+ {
220
+ return ReferralLib.toReferralId(
221
+ getNftId(),
222
+ referralCode);
223
+ }
224
+
87
225
  function calculateRenewalFeeAmount(
88
226
  ReferralId referralId,
89
227
  uint256 netPremiumAmount
@@ -99,13 +237,15 @@ contract Distribution is
99
237
 
100
238
  function processSale(
101
239
  ReferralId referralId,
102
- uint256 feeAmount
240
+ uint256 premiumAmount
103
241
  )
104
242
  external
105
- onlyProductService
243
+ onlyOwner
244
+ restricted()
106
245
  virtual override
107
246
  {
108
- // default is no action
247
+ DistributionStorage storage $ = _getDistributionStorage();
248
+ $._distributionService.processSale(referralId, premiumAmount);
109
249
  }
110
250
 
111
251
  function processRenewal(
@@ -113,7 +253,8 @@ contract Distribution is
113
253
  uint256 feeAmount
114
254
  )
115
255
  external
116
- onlyProductService
256
+ onlyOwner
257
+ restricted()
117
258
  virtual override
118
259
  {
119
260
  // default is no action
@@ -125,39 +266,43 @@ contract Distribution is
125
266
  }
126
267
 
127
268
  function getSetupInfo() public view returns (ISetup.DistributionSetupInfo memory setupInfo) {
128
- InstanceReader reader = _instance.getInstanceReader();
129
- return reader.getDistributionSetupInfo(getNftId());
269
+ InstanceReader reader = getInstance().getInstanceReader();
270
+ setupInfo = reader.getDistributionSetupInfo(getNftId());
271
+
272
+ // fallback to initial setup info (wallet is always != address(0))
273
+ if(setupInfo.wallet == address(0)) {
274
+ setupInfo = _getInitialSetupInfo();
275
+ }
276
+ }
277
+
278
+ function _getInitialSetupInfo() internal view returns (ISetup.DistributionSetupInfo memory setupInfo) {
279
+ DistributionStorage storage $ = _getDistributionStorage();
280
+ return ISetup.DistributionSetupInfo(
281
+ zeroNftId(),
282
+ $._tokenHandler,
283
+ $._distributionFee,
284
+ address(this)
285
+ );
286
+ }
287
+
288
+
289
+ function nftTransferFrom(address from, address to, uint256 tokenId) external virtual override (Component, ITransferInterceptor) {
290
+ // keep track of distributor nft owner
291
+ emit LogDistributorUpdated(to, msg.sender);
292
+ DistributionStorage storage $ = _getDistributionStorage();
293
+ $._distributorNftId[from] = zeroNftId();
294
+ $._distributorNftId[to] = toNftId(tokenId);
130
295
  }
131
296
 
132
297
 
133
298
  /// @dev returns true iff the component needs to be called when selling/renewing policis
134
299
  function isVerifying() external view returns (bool verifying) {
135
- return _isVerifying;
300
+ return true;
136
301
  }
137
302
 
138
- // from IRegisterable
139
-
140
- function getInitialInfo()
141
- public
142
- view
143
- override (IRegisterable, Registerable)
144
- returns(IRegistry.ObjectInfo memory, bytes memory)
145
- {
146
- (
147
- IRegistry.ObjectInfo memory info,
148
- ) = super.getInitialInfo();
149
-
150
- return (
151
- info,
152
- abi.encode(
153
- ISetup.DistributionSetupInfo(
154
- _productNftId,
155
- _tokenHandler,
156
- _initialDistributionFee,
157
- _isVerifying,
158
- address(this)
159
- )
160
- )
161
- );
303
+ function _getDistributionStorage() private pure returns (DistributionStorage storage $) {
304
+ assembly {
305
+ $.slot := DISTRIBUTION_STORAGE_LOCATION_V1
306
+ }
162
307
  }
163
308
  }
@@ -0,0 +1,50 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
+
6
+ import {IRegisterable} from "../shared/IRegisterable.sol";
7
+ import {IInstance} from "../instance/IInstance.sol";
8
+ import {IInstanceService} from "../instance/IInstanceService.sol";
9
+ import {IProductService} from "../instance/service/IProductService.sol";
10
+ import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
11
+ import {NftId} from "../types/NftId.sol";
12
+
13
+ interface IComponent is
14
+ IRegisterable,
15
+ ITransferInterceptor
16
+ {
17
+
18
+ error ErrorComponentNotChainNft(address caller);
19
+ error ErrorComponentNotProductService(address caller);
20
+ error ErrorComponentNotInstance(NftId instanceNftId, address instance);
21
+ error ErrorComponentProductNftAlreadySet();
22
+ error ErrorComponentWalletAddressZero();
23
+ error ErrorComponentWalletAddressIsSameAsCurrent(address newWallet);
24
+ error ErrorComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
25
+ error ErrorComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
26
+
27
+ event LogComponentWalletAddressChanged(address newWallet);
28
+ event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
29
+
30
+ function getName() external view returns (string memory name);
31
+
32
+ // TODO remove and replace with accessmanaged target locking mechanism
33
+ function lock() external;
34
+ function unlock() external;
35
+
36
+ function getToken() external view returns (IERC20Metadata token);
37
+
38
+ function setWallet(address walletAddress) external;
39
+ function getWallet() external view returns (address walletAddress);
40
+
41
+ function isNftInterceptor() external view returns(bool isInterceptor);
42
+
43
+ function getInstance() external view returns (IInstance instance);
44
+
45
+ function setProductNftId(NftId productNftId) external;
46
+ function getProductNftId() external view returns (NftId productNftId);
47
+
48
+ function getInstanceService() external view returns (IInstanceService);
49
+ function getProductService() external view returns (IProductService);
50
+ }