@etherisc/gif-next 0.0.2-f15b559-661 → 0.0.2-f1b01e0-214

Sign up to get free protection for your applications and to get access to all the features.
Files changed (396) hide show
  1. package/README.md +43 -0
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
  3. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +38 -38
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
  5. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +26 -26
  6. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
  7. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +6 -6
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  9. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +366 -251
  10. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +4 -0
  12. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +673 -0
  13. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  14. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +8 -39
  15. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  16. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +101 -28
  17. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  18. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  19. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +283 -189
  20. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  21. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +37 -5
  22. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  23. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  24. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
  25. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +32 -145
  27. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +101 -46
  29. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +1 -87
  31. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  32. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +160 -89
  33. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  34. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +56 -52
  35. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  36. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +1 -87
  37. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  38. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +68 -5
  39. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  40. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  41. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +44 -74
  42. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  43. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +101 -46
  44. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  45. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +94 -124
  46. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  47. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +101 -46
  48. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  49. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  50. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +82 -173
  51. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
  52. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +101 -46
  53. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  54. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +20 -63
  55. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  56. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +69 -112
  57. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
  58. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +101 -46
  59. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  60. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +95 -138
  61. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
  62. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +101 -46
  63. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  64. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  65. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  66. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +104 -8
  67. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  68. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +62 -13
  69. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  70. package/artifacts/contracts/instance/Instance.sol/Instance.json +119 -26
  71. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  72. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +520 -413
  73. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  74. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +101 -46
  75. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  76. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +225 -196
  77. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  78. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +94 -65
  79. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  80. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +26 -36
  81. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  82. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +356 -346
  83. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
  84. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +2 -2
  85. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  86. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  87. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  88. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  89. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  90. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  91. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  92. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  93. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  94. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +1 -1
  95. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +20 -20
  96. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  97. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  98. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  99. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  100. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  101. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  102. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  103. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +14 -35
  104. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  105. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +98 -35
  106. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  107. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  108. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +0 -21
  109. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  110. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  111. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +0 -21
  112. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  113. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +42 -42
  114. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  115. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +31 -31
  116. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  117. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +22 -43
  118. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  119. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +101 -46
  120. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  121. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +64 -64
  122. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  123. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +39 -39
  124. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  125. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +6 -6
  126. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  127. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +10 -31
  128. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  129. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +18 -18
  130. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  131. package/artifacts/contracts/pool/Pool.sol/Pool.json +10 -31
  132. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
  133. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +34 -34
  134. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  135. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +80 -80
  136. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  137. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +41 -41
  138. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  139. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +90 -24
  140. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  141. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +34 -22
  142. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  143. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +27 -48
  144. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  145. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +101 -46
  146. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  147. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +78 -78
  148. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  149. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +50 -50
  150. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  151. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +42 -0
  152. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  153. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  154. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  155. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +21 -0
  156. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  157. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +21 -42
  158. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  159. package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +21 -0
  160. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  161. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +62 -62
  162. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
  163. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +32 -32
  164. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  165. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +41 -41
  166. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  167. package/artifacts/contracts/product/PricingService.sol/PricingService.json +63 -82
  168. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  169. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +31 -51
  170. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  171. package/artifacts/contracts/product/Product.sol/Product.json +21 -42
  172. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  173. package/artifacts/contracts/product/RiskService.sol/RiskService.json +55 -26
  174. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  175. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +27 -23
  176. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  177. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  178. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  179. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +1 -1
  180. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  181. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  182. package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
  183. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  184. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +445 -355
  185. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +4 -0
  186. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +878 -0
  187. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  188. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -18
  189. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  190. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +19 -19
  191. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
  192. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +481 -376
  193. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  194. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  195. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  196. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +128 -124
  197. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  198. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
  199. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  200. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  201. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  202. package/artifacts/contracts/shared/Component.sol/Component.json +0 -21
  203. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  204. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +114 -129
  205. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  206. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +45 -49
  207. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  208. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  209. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +60 -4
  210. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
  211. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
  212. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +1 -1
  213. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  214. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +0 -21
  215. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  216. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +44 -51
  217. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  218. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +0 -21
  219. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  220. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  221. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  222. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  223. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  224. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  225. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  226. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  227. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -2
  228. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  229. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +0 -21
  230. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  231. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  232. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  233. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  234. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  235. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  236. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  237. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  238. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  239. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  240. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  241. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  242. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  243. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  244. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
  245. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
  246. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  247. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  248. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  249. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +83 -39
  250. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  251. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +75 -4
  252. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  253. package/artifacts/contracts/staking/Staking.sol/Staking.json +133 -94
  254. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +4 -0
  255. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +469 -0
  256. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  257. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  258. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  259. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +41 -37
  260. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  261. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +34 -61
  262. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  263. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +109 -30
  264. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  265. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +27 -23
  266. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  267. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +148 -134
  268. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  269. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +47 -37
  270. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  271. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  272. package/artifacts/contracts/type/Amount.sol/AmountLib.json +10 -10
  273. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  274. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  275. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  276. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  277. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  278. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  279. package/artifacts/contracts/type/Fee.sol/FeeLib.json +93 -37
  280. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  281. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  282. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
  283. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +2 -2
  284. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  286. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  287. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  288. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  289. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +33 -31
  290. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  291. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  292. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  293. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  294. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  295. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  296. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  297. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  298. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  299. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
  300. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  301. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  302. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  303. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  304. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  305. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  306. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  307. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +60 -36
  308. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  309. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
  310. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  311. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +56 -2
  312. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  313. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  314. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +4 -4
  315. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  316. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  317. package/contracts/accounting/IAccountingService.sol +2 -2
  318. package/contracts/authorization/AccessAdmin.sol +201 -186
  319. package/contracts/authorization/AccessAdminLib.sol +183 -0
  320. package/contracts/authorization/AccessManagerCloneable.sol +40 -31
  321. package/contracts/authorization/Authorization.sol +61 -33
  322. package/contracts/authorization/IAccess.sol +13 -5
  323. package/contracts/authorization/IAccessAdmin.sol +63 -36
  324. package/contracts/authorization/IAuthorization.sol +6 -0
  325. package/contracts/distribution/BasicDistribution.sol +6 -6
  326. package/contracts/distribution/BasicDistributionAuthorization.sol +1 -1
  327. package/contracts/distribution/Distribution.sol +3 -48
  328. package/contracts/distribution/DistributionService.sol +57 -30
  329. package/contracts/distribution/IDistributionComponent.sol +0 -9
  330. package/contracts/distribution/IDistributionService.sol +4 -2
  331. package/contracts/examples/fire/FirePool.sol +0 -4
  332. package/contracts/examples/fire/FireProduct.sol +0 -4
  333. package/contracts/examples/unpermissioned/SimpleDistribution.sol +32 -8
  334. package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -8
  335. package/contracts/examples/unpermissioned/SimplePool.sol +0 -4
  336. package/contracts/examples/unpermissioned/SimpleProduct.sol +0 -4
  337. package/contracts/instance/IInstance.sol +45 -9
  338. package/contracts/instance/IInstanceService.sol +19 -3
  339. package/contracts/instance/Instance.sol +73 -16
  340. package/contracts/instance/InstanceAdmin.sol +120 -107
  341. package/contracts/instance/InstanceAuthorizationV3.sol +43 -21
  342. package/contracts/instance/InstanceReader.sol +13 -0
  343. package/contracts/instance/InstanceService.sol +128 -73
  344. package/contracts/instance/module/IBundle.sol +6 -5
  345. package/contracts/instance/module/IComponents.sol +16 -5
  346. package/contracts/instance/module/IDistribution.sol +19 -7
  347. package/contracts/instance/module/IPolicy.sol +28 -8
  348. package/contracts/instance/module/IRisk.sol +2 -0
  349. package/contracts/oracle/BasicOracle.sol +1 -3
  350. package/contracts/oracle/BasicOracleAuthorization.sol +1 -1
  351. package/contracts/oracle/IOracle.sol +9 -4
  352. package/contracts/oracle/Oracle.sol +0 -2
  353. package/contracts/pool/BasicPool.sol +0 -2
  354. package/contracts/pool/BasicPoolAuthorization.sol +1 -1
  355. package/contracts/pool/Pool.sol +0 -2
  356. package/contracts/pool/PoolService.sol +1 -3
  357. package/contracts/product/ApplicationService.sol +21 -6
  358. package/contracts/product/BasicProduct.sol +0 -2
  359. package/contracts/product/BasicProductAuthorization.sol +1 -1
  360. package/contracts/product/IApplicationService.sol +3 -0
  361. package/contracts/product/IPricingService.sol +1 -0
  362. package/contracts/product/IRiskService.sol +3 -0
  363. package/contracts/product/PolicyService.sol +0 -18
  364. package/contracts/product/PricingService.sol +11 -6
  365. package/contracts/product/Product.sol +0 -2
  366. package/contracts/product/RiskService.sol +10 -0
  367. package/contracts/registry/IRegistry.sol +4 -0
  368. package/contracts/registry/RegistryAdmin.sol +133 -229
  369. package/contracts/registry/RegistryAuthorization.sol +267 -0
  370. package/contracts/registry/ReleaseAdmin.sol +30 -22
  371. package/contracts/registry/ReleaseRegistry.sol +39 -33
  372. package/contracts/registry/ServiceAuthorizationV3.sol +87 -3
  373. package/contracts/shared/Component.sol +13 -30
  374. package/contracts/shared/ComponentService.sol +58 -42
  375. package/contracts/shared/ContractLib.sol +28 -0
  376. package/contracts/shared/IComponent.sol +0 -3
  377. package/contracts/shared/IComponentService.sol +9 -9
  378. package/contracts/shared/InitializableERC165.sol +9 -1
  379. package/contracts/shared/InstanceLinkedComponent.sol +0 -2
  380. package/contracts/shared/NftOwnable.sol +1 -1
  381. package/contracts/shared/Registerable.sol +1 -4
  382. package/contracts/shared/TokenHandler.sol +5 -4
  383. package/contracts/staking/IStaking.sol +12 -2
  384. package/contracts/staking/IStakingService.sol +8 -1
  385. package/contracts/staking/Staking.sol +35 -15
  386. package/contracts/staking/{StakeManagerLib.sol → StakingLib.sol} +79 -22
  387. package/contracts/staking/StakingReader.sol +5 -15
  388. package/contracts/staking/StakingService.sol +36 -2
  389. package/contracts/staking/StakingStore.sol +2 -1
  390. package/contracts/type/Fee.sol +8 -8
  391. package/contracts/type/ObjectType.sol +5 -14
  392. package/contracts/type/UFixed.sol +27 -10
  393. package/contracts/type/Version.sol +39 -0
  394. package/package.json +2 -2
  395. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +0 -4
  396. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +0 -440
