@etherisc/gif-next 0.0.2-f2df3e2-873 → 0.0.2-f398177-971

Sign up to get free protection for your applications and to get access to all the features.
Files changed (252) hide show
  1. package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
  2. package/artifacts/contracts/components/Component.sol/Component.json +37 -6
  3. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.json +44 -13
  5. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.json +37 -6
  7. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +44 -13
  9. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +55 -24
  11. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +52 -21
  13. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  14. package/artifacts/contracts/components/Pool.sol/Pool.json +55 -24
  15. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  16. package/artifacts/contracts/components/Product.sol/Product.json +52 -21
  17. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  18. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
  19. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  20. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  21. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +252 -2210
  22. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  23. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +21 -38
  24. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  25. package/artifacts/contracts/instance/Instance.sol/Instance.json +346 -2685
  26. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  27. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +67 -49
  28. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +4 -0
  29. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +124 -0
  30. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  31. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +219 -53
  32. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  33. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +59 -220
  34. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  35. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +32 -117
  36. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
  37. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2788 -0
  38. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  39. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
  40. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
  41. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +37 -13
  42. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  43. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  44. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  45. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
  46. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  47. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  48. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  49. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  50. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  51. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  52. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  53. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  54. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  55. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  56. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  57. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +75 -217
  58. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  59. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +33 -66
  60. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  61. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +155 -133
  62. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  63. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +35 -64
  64. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
  65. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +463 -119
  66. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  67. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +109 -42
  68. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  69. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +181 -399
  70. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  71. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +81 -94
  72. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  73. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +11 -145
  74. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  75. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +79 -30
  76. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
  77. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +229 -88
  78. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  79. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +23 -273
  80. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +40 -326
  82. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  83. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +265 -32
  84. package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.dbg.json +4 -0
  85. package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.json +510 -0
  86. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  87. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +5 -13
  88. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +213 -443
  90. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  91. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +74 -75
  92. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  93. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +439 -54
  94. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  95. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +84 -37
  96. package/artifacts/contracts/instance/service/PricingService.sol/PricingService.dbg.json +4 -0
  97. package/artifacts/contracts/instance/service/PricingService.sol/PricingService.json +1004 -0
  98. package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
  99. package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.json +688 -0
  100. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  101. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +55 -31
  102. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  103. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +22 -35
  104. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  105. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  106. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  107. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +5 -13
  108. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  109. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  110. package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
  111. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  112. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
  113. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  114. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +17 -25
  115. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  116. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +21 -34
  117. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  118. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +2 -2
  119. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  120. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +10 -23
  121. package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
  122. package/artifacts/contracts/{instance → shared}/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +3 -3
  123. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  124. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  125. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  126. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +0 -13
  127. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  128. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +69 -9
  129. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  130. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +0 -13
  131. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  132. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +0 -13
  133. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  134. package/artifacts/contracts/shared/IService.sol/IService.json +5 -13
  135. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  136. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  137. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +6 -19
  138. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  139. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +80 -26
  140. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  141. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +14 -27
  142. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  143. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +6 -19
  144. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  145. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
  146. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  147. package/artifacts/contracts/shared/Service.sol/Service.json +5 -13
  148. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  149. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +24 -6
  150. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  151. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  152. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  153. package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
  154. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  155. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +6 -19
  156. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  157. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  158. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  159. package/artifacts/contracts/test/TestService.sol/TestService.json +17 -25
  160. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  161. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  162. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  163. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  164. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  165. package/artifacts/contracts/types/Amount.sol/AmountLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/Amount.sol/AmountLib.json +100 -4
  167. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  168. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  169. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  170. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +2 -2
  171. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  172. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
  173. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  174. package/artifacts/contracts/types/Fee.sol/FeeLib.json +42 -18
  175. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  176. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
  177. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  178. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
  179. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  180. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  181. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  182. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  183. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  184. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  185. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +2 -2
  186. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  187. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
  188. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  189. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
  190. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  191. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  192. package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +1 -1
  193. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  194. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  195. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  196. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  197. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  198. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  199. package/contracts/components/Component.sol +21 -2
  200. package/contracts/components/Distribution.sol +5 -4
  201. package/contracts/components/IComponent.sol +16 -2
  202. package/contracts/components/IPoolComponent.sol +7 -6
  203. package/contracts/components/IProductComponent.sol +5 -4
  204. package/contracts/components/Pool.sol +8 -8
  205. package/contracts/components/Product.sol +21 -17
  206. package/contracts/instance/IInstance.sol +28 -53
  207. package/contracts/instance/IInstanceService.sol +15 -10
  208. package/contracts/instance/Instance.sol +90 -171
  209. package/contracts/instance/InstanceAccessManager.sol +35 -21
  210. package/contracts/instance/InstanceAuthorizationsLib.sol +308 -0
  211. package/contracts/instance/InstanceReader.sol +56 -5
  212. package/contracts/instance/InstanceService.sol +96 -266
  213. package/contracts/instance/InstanceStore.sol +212 -0
  214. package/contracts/instance/ObjectManager.sol +1 -1
  215. package/contracts/instance/base/ComponentService.sol +47 -20
  216. package/contracts/instance/base/KeyValueStore.sol +0 -31
  217. package/contracts/instance/base/Lifecycle.sol +7 -4
  218. package/contracts/instance/module/IComponents.sol +3 -3
  219. package/contracts/instance/module/IDistribution.sol +3 -2
  220. package/contracts/instance/module/IPolicy.sol +5 -5
  221. package/contracts/instance/service/ApplicationService.sol +58 -227
  222. package/contracts/instance/service/BundleService.sol +65 -119
  223. package/contracts/instance/service/ClaimService.sol +232 -34
  224. package/contracts/instance/service/DistributionService.sol +51 -134
  225. package/contracts/instance/service/IApplicationService.sol +5 -21
  226. package/contracts/instance/service/IBundleService.sol +32 -10
  227. package/contracts/instance/service/IClaimService.sol +37 -39
  228. package/contracts/instance/service/IDistributionService.sol +10 -22
  229. package/contracts/instance/service/IPolicyService.sol +15 -72
  230. package/contracts/instance/service/IPoolService.sol +18 -3
  231. package/contracts/instance/service/IPricingService.sol +37 -0
  232. package/contracts/instance/service/PolicyService.sol +112 -277
  233. package/contracts/instance/service/PoolService.sol +121 -21
  234. package/contracts/instance/service/PricingService.sol +275 -0
  235. package/contracts/instance/service/PricingServiceManager.sol +51 -0
  236. package/contracts/instance/service/ProductService.sol +10 -10
  237. package/contracts/registry/IRegistryService.sol +0 -2
  238. package/contracts/registry/RegistryService.sol +14 -10
  239. package/contracts/shared/IPolicyHolder.sol +23 -9
  240. package/contracts/shared/IRegistryLinked.sol +0 -1
  241. package/contracts/shared/IService.sol +2 -0
  242. package/contracts/shared/NftOwnable.sol +0 -2
  243. package/contracts/shared/PolicyHolder.sol +30 -17
  244. package/contracts/shared/Registerable.sol +10 -9
  245. package/contracts/shared/RegistryLinked.sol +0 -5
  246. package/contracts/shared/TokenHandler.sol +4 -2
  247. package/contracts/types/Amount.sol +44 -0
  248. package/contracts/types/Fee.sol +7 -6
  249. package/contracts/types/ObjectType.sol +5 -1
  250. package/package.json +1 -1
  251. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
  252. /package/contracts/{instance → shared}/AccessManagerUpgradeableInitializeable.sol +0 -0
