@etherisc/gif-next 0.0.2-e8b06c8-540 → 0.0.2-e8ea5fe-337

Sign up to get free protection for your applications and to get access to all the features.
Files changed (459) hide show
  1. package/README.md +32 -3
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  3. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +38 -33
  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 +1 -1
  7. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +8 -8
  8. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  9. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  10. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +1 -1
  12. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +19 -0
  14. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
  15. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +8 -8
  16. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  17. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +23 -4
  18. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  19. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +85 -101
  20. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  21. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +19 -19
  22. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  23. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +43 -75
  24. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  25. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +223 -105
  26. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  27. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +67 -55
  28. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  29. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +43 -37
  30. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  31. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +120 -31
  32. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +4 -0
  33. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +703 -0
  34. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  35. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +7 -7
  36. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  37. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +10 -5
  38. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  39. package/artifacts/contracts/instance/Instance.sol/Instance.json +19 -19
  40. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  41. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +1208 -290
  42. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  43. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +31 -31
  44. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  45. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +238 -123
  46. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  47. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +44 -39
  48. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +35 -35
  50. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +226 -231
  52. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  53. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  54. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  55. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  56. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  57. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +4 -0
  58. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +182 -0
  59. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +4 -0
  60. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +181 -0
  61. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  62. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  63. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  64. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  65. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  66. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  67. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  68. package/artifacts/contracts/mock/Dip.sol/Dip.json +2 -2
  69. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  70. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +59 -88
  71. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  72. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +21 -21
  73. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  74. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  75. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +30 -37
  76. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  77. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  78. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +27 -72
  79. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  80. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +32 -32
  81. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  82. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +34 -34
  83. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  84. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +55 -137
  85. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  86. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +19 -19
  87. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  88. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +402 -62
  89. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  90. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +111 -43
  91. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  92. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +205 -1
  93. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  94. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +45 -95
  95. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  96. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +220 -100
  97. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  98. package/artifacts/contracts/pool/Pool.sol/Pool.json +45 -133
  99. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  100. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +264 -136
  101. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  102. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +40 -36
  103. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  104. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +31 -50
  105. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  106. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +31 -43
  107. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  108. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +22 -78
  109. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  110. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +19 -19
  111. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  112. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +194 -72
  113. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  114. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +58 -54
  115. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  116. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +5 -0
  117. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  118. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +114 -0
  119. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  120. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +184 -119
  121. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  122. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +43 -43
  123. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  124. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +19 -37
  125. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
  126. package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +2 -2
  127. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  128. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +242 -209
  129. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  130. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +55 -55
  131. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  132. package/artifacts/contracts/product/PricingService.sol/PricingService.json +113 -153
  133. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  134. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +55 -75
  135. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  136. package/artifacts/contracts/product/Product.sol/Product.json +22 -78
  137. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
  138. package/artifacts/contracts/product/RiskService.sol/RiskService.json +695 -0
  139. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
  140. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +702 -0
  141. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  142. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  143. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  144. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +51 -47
  145. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  146. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +0 -183
  147. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  148. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  149. package/artifacts/contracts/registry/Registry.sol/Registry.json +102 -74
  150. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  151. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +100 -95
  152. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  153. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -18
  154. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  155. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +27 -27
  156. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +4 -0
  157. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +164 -0
  158. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +4 -0
  159. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +1159 -0
  160. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  161. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +26 -7
  162. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  163. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +4 -4
  164. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  165. package/artifacts/contracts/shared/Component.sol/Component.json +0 -64
  166. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  167. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +255 -62
  168. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  169. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +69 -49
  170. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  171. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  172. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +0 -26
  173. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  174. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +153 -0
  175. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  176. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +19 -37
  177. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  178. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +11 -5
  179. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  180. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +0 -5
  181. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  182. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  183. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  184. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  185. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  186. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +1 -1
  187. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +4 -0
  188. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +73 -0
  189. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  190. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +19 -75
  191. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  192. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +15 -89
  193. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  194. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +4 -65
  195. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +4 -0
  196. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +306 -0
  197. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  198. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +6 -6
  199. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  200. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +6 -6
  201. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  202. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +8 -8
  203. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  204. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  205. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  206. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  207. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +330 -11
  208. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
  209. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +108 -0
  210. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  211. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +27 -27
  212. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  213. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  214. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +85 -105
  215. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  216. package/artifacts/contracts/staking/Staking.sol/Staking.json +84 -114
  217. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +4 -0
  218. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +164 -0
  219. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  220. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +47 -43
  221. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  222. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +6 -6
  223. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  224. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +26 -26
  225. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  226. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +31 -31
  227. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  228. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +146 -165
  229. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  230. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +58 -22
  231. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  232. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.json +2 -2
  233. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  234. package/artifacts/contracts/type/Amount.sol/AmountLib.json +37 -8
  235. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  236. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +2 -2
  237. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  238. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +4 -4
  239. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  240. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +4 -4
  241. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  242. package/artifacts/contracts/type/Fee.sol/FeeLib.json +17 -12
  243. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  244. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  245. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  246. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +4 -4
  247. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  248. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  249. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  250. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +2 -2
  251. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  252. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +4 -4
  253. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  254. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +4 -4
  255. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  256. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +4 -4
  257. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  258. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +4 -4
  259. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  260. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +14 -14
  261. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  262. package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +50 -2
  263. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  264. package/artifacts/contracts/type/Selector.sol/SelectorLib.json +2 -2
  265. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  266. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +2 -2
  267. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  268. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -2
  269. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  270. package/artifacts/contracts/type/String.sol/StrLib.json +2 -2
  271. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  272. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +23 -4
  273. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  274. package/artifacts/contracts/type/UFixed.sol/MathLib.json +9 -3
  275. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  276. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +39 -2
  277. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  278. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
  279. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +21 -2
  281. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +4 -0
  282. package/artifacts/contracts/{shared → upgradeability}/IVersionable.sol/IVersionable.json +1 -1
  283. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +4 -0
  284. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +617 -0
  285. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
  286. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
  287. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +4 -0
  288. package/artifacts/contracts/{shared → upgradeability}/Versionable.sol/Versionable.json +1 -1
  289. package/contracts/authorization/AccessAdmin.sol +8 -39
  290. package/contracts/authorization/AccessManagerCloneable.sol +16 -0
  291. package/contracts/authorization/Authorization.sol +0 -1
  292. package/contracts/authorization/IServiceAuthorization.sol +3 -0
  293. package/contracts/authorization/ModuleAuthorization.sol +0 -125
  294. package/contracts/authorization/ServiceAuthorization.sol +4 -0
  295. package/contracts/distribution/BasicDistribution.sol +4 -15
  296. package/contracts/distribution/BasicDistributionAuthorization.sol +5 -1
  297. package/contracts/distribution/Distribution.sol +22 -10
  298. package/contracts/distribution/DistributionService.sol +67 -34
  299. package/contracts/distribution/DistributionServiceManager.sol +2 -5
  300. package/contracts/distribution/IDistributionComponent.sol +8 -34
  301. package/contracts/distribution/IDistributionService.sol +18 -2
  302. package/contracts/instance/{BundleManager.sol → BundleSet.sol} +23 -23
  303. package/contracts/instance/IInstance.sol +12 -35
  304. package/contracts/instance/IInstanceService.sol +6 -5
  305. package/contracts/instance/Instance.sol +15 -79
  306. package/contracts/instance/InstanceAdmin.sol +220 -269
  307. package/contracts/instance/InstanceAuthorizationV3.sol +19 -28
  308. package/contracts/instance/InstanceReader.sol +32 -12
  309. package/contracts/instance/InstanceService.sol +73 -122
  310. package/contracts/instance/InstanceServiceManager.sol +2 -6
  311. package/contracts/instance/InstanceStore.sol +18 -4
  312. package/contracts/instance/base/ObjectLifecycle.sol +111 -0
  313. package/contracts/instance/base/{ObjectManager.sol → ObjectSet.sol} +5 -5
  314. package/contracts/instance/module/IBundle.sol +1 -1
  315. package/contracts/instance/module/IComponents.sol +1 -7
  316. package/contracts/instance/module/IDistribution.sol +0 -1
  317. package/contracts/instance/module/IPolicy.sol +22 -22
  318. package/contracts/mock/Dip.sol +1 -1
  319. package/contracts/oracle/IOracleComponent.sol +2 -1
  320. package/contracts/oracle/Oracle.sol +16 -6
  321. package/contracts/oracle/OracleService.sol +1 -0
  322. package/contracts/oracle/OracleServiceManager.sol +2 -5
  323. package/contracts/pool/BasicPool.sol +7 -5
  324. package/contracts/pool/BasicPoolAuthorization.sol +11 -2
  325. package/contracts/pool/BundleService.sol +189 -47
  326. package/contracts/pool/BundleServiceManager.sol +2 -5
  327. package/contracts/pool/IBundleService.sol +33 -5
  328. package/contracts/pool/IPoolComponent.sol +6 -0
  329. package/contracts/pool/IPoolService.sol +36 -26
  330. package/contracts/pool/Pool.sol +39 -24
  331. package/contracts/pool/PoolService.sol +161 -104
  332. package/contracts/pool/PoolServiceManager.sol +2 -5
  333. package/contracts/product/ApplicationService.sol +51 -57
  334. package/contracts/product/ApplicationServiceManager.sol +2 -2
  335. package/contracts/product/BasicProduct.sol +3 -32
  336. package/contracts/product/BasicProductAuthorization.sol +3 -0
  337. package/contracts/product/ClaimService.sol +118 -73
  338. package/contracts/product/ClaimServiceManager.sol +2 -2
  339. package/contracts/product/IApplicationService.sol +1 -0
  340. package/contracts/product/IClaimService.sol +28 -5
  341. package/contracts/product/IPolicyService.sol +27 -32
  342. package/contracts/product/IPricingService.sol +7 -7
  343. package/contracts/product/IProductComponent.sol +1 -1
  344. package/contracts/product/{IProductService.sol → IRiskService.sol} +1 -1
  345. package/contracts/product/PolicyService.sol +278 -180
  346. package/contracts/product/PolicyServiceManager.sol +2 -5
  347. package/contracts/product/PricingService.sol +42 -41
  348. package/contracts/product/PricingServiceManager.sol +2 -5
  349. package/contracts/product/Product.sol +67 -34
  350. package/contracts/product/{ProductService.sol → RiskService.sol} +10 -37
  351. package/contracts/product/RiskServiceManager.sol +39 -0
  352. package/contracts/registry/IRegistry.sol +27 -17
  353. package/contracts/registry/IRegistryService.sol +6 -6
  354. package/contracts/registry/Registry.sol +81 -87
  355. package/contracts/registry/RegistryAdmin.sol +34 -23
  356. package/contracts/registry/RegistryService.sol +4 -18
  357. package/contracts/registry/RegistryServiceManager.sol +2 -2
  358. package/contracts/registry/ReleaseLifecycle.sol +27 -0
  359. package/contracts/registry/{ReleaseManager.sol → ReleaseRegistry.sol} +149 -194
  360. package/contracts/registry/ServiceAuthorizationV3.sol +7 -10
  361. package/contracts/registry/TokenRegistry.sol +2 -2
  362. package/contracts/shared/Component.sol +25 -38
  363. package/contracts/shared/ComponentService.sol +84 -69
  364. package/contracts/shared/ComponentServiceManager.sol +2 -2
  365. package/contracts/shared/ComponentVerifyingService.sol +1 -1
  366. package/contracts/shared/IComponent.sol +4 -4
  367. package/contracts/shared/IComponentService.sol +15 -9
  368. package/contracts/shared/IInstanceLinkedComponent.sol +9 -10
  369. package/contracts/shared/IKeyValueStore.sol +1 -0
  370. package/contracts/shared/ILifecycle.sol +1 -2
  371. package/contracts/shared/IService.sol +1 -1
  372. package/contracts/shared/{ERC165.sol → InitializableERC165.sol} +1 -1
  373. package/contracts/shared/InstanceLinkedComponent.sol +22 -2
  374. package/contracts/shared/KeyValueStore.sol +6 -2
  375. package/contracts/shared/Lifecycle.sol +16 -69
  376. package/contracts/shared/{NftIdSetManager.sol → NftIdSet.sol} +1 -1
  377. package/contracts/shared/NftOwnable.sol +3 -3
  378. package/contracts/shared/PolicyHolder.sol +2 -5
  379. package/contracts/shared/Service.sol +3 -4
  380. package/contracts/shared/TokenHandler.sol +100 -19
  381. package/contracts/shared/TokenHandlerDeployerLib.sol +12 -0
  382. package/contracts/staking/IStaking.sol +3 -3
  383. package/contracts/staking/IStakingService.sol +12 -5
  384. package/contracts/staking/StakeManagerLib.sol +18 -25
  385. package/contracts/staking/Staking.sol +24 -39
  386. package/contracts/staking/StakingLifecycle.sol +23 -0
  387. package/contracts/staking/StakingManager.sol +2 -6
  388. package/contracts/staking/StakingReader.sol +12 -16
  389. package/contracts/staking/StakingService.sol +8 -12
  390. package/contracts/staking/StakingServiceManager.sol +2 -2
  391. package/contracts/staking/StakingStore.sol +15 -23
  392. package/contracts/staking/TargetManagerLib.sol +7 -3
  393. package/contracts/type/Amount.sol +12 -5
  394. package/contracts/type/Blocknumber.sol +7 -1
  395. package/contracts/type/ObjectType.sol +18 -18
  396. package/contracts/type/Referral.sol +1 -0
  397. package/contracts/type/RoleId.sol +10 -38
  398. package/contracts/type/Seconds.sol +21 -1
  399. package/contracts/type/StateId.sol +1 -0
  400. package/contracts/type/Timestamp.sol +11 -1
  401. package/contracts/type/UFixed.sol +29 -10
  402. package/contracts/type/Version.sol +3 -1
  403. package/contracts/{shared → upgradeability}/ProxyManager.sol +3 -4
  404. package/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol +1 -3
  405. package/package.json +3 -3
  406. package/artifacts/contracts/authorization/InstanceAdmin.sol/InstanceAdmin.dbg.json +0 -4
  407. package/artifacts/contracts/authorization/InstanceAdmin.sol/InstanceAdmin.json +0 -1385
  408. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +0 -4
  409. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +0 -703
  410. package/artifacts/contracts/instance/InstanceAdminNew.sol/InstanceAdminNew.dbg.json +0 -4
  411. package/artifacts/contracts/instance/InstanceAdminNew.sol/InstanceAdminNew.json +0 -1616
  412. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +0 -4
  413. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +0 -228
  414. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +0 -4
  415. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +0 -181
  416. package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +0 -4
  417. package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +0 -4
  418. package/artifacts/contracts/product/ProductService.sol/ProductService.json +0 -708
  419. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
  420. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +0 -702
  421. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +0 -4
  422. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +0 -1237
  423. package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.dbg.json +0 -4
  424. package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.json +0 -1193
  425. package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.dbg.json +0 -4
  426. package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.json +0 -1747
  427. package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.dbg.json +0 -4
  428. package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.json +0 -1760
  429. package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.dbg.json +0 -4
  430. package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.json +0 -1838
  431. package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +0 -4
  432. package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +0 -1856
  433. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
  434. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +0 -73
  435. package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.dbg.json +0 -4
  436. package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.json +0 -1562
  437. package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.dbg.json +0 -4
  438. package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.json +0 -1600
  439. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +0 -4
  440. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.dbg.json +0 -4
  441. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.json +0 -306
  442. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +0 -4
  443. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +0 -617
  444. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +0 -4
  445. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +0 -129
  446. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +0 -4
  447. package/contracts/authorization/InstanceAdmin.sol +0 -108
  448. package/contracts/instance/InstanceAdminNew.sol +0 -261
  449. package/contracts/instance/InstanceAuthorizationsLib.sol +0 -422
  450. package/contracts/product/ProductServiceManager.sol +0 -42
  451. package/contracts/shared/AccessManagerCustom.sol +0 -741
  452. package/contracts/shared/AccessManagerExtended.sol +0 -481
  453. package/contracts/shared/AccessManagerExtendedInitializeable.sol +0 -13
  454. package/contracts/shared/AccessManagerExtendedWithDisable.sol +0 -137
  455. package/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol +0 -14
  456. package/contracts/shared/IAccessManagerExtended.sol +0 -74
  457. package/contracts/shared/IAccessManagerExtendedWithDisable.sol +0 -18
  458. /package/contracts/{shared → upgradeability}/IVersionable.sol +0 -0
  459. /package/contracts/{shared → upgradeability}/Versionable.sol +0 -0
