@etherisc/gif-next 0.0.2-bad23b9-954 → 0.0.2-baec8d5-329

Sign up to get free protection for your applications and to get access to all the features.
Files changed (444) hide show
  1. package/README.md +30 -2
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +4 -0
  3. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +1253 -0
  4. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +4 -0
  5. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +1206 -0
  6. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +4 -0
  7. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +358 -0
  8. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +4 -0
  9. package/artifacts/contracts/authorization/IAccess.sol/IAccess.json +10 -0
  10. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +4 -0
  11. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +1032 -0
  12. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +4 -0
  13. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +258 -0
  14. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +4 -0
  15. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.json +290 -0
  16. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +4 -0
  17. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +148 -0
  18. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +4 -0
  19. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +390 -0
  20. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +4 -0
  21. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +190 -0
  22. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +4 -0
  23. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +1548 -0
  24. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +4 -0
  25. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +410 -0
  26. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  27. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +46 -228
  28. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  29. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +306 -95
  30. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  31. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +97 -57
  32. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  33. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +100 -132
  34. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  35. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +147 -16
  36. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +4 -0
  37. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +703 -0
  38. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  39. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +64 -84
  40. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  41. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +152 -45
  42. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  43. package/artifacts/contracts/instance/Instance.sol/Instance.json +78 -146
  44. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  45. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +1208 -290
  46. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +4 -0
  47. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +601 -0
  48. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +110 -76
  50. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +215 -108
  52. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  53. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +49 -49
  54. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  55. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +84 -135
  56. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  57. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  58. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  59. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.json +0 -53
  60. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  61. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  62. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +4 -0
  63. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +182 -0
  64. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +4 -0
  65. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +181 -0
  66. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  68. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.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/mock/Dip.sol/Dip.dbg.json +1 -1
  73. package/artifacts/contracts/mock/Dip.sol/Dip.json +2 -2
  74. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +4 -0
  75. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +1185 -0
  76. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +4 -0
  77. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +418 -0
  78. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  79. package/artifacts/contracts/oracle/IOracle.sol/IOracle.json +43 -1
  80. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  81. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +43 -0
  82. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  83. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +13 -0
  84. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  85. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +43 -96
  86. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  87. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +66 -29
  88. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  89. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +44 -32
  90. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +4 -0
  91. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +1520 -0
  92. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +4 -0
  93. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +410 -0
  94. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  95. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +254 -59
  96. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  97. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +82 -42
  98. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  99. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +115 -0
  100. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  101. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +43 -195
  102. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  103. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +13 -0
  104. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  105. package/artifacts/contracts/pool/Pool.sol/Pool.json +43 -296
  106. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  107. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +62 -41
  108. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  109. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +42 -38
  110. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  111. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +66 -37
  112. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  113. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +44 -36
  114. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +4 -0
  115. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +1318 -0
  116. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +4 -0
  117. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +410 -0
  118. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  119. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +106 -69
  120. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  121. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +64 -52
  122. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  123. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +13 -0
  124. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  125. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +13 -0
  126. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  127. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +13 -0
  128. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  129. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +13 -0
  130. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  131. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +32 -42
  132. package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +1 -1
  133. package/artifacts/contracts/product/IProductService.sol/IProductService.json +13 -0
  134. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  135. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +84 -47
  136. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  137. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +53 -41
  138. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  139. package/artifacts/contracts/product/PricingService.sol/PricingService.json +92 -63
  140. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  141. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +57 -49
  142. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  143. package/artifacts/contracts/product/Product.sol/Product.json +32 -153
  144. package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +1 -1
  145. package/artifacts/contracts/product/ProductService.sol/ProductService.json +54 -25
  146. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  147. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +38 -30
  148. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  149. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  150. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  151. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +50 -46
  152. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  153. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +13 -183
  154. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  155. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  156. package/artifacts/contracts/registry/Registry.sol/Registry.json +101 -73
  157. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  158. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +1506 -167
  159. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  160. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +50 -13
  161. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  162. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +37 -25
  163. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +4 -0
  164. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +164 -0
  165. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +4 -0
  166. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +1159 -0
  167. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +4 -0
  168. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +214 -0
  169. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  170. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +4 -4
  171. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  172. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  173. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +235 -85
  174. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  175. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +80 -60
  176. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  177. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +13 -0
  178. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  179. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
  180. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  181. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  182. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +110 -0
  183. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  184. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +32 -0
  185. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  186. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +11 -5
  187. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  188. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +0 -5
  189. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  190. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  191. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  192. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  193. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  194. package/artifacts/contracts/shared/IService.sol/IService.json +13 -0
  195. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +1 -1
  196. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  197. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +32 -53
  198. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  199. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +15 -89
  200. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  201. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +4 -65
  202. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +4 -0
  203. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +306 -0
  204. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  205. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +6 -6
  206. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  207. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +6 -6
  208. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  209. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +8 -8
  210. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  211. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  212. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  213. package/artifacts/contracts/shared/Service.sol/Service.json +13 -0
  214. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  215. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +6 -6
  216. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  217. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  218. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +49 -7
  219. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  220. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +44 -28
  221. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  222. package/artifacts/contracts/staking/Staking.sol/Staking.json +44 -84
  223. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +4 -0
  224. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +164 -0
  225. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  226. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +40 -56
  227. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  228. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +6 -6
  229. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  230. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +92 -73
  231. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  232. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +39 -47
  233. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  234. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +200 -152
  235. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  236. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +22 -22
  237. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  238. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.json +2 -2
  239. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  240. package/artifacts/contracts/type/Amount.sol/AmountLib.json +32 -8
  241. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  242. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +2 -2
  243. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  244. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +4 -4
  245. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  246. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +4 -4
  247. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  248. package/artifacts/contracts/type/Fee.sol/FeeLib.json +12 -12
  249. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  250. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  251. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  252. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +4 -4
  253. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  254. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  255. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  256. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +136 -2
  257. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  258. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +4 -4
  259. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  260. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +4 -4
  261. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  262. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +4 -4
  263. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  264. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +4 -4
  265. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  266. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +219 -6
  267. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  268. package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +2 -2
  269. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +4 -0
  270. package/artifacts/contracts/type/Selector.sol/SelectorLib.json +129 -0
  271. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +4 -0
  272. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +10 -0
  273. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  274. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -2
  275. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +4 -0
  276. package/artifacts/contracts/type/String.sol/StrLib.json +132 -0
  277. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  278. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +4 -4
  279. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/UFixed.sol/MathLib.json +2 -2
  281. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  282. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +21 -2
  283. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  284. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
  285. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  286. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +21 -2
  287. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +4 -0
  288. package/artifacts/contracts/{shared → upgradeability}/IVersionable.sol/IVersionable.json +1 -1
  289. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +4 -0
  290. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +617 -0
  291. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
  292. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
  293. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +4 -0
  294. package/artifacts/contracts/{shared → upgradeability}/Versionable.sol/Versionable.json +1 -1
  295. package/contracts/authorization/AccessAdmin.sol +591 -0
  296. package/contracts/authorization/AccessManagerCloneable.sol +16 -0
  297. package/contracts/authorization/Authorization.sol +218 -0
  298. package/contracts/authorization/IAccess.sol +48 -0
  299. package/contracts/authorization/IAccessAdmin.sol +136 -0
  300. package/contracts/authorization/IAuthorization.sol +54 -0
  301. package/contracts/authorization/IModuleAuthorization.sol +21 -0
  302. package/contracts/authorization/IServiceAuthorization.sol +38 -0
  303. package/contracts/authorization/ModuleAuthorization.sol +78 -0
  304. package/contracts/authorization/ServiceAuthorization.sol +90 -0
  305. package/contracts/distribution/BasicDistribution.sol +149 -0
  306. package/contracts/distribution/BasicDistributionAuthorization.sol +47 -0
  307. package/contracts/distribution/Distribution.sol +142 -102
  308. package/contracts/distribution/DistributionService.sol +73 -26
  309. package/contracts/distribution/DistributionServiceManager.sol +2 -5
  310. package/contracts/distribution/IDistributionComponent.sol +25 -39
  311. package/contracts/distribution/IDistributionService.sol +17 -1
  312. package/contracts/instance/{BundleManager.sol → BundleSet.sol} +23 -23
  313. package/contracts/instance/IInstance.sol +16 -12
  314. package/contracts/instance/IInstanceService.sol +34 -23
  315. package/contracts/instance/Instance.sol +106 -88
  316. package/contracts/instance/InstanceAdmin.sol +202 -267
  317. package/contracts/instance/InstanceAuthorizationV3.sol +204 -0
  318. package/contracts/instance/InstanceReader.sol +24 -9
  319. package/contracts/instance/InstanceService.sol +159 -78
  320. package/contracts/instance/InstanceServiceManager.sol +2 -6
  321. package/contracts/instance/InstanceStore.sol +15 -20
  322. package/contracts/instance/base/BalanceStore.sol +11 -6
  323. package/contracts/instance/base/Cloneable.sol +2 -25
  324. package/contracts/instance/base/ObjectLifecycle.sol +106 -0
  325. package/contracts/instance/base/{ObjectManager.sol → ObjectSet.sol} +11 -14
  326. package/contracts/instance/module/IComponents.sol +0 -1
  327. package/contracts/oracle/BasicOracle.sol +48 -0
  328. package/contracts/oracle/BasicOracleAuthorization.sol +46 -0
  329. package/contracts/oracle/IOracle.sol +16 -0
  330. package/contracts/oracle/IOracleComponent.sol +2 -1
  331. package/contracts/oracle/Oracle.sol +72 -47
  332. package/contracts/oracle/OracleService.sol +5 -4
  333. package/contracts/oracle/OracleServiceManager.sol +2 -5
  334. package/contracts/pool/BasicPool.sol +164 -0
  335. package/contracts/pool/BasicPoolAuthorization.sol +55 -0
  336. package/contracts/pool/BundleService.sol +89 -43
  337. package/contracts/pool/BundleServiceManager.sol +2 -5
  338. package/contracts/pool/IBundleService.sol +14 -0
  339. package/contracts/pool/IPoolComponent.sol +6 -60
  340. package/contracts/pool/Pool.sol +160 -131
  341. package/contracts/pool/PoolService.sol +17 -34
  342. package/contracts/pool/PoolServiceManager.sol +2 -5
  343. package/contracts/product/ApplicationService.sol +17 -41
  344. package/contracts/product/ApplicationServiceManager.sol +2 -2
  345. package/contracts/product/BasicProduct.sol +82 -0
  346. package/contracts/product/BasicProductAuthorization.sol +43 -0
  347. package/contracts/product/ClaimService.sol +10 -36
  348. package/contracts/product/ClaimServiceManager.sol +2 -2
  349. package/contracts/product/IProductComponent.sol +7 -9
  350. package/contracts/product/PolicyService.sol +5 -5
  351. package/contracts/product/PolicyServiceManager.sol +2 -5
  352. package/contracts/product/PricingService.sol +4 -5
  353. package/contracts/product/PricingServiceManager.sol +2 -5
  354. package/contracts/product/Product.sol +103 -88
  355. package/contracts/product/ProductService.sol +12 -37
  356. package/contracts/product/ProductServiceManager.sol +2 -5
  357. package/contracts/registry/IRegistry.sol +26 -16
  358. package/contracts/registry/IRegistryService.sol +6 -6
  359. package/contracts/registry/Registry.sol +85 -85
  360. package/contracts/registry/RegistryAdmin.sol +283 -155
  361. package/contracts/registry/RegistryService.sol +9 -23
  362. package/contracts/registry/RegistryServiceManager.sol +2 -7
  363. package/contracts/registry/ReleaseLifecycle.sol +27 -0
  364. package/contracts/registry/ReleaseRegistry.sol +487 -0
  365. package/contracts/registry/ServiceAuthorizationV3.sol +200 -0
  366. package/contracts/registry/TokenRegistry.sol +2 -2
  367. package/contracts/shared/Component.sol +13 -14
  368. package/contracts/shared/ComponentService.sol +76 -72
  369. package/contracts/shared/ComponentServiceManager.sol +2 -2
  370. package/contracts/shared/ComponentVerifyingService.sol +1 -1
  371. package/contracts/shared/IComponentService.sol +10 -0
  372. package/contracts/shared/IInstanceLinkedComponent.sol +10 -0
  373. package/contracts/shared/IKeyValueStore.sol +1 -0
  374. package/contracts/shared/ILifecycle.sol +1 -2
  375. package/contracts/shared/IService.sol +8 -1
  376. package/contracts/shared/InstanceLinkedComponent.sol +47 -19
  377. package/contracts/shared/KeyValueStore.sol +6 -2
  378. package/contracts/shared/Lifecycle.sol +16 -69
  379. package/contracts/shared/{NftIdSetManager.sol → NftIdSet.sol} +1 -1
  380. package/contracts/shared/Service.sol +27 -22
  381. package/contracts/staking/IStaking.sol +1 -2
  382. package/contracts/staking/IStakingService.sol +22 -11
  383. package/contracts/staking/StakeManagerLib.sol +52 -0
  384. package/contracts/staking/Staking.sol +75 -112
  385. package/contracts/staking/StakingLifecycle.sol +23 -0
  386. package/contracts/staking/StakingManager.sol +2 -6
  387. package/contracts/staking/StakingReader.sol +12 -16
  388. package/contracts/staking/StakingService.sol +61 -56
  389. package/contracts/staking/StakingServiceManager.sol +2 -3
  390. package/contracts/staking/StakingStore.sol +93 -60
  391. package/contracts/type/Amount.sol +7 -2
  392. package/contracts/type/ObjectType.sol +167 -64
  393. package/contracts/type/RoleId.sol +103 -75
  394. package/contracts/type/Selector.sol +102 -0
  395. package/contracts/type/String.sol +53 -0
  396. package/contracts/type/UFixed.sol +6 -0
  397. package/contracts/type/Version.sol +3 -1
  398. package/contracts/{shared → upgradeability}/ProxyManager.sol +3 -4
  399. package/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol +1 -3
  400. package/package.json +6 -3
  401. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +0 -4
  402. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +0 -778
  403. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +0 -4
  404. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +0 -228
  405. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +0 -4
  406. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +0 -256
  407. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +0 -4
  408. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +0 -1292
  409. package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.dbg.json +0 -4
  410. package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.json +0 -137
  411. package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.dbg.json +0 -4
  412. package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.json +0 -1193
  413. package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.dbg.json +0 -4
  414. package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.json +0 -1715
  415. package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.dbg.json +0 -4
  416. package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.json +0 -1728
  417. package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.dbg.json +0 -4
  418. package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.json +0 -1806
  419. package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +0 -4
  420. package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +0 -1824
  421. package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.dbg.json +0 -4
  422. package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.json +0 -1562
  423. package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.dbg.json +0 -4
  424. package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.json +0 -1600
  425. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +0 -4
  426. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.dbg.json +0 -4
  427. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.json +0 -306
  428. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +0 -4
  429. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +0 -617
  430. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +0 -4
  431. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +0 -129
  432. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +0 -4
  433. package/contracts/instance/InstanceAuthorizationsLib.sol +0 -377
  434. package/contracts/registry/ReleaseManager.sol +0 -600
  435. package/contracts/registry/ServiceAuthorizationsLib.sol +0 -173
  436. package/contracts/shared/AccessManagerCustom.sol +0 -736
  437. package/contracts/shared/AccessManagerExtended.sol +0 -470
  438. package/contracts/shared/AccessManagerExtendedInitializeable.sol +0 -13
  439. package/contracts/shared/AccessManagerExtendedWithDisable.sol +0 -137
  440. package/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol +0 -14
  441. package/contracts/shared/IAccessManagerExtended.sol +0 -74
  442. package/contracts/shared/IAccessManagerExtendedWithDisable.sol +0 -18
  443. /package/contracts/{shared → upgradeability}/IVersionable.sol +0 -0
  444. /package/contracts/{shared → upgradeability}/Versionable.sol +0 -0