@@ -7,6 +7,9 @@ import {Amount} from "../../type/Amount.sol";
7
7
  import {BasicDistribution} from "../../distribution/BasicDistribution.sol";
8
8
  import {IAuthorization} from "../../authorization/IAuthorization.sol";
9
9
  import {NftId} from "../../type/NftId.sol";
10
+ import {ReferralId} from "../../type/Referral.sol";
11
+ import {Timestamp, TimestampLib} from "../../type/Timestamp.sol";
12
+ import {UFixed, UFixedLib} from "../../type/UFixed.sol";
10
13
 
11
14
 
12
15
  contract SimpleDistribution is
@@ -17,8 +20,7 @@ contract SimpleDistribution is
17
20
  address registry,
18
21
  NftId productNftId,
19
22
  IAuthorization authorization,
20
- address initialOwner,
21
- address token
23
+ address initialOwner
22
24
  )
23
25
  {
24
26
  initialize(
@@ -26,8 +28,7 @@ contract SimpleDistribution is
26
28
  productNftId,
27
29
  authorization,
28
30
  initialOwner,
29
- "SimpleDistribution",
30
- token);
31
+ "SimpleDistribution");
31
32
  }
32
33
 
33
34
  function initialize(
@@ -35,8 +36,7 @@ contract SimpleDistribution is
35
36
  NftId productNftId,
36
37
  IAuthorization authorization,
37
38
  address initialOwner,
38
- string memory name,
39
- address token
39
+ string memory name
40
40
  )