@@ -6,17 +6,15 @@ import {
6
6
  } from "../../contracts/type/ObjectType.sol";
7
7
 
8
8
  import {
9
- ADMIN_ROLE, DISTRIBUTION_OWNER_ROLE, ORACLE_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE
9
+ DISTRIBUTION_OWNER_ROLE, ORACLE_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE
10
10
  } from "../../contracts/type/RoleId.sol";
11
11
 
12
- import {BundleManager} from "../instance/BundleManager.sol";
12
+ import {BundleSet} from "../instance/BundleSet.sol";
13
13
  import {IAccess} from "../authorization/IAccess.sol";
14
14
  import {Instance} from "../instance/Instance.sol";
15
- import {InstanceAdminNew} from "../instance/InstanceAdminNew.sol";
15
+ import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
16
16
  import {InstanceStore} from "../instance/InstanceStore.sol";
17
17
  import {ModuleAuthorization} from "../authorization/ModuleAuthorization.sol";
18
- import {RoleId} from "../type/RoleId.sol";
19
- import {VersionPart, VersionPartLib} from "../type/Version.sol";
20
18
 
21
19
 
22
20
  contract InstanceAuthorizationV3
@@ -26,7 +24,7 @@ contract InstanceAuthorizationV3
26
24
  string public constant INSTANCE_TARGET_NAME = "Instance";