@@ -12,7 +12,7 @@ import {IRegisterable} from "../shared/IRegisterable.sol";
12
12
 
13
13
  import {IRegistry} from "./IRegistry.sol";
14
14
  import {IRegistryLinked} from "../shared/IRegistryLinked.sol";
15
- import {ReleaseManager} from "./ReleaseManager.sol";
15
+ import {ReleaseRegistry} from "./ReleaseRegistry.sol";
16
16
  import {RegistryAdmin} from "./RegistryAdmin.sol";
17
17
 
18
18
 
@@ -49,7 +49,7 @@ contract TokenRegistry is
49
49
  TokenInfo [] internal _token;
50
50
 
51
51
  IRegistry internal _registry;
52
- ReleaseManager internal _releaseManager;
52
+ ReleaseRegistry internal _releaseRegistry;
53
53
  IERC20Metadata internal _dipToken;
54
54
 
55
55
  /// @dev enforces msg.sender is owner of nft (or initial owner of nft ownable)
@@ -26,7 +26,6 @@ abstract contract Component is
26
26
  struct ComponentStorage {
27
27
  string _name; // unique (per instance) component name
28
28
  IERC20Metadata _token; // token for this component
29
- TokenHandler _tokenHandler;
30
29
  address _wallet;
31
30
  bool _isInterceptor;
32
31
  bytes _data;
@@ -40,6 +39,12 @@ abstract contract Component is
40
39
  _;
41
40
  }