@@ -19,7 +19,7 @@ import {IRegisterable} from "../../contracts/shared/IRegisterable.sol";
19
19
  import {Registerable} from "../../contracts/shared/Registerable.sol";
20
20
 
21
21
  import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, ORACLE_OWNER_ROLE} from "../../contracts/types/RoleId.sol";
22
- import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, DISTRIBUTOR, APPLICATION, POLICY, CLAIM, BUNDLE, STAKE} from "../../contracts/types/ObjectType.sol";
22
+ import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, DISTRIBUTOR, APPLICATION, POLICY, CLAIM, BUNDLE, STAKE, PRICE} from "../../contracts/types/ObjectType.sol";
23
23
  import {StateId, ACTIVE, PAUSED} from "../../contracts/types/StateId.sol";
24
24
  import {NftId, NftIdLib, zeroNftId} from "../../contracts/types/NftId.sol";
25
25
  import {Fee, FeeLib} from "../../contracts/types/Fee.sol";
@@ -176,7 +176,7 @@ contract RegistryService is
176
176
  FunctionConfig[] memory config
177
177
  )
178
178
  {
179
- config = new FunctionConfig[](8);
179
+ config = new FunctionConfig[](9);
180
180
 
181
181
  // order of service registrations MUST be reverse to this array
182
182
  /*config[-1].serviceDomain = STAKE();
@@ -205,15 +205,19 @@ contract RegistryService is
205
205
  config[5].selectors = new bytes4[](1);
206
206
  config[5].selectors[0] = RegistryService.registerBundle.selector;
207
207
 
208
- config[6].serviceDomain = DISTRIBUTION();
209
- config[6].selectors = new bytes4[](2);
210
- config[6].selectors[0] = RegistryService.registerDistribution.selector;
211
- config[6].selectors[1] = RegistryService.registerDistributor.selector;
208
+ // registration of pricing service must preceed registration of application service
209
+ config[6].serviceDomain = PRICE();
210
+ config[6].selectors = new bytes4[](0);
212
211
 
213
- // registerInstance() have no restriction
214
- config[7].serviceDomain = INSTANCE();
215
- config[7].selectors = new bytes4[](1);
216
- config[7].selectors[0] = RegistryService.registerInstance.selector;
212
+ // registration of distribution service must preceed registration of pricing service
213
+ config[7].serviceDomain = DISTRIBUTION();
214
+ config[7].selectors = new bytes4[](2);
215
+ config[7].selectors[0] = RegistryService.registerDistribution.selector;
216
+ config[7].selectors[1] = RegistryService.registerDistributor.selector;
217
+
218
+ config[8].serviceDomain = INSTANCE();
219
+ config[8].selectors = new bytes4[](1);
220
+ config[8].selectors[0] = RegistryService.registerInstance.selector;
217
221
  }
218
222
 
219
223
  // Internal
@@ -4,23 +4,37 @@ pragma solidity ^0.8.20;
4
4
  import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
5
  import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
6
6
 
7
- import {IRegistry} from "../registry/IRegistry.sol";
7
+ import {Amount} from "../types/Amount.sol";
8
+ import {ClaimId} from "../types/ClaimId.sol";
9
+ import {IRegistryLinked} from "../shared/IRegistryLinked.sol";
8
10
  import {NftId} from "../types/NftId.sol";
9
- import {NumberId} from "../types/NumberId.sol";
11
+ import {PayoutId} from "../types/PayoutId.sol";
10
12
 
11
13
  /// @dev generic interface for contracts that need to hold policies and receive payouts
12
14
  /// GIF will notify policy holder contracts for policy creation and payout execution
13
- ///
15
+ interface IPolicyHolder is
16
+ IERC165,
17
+ IERC721Receiver,
18
+ IRegistryLinked
19
+ {
14
20
 
15
- interface IPolicyHolder is IERC165, IERC721Receiver {
21
+ /// @dev callback function that will be called after successful policy activation
22
+ /// active policies may open claims under the activated policy
23
+ function policyActivated(NftId policyNftId) external;
16
24
 
17
- /// @dev callback function that will be called after successful policy creation
18
- function policyCreatedCallback(NftId policyNftId) external;
25
+ /// @dev callback function to indicate the specified policy has expired
26
+ /// expired policies may no longer open claims
27
+ /// it is optional for products to notifiy policy holder of expired claims
28
+ function policyExpired(NftId policyNftId) external;
29
+
30
+ /// @dev callback function to notify the confirmation of the specified claim
31
+ /// active policies may open claims under the activated policy
32
+ function claimConfirmed(NftId policyNftId, ClaimId claimId, Amount amount) external;
19
33
 
20
34
  /// @dev callback function that will be called after a successful payout
21
- function payoutExecutedCallback(NftId policyNftId, NumberId payoutId, address beneficiary, uint256 amount) external;
35
+ function payoutExecuted(NftId policyNftId, PayoutId payoutId, address beneficiary, Amount amount) external;
22
36
 
23
- /// @dev determines beneficiary address that will be used in payouts targeting this contract
37
+ /// @dev determines policy and claim specific beneficiary address
24
38
  /// returned address will override GIF default where the policy nft holder is treated as beneficiary
25
- function getBeneficiary(NftId policyId, NumberId claimId) external view returns (address beneficiary);
39
+ function getBeneficiary(NftId policyNftId, ClaimId claimId) external view returns (address beneficiary);
26
40
  }
@@ -8,5 +8,4 @@ interface IRegistryLinked {
8
8
  error ErrorNotRegistry(address registryAddress);
9
9
 
10
10
  function getRegistry() external view returns (IRegistry);
11
- function getRegistryAddress() external view returns (address);
12
11
  }
@@ -12,5 +12,7 @@ interface IService is
12
12
  IVersionable,
13
13
  IAccessManaged
14
14
  {
15
+ error ErrorServiceNotImplemented();
16
+
15
17
  function getDomain() external pure returns(ObjectType serviceDomain);
16
18
  }
@@ -1,8 +1,6 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- // import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5
-
6
4
  import {ERC165} from "./ERC165.sol";
7
5
  import {INftOwnable} from "./INftOwnable.sol";
8
6
  import {NftId} from "../types/NftId.sol";
@@ -5,11 +5,12 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
5
  import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
6
6
  import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
7
7
 
8
+ import {Amount} from "../types/Amount.sol";
9
+ import {ClaimId, ClaimIdLib} from "../types/ClaimId.sol";
8
10
  import {ERC165} from "./ERC165.sol";
9
11
  import {IPolicyHolder} from "./IPolicyHolder.sol";
10
- import {IRegistry} from "../registry/IRegistry.sol";
11
12
  import {NftId} from "../types/NftId.sol";
12
- import {NumberId} from "../types/NumberId.sol";
13
+ import {PayoutId} from "../types/PayoutId.sol";
13
14
  import {RegistryLinked} from "./RegistryLinked.sol";
14
15
 
15
16
  /// @dev template implementation for IPolicyHolder
@@ -22,33 +23,43 @@ contract PolicyHolder is
22
23
  // TODO fix address
23
24
  bytes32 public constant POLICY_HOLDER_STORAGE_LOCATION_V1 = 0x07ebcf49758b6ed3af50fa146bec0abe157c0218fe65dc0874c286e9d5da4f00;
24
25
 
25
- // TODO uncomment/fix/refactor
26
26
  struct PolicyHolderStorage {
27
- // mapping(NftId policyId => mapping(NumberId claimId => address beneficiary)) private _claimBeneficiary;
28
- // mapping(NftId policyId => address beneficiary) private _beneficiary;
29
- bool dummy;
27
+ mapping(NftId policyId => mapping(ClaimId claimId => address beneficiary)) _beneficiary;
30
28
  }
31
29
 
32
30
  function initializePolicyHolder(
33
- address registryAddress
31
+ address registryAddress,
32
+ address beneficiaryDefault
34
33
  )
35
34
  public
36
35
  virtual
37
36
  onlyInitializing()
38
37
  {
39
38
  initializeRegistryLinked(registryAddress);
39
+ registerInterface(type(IPolicyHolder).interfaceId);
40
40
  }
41
41
 
42
42
  /// @dev empty default implementation
43
- function policyCreatedCallback(NftId policyNftId) external virtual { }
43
+ function policyActivated(NftId policyNftId) external {}
44
44
 
45
45
  /// @dev empty default implementation
46
- function payoutExecutedCallback(NftId policyNftId, NumberId payoutId, address beneficiary, uint256 amount) external virtual { }
46
+ function policyExpired(NftId policyNftId) external {}
47
47
 
48
- /// @dev determines beneficiary address that will be used in payouts targeting this contract
49
- /// returned address will override GIF default where the policy nft holder is treated as beneficiary
50
- function getBeneficiary(NftId policyId, NumberId claimId) external virtual view returns (address beneficiary) {
51
- // TODO add implementation
48
+ /// @dev empty default implementation
49
+ function claimConfirmed(NftId policyNftId, ClaimId claimId, Amount amount) external {}
50
+
51
+ /// @dev empty default implementation
52
+ function payoutExecuted(NftId policyNftId, PayoutId payoutId, address beneficiary, Amount amount) external {}
53
+
54
+ /// @dev returns claim specific beneficiary
55
+ /// when no such beneficiary is defined the policy specific beneficiary is returned
56
+ function getBeneficiary(NftId policyNftId, ClaimId claimId) external virtual view returns (address beneficiary) {
57
+ beneficiary = _getPolicyHolderStorage()._beneficiary[policyNftId][claimId];
58
+
59
+ // fallback to claim independent beneficiary
60
+ if(beneficiary == address(0) && claimId.gtz()) {
61
+ beneficiary = _getPolicyHolderStorage()._beneficiary[policyNftId][ClaimIdLib.zero()];
62
+ }
52
63
  }
53
64
 
54
65
  //--- IERC165 functions ---------------//
@@ -65,12 +76,14 @@ contract PolicyHolder is
65
76
  return IERC721Receiver.onERC721Received.selector;
66
77
  }
67
78
 
68
- function _setBeneficiary(address beneficiary) internal {
69
-
79
+ /// @dev sets policy specific beneficiary (used when no claim specific beneficiary is defined)
80
+ function _setBeneficiary(NftId policyNftId, address beneficiary) internal {
81
+ _setBeneficiary(policyNftId, ClaimIdLib.zero(), beneficiary);
70
82
  }
71
83
 
72
- function _setBeneficiary(NftId policyId, address beneficiary) internal {
73
-
84
+ /// @dev sets policy and claim specific beneficiary
85
+ function _setBeneficiary(NftId policyNftId, ClaimId claimId, address beneficiary) internal {
86
+ _getPolicyHolderStorage()._beneficiary[policyNftId][claimId] = beneficiary;
74
87
  }
75
88
 
76
89
  function _getPolicyHolderStorage() private pure returns (PolicyHolderStorage storage $) {
@@ -9,7 +9,6 @@ import {ObjectType} from "../types/ObjectType.sol";
9
9
 
10
10
  import {IRegistry} from "../registry/IRegistry.sol";
11
11
  import {IRegisterable} from "./IRegisterable.sol";
12
- import {Versionable} from "./Versionable.sol";
13
12
 
14
13
  contract Registerable is
15
14
  NftOwnable,
@@ -25,12 +24,6 @@ contract Registerable is
25
24
  bytes _data;
26
25
  }
27
26
 
28
- function _getRegisterableStorage() private pure returns (RegisterableStorage storage $) {
29
- assembly {
30
- $.slot := REGISTERABLE_LOCATION_V1
31
- }
32
- }
33
-
34
27
  function initializeRegisterable(
35
28
  address registryAddress,
36
29
  NftId parentNftId,
@@ -47,7 +40,11 @@ contract Registerable is
47
40
  initialOwner,
48
41
  registryAddress);
49
42
 
50
- RegisterableStorage storage $ = _getRegisterableStorage();
43
+ RegisterableStorage storage $;
44
+ assembly {
45
+ $.slot := REGISTERABLE_LOCATION_V1
46
+ }
47
+
51
48
  $._parentNftId = parentNftId;
52
49
  $._objectType = objectType;
53
50
  $._isInterceptor = isInterceptor;
@@ -61,7 +58,11 @@ contract Registerable is
61
58
  virtual
62
59
  returns (IRegistry.ObjectInfo memory info)
63
60
  {
64
- RegisterableStorage memory $ = _getRegisterableStorage();
61
+ RegisterableStorage storage $;
62
+ assembly {
63
+ $.slot := REGISTERABLE_LOCATION_V1
64
+ }
65
+
65
66
  info = IRegistry.ObjectInfo(
66
67
  zeroNftId(),
67
68
  $._parentNftId,
@@ -40,9 +40,4 @@ contract RegistryLinked is
40
40
  function getRegistry() public view returns (IRegistry) {
41
41
  return _registry;
42
42
  }
43
-
44
-
45
- function getRegistryAddress() public view returns (address) {
46
- return address(_registry);
47
- }
48
43
  }
@@ -4,6 +4,8 @@ pragma solidity ^0.8.20;
4
4
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
5
  import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
6
6
 
7
+ import {Amount} from "../types/Amount.sol";
8
+
7
9
  /// @dev token specific transfer helper
8
10
  /// relies internally on oz SafeERC20.safeTransferFrom
9
11
  contract TokenHandler {
@@ -16,11 +18,11 @@ contract TokenHandler {
16
18
  function transfer(
17
19
  address from,
18
20
  address to,
19
- uint256 amount
21
+ Amount amount
20
22
  )
21
23
  external
22
24
  {
23
- SafeERC20.safeTransferFrom(_token, from, to, amount);
25
+ SafeERC20.safeTransferFrom(_token, from, to, amount.toInt());
24
26
  }
25
27
 
26
28
  function getToken()
@@ -6,6 +6,12 @@ import {UFixed, UFixedLib} from "./UFixed.sol";
6
6
  type Amount is uint96;
7
7
 
8
8
  using {
9
+ addAmount as +,
10
+ subAmount as -,
11
+ eqAmount as ==,
12
+ ltAmount as <,
13
+ gtAmount as >,
14
+ AmountLib.eq,
9
15
  AmountLib.eqz,
10
16
  AmountLib.gtz,
11
17
  AmountLib.toInt,
@@ -13,6 +19,25 @@ using {
13
19
  AmountLib.toUFixed
14
20
  } for Amount global;
15
21
 
22
+ function addAmount(Amount a, Amount b) pure returns (Amount) {
23
+ return AmountLib.add(a, b);
24
+ }
25
+
26
+ function subAmount(Amount a, Amount b) pure returns (Amount) {
27
+ return AmountLib.sub(a, b);
28
+ }
29
+
30
+ function eqAmount(Amount a, Amount b) pure returns (bool) {
31
+ return AmountLib.eq(a, b);
32
+ }
33
+
34
+ function ltAmount(Amount a, Amount b) pure returns (bool) {
35
+ return AmountLib.lt(a, b);
36
+ }
37
+
38
+ function gtAmount(Amount a, Amount b) pure returns (bool) {
39
+ return AmountLib.gt(a, b);
40
+ }
16
41
 
17
42
  library AmountLib {
18
43
 
@@ -41,6 +66,21 @@ library AmountLib {
41
66
  return Amount.unwrap(amount) == 0;
42
67
  }
43
68
 
69
+ /// @dev return true if amount1 equals amount2
70
+ function eq(Amount amount1, Amount amount2) public pure returns (bool) {
71
+ return Amount.unwrap(amount1) == Amount.unwrap(amount2);
72
+ }
73
+
74
+ /// @dev return true if amount a1 is smaller than a2
75
+ function lt(Amount a1, Amount a2) public pure returns (bool) {
76
+ return Amount.unwrap(a1) < Amount.unwrap(a2);
77
+ }
78
+
79
+ /// @dev return true if amount a1 is larger than a2
80
+ function gt(Amount a1, Amount a2) public pure returns (bool) {
81
+ return Amount.unwrap(a1) > Amount.unwrap(a2);
82
+ }
83
+
44
84
  /// @dev return true if amount is larger than 0
45
85
  function gtz(Amount amount) public pure returns (bool) {
46
86
  return Amount.unwrap(amount) > 0;
@@ -50,6 +90,10 @@ library AmountLib {
50
90
  return Amount.wrap(Amount.unwrap(a1) + Amount.unwrap(a2));
51
91
  }
52
92
 
93
+ function sub(Amount a1, Amount a2) public pure returns (Amount) {
94
+ return Amount.wrap(Amount.unwrap(a1) - Amount.unwrap(a2));
95
+ }
96
+
53
97
  function toInt(Amount amount) public pure returns (uint256) {
54
98
  return uint256(uint96(Amount.unwrap(amount)));
55
99
  }
@@ -1,6 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.19;
3
3
 
4
+ import {Amount, AmountLib} from "./Amount.sol";
4
5
  import {UFixed, UFixedLib} from "./UFixed.sol";
5
6
 
6
7
  struct Fee {
@@ -12,21 +13,21 @@ library FeeLib {
12
13
 
13
14
  function calculateFee(
14
15
  Fee memory fee,
15
- uint256 amount
16
+ Amount amount
16
17
  )
17
18
  public
18
19
  pure
19
20
  returns (
20
- uint256 feeAmount,
21
- uint256 netAmount
21
+ Amount feeAmount,
22
+ Amount netAmount
22
23
  )
23
24
  {
24
25
  netAmount = amount;
25
26
  if(gtz(fee)) {
26
27
  UFixed fractionalAmount =
27
- UFixedLib.toUFixed(amount) * fee.fractionalFee;
28
- feeAmount = fractionalAmount.toInt() + fee.fixedFee;
29
- netAmount -= feeAmount;
28
+ amount.toUFixed() * fee.fractionalFee;
29
+ feeAmount = AmountLib.toAmount(fractionalAmount.toInt() + fee.fixedFee);
30
+ netAmount = netAmount - feeAmount;
30
31
  }
31
32
  }
32
33
 
@@ -110,6 +110,10 @@ function PAYOUT() pure returns (ObjectType) {
110
110
  return toObjectType(213);
111
111
  }
112
112
 
113
+ function PRICE() pure returns (ObjectType) {
114
+ return toObjectType(230);
115
+ }
116
+
113
117
  /// @dev Converts the uint8 to a ObjectType.
114
118
  function toObjectType(uint256 objectType) pure returns (ObjectType) {
115
119
  return ObjectType.wrap(uint8(objectType));
@@ -154,4 +158,4 @@ library ObjectTypeLib {
154
158
  function eq(ObjectType a, ObjectType b) public pure returns (bool isSame) {
155
159
  return eqObjectType(a, b);
156
160
  }
157
- }
161
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etherisc/gif-next",
3
- "version": "0.0.2-f2df3e2-873",
3
+ "version": "0.0.2-f398177-971",
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/0097d743c9f1859f51a737077ba376b2.json"
4
- }