27
25
  string public constant INSTANCE_STORE_TARGET_NAME = "InstanceStore";
28
26
  string public constant INSTANCE_ADMIN_TARGET_NAME = "InstanceAdmin";
29
- string public constant BUNDLE_MANAGER_TARGET_NAME = "BundleManager";
27
+ string public constant BUNDLE_SET_TARGET_NAME = "BundleSet";
30
28
 
31
29
  string public constant INSTANCE_ROLE_NAME = "InstanceRole";
32
30
  string public constant DISTRIBUTION_OWNER_ROLE_NAME = "DistributionOwnerRole";
@@ -61,7 +59,7 @@ contract InstanceAuthorizationV3
61
59
  // instance supporting targets
62
60
  _addTarget(INSTANCE_STORE_TARGET_NAME);
63
61
  _addTarget(INSTANCE_ADMIN_TARGET_NAME);
64
- _addTarget(BUNDLE_MANAGER_TARGET_NAME);
62
+ _addTarget(BUNDLE_SET_TARGET_NAME);
65
63
 
66
64
  // service targets relevant to instance
67
65
  _addServiceTargetWithRole(INSTANCE());
@@ -84,22 +82,22 @@ contract InstanceAuthorizationV3
84
82
  _setupInstanceAuthorization();
85
83
  _setupInstanceAdminAuthorization();
