@etherisc/gif-next 0.0.2-98e9f45-792 → 0.0.2-998ff1b-277

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/README.md +1 -1
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  3. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +33 -52
  4. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  5. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  6. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +2 -2
  7. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  8. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  9. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +0 -19
  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/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
  14. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +2 -2
  15. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  16. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
  17. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  18. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +30 -188
  19. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  20. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +2 -2
  21. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  22. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +0 -158
  23. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  24. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +85 -192
  25. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +84 -104
  27. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +0 -11
  29. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  30. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +4 -0
  31. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1411 -0
  32. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
  33. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1171 -0
  34. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
  35. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1517 -0
  36. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
  37. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +1978 -0
  38. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  39. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  40. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  41. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  42. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  43. package/artifacts/contracts/instance/Instance.sol/Instance.json +10 -99
  44. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  45. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +95 -98
  46. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  47. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +14 -14
  48. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +89 -70
  50. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +39 -146
  52. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  53. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +61 -81
  54. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  55. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +92 -217
  56. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  57. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  58. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  59. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  60. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  61. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  62. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  63. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  64. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  65. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  66. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  68. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  69. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  70. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  71. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +20 -178
  72. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  73. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +2 -2
  74. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  75. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  76. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +0 -11
  77. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  78. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  79. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +0 -158
  80. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  81. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +37 -144
  82. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  83. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +60 -80
  84. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  85. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +5 -163
  86. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  87. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +2 -2
  88. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  89. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +81 -188
  90. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  91. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +82 -102
  92. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  93. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  94. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +5 -16
  95. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  96. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +0 -10
  97. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  98. package/artifacts/contracts/pool/Pool.sol/Pool.json +5 -163
  99. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  100. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +43 -160
  101. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  102. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +63 -83
  103. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  104. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +31 -146
  105. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  106. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +57 -81
  107. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  108. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +0 -158
  109. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  110. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +2 -2
  111. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  112. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +190 -175
  113. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  114. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +92 -100
  115. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  116. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  117. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +98 -0
  118. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  119. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +83 -11
  120. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  121. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  122. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +0 -11
  123. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
  124. package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +2 -2
  125. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  126. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +173 -189
  127. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  128. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +91 -95
  129. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  130. package/artifacts/contracts/product/PricingService.sol/PricingService.json +55 -162
  131. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  132. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +68 -88
  133. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  134. package/artifacts/contracts/product/Product.sol/Product.json +0 -158
  135. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
  136. package/artifacts/contracts/product/RiskService.sol/RiskService.json +588 -0
  137. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
  138. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +682 -0
  139. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  140. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +59 -16
  141. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  142. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +221 -21
  143. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  144. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  145. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  146. package/artifacts/contracts/registry/Registry.sol/Registry.json +419 -82
  147. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  148. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +244 -132
  149. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  150. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +23 -130
  151. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  152. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +52 -72
  153. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  154. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  155. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  156. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +24 -14
  157. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  158. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +2 -2
  159. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  160. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  161. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  162. package/artifacts/contracts/shared/Component.sol/Component.json +0 -147
  163. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  164. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +75 -182
  165. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  166. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +89 -99
  167. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  168. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +5 -112
  169. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
  170. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +92 -0
  171. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  172. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  173. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  174. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +0 -11
  175. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  176. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  177. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  178. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  179. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +14 -46
  180. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  181. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  182. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  183. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +1 -1
  184. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  185. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -22
  186. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  187. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +0 -158
  188. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  189. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  190. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  191. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  192. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +6 -57
  193. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  194. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +18 -140
  195. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  196. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +8 -97
  197. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  198. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
  199. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  200. package/artifacts/contracts/shared/Service.sol/Service.json +5 -112
  201. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  202. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  203. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  204. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +27 -1
  205. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  206. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  207. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +83 -30
  208. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  209. package/artifacts/contracts/staking/Staking.sol/Staking.json +77 -190
  210. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  211. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  212. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  213. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +73 -84
  214. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  215. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
  216. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  217. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +31 -138
  218. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  219. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +56 -76
  220. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  221. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2 -2
  222. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  223. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +54 -23
  224. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  225. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  226. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  227. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  228. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  229. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  230. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  231. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  232. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  233. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  234. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  235. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  236. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  237. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  238. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  239. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  240. package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +26 -2
  241. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  242. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  243. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  244. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -2
  245. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  246. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  247. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +2 -2
  248. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  249. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  250. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  251. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  252. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  253. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  254. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +39 -70
  255. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  256. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  257. package/contracts/authorization/AccessAdmin.sol +25 -24
  258. package/contracts/authorization/IAccessAdmin.sol +0 -1
  259. package/contracts/distribution/Distribution.sol +1 -1
  260. package/contracts/distribution/DistributionService.sol +8 -8
  261. package/contracts/distribution/DistributionServiceManager.sol +6 -6
  262. package/contracts/examples/unpermissioned/SimpleDistribution.sol +50 -0
  263. package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
  264. package/contracts/examples/unpermissioned/SimplePool.sol +76 -0
  265. package/contracts/examples/unpermissioned/SimpleProduct.sol +351 -0
  266. package/contracts/instance/IInstance.sol +7 -30
  267. package/contracts/instance/Instance.sol +10 -35
  268. package/contracts/instance/InstanceAuthorizationV3.sol +1 -0
  269. package/contracts/instance/InstanceReader.sol +8 -0
  270. package/contracts/instance/InstanceService.sol +10 -11
  271. package/contracts/instance/InstanceServiceManager.sol +6 -7
  272. package/contracts/instance/InstanceStore.sol +0 -4
  273. package/contracts/instance/base/ObjectLifecycle.sol +2 -1
  274. package/contracts/instance/module/IComponents.sol +1 -1
  275. package/contracts/instance/module/IPolicy.sol +5 -5
  276. package/contracts/oracle/Oracle.sol +2 -1
  277. package/contracts/oracle/OracleService.sol +9 -6
  278. package/contracts/oracle/OracleServiceManager.sol +6 -6
  279. package/contracts/pool/BundleService.sol +8 -8
  280. package/contracts/pool/BundleServiceManager.sol +6 -6
  281. package/contracts/pool/Pool.sol +10 -10
  282. package/contracts/pool/PoolService.sol +5 -6
  283. package/contracts/pool/PoolServiceManager.sol +4 -4
  284. package/contracts/product/ApplicationService.sol +4 -6
  285. package/contracts/product/ApplicationServiceManager.sol +4 -4
  286. package/contracts/product/BasicProduct.sol +1 -0
  287. package/contracts/product/ClaimService.sol +201 -71
  288. package/contracts/product/ClaimServiceManager.sol +4 -4
  289. package/contracts/product/IClaimService.sol +27 -5
  290. package/contracts/product/IPolicyService.sol +9 -5
  291. package/contracts/product/{IProductService.sol → IRiskService.sol} +1 -2
  292. package/contracts/product/PolicyService.sol +103 -33
  293. package/contracts/product/PolicyServiceManager.sol +4 -4
  294. package/contracts/product/PricingService.sol +4 -5
  295. package/contracts/product/PricingServiceManager.sol +3 -3
  296. package/contracts/product/Product.sol +35 -16
  297. package/contracts/product/{ProductService.sol → RiskService.sol} +7 -10
  298. package/contracts/product/RiskServiceManager.sol +39 -0
  299. package/contracts/registry/ChainNft.sol +65 -32
  300. package/contracts/registry/IRegistry.sol +49 -15
  301. package/contracts/registry/Registry.sol +321 -195
  302. package/contracts/registry/RegistryAdmin.sol +140 -50
  303. package/contracts/registry/RegistryService.sol +2 -2
  304. package/contracts/registry/RegistryServiceManager.sol +2 -2
  305. package/contracts/registry/ReleaseRegistry.sol +12 -6
  306. package/contracts/shared/Component.sol +6 -6
  307. package/contracts/shared/ComponentService.sol +7 -7
  308. package/contracts/shared/ComponentServiceManager.sol +8 -5
  309. package/contracts/shared/ComponentVerifyingService.sol +1 -1
  310. package/contracts/shared/ContractLib.sol +38 -0
  311. package/contracts/shared/IInstanceLinkedComponent.sol +0 -7
  312. package/contracts/shared/IPolicyHolder.sol +12 -22
  313. package/contracts/shared/InitializableERC165.sol +2 -2
  314. package/contracts/shared/InstanceLinkedComponent.sol +4 -4
  315. package/contracts/shared/NftOwnable.sol +5 -5
  316. package/contracts/shared/PolicyHolder.sol +12 -53
  317. package/contracts/shared/Registerable.sol +4 -4
  318. package/contracts/shared/RegistryLinked.sol +3 -2
  319. package/contracts/shared/Service.sol +16 -11
  320. package/contracts/staking/IStaking.sol +2 -1
  321. package/contracts/staking/StakeManagerLib.sol +18 -0
  322. package/contracts/staking/Staking.sol +6 -5
  323. package/contracts/staking/StakingManager.sol +8 -6
  324. package/contracts/staking/StakingService.sol +2 -2
  325. package/contracts/staking/StakingServiceManager.sol +2 -2
  326. package/contracts/staking/TargetManagerLib.sol +7 -3
  327. package/contracts/type/Seconds.sol +8 -0
  328. package/contracts/type/StateId.sol +1 -0
  329. package/contracts/upgradeability/ProxyManager.sol +67 -34
  330. package/contracts/upgradeability/Versionable.sol +2 -2
  331. package/package.json +1 -1
  332. package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +0 -4
  333. package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +0 -4
  334. package/artifacts/contracts/product/ProductService.sol/ProductService.json +0 -708
  335. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
  336. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +0 -702
  337. package/contracts/product/ProductServiceManager.sol +0 -39