41
41
  public
42
42
  virtual
@@ -47,11 +47,35 @@ contract SimpleDistribution is
47
47
  productNftId,
48
48
  authorization,
49
49
  initialOwner,
50
- name,
51
- token);
50
+ name);
52
51
  }
53
52
 
54
53
  function approveTokenHandler(IERC20Metadata token, Amount amount) external restricted() onlyOwner() { _approveTokenHandler(token, amount); }
55
54
  function setLocked(bool locked) external onlyOwner() { _setLocked(locked); }
56
55
  function setWallet(address newWallet) external restricted() onlyOwner() { _setWallet(newWallet); }
56
+
57
+ /**
58
+ * @dev create referral codes. This is required for testing only to provide a distributor that is not the message sender.
59
+ */
60
+ function createReferral2(
61
+ NftId distributorNftId,
62
+ string memory code,
63
+ UFixed discountPercentage,
64
+ uint32 maxReferrals,
65
+ Timestamp expiryAt,
66
+ bytes memory data
67
+ )
68
+ external
69
+ virtual
70
+ returns (ReferralId referralId)
71
+ {
72
+ return _createReferral(
73
+ distributorNftId,
74
+ code,
75
+ discountPercentage,
76
+ maxReferrals,
77
+ expiryAt,
78
+ data); // data
79
+ }
80
+
57
81
  }