86
84
  _setupInstanceStoreAuthorization();
87
- _setupBundleManagerAuthorization();
85
+ _setupBundleSetAuthorization();
88
86
  }
89
87
 
90
88
 
91
- function _setupBundleManagerAuthorization()
89
+ function _setupBundleSetAuthorization()
92
90
  internal
93
91
  {
94
92
  IAccess.FunctionInfo[] storage functions;
95
93
 
96
94
  // authorize bundle service role
97
- functions = _authorizeForTarget(BUNDLE_MANAGER_TARGET_NAME, getServiceRole(BUNDLE()));
98
- _authorize(functions, BundleManager.linkPolicy.selector, "linkPolicy");
99
- _authorize(functions, BundleManager.unlinkPolicy.selector, "unlinkPolicy");
100
- _authorize(functions, BundleManager.add.selector, "add");
101
- _authorize(functions, BundleManager.lock.selector, "lock");
102
- _authorize(functions, BundleManager.unlock.selector, "unlock");
95
+ functions = _authorizeForTarget(BUNDLE_SET_TARGET_NAME, getServiceRole(BUNDLE()));
96
+ _authorize(functions, BundleSet.linkPolicy.selector, "linkPolicy");
97
+ _authorize(functions, BundleSet.unlinkPolicy.selector, "unlinkPolicy");
98
+ _authorize(functions, BundleSet.add.selector, "add");
99
+ _authorize(functions, BundleSet.lock.selector, "lock");
100
+ _authorize(functions, BundleSet.unlock.selector, "unlock");
103
101
  }
104
102
 
105
103
 
@@ -108,12 +106,8 @@ contract InstanceAuthorizationV3
108
106
  {
109
107
  IAccess.FunctionInfo[] storage functions;
110
108
 
111
- // TODO cleanup
112
109
  // authorize instance service role
113
110
  functions = _authorizeForTarget(INSTANCE_TARGET_NAME, getServiceRole(INSTANCE()));
114
- // _authorize(functions, Instance.setInstanceAdmin.selector, "setInstanceAdmin");
115
- // _authorize(functions, Instance.setInstanceStore.selector, "setInstanceStore");
116
- // _authorize(functions, Instance.setBundleManager.selector, "setBundleManager");
117
111
  _authorize(functions, Instance.setInstanceReader.selector, "setInstanceReader");
118
112
  }
119
113
 
@@ -125,17 +119,10 @@ contract InstanceAuthorizationV3
125
119
 
126
120
  // authorize instance role
127
121
  functions = _authorizeForTarget(INSTANCE_ADMIN_TARGET_NAME, _getTargetRoleId(INSTANCE()));
128
- // _authorize(functions, InstanceAdminNew.createRole.selector, "createRole");
129
- _authorize(functions, InstanceAdminNew.grantRole.selector, "grantRole");
130
- // _authorize(functions, InstanceAdminNew.createTarget.selector, "createTarget");
131
- // _authorize(functions, InstanceAdminNew.setTargetFunctionRoleByInstance.selector, "setTargetFunctionRoleByInstance");
132
- // _authorize(functions, InstanceAdminNew.setTargetLockedByInstance.selector, "setTargetLockedByInstance");
122
+ _authorize(functions, InstanceAdmin.grantRole.selector, "grantRole");
133
123
 
134
124
  // authorize instance service role
135
- functions = _authorizeForTarget(INSTANCE_ADMIN_TARGET_NAME, getServiceRole(INSTANCE()));
136
- // _authorize(functions, InstanceAdminNew.createGifTarget.selector, "createGifTarget");
137
- // _authorize(functions, InstanceAdminNew.setTargetLockedByService.selector, "setTargetLockedByService");
138
- // _authorize(functions, InstanceAdminNew.setTargetFunctionRoleByService.selector, "setTargetFunctionRoleByService");
125
+ // functions = _authorizeForTarget(INSTANCE_ADMIN_TARGET_NAME, getServiceRole(INSTANCE()));
139
126
  }
140
127
 
141
128
 
@@ -152,7 +139,9 @@ contract InstanceAuthorizationV3
152
139
  _authorize(functions, InstanceStore.createProduct.selector, "createProduct");
153
140
  _authorize(functions, InstanceStore.updateProduct.selector, "updateProduct");
154
141
  _authorize(functions, InstanceStore.increaseBalance.selector, "increaseBalance");
142
+ _authorize(functions, InstanceStore.decreaseBalance.selector, "decreaseBalance");
155
143
  _authorize(functions, InstanceStore.increaseFees.selector, "increaseFees");
144
+ _authorize(functions, InstanceStore.decreaseFees.selector, "decreaseFees");
156
145
 
157
146
  // authorize distribution service role
158
147
  functions = _authorizeForTarget(INSTANCE_STORE_TARGET_NAME, getServiceRole(DISTRIBUTION()));
@@ -200,6 +189,8 @@ contract InstanceAuthorizationV3
200
189
  functions = _authorizeForTarget(INSTANCE_STORE_TARGET_NAME, getServiceRole(POLICY()));
201
190
  _authorize(functions, InstanceStore.updatePolicy.selector, "updatePolicy");
202
191
  _authorize(functions, InstanceStore.updatePolicyState.selector, "updatePolicyState");
192
+ _authorize(functions, InstanceStore.createPremium.selector, "createPremium");
193
+ _authorize(functions, InstanceStore.updatePremiumState.selector, "updatePremiumState");
203
194
 
204
195
  // authorize claim service role