@@ -103,7 +103,7 @@ abstract contract InstanceLinkedComponent is
103
103
  revert ErrorComponentNotInstance(instanceNftId);
104
104
  }
105
105
 
106
- initializeComponent(
106
+ _initializeComponent(
107
107
  $._instance.authority(),
108
108
  registry,
109
109
  instanceNftId,
@@ -120,8 +120,8 @@ abstract contract InstanceLinkedComponent is
120
120
  $._initialAuthorization = authorization;
121
121
  $._componentService = IComponentService(_getServiceAddress(COMPONENT()));
122
122
 
123
- registerInterface(type(IAccessManaged).interfaceId);
124
- registerInterface(type(IInstanceLinkedComponent).interfaceId);
123
+ _registerInterface(type(IAccessManaged).interfaceId);
124
+ _registerInterface(type(IInstanceLinkedComponent).interfaceId);
125
125
  }
126
126
 
127
127
  /// @dev for instance linked components the wallet address stored in the instance store.
@@ -132,7 +132,7 @@ abstract contract InstanceLinkedComponent is
132
132
 
133
133
 
134
134
  function _getComponentInfo() internal virtual override view returns (IComponents.ComponentInfo memory info) {
135
- NftId componentNftId = getRegistry().getNftId(address(this));
135
+ NftId componentNftId = getRegistry().getNftIdForAddress(address(this));
136
136
 
137
137
  // if registered, attempt to return component info via instance reader
138
138
  if (componentNftId.gtz()) {
@@ -30,16 +30,16 @@ contract NftOwnable is
30
30
 
31
31
  /// @dev initialization for upgradable contracts
32
32
  // used in _initializeRegisterable
33
- function initializeNftOwnable(
33
+ function _initializeNftOwnable(
34
34
  address initialOwner,
35
35
  address registryAddress
36
36
  )
37
- public
37
+ internal
38
38
  virtual
39
39
  onlyInitializing()
40
40
  {
41
- initializeRegistryLinked(registryAddress);
42
- initializeERC165();
41
+ _initializeRegistryLinked(registryAddress);
42
+ _initializeERC165();
43
43
 
44
44
  if(initialOwner == address(0)) {
45
45
  revert ErrorNftOwnableInitialOwnerZero();
@@ -93,7 +93,7 @@ contract NftOwnable is
93
93
  revert ErrorNftOwnableContractNotRegistered(nftOwnableAddress);
94
94
  }
95
95
 
96
- $._nftId = getRegistry().getNftId(nftOwnableAddress);
96
+ $._nftId = getRegistry().getNftIdForAddress(nftOwnableAddress);
97
97
 
98
98
  return $._nftId;
99
99
  }
@@ -10,62 +10,37 @@ import {IPolicyHolder} from "./IPolicyHolder.sol";
10
10
  import {NftId} from "../type/NftId.sol";
11
11
  import {PayoutId, PayoutIdLib} from "../type/PayoutId.sol";
12
12
  import {RegistryLinked} from "./RegistryLinked.sol";
13
+ import {Timestamp} from "../type/Timestamp.sol";
13
14
 
14
15
  /// @dev template implementation for IPolicyHolder
15
16
  contract PolicyHolder is
16
17
  InitializableERC165,
17
- RegistryLinked, // TODO need upgradeable version
18
+ RegistryLinked,
18
19
  IPolicyHolder
19
20
  {
20
- // keccak256(abi.encode(uint256(keccak256("etherisc.storage.PolicyHolder")) - 1)) & ~bytes32(uint256(0xff));
21
- // TODO fix address
22
- bytes32 public constant POLICY_HOLDER_STORAGE_LOCATION_V1 = 0x07ebcf49758b6ed3af50fa146bec0abe157c0218fe65dc0874c286e9d5da4f00;
23
-
24
- struct PolicyHolderStorage {
25
- mapping(NftId policyId => mapping(PayoutId payoutId => address beneficiary)) _beneficiary;
26
- address _beneficiaryDefault;
27
- }
28
-
29
- function initializePolicyHolder(
30
- address registryAddress,
31
- address beneficiaryDefault
21
+ function _initializePolicyHolder(
22
+ address registryAddress
32
23
  )
33
- public
24
+ internal
34
25
  virtual
35
26
  onlyInitializing()
36
27
  {
37
- initializeRegistryLinked(registryAddress);
38
-
39
- _getPolicyHolderStorage()._beneficiaryDefault = beneficiaryDefault;
40
-
41
- registerInterface(type(IPolicyHolder).interfaceId);
28
+ _initializeRegistryLinked(registryAddress);
29
+ _initializeERC165();
30
+ _registerInterface(type(IPolicyHolder).interfaceId);
42
31
  }
43
32
 
44
33
  /// @dev empty default implementation
45
- function requestPayout(NftId requestingPolicyNftId, Amount requestedPayoutAmount) external { }
46
-
47
- /// @dev empty default implementation
48
- function policyActivated(NftId policyNftId) external {}
34
+ function policyActivated(NftId policyNftId, Timestamp activatedAt) external virtual {}
49
35
 
50
36
  /// @dev empty default implementation
51
- function policyExpired(NftId policyNftId) external {}
37
+ function policyExpired(NftId policyNftId, Timestamp expiredAt) external virtual {}
52
38
 
53
39
  /// @dev empty default implementation
54
- function claimConfirmed(NftId policyNftId, ClaimId claimId, Amount amount) external {}
40
+ function claimConfirmed(NftId policyNftId, ClaimId claimId, Amount amount) external virtual {}
55
41
 
56
42
  /// @dev empty default implementation
57
- function payoutExecuted(NftId policyNftId, PayoutId payoutId, address beneficiary, Amount amount) external {}
58
-
59
- /// @dev returns payout specific beneficiary
60
- /// when no such beneficiary is defined the policy specific beneficiary is returned
61
- function getBeneficiary(NftId policyNftId, PayoutId payoutId) external virtual view returns (address beneficiary) {
62
- beneficiary = _getPolicyHolderStorage()._beneficiary[policyNftId][payoutId];
63
-
64
- // fallback to claim independent beneficiary
65
- if(beneficiary == address(0) && payoutId.gtz()) {
66
- beneficiary = _getPolicyHolderStorage()._beneficiary[policyNftId][PayoutIdLib.zero()];
67
- }
68
- }
43
+ function payoutExecuted(NftId policyNftId, PayoutId payoutId, Amount amount, address beneficiary) external virtual {}
69
44
 
70
45
  //--- IERC165 functions ---------------//
71
46
  function onERC721Received(
@@ -80,20 +55,4 @@ contract PolicyHolder is
80
55
  {
81
56
  return IERC721Receiver.onERC721Received.selector;
82
57
  }
83
-
84
- /// @dev sets policy specific beneficiary (used when no payout specific beneficiary is defined)
85
- function _setBeneficiary(NftId policyNftId, address beneficiary) internal {
86
- _setBeneficiary(policyNftId, PayoutIdLib.zero(), beneficiary);
87
- }
88
-
89
- /// @dev sets policy and claim specific beneficiary
90
- function _setBeneficiary(NftId policyNftId, PayoutId payoutId, address beneficiary) internal {
91
- _getPolicyHolderStorage()._beneficiary[policyNftId][payoutId] = beneficiary;
92
- }
93
-
94
- function _getPolicyHolderStorage() private pure returns (PolicyHolderStorage storage $) {
95
- assembly {
96
- $.slot := POLICY_HOLDER_STORAGE_LOCATION_V1
97
- }
98
- }
99
58
  }
@@ -24,7 +24,7 @@ contract Registerable is
24
24
  bytes _data;
25
25
  }
26
26
 
27
- function initializeRegisterable(
27
+ function _initializeRegisterable(
28
28
  address registryAddress,
29
29
  NftId parentNftId,
30
30
  ObjectType objectType,
@@ -32,11 +32,11 @@ contract Registerable is
32
32
  address initialOwner,
33
33
  bytes memory registryData // writeonly data that will saved in the object info record of the registry
34
34
  )
35
- public
35
+ internal
36
36
  virtual
37
- onlyInitializing
37
+ onlyInitializing()
38
38
  {
39
- initializeNftOwnable(
39
+ _initializeNftOwnable(
40
40
  initialOwner,
41
41
  registryAddress);
42
42
 
@@ -10,14 +10,15 @@ contract RegistryLinked is
10
10
  IRegistryLinked
11
11
  {
12
12
 
13
+ // priorize simplicity and size over using standard upgradeability structs
13
14
  IRegistry private _registry;
14
15
 
15
16
  /// @dev initialization for upgradable contracts
16
17
  // used in _initializeRegisterable
17
- function initializeRegistryLinked(
18
+ function _initializeRegistryLinked(
18
19
  address registryAddress
19
20
  )
20
- public
21
+ internal
21
22
  virtual
22
23
  onlyInitializing()
23
24
  {
@@ -3,6 +3,7 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
5
5
  import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
6
+ import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
6
7
 
7
8
  import {IRegistry} from "../registry/IRegistry.sol";
8
9
  import {IService} from "./IService.sol";
@@ -19,28 +20,23 @@ abstract contract Service is
19
20
  Registerable,
20
21
  Versionable,
21
22
  AccessManagedUpgradeable,
23
+ ReentrancyGuardUpgradeable,
22
24
  IService
23
25
  {
24
26
 
25
27
  uint8 private constant GIF_MAJOR_VERSION = 3;
26
28
 
27
29
 
28
- function initializeService(
30
+ function _initializeService(
29
31
  address registry,
30
32
  address authority, // real authority for registry service adress(0) for other services
31
33
  address initialOwner
32
34
  )
33
- public
35
+ internal
34
36
  virtual
35
37
  onlyInitializing()
36
38
  {
37
- initializeRegisterable(
38
- registry,
39
- IRegistry(registry).getNftId(),
40
- SERVICE(),
41
- false, // is interceptor
42
- initialOwner,
43
- ""); // data
39
+ __ReentrancyGuard_init();
44
40
 
45
41
  // externally provided authority
46
42
  if(authority != address(0)) {
@@ -52,8 +48,17 @@ abstract contract Service is
52
48
  __AccessManaged_init(IAccessManaged(registryServiceAddress).authority());
53
49
  }
54
50
 
55
- registerInterface(type(IAccessManaged).interfaceId);
56
- registerInterface(type(IService).interfaceId);
51
+ _initializeRegisterable(
52
+ registry,
53
+ IRegistry(registry).getNftId(),
54
+ SERVICE(),
55
+ false, // is interceptor
56
+ initialOwner,
57
+ ""); // data
58
+
59
+
60
+ _registerInterface(type(IAccessManaged).interfaceId);
61
+ _registerInterface(type(IService).interfaceId);
57
62
  }
58
63
 
59
64
  function getDomain() external virtual pure returns(ObjectType serviceDomain) {
@@ -42,8 +42,9 @@ interface IStaking is
42
42
  error ErrorStakingTargetNftIdZero();
43
43
  error ErrorStakingTargetTypeNotSupported(NftId targetNftId, ObjectType objectType);
44
44
  error ErrorStakingTargetUnexpectedObjectType(NftId targetNftId, ObjectType expectedObjectType, ObjectType actualObjectType);
45
- error ErrorStakingLockingPeriodZero(NftId targetNftId);
45
+ error ErrorStakingLockingPeriodTooShort(NftId targetNftId, Seconds minLockingPeriod, Seconds lockingPeriod);
46
46
  error ErrorStakingLockingPeriodTooLong(NftId targetNftId, Seconds maxLockingPeriod, Seconds lockingPeriod);
47
+ error ErrorStakingStakeLocked(NftId stakeNftId, Timestamp lockedUntil);
47
48
  error ErrorStakingRewardRateTooHigh(NftId targetNftId, UFixed maxRewardRate, UFixed rewardRate);
48
49
  error ErrorStakingTargetNotFound(NftId targetNftId);
49
50
  error ErrorStakingTargetTokenNotFound(NftId targetNftId, uint256 chainId, address token);
@@ -114,6 +114,24 @@ library StakeManagerLib {
114
114
  lockingPeriod = info.lockingPeriod;
115
115
  }
116
116
 
117
+ function checkUnstakeParameters(
118
+ StakingReader stakingReader,
119
+ NftId stakeNftId
120
+ )
121
+ public
122
+ view
123
+ returns (
124
+ UFixed rewardRate,
125
+ Seconds lockingPeriod
126
+ )
127
+ {
128
+ IStaking.StakeInfo memory stakeInfo = stakingReader.getStakeInfo(stakeNftId);
129
+
130
+ if (stakeInfo.lockedUntil > TimestampLib.blockTimestamp()) {
131
+ revert IStaking.ErrorStakingStakeLocked(stakeNftId, stakeInfo.lockedUntil);
132
+ }
133
+ }
134
+
117
135
 
118
136
  function checkTarget(
119
137
  StakingReader stakingReader,
@@ -350,9 +350,10 @@ contract Staking is
350
350
  Amount rewardsClaimedAmount
351
351
  )
352
352
  {
353
- // TODO add check that stake locking is in the past
354
353
  StakingStorage storage $ = _getStakingStorage();
355
-
354
+
355
+ StakeManagerLib.checkUnstakeParameters($._reader, stakeNftId);
356
+
356
357
  // update rewards since last update
357
358
  NftId targetNftId = _updateRewards($._reader, $._store, stakeNftId);
358
359
 
@@ -450,7 +451,7 @@ contract Staking is
450
451
  )
451
452
  internal
452
453
  virtual override
453
- initializer
454
+ initializer()
454
455
  {
455
456
  (
456
457
  address registryAddress,
@@ -465,7 +466,7 @@ contract Staking is
465
466
  TokenRegistry tokenRegistry = TokenRegistry(tokenRegistryAddress);
466
467
  address dipTokenAddress = tokenRegistry.getDipTokenAddress();
467
468
 
468
- initializeComponent(
469
+ _initializeComponent(
469
470
  authority,
470
471
  registryAddress,
471
472
  registry.getNftId(),
@@ -485,7 +486,7 @@ contract Staking is
485
486
  $._tokenRegistry = TokenRegistry(tokenRegistryAddress);
486
487
  $._tokenHandler = TokenHandlerDeployerLib.deployTokenHandler(dipTokenAddress, authority);
487
488
 
488
- registerInterface(type(IStaking).interfaceId);
489
+ _registerInterface(type(IStaking).interfaceId);
489
490
  }
490
491
 
491
492
 
@@ -18,9 +18,9 @@ contract StakingManager is
18
18
  address registry,
19
19
  address tokenRegistry,
20
20
  address stakingStore,
21
- address initialOwner
21
+ address initialOwner,
22
+ bytes32 salt
22
23
  )
23
- ProxyManager(registry)
24
24
  {
25
25
  Staking stakingImplementation = new Staking();
26
26
 
@@ -30,10 +30,12 @@ contract StakingManager is
30
30
  tokenRegistry,
31
31
  stakingStore,
32
32
  initialOwner);
33
-
34
- IVersionable versionable = deploy(
35
- _initialImplementation,
36
- _initializationData);
33
+
34
+ IVersionable versionable = initialize(
35
+ registry,
36
+ _initialImplementation,
37
+ _initializationData,
38
+ salt);
37
39
 
38
40
  _staking = Staking(address(versionable));
39
41
  }
@@ -331,7 +331,7 @@ contract StakingService is
331
331
  address stakingAddress
332
332
  ) = abi.decode(data, (address, address, address));
333
333
 
334
- initializeService(registryAddress, authority, owner);
334
+ _initializeService(registryAddress, authority, owner);
335
335
 
336
336
  StakingServiceStorage storage $ = _getStakingServiceStorage();
337
337
  $._registryService = RegistryService(_getServiceAddress(REGISTRY()));
@@ -339,7 +339,7 @@ contract StakingService is
339
339
  $._dip = $._staking.getToken();
340
340
  $._tokenHandler = $._staking.getTokenHandler();
341
341
 
342
- registerInterface(type(IStakingService).interfaceId);
342
+ _registerInterface(type(IStakingService).interfaceId);
343
343
  }
344
344
 
345
345
 
@@ -18,14 +18,14 @@ contract StakingServiceManager is
18
18
  address registryAddress,
19
19
  bytes32 salt
20
20
  )
21
- ProxyManager(registryAddress)
22
21
  {
23
22
  StakingService svc = new StakingService();
24
23
  bytes memory data = abi.encode(
25
24
  authority,
26
25
  registryAddress,
27
26
  IRegistry(registryAddress).getStakingAddress());
28
- IVersionable versionable = deployDetermenistic(
27
+ IVersionable versionable = initialize(
28
+ registryAddress,
29
29
  address(svc),
30
30
  data,
31
31
  salt);
@@ -132,9 +132,9 @@ library TargetManagerLib {
132
132
  public
133
133
  pure
134
134
  {
135
- // check locking period is > 0
136
- if (lockingPeriod.eqz()) {
137
- revert IStaking.ErrorStakingLockingPeriodZero(targetNftId);
135
+ // check locking period is >= min locking period
136
+ if (lockingPeriod.lt(getMinimumLockingPeriod())) {
137
+ revert IStaking.ErrorStakingLockingPeriodTooShort(targetNftId, getMinimumLockingPeriod(), lockingPeriod);
138
138
  }
139
139
 
140
140
  // check locking period <= max locking period
@@ -190,6 +190,10 @@ library TargetManagerLib {
190
190
  return SecondsLib.toSeconds(365 * 24 * 3600 / 2);
191
191
  }
192
192
 
193
+ /// @dev the minimum locking period is 24 hours
194
+ function getMinimumLockingPeriod() public pure returns (Seconds minLockingPeriod) {
195
+ return SecondsLib.toSeconds(24 * 3600);
196
+ }
193
197
 
194
198
  function getMaxRewardRate() public pure returns (UFixed maxRewardRate) {
195
199
  return UFixedLib.toUFixed(33, -2);
@@ -9,6 +9,9 @@ using {
9
9
  SecondsAdd as +,
10
10
  SecondsLib.eqz,
11
11
  SecondsLib.gtz,
12
+ SecondsLib.eq,
13
+ SecondsLib.gt,
14
+ SecondsLib.lt,
12
15
  SecondsLib.toInt,
13
16
  SecondsLib.add
14
17
  } for Seconds global;
@@ -77,6 +80,11 @@ library SecondsLib {
77
80
  return Seconds.unwrap(duration1) > Seconds.unwrap(duration2);
78
81
  }
79
82
 
83
+ /// @dev return true if duration1 is smaller than duration2
84
+ function lt(Seconds duration1, Seconds duration2) public pure returns (bool) {
85
+ return Seconds.unwrap(duration1) < Seconds.unwrap(duration2);
86
+ }
87
+
80
88
  /// @dev return add duration1 and duration2
81
89
  function add(Seconds duration1, Seconds duration2) public pure returns (Seconds) {
82
90
  return Seconds.wrap(Seconds.unwrap(duration1) + Seconds.unwrap(duration2));
@@ -9,6 +9,7 @@ using {
9
9
  eqStateId as ==,
10
10
  neStateId as !=,
11
11
  StateIdLib.eqz,
12
+ StateIdLib.eq,
12
13
  StateIdLib.gtz,
13
14
  StateIdLib.toInt
14
15
  } for StateId global;
@@ -40,57 +40,68 @@ contract ProxyManager is
40
40
  mapping(Version version => VersionInfo info) _versionHistory;
41
41
  Version [] _versions;
42
42
 
43
- /// @dev only used to capture proxy owner
44
- constructor(address registry)
45
- {
46
- initializeProxyManager(registry);
47
- }
48
-
49
- function initializeProxyManager(address registry)
43
+ /// @dev convencience initializer
44
+ function initialize(
45
+ address registry,
46
+ address implementation,
47
+ bytes memory data,
48
+ bytes32 salt
49
+ )
50
50
  public
51
51
  initializer()
52
+ returns (IVersionable versionable)
52
53
  {
53
- initializeNftOwnable(msg.sender, registry);
54
+ versionable = deployDetermenistic(
55
+ registry,
56
+ implementation,
57
+ data,
58
+ salt);
54
59
  }
55
60
 
56
61
  /// @dev deploy initial contract
57
- function deploy(address initialImplementation, bytes memory initializationData)
62
+ function deploy(
63
+ address registry,
64
+ address initialImplementation,
65
+ bytes memory initializationData
66
+ )
58
67
  public
59
68
  virtual
60
- onlyOwner()
69
+ onlyInitializing()
61
70
  returns (IVersionable versionable)
62
71
  {
63
- if (_versions.length > 0) {
64
- revert ErrorProxyManagerAlreadyDeployed();
65
- }
72
+ (
73
+ address currentProxyOwner,
74
+ address initialProxyAdminOwner
75
+ ) = _preDeployChecksAndSetup(registry);
66
76
 
67
- address currentProxyOwner = getOwner(); // used by implementation
68
- address initialProxyAdminOwner = address(this); // used by proxy
69
-
70
77
  _proxy = new UpgradableProxyWithAdmin(
71
78
  initialImplementation,
72
79
  initialProxyAdminOwner,
73
80
  getDeployData(currentProxyOwner, initializationData)
74
81
  );
75
82
 
76
- versionable = IVersionable(address(_proxy));
77
- _updateVersionHistory(versionable.getVersion(), initialImplementation, currentProxyOwner);
83
+ versionable = _updateVersionHistory(
84
+ initialImplementation,
85
+ currentProxyOwner);
78
86
 
79
- emit LogProxyManagerVersionableDeployed(address(_proxy), initialImplementation);
87
+ emit LogProxyManagerVersionableDeployed(address(versionable), initialImplementation);
80
88
  }
81
89
 
82
- function deployDetermenistic(address initialImplementation, bytes memory initializationData, bytes32 salt)
90
+ function deployDetermenistic(
91
+ address registry,
92
+ address initialImplementation,
93
+ bytes memory initializationData,
94
+ bytes32 salt
95
+ )
83
96
  public
84
97
  virtual
85
- onlyOwner()
98
+ onlyInitializing()
86
99
  returns (IVersionable versionable)
87
100
  {
88
- if (_versions.length > 0) {
89
- revert ErrorProxyManagerAlreadyDeployed();
90
- }
91
-
92
- address currentProxyOwner = getOwner();
93
- address initialProxyAdminOwner = address(this);
101
+ (
102
+ address currentProxyOwner,
103
+ address initialProxyAdminOwner
104
+ ) = _preDeployChecksAndSetup(registry);
94
105
 
95
106
  _proxy = new UpgradableProxyWithAdmin{salt: salt}(
96
107
  initialImplementation,
@@ -98,10 +109,11 @@ contract ProxyManager is
98
109
  getDeployData(currentProxyOwner, initializationData)
99
110
  );
100
111
 
101
- versionable = IVersionable(address(_proxy));
102
- _updateVersionHistory(versionable.getVersion(), initialImplementation, currentProxyOwner);
112
+ versionable = _updateVersionHistory(
113
+ initialImplementation,
114
+ currentProxyOwner);
103
115
 
104
- emit LogProxyManagerVersionableDeployed(address(_proxy), initialImplementation);
116
+ emit LogProxyManagerVersionableDeployed(address(versionable), initialImplementation);
105
117
  }
106
118
 
107
119
  /// @dev upgrade existing contract
@@ -124,10 +136,11 @@ contract ProxyManager is
124
136
  newImplementation,
125
137
  getUpgradeData(upgradeData));
126
138
 
127
- versionable = IVersionable(address(_proxy));
128
- _updateVersionHistory(versionable.getVersion(), newImplementation, currentProxyOwner);
139
+ versionable = _updateVersionHistory(
140
+ newImplementation,
141
+ currentProxyOwner);
129
142
 
130
- emit LogProxyManagerVersionableUpgraded(address(_proxy), newImplementation);
143
+ emit LogProxyManagerVersionableUpgraded(address(versionable), newImplementation);
131
144
 
132
145
  }
133
146
 
@@ -168,13 +181,33 @@ contract ProxyManager is
168
181
  return _versionHistory[_version];
169
182
  }
170
183
 
184
+ function _preDeployChecksAndSetup(address registry)
185
+ private
186
+ returns (
187
+ address currentProxyOwner,
188
+ address initialProxyAdminOwner
189
+ )
190
+ {
191
+ if (_versions.length > 0) {
192
+ revert ErrorProxyManagerAlreadyDeployed();
193
+ }
194
+
195
+ _initializeNftOwnable(msg.sender, registry);
196
+
197
+ currentProxyOwner = getOwner(); // used by implementation
198
+ initialProxyAdminOwner = address(this); // used by proxy
199
+ }
200
+
171
201
  function _updateVersionHistory(
172
- Version newVersion,
173
202
  address implementation,
174
203
  address activatedBy
175
204
  )
176
205
  private
206
+ returns (IVersionable versionable)
177
207
  {
208
+ versionable = IVersionable(address(_proxy));
209
+ Version newVersion = versionable.getVersion();
210
+
178
211
  if(newVersion == VersionLib.zeroVersion()) {
179
212
  revert ErrorProxyManagerZeroVersion();
180
213
  }
@@ -20,7 +20,7 @@ abstract contract Versionable is
20
20
  bytes memory data
21
21
  )
22
22
  public
23
- initializer
23
+ initializer()
24
24
  {
25
25
  _initialize(activatedBy, data);
26
26
  }
@@ -41,7 +41,7 @@ abstract contract Versionable is
41
41
  // each implementation MUST call intializers of all base contracts...
42
42
  function _initialize(address owner, bytes memory data)
43
43
  internal
44
- onlyInitializing
44
+ onlyInitializing()
45
45
  virtual
46
46
  {
47
47
  revert();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etherisc/gif-next",
3
- "version": "0.0.2-98e9f45-792",
3
+ "version": "0.0.2-998ff1b-277",
4
4
  "description": "This is the repository for the next version of the Generic Insurance Framework (GIF) smart contracts. ",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,4 +0,0 @@
1
- {
2
- "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/5695401de7c03376933cf5a112bb7c6c.json"
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/5695401de7c03376933cf5a112bb7c6c.json"
4
- }