@@ -34,8 +34,7 @@ contract SimpleOracle is
34
34
  address registry,
35
35
  NftId productNftId,
36
36
  IAuthorization authorization,
37
- address initialOwner,
38
- address token
37
+ address initialOwner
39
38
  )
40
39
  {
41
40
  initialize(
@@ -43,8 +42,7 @@ contract SimpleOracle is
43
42
  productNftId,
44
43
  authorization,
45
44
  initialOwner,
46
- "SimpleOracle",
47
- token
45
+ "SimpleOracle"
48
46
  );
49
47
  }
50
48
 
@@ -53,8 +51,7 @@ contract SimpleOracle is
53
51
  NftId productNftId,
54
52
  IAuthorization authorization,
55
53
  address initialOwner,
56
- string memory name,
57
- address token
54
+ string memory name
58
55
  )
59
56
  public
60
57
  virtual
@@ -65,8 +62,7 @@ contract SimpleOracle is
65
62
  productNftId,
66
63
  authorization,
67
64
  initialOwner,
68
- name,
69
- token);
65
+ name);
70
66
  }
71
67
 
72
68
  /// @dev use case specific handling of oracle requests
@@ -19,7 +19,6 @@ contract SimplePool is
19
19
  constructor(
20
20
  address registry,
21
21
  NftId productNftId,
22
- address token,
23
22
  IComponents.PoolInfo memory poolInfo,
24
23
  IAuthorization authorization,
25
24
  address initialOwner
@@ -28,7 +27,6 @@ contract SimplePool is
28
27
  initialize(
29
28
  registry,
30
29
  productNftId,
31
- token,
32
30
  poolInfo,
33
31
  authorization,
34
32
  initialOwner
@@ -39,7 +37,6 @@ contract SimplePool is
39
37
  function initialize(
40
38
  address registry,
41
39
  NftId productNftId,
42
- address token,
43
40
  IComponents.PoolInfo memory poolInfo,
44
41
  IAuthorization authorization,
45
42
  address initialOwner
@@ -52,7 +49,6 @@ contract SimplePool is
52
49
  registry,
53
50
  productNftId,
54
51
  "SimplePool",
55
- token,
56
52
  poolInfo,
57
53
  authorization,
58
54
  initialOwner);
@@ -37,7 +37,6 @@ contract SimpleProduct is
37
37
  address registry,
38
38
  NftId instanceNftId,
39
39
  string memory name,
40
- address token,
41
40
  IComponents.ProductInfo memory productInfo,
42
41
  IComponents.FeeInfo memory feeInfo,
43
42
  IAuthorization authorization,
@@ -48,7 +47,6 @@ contract SimpleProduct is
48
47
  registry,
49
48
  instanceNftId,
50
49
  name,
51
- token,
52
50
  productInfo,
53
51
  feeInfo,
54
52
  authorization,
@@ -60,7 +58,6 @@ contract SimpleProduct is
60
58
  address registry,
61
59
  NftId instanceNftid,
62
60
  string memory name,
63
- address token,
64
61
  IComponents.ProductInfo memory productInfo,
65
62
  IComponents.FeeInfo memory feeInfo,
66
63
  IAuthorization authorization,
@@ -74,7 +71,6 @@ contract SimpleProduct is
74
71
  registry,
75
72
  instanceNftid,
76
73
  name,
77
- token,
78
74
  productInfo,
79
75
  feeInfo,
80
76
  authorization,
@@ -18,7 +18,7 @@ interface IInstance is
18
18
  IRegisterable
19
19
  {
20
20
  error ErrorInstanceInstanceAdminZero();
21
- error ErrorInstanceInstanceAdminAlreadySet(address InstanceAdmin);
21
+ error ErrorInstanceInstanceAdminAlreadySet(address instanceAdmin);
22
22
  error ErrorInstanceInstanceAdminAuthorityMismatch(address instanceAuthority);
23
23
 
24
24
  error ErrorInstanceBundleSetAlreadySet(address instanceBundleSet);
@@ -38,8 +38,44 @@ interface IInstance is
38
38
  uint64 requestsCount;
39
39
  }
40
40
 
41
+ ///--- instance ---------------------------------------------------------//
42
+
43
+ /// @dev Locks/unlocks the complete instance, including all its components.
44
+ function setInstanceLocked(bool locked) external;
45
+
46
+ /// @dev Upgrades the instance reader to the specified target.
47
+ function upgradeInstanceReader() external;
48
+
49
+ /// @dev Sets the instance reader for the instance.
50
+ /// Permissioned: only the instance service may call this function.
51
+ function setInstanceReader(InstanceReader instanceReader) external;
52
+
53
+ ///--- staking ----------------------------------------------------------//
54
+
55
+ /// @dev Sets the duration for locking new stakes on this instance..
56
+ function setStakingLockingPeriod(Seconds stakeLockingPeriod) external;
57
+
58
+ /// @dev Sets the staking reward rate [apr] for this instance.
59
+ function setStakingRewardRate(UFixed rewardRate) external;
60
+
61
+ /// @dev Sets the maximum staked amount for this instance.
62
+ function setStakingMaxAmount(Amount maxStakedAmount) external;
63
+
64
+ /// @dev Refills the staking reward reserves for the specified target.
65
+ function refillStakingRewardReserves(Amount dipAmount) external;
66
+
67
+ /// @dev Defunds the staking reward reserves for the specified target.
68
+ function withdrawStakingRewardReserves(Amount dipAmount) external returns (Amount newBalance);
69
+
70
+ ///--- product/component ------------------------------------------------//
71
+
72
+ /// @dev Locks/unlocks the specified target.
73
+ function setTargetLocked(address target, bool locked) external;
74
+
41
75
  /// @dev Register a product with the instance.
42
- function registerProduct(address product) external returns (NftId productNftId);
76
+ function registerProduct(address product, address token) external returns (NftId productNftId);
77
+
78
+ ///--- authz ------------------------------------------------------------//
43
79
 
44
80
  function createRole(string memory roleName, string memory adminName) external returns (RoleId roleId, RoleId admin);
45
81
  function grantRole(RoleId roleId, address account) external;
@@ -47,15 +83,14 @@ interface IInstance is
47
83
 
48
84
  function createTarget(address target, string memory name) external;
49
85
  function setTargetFunctionRole(string memory targetName, bytes4[] calldata selectors, RoleId roleId) external;
50
- function setLocked(address target, bool locked) external;
51
86
 
52
- function setStakingLockingPeriod(Seconds stakeLockingPeriod) external;
53
- function setStakingRewardRate(UFixed rewardRate) external;
54
- function refillStakingRewardReserves(Amount dipAmount) external;
87
+ //--- getters -----------------------------------------------------------//
55
88
 
56
- /// @dev Defunds the staking reward reserves for the specified target.
57
- /// Permissioned: only the target owner may call this function.
58
- function withdrawStakingRewardReserves(Amount dipAmount) external returns (Amount newBalance);
89
+ /// @dev returns the overall locking state of the instance (including all components)
90
+ function isInstanceLocked() external view returns (bool isLocked);
91
+
92
+ /// @dev returns the locking state of the specified target
93
+ function isTargetLocked(address target) external view returns (bool isLocked);
59
94
 
60
95
  // get products
61
96
  function products() external view returns (uint256 productCount);
@@ -67,4 +102,5 @@ interface IInstance is
67
102
  function getRiskSet() external view returns (RiskSet);
68
103
  function getInstanceAdmin() external view returns (InstanceAdmin);
69
104
  function getInstanceStore() external view returns (InstanceStore);
105
+ function isTokenRegistryDisabled() external view returns (bool);
70
106
  }
@@ -15,7 +15,7 @@ interface IInstanceService is IService {
15
15
  // onlyInstance
16
16
  error ErrorInstanceServiceNotRegistered(address instance);
17
17
  error ErrorInstanceServiceNotInstance(address instance, ObjectType objectType);
18
- error ErrorInstanceServiceInstanceVersionMismatch(address instance, VersionPart instanceVersion);
18
+ error ErrorInstanceServiceInstanceVersionMismatch(NftId instanceNftId, VersionPart expectedRelease, VersionPart instanceRelease);
19
19
 
20
20
  error ErrorInstanceServiceComponentNotInstanceLinked(address component);
21
21
 
@@ -53,18 +53,34 @@ interface IInstanceService is IService {
53
53
 
54
54
  event LogInstanceCloned(NftId instanceNftId, address instance);
55
55
 
56
- function createInstance()
56
+ /// @dev Locks the complete instance, including all its components.
57
+ function setInstanceLocked(bool locked) external;
58
+
59
+ /// @dev Locks/unlocks the specified target constrolled by the corresponding instance admin.
60
+ function setTargetLocked(address target, bool locked) external;
61
+
62
+ /// @dev Creates a new instance.
63
+ /// The caller becomes the owner of the new instance.
64
+ /// Creation of a new instance is achieved by this service through the creation and registration
65
+ /// of a new clone of the master instance and then setting up the initial wiring and authorization
66
+ /// of the necessary components.
67
+ /// @param allowAnyToken specifies whether the new instance is allowed to use any token or
68
+ /// only tokens that are registered in the `TokenRegistry`. Use of tokens **not** registered in the
69
+ /// `TokenRegistry` may result in problems with token handline and is therefor not recommended. The
70
+ /// use of such instances **is not supported** by Etherisc.
71
+ function createInstance(bool allowAnyToken)
57
72
  external
58
73
  returns (
59
74
  IInstance instance,
60
75
  NftId instanceNftId
61
76
  );
62
77
 
63
- function upgradeInstanceReader(NftId instanceNftId) external;
78
+ function upgradeInstanceReader() external;
64
79
  function upgradeMasterInstanceReader(address instanceReaderAddress) external;
65
80
 
66
81
  function setStakingLockingPeriod(Seconds stakeLockingPeriod) external;
67
82
  function setStakingRewardRate(UFixed rewardRate) external;
83
+ function setStakingMaxAmount(Amount maxStakedAmount) external;
68
84
  function refillStakingRewardReserves(address rewardProvider, Amount dipAmount) external;
69
85
 
70
86
  /// @dev Defunds the staking reward reserves for the specified target.
@@ -1,22 +1,24 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {IInstance} from "./IInstance.sol";
5
+ import {IComponentService} from "../shared/IComponentService.sol";
6
+ import {IInstanceService} from "./IInstanceService.sol";
7
+ import {IRegistry} from "../registry/IRegistry.sol";
8
+
4
9
  import {Amount} from "../type/Amount.sol";
5
10
  import {BundleSet} from "./BundleSet.sol";
6
11
  import {RiskSet} from "./RiskSet.sol";
7
12
  import {COMPONENT, INSTANCE} from "../type/ObjectType.sol";
8
- import {IInstance} from "./IInstance.sol";
9
- import {IComponentService} from "../shared/IComponentService.sol";
10
- import {IInstanceService} from "./IInstanceService.sol";
11
13
  import {InstanceReader} from "./InstanceReader.sol";
12
14
  import {InstanceAdmin} from "./InstanceAdmin.sol";
13
15
  import {InstanceStore} from "./InstanceStore.sol";
14
- import {IRegistry} from "../registry/IRegistry.sol";
15
16
  import {NftId} from "../type/NftId.sol";
16
17
  import {Registerable} from "../shared/Registerable.sol";
17
18
  import {RoleId} from "../type/RoleId.sol";
18
19
  import {Seconds} from "../type/Seconds.sol";
19
20
  import {UFixed} from "../type/UFixed.sol";
21
+ import {VersionPart} from "../type/Version.sol";
20
22
 
21
23
  contract Instance is
22
24
  IInstance,
@@ -33,6 +35,7 @@ contract Instance is
33
35
  RiskSet internal _riskSet;
34
36
  InstanceStore internal _instanceStore;
35
37
  NftId [] internal _products;
38
+ bool internal _tokenRegistryDisabled;
36
39
 
37
40
  modifier onlyChainNft() {
38
41
  if(msg.sender != getRegistry().getChainNftAddress()) {
@@ -48,7 +51,9 @@ contract Instance is
48
51
  RiskSet riskSet,
49
52
  InstanceReader instanceReader,
50
53
  IRegistry registry,
51
- address initialOwner
54
+ VersionPart release,
55
+ address initialOwner,
56
+ bool tokenRegistryDisabled
52
57
  )
53
58
  external
54
59
  initializer()
@@ -84,24 +89,46 @@ contract Instance is
84
89
  _componentService = IComponentService(
85
90
  getRegistry().getServiceAddress(
86
91
  COMPONENT(),
87
- getRelease()));
92
+ release));
88
93
 
89
94
  _instanceService = IInstanceService(
90
95
  getRegistry().getServiceAddress(
91
96
  INSTANCE(),
92
- getRelease()));
97
+ release));
98
+
99
+ _tokenRegistryDisabled = tokenRegistryDisabled;
93
100
 