42
41
 
42
+ modifier onlyNftOwner(NftId nftId) {
43
+ if(msg.sender != getRegistry().ownerOf(nftId)) {
44
+ revert ErrorNftOwnableNotOwner(msg.sender);
45
+ }
46
+ _;
47
+ }
43
48
 
44
49
  function _getComponentStorage() private pure returns (ComponentStorage storage $) {
45
50
  assembly {
@@ -78,7 +83,6 @@ abstract contract Component is
78
83
  ComponentStorage storage $ = _getComponentStorage();
79
84
  $._name = name;
80
85
  $._token = IERC20Metadata(token);
81
- $._tokenHandler = TokenHandler(address(0));
82
86
  $._wallet = address(this);
83
87
  $._isInterceptor = isInterceptor;
84
88
  $._data = componentData;
@@ -253,29 +257,24 @@ abstract contract Component is
253
257
  }
254
258
 
255
259
 
256
- /// @dev for component contracts that hold its own component information
257
- /// this function creates and sets a token hanlder for the components tokens
258
- function _createAndSetTokenHandler()
259
- internal
260
- {
261
- ComponentStorage storage $ = _getComponentStorage();
262
- $._tokenHandler = new TokenHandler(address($._token));
263
- }
264
-
265
-
266
260
  /// @dev depending on the source of the component information this function needs to be overwritten.
267
261
  /// eg for instance linked components that externally store this information with the instance store contract
268
262
  function _getComponentInfo() internal virtual view returns (IComponents.ComponentInfo memory info) {
269
263
  ComponentStorage storage $ = _getComponentStorage();
270
-
264
+
271
265
  return IComponents.ComponentInfo({
272
266
  name: $._name,
273
267
  productNftId: NftIdLib.zero(),
274
268
  token: $._token,
275
- tokenHandler: $._tokenHandler,
269
+ tokenHandler: TokenHandler(address(0)),
276
270
  wallet: $._wallet, // initial wallet address
277
271
  data: $._data // user specific component data
278
272
  });
279
273
  }
280
274
 
275
+ function _approveTokenHandler(uint256 amount) internal {
276
+ ComponentStorage storage $ = _getComponentStorage();
277
+ $._token.approve(address(getComponentInfo().tokenHandler), amount);
278
+ }
279
+
281
280
  }