205
196
  functions = _authorizeForTarget(INSTANCE_STORE_TARGET_NAME, getServiceRole(CLAIM()));
@@ -1,25 +1,20 @@
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
-
6
4
  import {Amount} from "../type/Amount.sol";
7
5
  import {ClaimId} from "../type/ClaimId.sol";
8
6
  import {DistributorType} from "../type/DistributorType.sol";
9
- import {Fee, FeeLib} from "../type/Fee.sol";
10
7
  import {Key32} from "../type/Key32.sol";
11
8
  import {NftId} from "../type/NftId.sol";
12
- import {ObjectType, COMPONENT, DISTRIBUTOR, DISTRIBUTION, INSTANCE, PRODUCT, POLICY, POOL, BUNDLE} from "../type/ObjectType.sol";
9
+ import {COMPONENT, DISTRIBUTOR, DISTRIBUTION, PREMIUM, PRODUCT, POLICY, POOL, BUNDLE} from "../type/ObjectType.sol";
13
10
  import {PayoutId} from "../type/PayoutId.sol";
14
11
  import {ReferralId, ReferralStatus, ReferralLib, REFERRAL_OK, REFERRAL_ERROR_UNKNOWN, REFERRAL_ERROR_EXPIRED, REFERRAL_ERROR_EXHAUSTED} from "../type/Referral.sol";
15
12
  import {RequestId} from "../type/RequestId.sol";
16
13
  import {RiskId} from "../type/RiskId.sol";
17
14
  import {RoleId} from "../type/RoleId.sol";
18
15
  import {StateId} from "../type/StateId.sol";
19
- import {UFixed, MathLib, UFixedLib} from "../type/UFixed.sol";
20
- import {Version} from "../type/Version.sol";
16
+ import {UFixed, UFixedLib} from "../type/UFixed.sol";
21
17
 
22
- import {IRegistry} from "../registry/IRegistry.sol";
23
18
  import {IBundle} from "../instance/module/IBundle.sol";
24
19
  import {IComponents} from "../instance/module/IComponents.sol";
25
20
  import {IDistribution} from "../instance/module/IDistribution.sol";
@@ -49,11 +44,6 @@ contract InstanceReader {
49
44
  revert ErrorInstanceReaderAlreadyInitialized();
50
45
  }
51
46
 
52
- // TODO cleanup
53
- // _initialized = true;
54
- // _instance = IInstance(msg.sender);
55
- // _store = _instance.getInstanceStore();
56
-
57
47
  initializeWithInstance(msg.sender);
58
48
  }
59
49
 
@@ -90,6 +80,33 @@ contract InstanceReader {
90
80
  return _store.getState(toPolicyKey(policyNftId));
91
81
  }
92
82
 
83
+ function getPremiumInfo(NftId policyNftId)
84
+ public
85
+ view
86
+ returns (IPolicy.PremiumInfo memory info)
87
+ {
88
+ bytes memory data = _store.getData(toPremiumKey(policyNftId));
89
+ if (data.length > 0) {
90
+ return abi.decode(data, (IPolicy.PremiumInfo));
91
+ }
92
+ }
93
+
94
+ function getPremiumInfoState(NftId policyNftId)
95
+ public
96
+ view
97
+ returns (StateId state)
98
+ {
99
+ return _store.getState(toPremiumKey(policyNftId));
100
+ }
101
+
102
+ function getBundleState(NftId bundleNftId)
103
+ public
104
+ view
105
+ returns (StateId state)
106
+ {
107
+ return _store.getState(toBundleKey(bundleNftId));
108
+ }
109
+
93
110
  /// @dev returns true iff policy may be closed
94
111
  /// a policy can be closed all conditions below are met
95
112
  /// - policy exists
@@ -366,6 +383,9 @@ contract InstanceReader {
366
383
  return policyNftId.toKey32(POLICY());
367
384
  }
368
385
 
386
+ function toPremiumKey(NftId policyNftId) public pure returns (Key32) {
387
+ return policyNftId.toKey32(PREMIUM());
388
+ }
369
389
 