94
101
  _registerInterface(type(IInstance).interfaceId);
95
102
  }
96
103
 
104
+
105
+ function setInstanceLocked(bool locked)
106
+ external
107
+ // not restricted(): need to be able to unlock a locked instance
108
+ onlyOwner()
109
+ {
110
+ _instanceService.setInstanceLocked(locked);
111
+ }
112
+
113
+
114
+ function upgradeInstanceReader()
115
+ external
116
+ restricted()
117
+ onlyOwner()
118
+ {
119
+ _instanceService.upgradeInstanceReader();
120
+ }
121
+
122
+
97
123
  //--- ProductRegistration ----------------------------------------------//
98
124
 
99
- function registerProduct(address product)
125
+ function registerProduct(address product, address token)
100
126
  external
127
+ restricted()
101
128
  onlyOwner()
102
129
  returns (NftId productNftId)
103
130
  {
104
- productNftId = _componentService.registerProduct(product);
131
+ productNftId = _componentService.registerProduct(product, token);
105
132
  _products.push(productNftId);
106
133
  }
107
134
 
@@ -109,6 +136,7 @@ contract Instance is
109
136
 
110
137
  function setStakingLockingPeriod(Seconds stakeLockingPeriod)
111
138
  external
139
+ restricted()
112
140
  onlyOwner()