@@ -1,32 +1,33 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
+
4
6
  import {Amount, AmountLib} from "../type/Amount.sol";
5
7
  import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
6
8
  import {Fee, FeeLib} from "../type/Fee.sol";
7
- import {IInstanceLinkedComponent} from "./IInstanceLinkedComponent.sol";
8
- import {IRegistry} from "../registry/IRegistry.sol";
9
- import {IRegistryService} from "../registry/IRegistryService.sol";
10
- import {IInstance} from "../instance/IInstance.sol";
11
- import {IAccess} from "../instance/module/IAccess.sol";
12
- import {NftId} from "../type/NftId.sol";
13
- import {ObjectType, REGISTRY, COMPONENT, DISTRIBUTION, INSTANCE, ORACLE, POOL, PRODUCT} from "../type/ObjectType.sol";
14
- import {RoleId, DISTRIBUTION_OWNER_ROLE, ORACLE_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE, POLICY_SERVICE_ROLE, PRODUCT_SERVICE_ROLE} from "../type/RoleId.sol";
15
- import {KEEP_STATE} from "../type/StateId.sol";
16
9
  import {IComponents} from "../instance/module/IComponents.sol";
17
10
  import {IComponentService} from "./IComponentService.sol";
18
- import {IDistributionComponent} from "../distribution/IDistributionComponent.sol";
11
+ import {IInstance} from "../instance/IInstance.sol";
12
+ import {IInstanceLinkedComponent} from "./IInstanceLinkedComponent.sol";
13
+ import {InstanceReader} from "../instance/InstanceReader.sol";
14
+ import {InstanceStore} from "../instance/InstanceStore.sol";
19
15
  import {IInstanceService} from "../instance/IInstanceService.sol";
20
16
  import {IPoolComponent} from "../pool/IPoolComponent.sol";
21
17
  import {IProductComponent} from "../product/IProductComponent.sol";
22
- import {InstanceReader} from "../instance/InstanceReader.sol";
23
- import {InstanceStore} from "../instance/InstanceStore.sol";
18
+ import {IRegistry} from "../registry/IRegistry.sol";
19
+ import {IRegistryService} from "../registry/IRegistryService.sol";
20
+ import {KEEP_STATE} from "../type/StateId.sol";
21
+ import {NftId} from "../type/NftId.sol";
22
+ import {ObjectType, REGISTRY, COMPONENT, DISTRIBUTION, INSTANCE, ORACLE, POOL, PRODUCT} from "../type/ObjectType.sol";
23
+ import {RoleId, DISTRIBUTION_OWNER_ROLE, ORACLE_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE} from "../type/RoleId.sol";
24
24
  import {TokenHandler} from "./TokenHandler.sol";