370
390
  function toDistributorKey(NftId distributorNftId) public pure returns (Key32) {
371
391
  return distributorNftId.toKey32(DISTRIBUTOR());
@@ -4,8 +4,9 @@ pragma solidity ^0.8.20;
4
4
  import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
5
5
  import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
6
6
 
7
+ import {AccessManagerCloneable} from "../authorization/AccessManagerCloneable.sol";
7
8
  import {Amount} from "../type/Amount.sol";
8
- import {BundleManager} from "./BundleManager.sol";
9
+ import {BundleSet} from "./BundleSet.sol";
9
10
  import {ChainNft} from "../registry/ChainNft.sol";
10
11
  import {NftId} from "../type/NftId.sol";
11
12
  import {RoleId} from "../type/RoleId.sol";
@@ -30,13 +31,10 @@ import {TargetManagerLib} from "../staking/TargetManagerLib.sol";
30
31
  import {Instance} from "./Instance.sol";
31
32
  import {IModuleAuthorization} from "../authorization/IModuleAuthorization.sol";
32
33
  import {IInstance} from "./IInstance.sol";
33
- // TODO cleanup
34
34
  import {InstanceAdmin} from "./InstanceAdmin.sol";
35
- import {InstanceAdminNew} from "./InstanceAdminNew.sol";
36
35
  import {IInstanceService} from "./IInstanceService.sol";
37
36
  import {InstanceReader} from "./InstanceReader.sol";
38
37
  import {InstanceStore} from "./InstanceStore.sol";
39
- import {InstanceAuthorizationsLib} from "./InstanceAuthorizationsLib.sol";
40
38
  import {Seconds} from "../type/Seconds.sol";
41
39
  import {VersionPart, VersionPartLib} from "../type/Version.sol";
42
40
 
@@ -52,16 +50,17 @@ contract InstanceService is
52
50
  IRegistryService internal _registryService;
53
51
  IStakingService internal _stakingService;
54
52
 
53
+ address internal _masterAccessManager;
55
54
  address internal _masterInstanceAdmin;
56
55
  address internal _masterInstance;
57
56
  address internal _masterInstanceReader;
58
- address internal _masterInstanceBundleManager;
57
+ address internal _masterInstanceBundleSet;
59
58
  address internal _masterInstanceStore;
60
59
 
61
60
 
62
61
  modifier onlyInstance() {
63
62
  address instanceAddress = msg.sender;
64
- NftId instanceNftId = getRegistry().getNftId(msg.sender);
63
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
65
64
  if (instanceNftId.eqz()) {
66
65
  revert ErrorInstanceServiceNotRegistered(instanceAddress);
67
66
  }
@@ -95,7 +94,7 @@ contract InstanceService is
95
94
  _;
96
95
  }
97
96
 
98
- function createInstanceClone()
97
+ function createInstance()
99
98
  external
100
99
  returns (
101
100
  Instance clonedInstance,
@@ -105,37 +104,9 @@ contract InstanceService is
105
104
  // tx sender will become instance owner
106
105
  address instanceOwner = msg.sender;
107
106
 
108
- // start with setting up the instance admin
109
- InstanceAdminNew clonedInstanceAdmin = InstanceAdminNew(Clones.clone(_masterInstanceAdmin));
110
- clonedInstanceAdmin.initialize(InstanceAdminNew(_masterInstanceAdmin).getInstanceAuthorization());
111
-
112
- InstanceStore clonedInstanceStore = InstanceStore(Clones.clone(address(_masterInstanceStore)));
113
- BundleManager clonedBundleManager = BundleManager(Clones.clone(_masterInstanceBundleManager));
114
- InstanceReader clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
115
-
116
- // clone instance
117
- clonedInstance = Instance(Clones.clone(_masterInstance));
118
- clonedInstance.initialize(
119
- clonedInstanceAdmin,
120
- clonedInstanceStore,
121
- clonedBundleManager,
122
- clonedInstanceReader,
123
- getRegistry(),
124
- instanceOwner);
125
-
126
- // TODO cleanup
127
- // // initialize and set before instance reader
128
- // InstanceStore clonedInstanceStore = InstanceStore(Clones.clone(address(_masterInstanceStore)));
129
- // clonedInstanceStore.initialize(address(clonedInstance));
130
- // clonedInstance.setInstanceStore(clonedInstanceStore);
131
-
132
- // InstanceReader clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
133
- // clonedInstanceReader.initialize(address(clonedInstance));
134
- // clonedInstance.setInstanceReader(clonedInstanceReader);
135
-
136
- // BundleManager clonedBundleManager = BundleManager(Clones.clone(_masterInstanceBundleManager));
137
- // clonedBundleManager.initialize(address(clonedInstance));
138
- // clonedInstance.setBundleManager(clonedBundleManager);
107
+ // create instance admin and instance
108
+ InstanceAdmin instanceAdmin = _createInstanceAdmin();
109
+ clonedInstance = _createInstance(instanceAdmin, instanceOwner);
139
110
 
140
111
  // register cloned instance with registry
141
112
  clonedInstanceNftId = _registryService.registerInstance(
@@ -148,90 +119,20 @@ contract InstanceService is
148
119
  TargetManagerLib.getDefaultRewardRate());
149
120
 
150
121
  // MUST be set after instance is set up and registered
151
- clonedInstanceAdmin.initializeInstanceAuthorization(address(clonedInstance));
122
+ instanceAdmin.initializeInstanceAuthorization(address(clonedInstance));
152
123
 
153
124
  emit LogInstanceCloned(
154
125
  clonedInstanceNftId,
155
126
  address(clonedInstance));
156
127
  }
157
128
 
158
- // TODO cleanup/remove
159
- // function _createInstanceCloneOld()
160
- // external
161
- // returns (
162
- // Instance clonedInstance,
163
- // NftId clonedInstanceNftId
164
- // )
165
- // {
166
- // address instanceOwner = msg.sender;
167
- // AccessManagerExtendedInitializeable clonedAccessManager = AccessManagerExtendedInitializeable(
168
- // Clones.clone(_masterAccessManager));
169
-
170
- // // initially grants ADMIN_ROLE to this (being the instance service).
171
- // // This will allow the instance service to bootstrap the authorizations of the instance.
172
- // // Instance service will renounce ADMIN_ROLE when bootstraping is finished
173
- // clonedAccessManager.initialize(address(this));
174
-
175
- // clonedInstance = Instance(Clones.clone(_masterInstance));
176
- // // clonedInstance.initialize(
177
- // // address(clonedAccessManager),
178
- // // address(getRegistry()),
179
- // // instanceOwner);
180
- // // initialize and set before instance reader
181
- // InstanceStore clonedInstanceStore = InstanceStore(Clones.clone(address(_masterInstanceStore)));
182
- // // clonedInstanceStore.initialize(address(clonedInstance));
183
- // clonedInstance.setInstanceStore(clonedInstanceStore);
184
-
185
- // InstanceReader clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
186
- // // clonedInstanceReader.initialize(address(clonedInstance));
187
- // clonedInstance.setInstanceReader(clonedInstanceReader);
188
-
189
- // BundleManager clonedBundleManager = BundleManager(Clones.clone(_masterInstanceBundleManager));
190
- // // clonedBundleManager.initialize(address(clonedInstance));
191
- // clonedInstance.setBundleManager(clonedBundleManager);
192
-
193
- // InstanceAdmin clonedInstanceAdmin = InstanceAdmin(Clones.clone(_masterInstanceAdmin));
194
- // clonedAccessManager.grantRole(ADMIN_ROLE().toInt(), address(clonedInstanceAdmin), 0);
195
- // // clonedInstanceAdmin.initialize(address(clonedInstance));
196
- // // clonedInstance.setInstanceAdmin(clonedInstanceAdmin);
197
-
198
- // // TODO amend setters with instance specific , policy manager ...
199
-
200
- // // TODO library does external calls -> but it is registry and access manager -> find out is it best practice
201
- // InstanceAuthorizationsLib.grantInitialAuthorizations(
202
- // clonedAccessManager,
203
- // clonedInstanceAdmin,
204
- // clonedInstance,
205
- // clonedBundleManager,
206
- // clonedInstanceStore,
207
- // instanceOwner,
208
- // getRegistry(),
209
- // getVersion().toMajorPart());
210
-
211
- // clonedAccessManager.renounceRole(ADMIN_ROLE().toInt(), address(this));
212
-
213
- // // register new instance with registry
214
- // IRegistry.ObjectInfo memory info = _registryService.registerInstance(clonedInstance, instanceOwner);
215
- // clonedInstanceNftId = info.nftId;
216
-
217
- // // create corresponding staking target
218
- // _stakingService.createInstanceTarget(
219
- // clonedInstanceNftId,
220
- // TargetManagerLib.getDefaultLockingPeriod(),
221
- // TargetManagerLib.getDefaultRewardRate());
222
-
223
- // emit LogInstanceCloned(
224
- // clonedInstanceNftId,
225
- // address(clonedInstance));
226
- // }
227
-
228
129
 
229
130
  function setStakingLockingPeriod(Seconds stakeLockingPeriod)
230
131
  external
231
132
  virtual
232
133
  onlyInstance()
233
134
  {
234
- NftId instanceNftId = getRegistry().getNftId(msg.sender);
135
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
235
136
  _stakingService.setInstanceLockingPeriod(
236
137
  instanceNftId,
237
138
  stakeLockingPeriod);
@@ -243,7 +144,7 @@ contract InstanceService is
243
144
  virtual
244
145
  onlyInstance()
245
146
  {
246
- NftId instanceNftId = getRegistry().getNftId(msg.sender);
147
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
247
148
  _stakingService.setInstanceRewardRate(
248
149
  instanceNftId,
249
150
  rewardRate);
@@ -255,7 +156,7 @@ contract InstanceService is
255
156
  virtual
256
157
  onlyInstance()
257
158
  {
258
- NftId instanceNftId = getRegistry().getNftId(msg.sender);
159
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
259
160
  _stakingService.refillInstanceRewardReserves(
260
161
  instanceNftId,
261
162
  rewardProvider,
@@ -269,7 +170,7 @@ contract InstanceService is
269
170
  onlyInstance()
270
171
  returns (Amount newBalance)
271
172
  {
272
- NftId instanceNftId = getRegistry().getNftId(msg.sender);
173
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
273
174
  _stakingService.withdrawInstanceRewardReserves(
274
175
  instanceNftId,
275
176
  dipAmount);
@@ -314,35 +215,38 @@ contract InstanceService is
314
215
  {
315
216
  if(_masterInstance != address(0)) { revert ErrorInstanceServiceMasterInstanceAlreadySet(); }
316
217
  if(_masterInstanceAdmin != address(0)) { revert ErrorInstanceServiceMasterInstanceAdminAlreadySet(); }
317
- if(_masterInstanceBundleManager != address(0)) { revert ErrorInstanceServiceMasterBundleManagerAlreadySet(); }
218
+ if(_masterInstanceBundleSet != address(0)) { revert ErrorInstanceServiceMasterBundleSetAlreadySet(); }
318
219
 
319
220
  if(instanceAddress == address(0)) { revert ErrorInstanceServiceInstanceAddressZero(); }
320
221
 
321
222
  IInstance instance = IInstance(instanceAddress);
322
- InstanceAdminNew instanceAdmin = instance.getInstanceAdmin();
223
+ address accessManagerAddress = instance.authority();
224
+ InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
323
225
  address instanceAdminAddress = address(instanceAdmin);
324
226
  InstanceReader instanceReader = instance.getInstanceReader();
325
227
  address instanceReaderAddress = address(instanceReader);
326
- BundleManager bundleManager = instance.getBundleManager();
228
+ BundleSet bundleManager = instance.getBundleSet();
327
229
  address bundleManagerAddress = address(bundleManager);
328
230
  InstanceStore instanceStore = instance.getInstanceStore();
329
231
  address instanceStoreAddress = address(instanceStore);
330
232
 
233
+ if(accessManagerAddress == address(0)) { revert ErrorInstanceServiceAccessManagerZero(); }
331
234
  if(instanceAdminAddress == address(0)) { revert ErrorInstanceServiceInstanceAdminZero(); }
332
235
  if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderZero(); }
333
- if(bundleManagerAddress == address(0)) { revert ErrorInstanceServiceBundleManagerZero(); }
236
+ if(bundleManagerAddress == address(0)) { revert ErrorInstanceServiceBundleSetZero(); }
334
237
  if(instanceStoreAddress == address(0)) { revert ErrorInstanceServiceInstanceStoreZero(); }
335
238
 
336
239
  if(instance.authority() != instanceAdmin.authority()) { revert ErrorInstanceServiceInstanceAuthorityMismatch(); }
337
- if(bundleManager.authority() != instanceAdmin.authority()) { revert ErrorInstanceServiceBundleManagerAuthorityMismatch(); }
240
+ if(bundleManager.authority() != instanceAdmin.authority()) { revert ErrorInstanceServiceBundleSetAuthorityMismatch(); }
338
241
  if(instanceStore.authority() != instanceAdmin.authority()) { revert ErrorInstanceServiceInstanceStoreAuthorityMismatch(); }
339
242
  if(bundleManager.getInstance() != instance) { revert ErrorInstanceServiceBundleMangerInstanceMismatch(); }
340
243
  if(instanceReader.getInstance() != instance) { revert ErrorInstanceServiceInstanceReaderInstanceMismatch2(); }
341
244
 
245
+ _masterAccessManager = accessManagerAddress;
342
246
  _masterInstanceAdmin = instanceAdminAddress;
343
247
  _masterInstance = instanceAddress;
344
248
  _masterInstanceReader = instanceReaderAddress;
345
- _masterInstanceBundleManager = bundleManagerAddress;
249
+ _masterInstanceBundleSet = bundleManagerAddress;
346
250
  _masterInstanceStore = instanceStoreAddress;
347
251
 
348
252
  IInstance masterInstance = IInstance(_masterInstance);
@@ -408,9 +312,9 @@ contract InstanceService is
408
312
  instanceNftId,
409
313
  address(component));
410
314
 
411
- InstanceAdminNew instanceAdmin = instance.getInstanceAdmin();
315
+ InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
412
316
  instanceAdmin.initializeComponentAuthorization(
413
- address(component),
317
+ component,
414
318
  component.getAuthorization());
415
319
  }
416
320
 
@@ -435,6 +339,53 @@ contract InstanceService is
435
339
  );
436
340
  }
437
341
 
342
+ /// @dev create new cloned instance admin
343
+ /// function used to setup a new instance
344
+ function _createInstanceAdmin()
345
+ internal
346
+ virtual
347
+ returns (InstanceAdmin clonedInstanceAdmin)
348
+ {
349
+ // start with setting up a new OZ access manager
350
+ AccessManagerCloneable clonedAccessManager = AccessManagerCloneable(
351
+ Clones.clone(_masterAccessManager));
352
+
353
+ // set up the instance admin
354
+ clonedInstanceAdmin = InstanceAdmin(Clones.clone(_masterInstanceAdmin));
355
+ clonedAccessManager.initialize(
356
+ address(clonedInstanceAdmin)); // grant ADMIN_ROLE to instance admin
357
+
358
+ clonedInstanceAdmin.initialize(
359
+ clonedAccessManager,
360
+ InstanceAdmin(_masterInstanceAdmin).getInstanceAuthorization());
361
+ }
362
+
363
+
364
+ /// @dev create new cloned instance
365
+ /// function used to setup a new instance
366
+ function _createInstance(
367
+ InstanceAdmin instanceAdmin,
368
+ address instanceOwner
369
+ )
370
+ internal
371
+ virtual
372
+ returns (Instance clonedInstance)
373
+ {
374
+ InstanceStore clonedInstanceStore = InstanceStore(Clones.clone(address(_masterInstanceStore)));
375
+ BundleSet clonedBundleSet = BundleSet(Clones.clone(_masterInstanceBundleSet));
376
+ InstanceReader clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
377
+
378
+ // clone instance
379
+ clonedInstance = Instance(Clones.clone(_masterInstance));
380
+ clonedInstance.initialize(
381
+ instanceAdmin,
382
+ clonedInstanceStore,
383
+ clonedBundleSet,
384
+ clonedInstanceReader,
385
+ getRegistry(),
386
+ instanceOwner);
387
+ }
388
+
438
389
 
439
390
  /// all gif targets MUST be children of instanceNftId
440
391
  function _createGifTarget(
@@ -453,7 +404,7 @@ contract InstanceService is
453
404
  // or targetInfo
454
405
  ) = _validateInstanceAndComponent(instanceNftId, targetAddress);
455
406
 
456
- InstanceAdminNew instanceAdmin = instance.getInstanceAdmin();
407
+ InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
457
408
 
458
409
  // TODO refactor/implement
459
410
  // instanceAdmin.createGifTarget(targetAddress, targetName);
@@ -1,13 +1,9 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {Instance} from "./Instance.sol";
5
- import {IVersionable} from "../shared/IVersionable.sol";
6
- import {ProxyManager} from "../shared/ProxyManager.sol";
4
+ import {IVersionable} from "../upgradeability/IVersionable.sol";
5
+ import {ProxyManager} from "../upgradeability/ProxyManager.sol";
7
6
  import {InstanceService} from "./InstanceService.sol";
8
- import {Registry} from "../registry/Registry.sol";
9
- import {RegistryService} from "../registry/RegistryService.sol";
10
- import {REGISTRY} from "../type/ObjectType.sol";
11
7
 
12
8
  contract InstanceServiceManager is ProxyManager {
13
9
 
@@ -7,7 +7,7 @@ import {Amount} from "../type/Amount.sol";
7
7
  import {Key32} from "../type/Key32.sol";
8
8
  import {NftId} from "../type/NftId.sol";
9
9
  import {ClaimId} from "../type/ClaimId.sol";
10
- import {ObjectType, BUNDLE, POLICY, POOL, PRODUCT, COMPONENT, DISTRIBUTOR, DISTRIBUTOR_TYPE} from "../type/ObjectType.sol";
10
+ import {ObjectType, BUNDLE, POLICY, POOL, PREMIUM, PRODUCT, COMPONENT, DISTRIBUTOR} from "../type/ObjectType.sol";
11
11
  import {RequestId} from "../type/RequestId.sol";
12
12
  import {RiskId} from "../type/RiskId.sol";
13
13
  import {StateId} from "../type/StateId.sol";
@@ -27,12 +27,15 @@ import {IPolicy} from "./module/IPolicy.sol";
27
27
  import {IOracle} from "../oracle/IOracle.sol";
28
28
  import {IRisk} from "./module/IRisk.sol";
29
29
 
30
+ import {ObjectLifecycle} from "./base/ObjectLifecycle.sol";
31
+
30
32
 
31
33
  contract InstanceStore is
32
34
  AccessManagedUpgradeable,
33
35
  BalanceStore,
34
36
  KeyValueStore,
35
- ObjectCounter
37
+ ObjectCounter,
38
+ ObjectLifecycle
36
39
  {
37
40
 
38
41
  /// @dev This initializer needs to be called from the instance itself.
@@ -44,8 +47,8 @@ contract InstanceStore is
44
47
  address authority = IInstance(instance).authority();
45
48
 
46
49
  __AccessManaged_init(authority);
47
-
48
- initializeLifecycle();
50
+ // double initialization, safe
51
+ _initializeLifecycle();
49
52
  }
50
53
 
51
54
  //--- Component ---------------------------------------------------------//
@@ -113,6 +116,7 @@ contract InstanceStore is
113
116
 
114
117
  //--- Distributor -------------------------------------------------------//
115
118
  function createDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info) external restricted() {
119
+ _registerBalanceTarget(distributorNftId);
116
120
  _create(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info));
117
121
  }
118
122
 
@@ -191,6 +195,16 @@ contract InstanceStore is
191
195
  _updateState(_toNftKey32(policyNftId, POLICY()), newState);
192
196
  }
193
197
 
198
+
199
+ //--- Premium (Policy) ----------------------------------------------//
200
+ function createPremium(NftId policyNftId, IPolicy.PremiumInfo memory premium) external restricted() {
201
+ _create(_toNftKey32(policyNftId, PREMIUM()), abi.encode(premium));
202
+ }
203
+
204
+ function updatePremiumState(NftId policyNftId, StateId newState) external restricted() {
205
+ _updateState(_toNftKey32(policyNftId, PREMIUM()), newState);
206
+ }
207
+
194
208
  //--- Claim -------------------------------------------------------------//
195
209
  function createClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim) external restricted() {
196
210
  _create(_toClaimKey32(policyNftId, claimId), abi.encode(claim));