113
141
  {
114
142
  _instanceService.setStakingLockingPeriod(stakeLockingPeriod);
@@ -116,13 +144,22 @@ contract Instance is
116
144
 
117
145
  function setStakingRewardRate(UFixed rewardRate)
118
146
  external
147
+ restricted()
119
148
  onlyOwner()
120
149
  {
121
150
  _instanceService.setStakingRewardRate(rewardRate);
122
151
  }
123
152
 
153
+ function setStakingMaxAmount(Amount maxStakedAmount)
154
+ external
155
+ onlyOwner()
156
+ {
157
+ _instanceService.setStakingMaxAmount(maxStakedAmount);
158
+ }
159
+
124
160
  function refillStakingRewardReserves(Amount dipAmount)
125
161
  external
162
+ restricted()
126
163
  onlyOwner()
127
164
  {
128
165
  address instanceOwner = msg.sender;
@@ -131,6 +168,7 @@ contract Instance is
131
168
 
132
169
  function withdrawStakingRewardReserves(Amount dipAmount)
133
170
  external
171
+ restricted()
134
172
  onlyOwner()
135
173
  returns (Amount newBalance)
136
174
  {
@@ -141,6 +179,7 @@ contract Instance is
141
179
 
142
180
  function createRole(string memory roleName, string memory adminName)
143
181
  external
182
+ restricted()
144
183
  onlyOwner()
145
184
  returns (RoleId roleId, RoleId admin)
146
185
  {
@@ -150,6 +189,7 @@ contract Instance is
150
189
 
151
190
  function grantRole(RoleId roleId, address account)
152
191
  external
192
+ restricted()
153
193
  onlyOwner()
154
194
  {
155
195
  _instanceAdmin.grantRole(roleId, account);
@@ -157,6 +197,7 @@ contract Instance is
157
197
 
158
198
  function revokeRole(RoleId roleId, address account)
159
199
  external
200
+ restricted()
160
201
  onlyOwner()
161
202
  {
162
203
  // TODO refactor
@@ -165,8 +206,18 @@ contract Instance is
165
206
 
166
207
  //--- Targets ------------------------------------------------------------//
167
208
 
209
+
210
+ function setTargetLocked(address target, bool locked)
211
+ external
212
+ // not restricted(): instance owner may need to be able to unlock targets on an locked instance
213
+ onlyOwner()
214
+ {
215
+ _instanceService.setTargetLocked(target, locked);
216
+ }
217
+
168
218
  function createTarget(address target, string memory name)
169
219
  external
220
+ restricted()
170
221
  onlyOwner()
171
222
  {
172
223
  // TODO refactor
@@ -179,19 +230,13 @@ contract Instance is
179
230
  RoleId roleId
180
231
  )
181
232
  external
233
+ restricted()
182
234
  onlyOwner()
183
235
  {
184
236
  // TODO refactor
185
237
  // _instanceAdmin.setTargetFunctionRoleByInstance(targetName, selectors, roleId);
186
238
  }
187
239
 
188
- function setLocked(address target, bool locked)
189
- external
190
- onlyOwner()
191
- {
192
- _componentService.setLockedFromInstance(target, locked);
193
- }
194
-
195
240
  //--- ITransferInterceptor ----------------------------------------------//
196
241
 
197
242
  function nftTransferFrom(address from, address to, uint256 tokenId, address operator) external onlyChainNft {
@@ -215,6 +260,14 @@ contract Instance is
215
260
 
216
261
  //--- external view functions -------------------------------------------//
217
262
 
263
+ function isInstanceLocked() external view returns (bool) {
264
+ return _instanceAdmin.isLocked();
265
+ }
266
+
267
+ function isTargetLocked(address target) external view returns (bool) {
268
+ return _instanceAdmin.isTargetLocked(target);
269
+ }
270
+
218
271
  function products() external view returns (uint256 productCount) {
219
272
  return _products.length;
220
273
  }
@@ -243,5 +296,9 @@ contract Instance is
243
296
  return _instanceStore;
244
297
  }
245
298
 
299
+ function isTokenRegistryDisabled() external view returns (bool) {
300
+ return _tokenRegistryDisabled;
301
+ }
302
+
246
303
  //--- internal view/pure functions --------------------------------------//
247
304
  }