25
25
 
26
26
  contract ComponentService is
27
27
  ComponentVerifyingService,
28
28
  IComponentService
29
29
  {
30
+ using AmountLib for Amount;
30
31
 
31
32
  error ErrorComponentServiceAlreadyRegistered(address component);
32
33
  error ErrorComponentServiceNotComponent(address component);
@@ -64,11 +65,6 @@ contract ComponentService is
64
65
  registerInterface(type(IComponentService).interfaceId);
65
66
  }
66
67
 
67
-
68
- function getDomain() public pure virtual override returns(ObjectType) {
69
- return COMPONENT();
70
- }
71
-
72
68
  //-------- component ----------------------------------------------------//
73
69
 
74
70
  function setWallet(address newWallet) external virtual {
@@ -99,6 +95,46 @@ contract ComponentService is
99
95
  // TODO implement
100
96
  function unlock() external virtual {}
101
97
 
98
+ function withdrawFees(Amount amount)
99
+ external
100
+ virtual
101
+ returns (Amount withdrawnAmount)
102
+ {
103
+ (NftId componentNftId,, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
104
+ IComponents.ComponentInfo memory info = instance.getInstanceReader().getComponentInfo(componentNftId);
105
+ address componentWallet = info.wallet;
106
+
107
+ // determine withdrawn amount
108
+ withdrawnAmount = amount;
109
+ if (withdrawnAmount.gte(AmountLib.max())) {
110
+ withdrawnAmount = instance.getInstanceReader().getFeeAmount(componentNftId);
111
+ } else if (withdrawnAmount.eqz()) {
112
+ revert ErrorComponentServiceWithdrawAmountIsZero();
113
+ } else {
114
+ Amount withdrawLimit = instance.getInstanceReader().getFeeAmount(componentNftId);
115
+ if (withdrawnAmount.gt(withdrawLimit)) {
116
+ revert ErrorComponentServiceWithdrawAmountExceedsLimit(withdrawnAmount, withdrawLimit);
117
+ }
118
+ }
119
+
120
+ // check allowance
121
+ TokenHandler tokenHandler = info.tokenHandler;
122
+ IERC20Metadata token = IERC20Metadata(info.token);
123
+ uint256 tokenAllowance = token.allowance(componentWallet, address(tokenHandler));
124
+ if (tokenAllowance < withdrawnAmount.toInt()) {
125
+ revert ErrorComponentServiceWalletAllowanceTooSmall(componentWallet, address(tokenHandler), tokenAllowance, withdrawnAmount.toInt());
126
+ }
127
+
128
+ // decrease fee counters by withdrawnAmount
129
+ _changeTargetBalance(DECREASE, instance.getInstanceStore(), componentNftId, AmountLib.zero(), withdrawnAmount);
130
+
131
+ // transfer amount to component owner
132
+ address componentOwner = getRegistry().ownerOf(componentNftId);
133
+ tokenHandler.transfer(componentWallet, componentOwner, withdrawnAmount);
134
+
135
+ emit LogComponentServiceComponentFeesWithdrawn(componentNftId, componentOwner, address(token), withdrawnAmount);
136
+ }
137
+
102
138
 
103
139
  //-------- product ------------------------------------------------------//
104
140
 
@@ -107,12 +143,6 @@ contract ComponentService is
107
143
  virtual
108
144
  {
109
145
  address contractAddress = msg.sender;
110
- RoleId[] memory roles = new RoleId[](1);
111
- bytes4[][] memory selectors = new bytes4[][](1);
112
-
113
- // authorizaion for distribution owner
114
- roles[0] = PRODUCT_OWNER_ROLE();
115
- selectors[0] = _createSelectors(IProductComponent.setFees.selector);
116
146
 
117
147
  // register/create component setup
118
148
  (
@@ -122,9 +152,7 @@ contract ComponentService is
122
152
  ) = _register(
123
153
  contractAddress,
124
154
  PRODUCT(),
125
- PRODUCT_OWNER_ROLE(),
126
- roles,
127
- selectors);
155
+ PRODUCT_OWNER_ROLE());
128
156
 
129
157
  // create product info
130
158
  IComponents.ProductInfo memory productInfo = IProductComponent(contractAddress).getInitialProductInfo();
@@ -198,24 +226,12 @@ contract ComponentService is
198
226
  virtual
199
227
  {
200
228
  address contractAddress = msg.sender;
201
- RoleId[] memory roles = new RoleId[](2);
202
- bytes4[][] memory selectors = new bytes4[][](2);
203
-
204
- // authorizaion for distribution owner
205
- roles[0] = DISTRIBUTION_OWNER_ROLE();
206
- selectors[0] = _createSelectors(IDistributionComponent.setFees.selector);
207
-
208
- // authorizaion for product service
209
- roles[1] = PRODUCT_SERVICE_ROLE();
210
- selectors[1] = _createSelectors(IDistributionComponent.processRenewal.selector);
211
229
 
212
230
  // register/create component info
213
231
  _register(
214
232
  contractAddress,
215
233
  DISTRIBUTION(),
216
- DISTRIBUTION_OWNER_ROLE(),
217
- roles,
218
- selectors);
234
+ DISTRIBUTION_OWNER_ROLE());
219
235
  }
220
236
 
221
237
 
@@ -287,8 +303,6 @@ contract ComponentService is
287
303
  virtual
288
304
  {
289
305
  address contractAddress = msg.sender;
290
- RoleId[] memory roles = new RoleId[](0);
291
- bytes4[][] memory selectors = new bytes4[][](0);
292
306
 
293
307
  // register/create component setup
294
308
  (
@@ -298,9 +312,7 @@ contract ComponentService is
298
312
  ) = _register(
299
313
  contractAddress,
300
314
  ORACLE(),
301
- ORACLE_OWNER_ROLE(),
302
- roles,
303
- selectors);
315
+ ORACLE_OWNER_ROLE());
304
316
  }
