@etherisc/gif-next 0.0.2-90f8ffc-398 → 0.0.2-9105e58-225

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 (272) hide show
  1. package/README.md +73 -1
  2. package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
  3. package/artifacts/contracts/components/Component.sol/Component.json +242 -34
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +592 -41
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IComponent.sol/IComponent.json +85 -27
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +327 -32
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +187 -43
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +85 -27
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +443 -54
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  17. package/artifacts/contracts/components/Product.sol/Product.json +342 -34
  18. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
  33. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  35. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  36. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  37. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  38. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  39. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  40. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
  41. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  42. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  43. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +673 -169
  44. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  45. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +96 -34
  46. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  47. package/artifacts/contracts/instance/Instance.sol/Instance.json +762 -422
  48. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +39 -89
  50. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +58 -53
  52. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  53. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +289 -104
  54. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  55. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +163 -57
  56. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  57. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
  58. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
  59. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +151 -52
  60. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  61. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  62. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  63. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
  64. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  65. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  66. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +13 -13
  68. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  69. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  70. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  71. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  72. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  73. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  74. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
  75. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +1047 -0
  76. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
  77. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +543 -0
  78. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  79. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +282 -118
  80. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +149 -51
  82. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
  83. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +932 -0
  84. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
  85. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +523 -0
  86. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  87. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +426 -74
  88. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +174 -48
  90. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
  91. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +612 -0
  92. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  93. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +130 -73
  94. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
  95. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +548 -0
  96. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  97. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +220 -31
  98. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  99. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +44 -88
  100. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  101. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +23 -31
  102. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  103. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +23 -31
  104. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  105. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +212 -149
  106. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  107. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +162 -64
  108. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  109. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +173 -74
  110. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  111. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +146 -48
  112. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  113. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +173 -74
  114. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  115. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +146 -48
  116. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  117. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  118. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +15 -2
  119. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  120. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +82 -34
  121. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  122. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  123. package/artifacts/contracts/registry/Registry.sol/Registry.json +28 -15
  124. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  125. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
  126. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  127. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +218 -63
  128. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  129. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +142 -50
  130. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  131. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +11 -11
  132. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  133. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +141 -37
  134. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  135. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  136. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +41 -3
  137. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  138. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +40 -29
  139. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
  140. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
  141. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  142. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +21 -29
  143. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
  144. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +48 -0
  145. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  146. package/artifacts/contracts/shared/IService.sol/IService.json +23 -31
  147. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  148. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -2
  149. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  150. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +113 -33
  151. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
  152. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +248 -0
  153. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  154. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +143 -39
  155. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  156. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +126 -45
  157. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
  158. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +84 -0
  159. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  160. package/artifacts/contracts/shared/Service.sol/Service.json +143 -44
  161. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  162. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  163. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  164. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  165. package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -2
  166. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  167. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  168. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +126 -45
  169. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  170. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  171. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  172. package/artifacts/contracts/test/TestService.sol/TestService.json +161 -62
  173. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  174. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  175. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  176. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +8 -8
  177. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  178. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  179. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  180. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  181. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
  182. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +100 -0
  183. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  184. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
  185. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  186. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  187. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
  188. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  189. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
  190. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  191. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  192. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  193. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  194. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  195. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
  196. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +100 -0
  197. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  198. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
  199. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  200. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
  201. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  202. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  203. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  204. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  205. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  206. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  207. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  208. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  209. package/contracts/components/Component.sol +46 -20
  210. package/contracts/components/Distribution.sol +188 -33
  211. package/contracts/components/IComponent.sol +15 -3
  212. package/contracts/components/IDistributionComponent.sol +54 -1
  213. package/contracts/components/IPoolComponent.sol +48 -17
  214. package/contracts/components/Pool.sol +134 -95
  215. package/contracts/components/Product.sol +76 -57
  216. package/contracts/instance/IInstance.sol +21 -1
  217. package/contracts/instance/IInstanceService.sol +18 -0
  218. package/contracts/instance/Instance.sol +58 -36
  219. package/contracts/instance/InstanceAccessManager.sol +12 -13
  220. package/contracts/instance/InstanceService.sol +76 -35
  221. package/contracts/instance/InstanceServiceManager.sol +1 -1
  222. package/contracts/instance/base/ComponentService.sol +1 -1
  223. package/contracts/instance/module/IAccess.sol +3 -4
  224. package/contracts/instance/module/IPolicy.sol +4 -2
  225. package/contracts/instance/module/ISetup.sol +5 -4
  226. package/contracts/instance/service/ApplicationService.sol +268 -0
  227. package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
  228. package/contracts/instance/service/BundleService.sol +11 -6
  229. package/contracts/instance/service/BundleServiceManager.sol +1 -1
  230. package/contracts/instance/service/ClaimService.sol +151 -0
  231. package/contracts/instance/service/ClaimServiceManager.sol +35 -0
  232. package/contracts/instance/service/DistributionService.sol +185 -14
  233. package/contracts/instance/service/DistributionServiceManager.sol +1 -1
  234. package/contracts/instance/service/IApplicationService.sol +82 -0
  235. package/contracts/instance/service/IBundleService.sol +11 -1
  236. package/contracts/instance/service/IClaimService.sol +61 -0
  237. package/contracts/instance/service/IDistributionService.sol +53 -0
  238. package/contracts/instance/service/IPolicyService.sol +41 -46
  239. package/contracts/instance/service/PolicyService.sol +94 -158
  240. package/contracts/instance/service/PolicyServiceManager.sol +1 -1
  241. package/contracts/instance/service/PoolService.sol +2 -3
  242. package/contracts/instance/service/PoolServiceManager.sol +1 -1
  243. package/contracts/instance/service/ProductService.sol +9 -9
  244. package/contracts/instance/service/ProductServiceManager.sol +1 -1
  245. package/contracts/registry/IRegistry.sol +3 -2
  246. package/contracts/registry/IRegistryService.sol +10 -8
  247. package/contracts/registry/Registry.sol +20 -8
  248. package/contracts/registry/RegistryService.sol +70 -49
  249. package/contracts/registry/RegistryServiceManager.sol +13 -13
  250. package/contracts/registry/ReleaseManager.sol +8 -9
  251. package/contracts/registry/TokenRegistry.sol +15 -6
  252. package/contracts/shared/ERC165.sol +14 -12
  253. package/contracts/shared/INftOwnable.sol +11 -10
  254. package/contracts/shared/IPolicyHolder.sol +26 -0
  255. package/contracts/shared/IRegisterable.sol +3 -3
  256. package/contracts/shared/IRegistryLinked.sol +12 -0
  257. package/contracts/shared/IVersionable.sol +2 -2
  258. package/contracts/shared/NftOwnable.sol +66 -85
  259. package/contracts/shared/PolicyHolder.sol +81 -0
  260. package/contracts/shared/ProxyManager.sol +13 -5
  261. package/contracts/shared/Registerable.sol +6 -14
  262. package/contracts/shared/RegistryLinked.sol +48 -0
  263. package/contracts/shared/Service.sol +5 -5
  264. package/contracts/shared/Versionable.sol +3 -2
  265. package/contracts/test/TestRegisterable.sol +1 -1
  266. package/contracts/test/TestService.sol +1 -1
  267. package/contracts/types/ClaimId.sol +52 -0
  268. package/contracts/types/DistributorType.sol +2 -2
  269. package/contracts/types/ObjectType.sol +9 -5
  270. package/contracts/types/PayoutId.sol +54 -0
  271. package/contracts/types/RoleId.sol +3 -3
  272. package/package.json +3 -3