305
317
 
306
318
  //-------- pool ---------------------------------------------------------//
@@ -310,16 +322,6 @@ contract ComponentService is
310
322
  virtual
311
323
  {
312
324
  address contractAddress = msg.sender;
313
- RoleId[] memory roles = new RoleId[](2);
314
- bytes4[][] memory selectors = new bytes4[][](2);
315
-
316
- // authorizaion for pool owner
317
- roles[0] = POOL_OWNER_ROLE();
318
- selectors[0] = _createSelectors(IPoolComponent.setFees.selector);
319
-
320
- // authorizaion for product service
321
- roles[1] = POLICY_SERVICE_ROLE();
322
- selectors[1] = _createSelectors(IPoolComponent.verifyApplication.selector);
323
325
 
324
326
  // register/create component setup
325
327
  (
@@ -329,14 +331,13 @@ contract ComponentService is
329
331
  ) = _register(
330
332
  contractAddress,
331
333
  POOL(),
332
- POOL_OWNER_ROLE(),
333
- roles,
334
- selectors);
334
+ POOL_OWNER_ROLE());
335
335
 
336
336
  // create info
337
337
  instanceStore.createPool(
338
338
  componentNftId,
339
- IPoolComponent(contractAddress).getInitialPoolInfo());
339
+ IPoolComponent(
340
+ contractAddress).getInitialPoolInfo());
340
341
  }
341
342
 
342
343
 
@@ -466,9 +467,7 @@ contract ComponentService is
466
467
  function _register(
467
468
  address componentAddress, // address of component to register
468
469
  ObjectType requiredType, // required type for component for registration
469
- RoleId requiredRole, // role required for comonent owner for registration
470
- RoleId[] memory roles, // roles with write access to component
471
- bytes4[][] memory selectors // authorized functions per role with write access
470
+ RoleId requiredRole // role required for comonent owner for registration
472
471
  )
473
472
  internal
474
473
  virtual
@@ -495,21 +494,23 @@ contract ComponentService is
495
494
 
496
495
  component.linkToRegisteredNftId();
497
496
 
497
+ // setup initial component authorization
498
+ _instanceService.initializeAuthorization(
499
+ instance.getNftId(),
500
+ component);
501
+
498
502
  // save amended component info with instance
499
503
  instanceReader = instance.getInstanceReader();
500
504
  instanceStore = instance.getInstanceStore();
501
505
 
502
506
  IComponents.ComponentInfo memory componentInfo = component.getComponentInfo();
503
507
  componentInfo.tokenHandler = new TokenHandler(address(componentInfo.token));
504
- instanceStore.createComponent(component.getNftId(), componentInfo);
505
-
506
- // configure instance authorization
507
- _instanceService.createComponentTarget(
508
- instance.getNftId(),
509
- componentAddress,
510
- component.getName(),
511
- selectors,
512
- roles);
508
+
509
+ instanceStore.createComponent(
510
+ component.getNftId(),
511
+ componentInfo);
512
+
513
+ // TODO add logging
513
514
  }
514
515
 
515
516
 
@@ -610,9 +611,12 @@ contract ComponentService is
610
611
  instance = _getInstance(info.parentNftId);
611
612
  owner = info.initialOwner;
612
613
 
613
- (bool hasRole,) = instance.getInstanceAccessManager().hasRole(requiredRole.toInt(), owner);
614
- if(!hasRole) {
614
+ if(!instance.getInstanceAdmin().hasRole(owner, requiredRole)) {
615
615
  revert ErrorComponentServiceExpectedRoleMissing(info.parentNftId, requiredRole, owner);
616
616
  }
617
617
  }
618
+
619
+ function _getDomain() internal pure virtual override returns(ObjectType) {
620
+ return COMPONENT();
621
+ }
618
622
  }
@@ -1,9 +1,9 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {IVersionable} from "./IVersionable.sol";
5
- import {ProxyManager} from "./ProxyManager.sol";
6
4
  import {ComponentService} from "./ComponentService.sol";
5
+ import {IVersionable} from "../upgradeability/IVersionable.sol";
6
+ import {ProxyManager} from "../upgradeability/ProxyManager.sol";
7
7
 
8
8
  contract ComponentServiceManager is ProxyManager {
9
9
 
@@ -87,7 +87,7 @@ abstract contract ComponentVerifyingService is
87
87
 
88
88
  // ensure component is not locked
89
89
  if (onlyActive) {
90
- if (instance.getInstanceAccessManager().isTargetClosed(info.objectAddress)) {
90
+ if (instance.getInstanceAdmin().isTargetLocked(info.objectAddress)) {
91
91
  revert ErrorComponentVerifyingServiceComponentIsLocked(componentNftId);
92
92
  }
93
93
  }
@@ -27,7 +27,12 @@ interface IComponentService is
27
27
  error ErrorComponentServiceWalletAddressZero();
28
28
  error ErrorComponentServiceWalletAddressIsSameAsCurrent();
29
29
 
30
+ error ErrorComponentServiceWithdrawAmountIsZero();
31
+ error ErrorComponentServiceWithdrawAmountExceedsLimit(Amount withdrawnAmount, Amount withdrawLimit);
32
+ error ErrorComponentServiceWalletAllowanceTooSmall(address wallet, address spender, uint256 allowance, uint256 amount);
33
+
30
34
  event LogComponentServiceWalletAddressChanged(NftId componentNftId, address currentWallet, address newWallet);
35
+ event LogComponentServiceComponentFeesWithdrawn(NftId componentNftId, address recipient, address token, Amount withdrawnAmount);
31
36
  event LogComponentServiceProductFeesUpdated(NftId productNftId);
32
37
  event LogComponentServiceDistributionFeesUpdated(NftId distributionNftId);
33
38
  event LogComponentServicePoolFeesUpdated(NftId poolNftId);
@@ -51,6 +56,11 @@ interface IComponentService is
51
56
  /// @dev unlocks the component associated with the caller
52
57
  function unlock() external;
53
58
 
59
+ /// @dev Withdraw fees from the distribution component. Only component owner is allowed to withdraw fees.
60
+ /// @param withdrawAmount the amount to withdraw
61
+ /// @return withdrawnAmount the amount that was actually withdrawn
62
+ function withdrawFees(Amount withdrawAmount) external returns (Amount withdrawnAmount);
63
+
54
64
  //-------- product ------------------------------------------------------//
55
65
 
56
66
  /// @dev registers the sending component as a product component
@@ -4,7 +4,9 @@ pragma solidity ^0.8.20;
4
4
  import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
5
5
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
6
6
 
7
+ import {Amount} from "../type/Amount.sol";
7
8
  import {IComponent} from "../shared/IComponent.sol";
9
+ import {IAuthorization} from "../authorization/IAuthorization.sol";
8
10
  import {IComponents} from "../instance/module/IComponents.sol";
9
11
  import {IInstance} from "../instance/IInstance.sol";
10
12
  import {IInstanceService} from "../instance/IInstanceService.sol";
@@ -43,4 +45,12 @@ interface IInstanceLinkedComponent is
43
45
  /// this is only relevant for pool and distribution components
44
46
  function getProductNftId() external view returns (NftId productNftId);
45
47
 
48
+ /// @dev returns the initial component authorization specification.
49
+ function getAuthorization() external view returns (IAuthorization authorization);
50
+
51
+ /// @dev Withdraw fees from the distribution component. Only component owner is allowed to withdraw fees.
52
+ /// @param amount the amount to withdraw
53
+ /// @return withdrawnAmount the amount that was actually withdrawn
54
+ function withdrawFees(Amount amount) external returns (Amount withdrawnAmount);
55
+
46
56
  }
@@ -13,6 +13,7 @@ interface IKeyValueStore is ILifecycle {
13
13
 
14
14
  error ErrorKeyValueStoreTypeUndefined(ObjectType objectType);
15
15
  error ErrorKeyValueStoreAlreadyCreated(Key32 key, ObjectType objectType);
16
+ error ErrorKeyValueStoreNoLifecycle(ObjectType objectType);
16
17
  error ErrorKeyValueStoreStateZero(Key32 key);
17
18
  error ErrorKeyValueStoreNotExisting(Key32 key);
18
19
 
@@ -1,13 +1,12 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {NftId} from "../type/NftId.sol";
5
4
  import {ObjectType} from "../type/ObjectType.sol";
6
5
  import {StateId} from "../type/StateId.sol";
7
6
 
8
7
  interface ILifecycle {
9
8
 
10
- error ErrorNoLifecycle(NftId nftId, ObjectType objectType);
9
+ error ErrorNoLifecycle(ObjectType objectType);
11
10
  error ErrorInvalidStateTransition(
12
11
  ObjectType objectType,
13
12
  StateId fromStateId,
@@ -4,8 +4,9 @@ pragma solidity ^0.8.20;
4
4
  import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
5
5
 
6
6
  import {IRegisterable} from "./IRegisterable.sol";
7
- import {IVersionable} from "./IVersionable.sol";
7
+ import {IVersionable} from "../upgradeability/IVersionable.sol";
8
8
  import {ObjectType} from "../type/ObjectType.sol";
9
+ import {RoleId} from "../type/RoleId.sol";
9
10
 
10
11
  interface IService is
11
12
  IRegisterable,
@@ -14,5 +15,11 @@ interface IService is
14
15
  {
15
16
  error ErrorServiceNotImplemented();
16
17
 
18
+ /// @dev returns the domain for this service.
19
+ /// In any GIF release only one service for any given domain may be deployed.
17
20
  function getDomain() external pure returns(ObjectType serviceDomain);
21
+
22
+ /// @dev returns the GIF release specific role id.
23
+ /// These role ids are used to authorize service to service communication.
24
+ function getRoleId() external pure returns(RoleId serviceRoleId);
18
25
  }
@@ -6,13 +6,14 @@ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessMana
6
6
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
7
7
  import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8
8
 
9
+ import {Amount} from "../type/Amount.sol";
9
10
  import {Component} from "./Component.sol";
10
11
  import {IComponentService} from "./IComponentService.sol";
11
12
  import {IInstanceLinkedComponent} from "./IInstanceLinkedComponent.sol";
13
+ import {IAuthorization} from "../authorization/IAuthorization.sol";
12
14
  import {IComponents} from "../instance/module/IComponents.sol";
13
15
  import {IInstanceService} from "../instance/IInstanceService.sol";
14
16
  import {IInstance} from "../instance/IInstance.sol";
15
- import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
16
17
  import {InstanceReader} from "../instance/InstanceReader.sol";
17
18
  import {IRegistry} from "../registry/IRegistry.sol";
18
19
  import {NftId} from "../type/NftId.sol";
@@ -35,6 +36,39 @@ abstract contract InstanceLinkedComponent is
35
36
  struct InstanceLinkedComponentStorage {
36
37
  IInstance _instance; // instance for this component
37
38
  InstanceReader _instanceReader; // instance reader for this component
39
+ IAuthorization _initialAuthorization;
40
+ IComponentService _componentService;
41
+ }
42
+
43
+ function lock() external onlyOwner {
44
+ IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(true);
45
+ }
46
+
47
+ function unlock() external onlyOwner {
48
+ IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(false);
49
+ }
50
+
51
+ function getInstance() public view override returns (IInstance instance) {
52
+ return _getInstanceLinkedComponentStorage()._instance;
53
+ }
54
+
55
+ function getProductNftId() public view override returns (NftId productNftId) {
56
+ return getComponentInfo().productNftId;
57
+ }
58
+
59
+ function getAuthorization() external view returns (IAuthorization authorization) {
60
+ return _getInstanceLinkedComponentStorage()._initialAuthorization;
61
+ }
62
+
63
+ /// @inheritdoc IInstanceLinkedComponent
64
+ function withdrawFees(Amount amount)
65
+ external
66
+ virtual
67
+ onlyOwner()
68
+ restricted()
69
+ returns (Amount withdrawnAmount)
70
+ {
71
+ return _withdrawFees(amount);
38
72
  }
39
73
 
40
74
  function _getInstanceLinkedComponentStorage() private pure returns (InstanceLinkedComponentStorage storage $) {
@@ -43,18 +77,19 @@ abstract contract InstanceLinkedComponent is
43
77
  }
44
78
  }
45
79
 
46
- function initializeInstanceLinkedComponent(
80
+ function _initializeInstanceLinkedComponent(
47
81
  address registry,
48
82
  NftId instanceNftId,
49
83
  string memory name,
50
84
  address token,
51
85
  ObjectType componentType,
86
+ IAuthorization authorization,
52
87
  bool isInterceptor,
53
88
  address initialOwner,
54
89
  bytes memory registryData, // writeonly data that will saved in the object info record of the registry
55
90
  bytes memory componentData // data that will saved with the component info in the instance store
56
91
  )
57
- public
92
+ internal
58
93
  virtual
59
94
  onlyInitializing()
60
95
  {
@@ -82,6 +117,8 @@ abstract contract InstanceLinkedComponent is
82
117
 
83
118
  // set component state
84
119
  $._instanceReader = $._instance.getInstanceReader();
120
+ $._initialAuthorization = authorization;
121
+ $._componentService = IComponentService(_getServiceAddress(COMPONENT()));
85
122
 
86
123
  registerInterface(type(IAccessManaged).interfaceId);
87
124
  registerInterface(type(IInstanceLinkedComponent).interfaceId);
@@ -93,22 +130,6 @@ abstract contract InstanceLinkedComponent is
93
130
  IComponentService(_getServiceAddress(COMPONENT())).setWallet(newWallet);
94
131
  }
95
132
 
96
- function lock() external onlyOwner {
97
- IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(true);
98
- }
99
-
100
- function unlock() external onlyOwner {
101
- IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(false);
102
- }
103
-
104
- function getInstance() public view override returns (IInstance instance) {
105
- return _getInstanceLinkedComponentStorage()._instance;
106
- }
107
-
108
- function getProductNftId() public view override returns (NftId productNftId) {
109
- return getComponentInfo().productNftId;
110
- }
111
-
112
133
 
113
134
  function _getComponentInfo() internal virtual override view returns (IComponents.ComponentInfo memory info) {
114
135
  NftId componentNftId = getRegistry().getNftId(address(this));
@@ -134,6 +155,13 @@ abstract contract InstanceLinkedComponent is
134
155
  return _getInstanceLinkedComponentStorage()._instanceReader;
135
156
  }
136
157
 
158
+ function _withdrawFees(Amount amount)
159
+ internal
160
+ returns (Amount withdrawnAmount)
161
+ {
162
+ return _getInstanceLinkedComponentStorage()._componentService.withdrawFees(amount);
163
+ }
164
+
137
165
 
138
166
  /// @dev returns the service address for the specified domain
139
167
  /// gets address via lookup from registry using the major version form the linked instance
@@ -11,7 +11,7 @@ import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
11
11
  import {Lifecycle} from "./Lifecycle.sol";
12
12
  import {IKeyValueStore} from "./IKeyValueStore.sol";
13
13
 
14
- contract KeyValueStore is
14
+ abstract contract KeyValueStore is
15
15
  Lifecycle,
16
16
  IKeyValueStore
17
17
  {
@@ -34,8 +34,12 @@ contract KeyValueStore is
34
34
  revert ErrorKeyValueStoreAlreadyCreated(key32, objectType);
35
35
  }
36
36
 
37
+ if(!hasLifecycle(objectType)) {
38
+ revert ErrorKeyValueStoreNoLifecycle(objectType);
39
+ }
40
+
37
41
  Blocknumber blocknumber = blockBlocknumber();
38
- StateId initialState = hasLifecycle(objectType) ? getInitialState(objectType) : ACTIVE();
42
+ StateId initialState = getInitialState(objectType);
39
43
 
40
44
  // set metadata
41
45
  metadata.objectType = objectType;