@@ -1,139 +1,120 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {INftOwnable} from "./INftOwnable.sol";
5
- import {IRegistry} from "../registry/IRegistry.sol";
6
- import {NftId, zeroNftId} from "../types/NftId.sol";
7
-
8
- // TODO make contract upgradeable
9
- contract NftOwnable is INftOwnable {
4
+ // import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
10
5
 
11
- // TODO move vars to struct and add _getNftOwnableStorage
12
- IRegistry internal _registry;
13
- NftId private _nftId;
14
- address private _initialOwner;
6
+ import {ERC165} from "./ERC165.sol";
7
+ import {INftOwnable} from "./INftOwnable.sol";
8
+ import {NftId} from "../types/NftId.sol";
9
+ import {RegistryLinked} from "./RegistryLinked.sol";
10
+
11
+ contract NftOwnable is
12
+ ERC165,
13
+ RegistryLinked,
14
+ INftOwnable
15
+ {
16
+ // keccak256(abi.encode(uint256(keccak256("etherisc.storage.NftOwnable")) - 1)) & ~bytes32(uint256(0xff));
17
+ bytes32 public constant NFT_OWNABLE_STORAGE_LOCATION_V1 = 0x07ebcf49758b6ed3af50fa146bec0abe157c0218fe65dc0874c286e9d5da4f00;
18
+
19
+ struct NftOwnableStorage {
20
+ NftId _nftId;
21
+ address _initialOwner;
22
+ }
15
23
 
16
24
  /// @dev enforces msg.sender is owner of nft (or initial owner of nft ownable)
17
25
  modifier onlyOwner() {
18
26
  if (msg.sender != getOwner()) {
19
- revert ErrorNotOwner(msg.sender);
27
+ revert ErrorNftOwnableNotOwner(msg.sender);
20
28
  }
21
29
  _;
22
30
  }
23
31
 
24
- constructor() {
25
- _initialOwner = msg.sender;
32
+
33
+ /// @dev initialization for upgradable contracts
34
+ // used in _initializeRegisterable
35
+ function initializeNftOwnable(
36
+ address initialOwner,
37
+ address registryAddress
38
+ )
39
+ public
40
+ virtual
41
+ onlyInitializing()
42
+ {
43
+ initializeRegistryLinked(registryAddress);
44
+ initializeERC165();
45
+
46
+ if(initialOwner == address(0)) {
47
+ revert ErrorNftOwnableInitialOwnerZero();
48
+ }
49
+
50
+ _getNftOwnableStorage()._initialOwner = initialOwner;
26
51
  }
27
52
 
53
+
28
54
  /// @dev links this contract to nft after registration
29
55
  // needs to be done once per registered contract and
30
56
  // reduces registry calls to check ownership
31
57
  // does not need any protection as function can only do the "right thing"
32
- function linkToRegisteredNftId() public {
33
- if (_nftId.gtz()) {
34
- revert ErrorAlreadyLinked(address(_registry), _nftId);
35
- }
58
+ function linkToRegisteredNftId()
59
+ public
60
+ virtual
61
+ {
62
+ NftOwnableStorage storage $ = _getNftOwnableStorage();
36
63
 
37
- if (address(_registry) == address(0)) {
38
- revert ErrorRegistryNotInitialized();
64
+ if ($._nftId.gtz()) {
65
+ revert ErrorNftOwnableAlreadyLinked($._nftId);
39
66
  }
40
67
 
41
68
  address contractAddress = address(this);
42
69
 
43
- if (!_registry.isRegistered(contractAddress)) {
44
- revert ErrorContractNotRegistered(contractAddress);
70
+ if (!getRegistry().isRegistered(contractAddress)) {
71
+ revert ErrorNftOwnableContractNotRegistered(contractAddress);
45
72
  }
46
73
 
47
- _nftId = _registry.getNftId(contractAddress);
48
- }
49
-
50
-
51
- function getRegistry() public view virtual override returns (IRegistry) {
52
- return _registry;
74
+ $._nftId = getRegistry().getNftId(contractAddress);
53
75
  }
54
76
 
55
-
56
77
  function getNftId() public view virtual override returns (NftId) {
57
- return _nftId;
58
- }
59
-
60
- function getInitialOwner() public view returns (address) {
61
- return _initialOwner;
78
+ return _getNftOwnableStorage()._nftId;
62
79
  }
63
80
 
64
81
  function getOwner() public view virtual override returns (address) {
65
- if (_nftId.gtz()) {
66
- return _registry.ownerOf(_nftId);
67
- }
68
-
69
- return _initialOwner;
70
- }
82
+ NftOwnableStorage storage $ = _getNftOwnableStorage();
71
83
 
84
+ if ($._nftId.gtz()) {
85
+ return getRegistry().ownerOf($._nftId);
86
+ }
72
87
 
73
- /// @dev initialization for upgradable contracts
74
- // used in _initializeRegisterable
75
- function _initializeNftOwnable(
76
- address initialOwner,
77
- address registryAddress
78
- )
79
- internal
80
- virtual
81
- {
82
- require(initialOwner > address(0), "NftOwnable: initial owner is 0");
83
- _initialOwner = initialOwner;
84
- _setRegistry(registryAddress);
88
+ return $._initialOwner;
85
89
  }
86
90
 
87
-
88
91
  /// @dev used in constructor of registry service manager
89
92
  // links ownership of registry service manager ot nft owner of registry service
90
93
  function _linkToNftOwnable(
91
- address registryAddress,
92
94
  address nftOwnableAddress
93
95
  )
94
96
  internal
95
- onlyOwner()
96
97
  returns (NftId)
97
98
  {
98
- if (_nftId.gtz()) {
99
- revert ErrorAlreadyLinked(address(_registry), _nftId);
100
- }
99
+ NftOwnableStorage storage $ = _getNftOwnableStorage();
101
100
 
102
- _setRegistry(registryAddress);
103
-
104
- if (!_registry.isRegistered(nftOwnableAddress)) {
105
- revert ErrorContractNotRegistered(nftOwnableAddress);
101
+ if ($._nftId.gtz()) {
102
+ revert ErrorNftOwnableAlreadyLinked($._nftId);
106
103
  }
107
104
 
108
- _nftId = _registry.getNftId(nftOwnableAddress);
109
-
110
- return _nftId;
111
- }
112
-
113
-
114
- function _setRegistry(address registryAddress)
115
- private
116
- {
117
- if (address(_registry) != address(0)) {
118
- revert ErrorRegistryAlreadyInitialized(address(_registry));
105
+ if (!getRegistry().isRegistered(nftOwnableAddress)) {
106
+ revert ErrorNftOwnableContractNotRegistered(nftOwnableAddress);
119
107
  }
120
108
 
121
- if (registryAddress == address(0)) {
122
- revert ErrorRegistryAddressZero();
123
- }
109
+ $._nftId = getRegistry().getNftId(nftOwnableAddress);
124
110
 
125
- if (registryAddress.code.length == 0) {
126
- revert ErrorNotRegistry(registryAddress);
127
- }
111
+ return $._nftId;
112
+ }
128
113
 
129
- _registry = IRegistry(registryAddress);
130
114
 
131
- try _registry.supportsInterface(type(IRegistry).interfaceId) returns (bool isRegistry) {
132
- if (!isRegistry) {
133
- revert ErrorNotRegistry(registryAddress);
134
- }
135
- } catch {
136
- revert ErrorNotRegistry(registryAddress);
115
+ function _getNftOwnableStorage() private pure returns (NftOwnableStorage storage $) {
116
+ assembly {
117
+ $.slot := NFT_OWNABLE_STORAGE_LOCATION_V1
137
118
  }
138
119
  }
139
120
  }
@@ -0,0 +1,81 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
+ import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
6
+ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
7
+
8
+ import {ERC165} from "./ERC165.sol";
9
+ import {IPolicyHolder} from "./IPolicyHolder.sol";
10
+ import {IRegistry} from "../registry/IRegistry.sol";
11
+ import {NftId} from "../types/NftId.sol";
12
+ import {NumberId} from "../types/NumberId.sol";
13
+ import {RegistryLinked} from "./RegistryLinked.sol";
14
+
15
+ /// @dev template implementation for IPolicyHolder
16
+ contract PolicyHolder is
17
+ ERC165,
18
+ RegistryLinked,
19
+ IPolicyHolder
20
+ {
21
+ // keccak256(abi.encode(uint256(keccak256("etherisc.storage.PolicyHolder")) - 1)) & ~bytes32(uint256(0xff));
22
+ // TODO fix address
23
+ bytes32 public constant POLICY_HOLDER_STORAGE_LOCATION_V1 = 0x07ebcf49758b6ed3af50fa146bec0abe157c0218fe65dc0874c286e9d5da4f00;
24
+
25
+ // TODO uncomment/fix/refactor
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;
30
+ }
31
+
32
+ function initializePolicyHolder(
33
+ address registryAddress
34
+ )
35
+ public
36
+ virtual
37
+ onlyInitializing()
38
+ {
39
+ initializeRegistryLinked(registryAddress);
40
+ }
41
+
42
+ /// @dev empty default implementation
43
+ function policyCreatedCallback(NftId policyNftId) external virtual { }
44
+
45
+ /// @dev empty default implementation
46
+ function payoutExecutedCallback(NftId policyNftId, NumberId payoutId, address beneficiary, uint256 amount) external virtual { }
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
52
+ }
53
+
54
+ //--- IERC165 functions ---------------//
55
+ function onERC721Received(
56
+ address, // operator
57
+ address, // from
58
+ uint256, // tokenId
59
+ bytes calldata // data
60
+ )
61
+ external
62
+ virtual
63
+ returns (bytes4)
64
+ {
65
+ return IERC721Receiver.onERC721Received.selector;
66
+ }
67
+
68
+ function _setBeneficiary(address beneficiary) internal {
69
+
70
+ }
71
+
72
+ function _setBeneficiary(NftId policyId, address beneficiary) internal {
73
+
74
+ }
75
+
76
+ function _getPolicyHolderStorage() private pure returns (PolicyHolderStorage storage $) {
77
+ assembly {
78
+ $.slot := POLICY_HOLDER_STORAGE_LOCATION_V1
79
+ }
80
+ }
81
+ }
@@ -26,9 +26,17 @@ contract ProxyManager is
26
26
  bool internal _isDeployed;
27
27
 
28
28
  /// @dev only used to capture proxy owner
29
- constructor()
30
- NftOwnable()
31
- { }
29
+ constructor(address registry)
30
+ {
31
+ initializeProxyManager(registry);
32
+ }
33
+
34
+ function initializeProxyManager(address registry)
35
+ public
36
+ initializer()
37
+ {
38
+ initializeNftOwnable(msg.sender, registry);
39
+ }
32
40
 
33
41
  /// @dev deploy initial contract
34
42
  function deploy(address initialImplementation, bytes memory initializationData)
@@ -81,11 +89,11 @@ contract ProxyManager is
81
89
  }
82
90
 
83
91
  function getDeployData(address implementation, address proxyOwner, bytes memory deployData) public pure returns (bytes memory data) {
84
- return abi.encodeWithSelector(IVersionable.initialize.selector, implementation, proxyOwner, deployData);
92
+ return abi.encodeWithSelector(IVersionable.initializeVersionable.selector, implementation, proxyOwner, deployData);
85
93
  }
86
94
 
87
95
  function getUpgradeData(address implementation, address proxyOwner, bytes memory upgradeData) public pure returns (bytes memory data) {
88
- return abi.encodeWithSelector(IVersionable.upgrade.selector, implementation, proxyOwner, upgradeData);
96
+ return abi.encodeWithSelector(IVersionable.upgradeVersionable.selector, implementation, proxyOwner, upgradeData);
89
97
  }
90
98
 
91
99
  function getProxy() public returns (UpgradableProxyWithAdmin) {
@@ -11,11 +11,7 @@ import {IRegistry} from "../registry/IRegistry.sol";
11
11
  import {IRegisterable} from "./IRegisterable.sol";
12
12
  import {Versionable} from "./Versionable.sol";
13
13
 
14
- import {ERC165} from "./ERC165.sol";
15
-
16
14
  contract Registerable is
17
- ERC165,
18
- Initializable,
19
15
  NftOwnable,
20
16
  IRegisterable
21
17
  {
@@ -37,7 +33,7 @@ contract Registerable is
37
33
  }
38
34
  }
39
35
 
40
- function _initializeRegisterable(
36
+ function initializeRegisterable(
41
37
  address registryAddress,
42
38
  NftId parentNftId,
43
39
  ObjectType objectType,
@@ -45,25 +41,21 @@ contract Registerable is
45
41
  address initialOwner,
46
42
  bytes memory data
47
43
  )
48
- internal
49
- //onlyInitializing//TODO uncomment when "fully" upgradeable
44
+ public
50
45
  virtual
46
+ onlyInitializing
51
47
  {
52
- _initializeERC165();
53
- _initializeNftOwnable(
48
+ initializeNftOwnable(
54
49
  initialOwner,
55
50
  registryAddress);
56
51
 
57
- // TODO check parentNftId -> registry.isRegistered(parentNftId)
58
- // TODO check object-parent type pair -> registry.isValidTypeCombo() or something...verify with registry that setup will be able to register...
59
-
60
52
  RegisterableStorage storage $ = _getRegisterableStorage();
61
53
  $._parentNftId = parentNftId;
62
54
  $._objectType = objectType;
63
55
  $._isInterceptor = isInterceptor;
64
56
  $._data = data;
65
57
 
66
- _registerInterface(type(IRegisterable).interfaceId);
58
+ registerInterface(type(IRegisterable).interfaceId);
67
59
  }
68
60
 
69
61
 
@@ -80,7 +72,7 @@ contract Registerable is
80
72
  $._objectType,
81
73
  $._isInterceptor,
82
74
  address(this),
83
- getInitialOwner(),
75
+ getOwner(),
84
76
  $._data);
85
77
  }
86
78
  }
@@ -0,0 +1,48 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5
+ import {IRegistry} from "../registry/IRegistry.sol";
6
+ import {IRegistryLinked} from "./IRegistryLinked.sol";
7
+
8
+ contract RegistryLinked is
9
+ Initializable,
10
+ IRegistryLinked
11
+ {
12
+
13
+ IRegistry private _registry;
14
+
15
+ /// @dev initialization for upgradable contracts
16
+ // used in _initializeRegisterable
17
+ function initializeRegistryLinked(
18
+ address registryAddress
19
+ )
20
+ public
21
+ virtual
22
+ onlyInitializing()
23
+ {
24
+ if (registryAddress.code.length == 0) {
25
+ revert ErrorNotRegistry(registryAddress);
26
+ }
27
+
28
+ _registry = IRegistry(registryAddress);
29
+
30
+ try _registry.supportsInterface(type(IRegistry).interfaceId) returns (bool isRegistry) {
31
+ if (!isRegistry) {
32
+ revert ErrorNotRegistry(registryAddress);
33
+ }
34
+ } catch {
35
+ revert ErrorNotRegistry(registryAddress);
36
+ }
37
+ }
38
+
39
+
40
+ function getRegistry() public view returns (IRegistry) {
41
+ return _registry;
42
+ }
43
+
44
+
45
+ function getRegistryAddress() public view returns (address) {
46
+ return address(_registry);
47
+ }
48
+ }
@@ -36,21 +36,21 @@ abstract contract Service is
36
36
  return VersionLib.toVersion(3,0,0);
37
37
  }
38
38
 
39
- function _initializeService(
39
+ function initializeService(
40
40
  address registry,
41
41
  address initialOwner
42
42
  )
43
- internal
43
+ public
44
44
  virtual
45
- //onlyInitializing //TODO uncomment when "fully" upgradeable
45
+ onlyInitializing()
46
46
  {
47
47
  // service must provide its name and version upon registration
48
48
  bytes memory data = abi.encode(getDomain(), getMajorVersion());
49
49
  NftId registryNftId = _getRegistryNftId(registry);
50
50
  bool isInterceptor = false;
51
51
 
52
- _initializeRegisterable(registry, registryNftId, SERVICE(), isInterceptor, initialOwner, data);
53
- _registerInterface(type(IService).interfaceId);
52
+ initializeRegisterable(registry, registryNftId, SERVICE(), isInterceptor, initialOwner, data);
53
+ registerInterface(type(IService).interfaceId);
54
54
  }
55
55
 
56
56
  // this is just a conveniene function, actual validation will be done upon registration
@@ -31,7 +31,8 @@ abstract contract Versionable is
31
31
  _disableInitializers();
32
32
  }
33
33
  // TODO write test where new version of private _updateVersionHistory is added and used...
34
- function initialize(
34
+
35
+ function initializeVersionable(
35
36
  address implementation,
36
37
  address activatedBy,
37
38
  bytes memory data
@@ -44,7 +45,7 @@ abstract contract Versionable is
44
45
  }
45
46
 
46
47
  // TODO activatedBy MUST ALWAYS be an owner?
47
- function upgrade(
48
+ function upgradeVersionable(
48
49
  address implementation,
49
50
  address activatedBy,
50
51
  bytes memory data
@@ -13,6 +13,6 @@ contract TestRegisterable is Registerable {
13
13
  // solhint-disable-next-line no-empty-blocks
14
14
  {
15
15
  bytes memory data = "";
16
- _initializeRegisterable(registry, registryNftId, objectType, isInterceptor, initialOwner, data);
16
+ initializeRegisterable(registry, registryNftId, objectType, isInterceptor, initialOwner, data);
17
17
  }
18
18
  }
@@ -16,7 +16,7 @@ contract TestService is Service {
16
16
  constructor(address registry, NftId registryNftId, address initialOwner)
17
17
  // solhint-disable-next-line no-empty-blocks
18
18
  {
19
- _initializeService(registry, initialOwner);
19
+ initializeService(registry, initialOwner);
20
20
  }
21
21
 
22
22
  function getDomain() public pure override returns(ObjectType) {
@@ -0,0 +1,52 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ // uint16 allows for 65'535 claims per policy
5
+ type ClaimId is uint16;
6
+
7
+ // type bindings
8
+ using {
9
+ eqClaimId as ==,
10
+ neClaimId as !=,
11
+ ClaimIdLib.eqz,
12
+ ClaimIdLib.gtz,
13
+ ClaimIdLib.toInt
14
+ } for ClaimId global;
15
+
16
+
17
+ // pure free functions for operators
18
+ function eqClaimId(ClaimId a, ClaimId b) pure returns (bool isSame) {
19
+ return ClaimId.unwrap(a) == ClaimId.unwrap(b);
20
+ }
21
+
22
+ function neClaimId(ClaimId a, ClaimId b) pure returns (bool isDifferent) {
23
+ return ClaimId.unwrap(a) != ClaimId.unwrap(b);
24
+ }
25
+
26
+ // library functions that operate on user defined type
27
+ library ClaimIdLib {
28
+ /// @dev Converts the ClaimId to a uint.
29
+ function zero() public pure returns (ClaimId) {
30
+ return ClaimId.wrap(0);
31
+ }
32
+
33
+ /// @dev Converts an uint into a ClaimId.
34
+ function toClaimId(uint256 a) public pure returns (ClaimId) {
35
+ return ClaimId.wrap(uint16(a));
36
+ }
37
+
38
+ /// @dev Converts the ClaimId to a uint.
39
+ function toInt(ClaimId a) public pure returns (uint16) {
40
+ return uint16(ClaimId.unwrap(a));
41
+ }
42
+
43
+ /// @dev Returns true if the value is non-zero (> 0).
44
+ function gtz(ClaimId a) public pure returns (bool) {
45
+ return ClaimId.unwrap(a) > 0;
46
+ }
47
+
48
+ /// @dev Returns true if the value is zero (== 0).
49
+ function eqz(ClaimId a) public pure returns (bool) {
50
+ return ClaimId.unwrap(a) == 0;
51
+ }
52
+ }
@@ -3,7 +3,7 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {Key32, KeyId, Key32Lib} from "./Key32.sol";
5
5
  import {NftId} from "./NftId.sol";
6
- import {DISTRIBUTION_TYPE} from "./ObjectType.sol";
6
+ import {DISTRIBUTOR_TYPE} from "./ObjectType.sol";
7
7
 
8
8
  type DistributorType is bytes8;
9
9
 
@@ -45,7 +45,7 @@ library DistributorTypeLib {
45
45
 
46
46
  /// @dev Returns the key32 value for the specified nft id and object type.
47
47
  function toKey32(DistributorType id) public pure returns (Key32 key) {
48
- return Key32Lib.toKey32(DISTRIBUTION_TYPE(), toKeyId(id));
48
+ return Key32Lib.toKey32(DISTRIBUTOR_TYPE(), toKeyId(id));
49
49
  }
50
50
 
51
51
  /// @dev Returns the key id value for the specified nft id
@@ -66,7 +66,7 @@ function DISTRIBUTION() pure returns (ObjectType) {
66
66
  return toObjectType(120);
67
67
  }
68
68
 
69
- function DISTRIBUTION_TYPE() pure returns (ObjectType) {
69
+ function DISTRIBUTOR_TYPE() pure returns (ObjectType) {
70
70
  return toObjectType(121);
71
71
  }
72
72
 
@@ -90,16 +90,20 @@ function RISK() pure returns (ObjectType) {
90
90
  return toObjectType(200);
91
91
  }
92
92
 
93
- function POLICY() pure returns (ObjectType) {
93
+ function APPLICATION() pure returns (ObjectType) {
94
94
  return toObjectType(210);
95
95
  }
96
96
 
97
- function BUNDLE() pure returns (ObjectType) {
98
- return toObjectType(220);
97
+ function POLICY() pure returns (ObjectType) {
98
+ return toObjectType(211);
99
99
  }
100
100
 
101
101
  function CLAIM() pure returns (ObjectType) {
102
- return toObjectType(211);
102
+ return toObjectType(212);
103
+ }
104
+
105
+ function BUNDLE() pure returns (ObjectType) {
106
+ return toObjectType(220);
103
107
  }
104
108
 
105
109
  function PAYOUT() pure returns (ObjectType) {
@@ -0,0 +1,54 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ // uint24 allows for 65'535 claims with 255 payouts each per policy
5
+ type PayoutId is uint24;
6
+
7
+ // type bindings
8
+ using {
9
+ eqPayoutId as ==,
10
+ nePayoutId as !=,
11
+ PayoutIdLib.eqz,
12
+ PayoutIdLib.gtz,
13
+ PayoutIdLib.toInt
14
+ } for PayoutId global;
15
+
16
+
17
+ // pure free functions for operators
18
+ function eqPayoutId(PayoutId a, PayoutId b) pure returns (bool isSame) {
19
+ return PayoutId.unwrap(a) == PayoutId.unwrap(b);
20
+ }
21
+
22
+ function nePayoutId(PayoutId a, PayoutId b) pure returns (bool isDifferent) {
23
+ return PayoutId.unwrap(a) != PayoutId.unwrap(b);
24
+ }
25
+
26
+ // TODO come up with a way to code claim id into payout id
27
+ // eg payoutId.getClaimId(), payoutId.getPayoutNo()
28
+ // library functions that operate on user defined type
29
+ library PayoutIdLib {
30
+ /// @dev Converts the PayoutId to a uint.
31
+ function zero() public pure returns (PayoutId) {
32
+ return PayoutId.wrap(0);
33
+ }
34
+
35
+ /// @dev Converts an uint into a PayoutId.
36
+ function toPayoutId(uint256 a) public pure returns (PayoutId) {
37
+ return PayoutId.wrap(uint24(a));
38
+ }
39
+
40
+ /// @dev Converts the PayoutId to a uint.
41
+ function toInt(PayoutId a) public pure returns (uint24) {
42
+ return uint24(PayoutId.unwrap(a));
43
+ }
44
+
45
+ /// @dev Returns true if the value is non-zero (> 0).
46
+ function gtz(PayoutId a) public pure returns (bool) {
47
+ return PayoutId.unwrap(a) > 0;
48
+ }
49
+
50
+ /// @dev Returns true if the value is zero (== 0).
51
+ function eqz(PayoutId a) public pure returns (bool) {
52
+ return PayoutId.unwrap(a) == 0;
53
+ }
54
+ }
@@ -29,15 +29,15 @@ function ORACLE_OWNER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2
29
29
  function POOL_OWNER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(300); }
30
30
  function PRODUCT_OWNER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(400); }
31
31
 
32
-
33
32
  function INSTANCE_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2000); }
34
33
  function DISTRIBUTION_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2100); }
35
34
  function POOL_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2200); }
36
35
  function PRODUCT_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2300); }
37
- function POLICY_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2400); }
36
+ function APPLICATION_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2400); }
37
+ function POLICY_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2410); }
38
+ function CLAIM_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2420); }
38
39
  function BUNDLE_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2500); }
39
40
 
40
-
41
41
  function GIF_ADMIN_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1500); }
42
42
  function GIF_MANAGER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1600); }
43
43
  function RELEASE_MANAGER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1700); }