@etherisc/gif-next 0.0.2-ebbe63d → 0.0.2-f619be3-760

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. package/README.md +144 -1
  2. package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
  3. package/artifacts/contracts/components/Component.sol/Component.json +205 -0
  4. package/artifacts/contracts/components/Component.sol/InstanceLinked.dbg.json +4 -0
  5. package/artifacts/contracts/components/Component.sol/InstanceLinked.json +35 -0
  6. package/artifacts/contracts/components/IPool.sol/IPoolComponent.dbg.json +4 -0
  7. package/artifacts/contracts/components/IPool.sol/IPoolComponent.json +255 -0
  8. package/artifacts/contracts/components/IProduct.sol/IProductComponent.dbg.json +4 -0
  9. package/artifacts/contracts/components/IProduct.sol/IProductComponent.json +74 -0
  10. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +4 -0
  11. package/artifacts/contracts/components/Pool.sol/Pool.json +328 -0
  12. package/artifacts/contracts/components/Product.sol/Product.dbg.json +4 -0
  13. package/artifacts/contracts/components/Product.sol/Product.json +346 -0
  14. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +4 -0
  15. package/artifacts/contracts/experiment/errors/Require.sol/Require.json +105 -0
  16. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +4 -0
  17. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +105 -0
  18. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +4 -0
  19. package/artifacts/contracts/experiment/inheritance/A.sol/A.json +128 -0
  20. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +4 -0
  21. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +42 -0
  22. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +4 -0
  23. package/artifacts/contracts/experiment/inheritance/B.sol/B.json +76 -0
  24. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +4 -0
  25. package/artifacts/contracts/experiment/inheritance/C.sol/C.json +89 -0
  26. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +4 -0
  27. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.json +128 -0
  28. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +4 -0
  29. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.json +37 -0
  30. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +4 -0
  31. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.json +50 -0
  32. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +4 -0
  33. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.json +63 -0
  34. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +4 -0
  35. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +59 -0
  36. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +4 -0
  37. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +124 -0
  38. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +4 -0
  39. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +74 -0
  40. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +4 -0
  41. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +124 -0
  42. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +4 -0
  43. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +207 -0
  44. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +4 -0
  45. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +10 -0
  46. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +4 -0
  47. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +10 -0
  48. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +4 -0
  49. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1479 -0
  50. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +4 -0
  51. package/artifacts/contracts/instance/Instance.sol/Instance.json +1725 -0
  52. package/artifacts/contracts/instance/access/Access.sol/AccessModule.dbg.json +4 -0
  53. package/artifacts/contracts/instance/access/Access.sol/AccessModule.json +400 -0
  54. package/artifacts/contracts/instance/access/IAccess.sol/IAccess.dbg.json +4 -0
  55. package/artifacts/contracts/instance/access/IAccess.sol/IAccess.json +10 -0
  56. package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.dbg.json +4 -0
  57. package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.json +35 -0
  58. package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.dbg.json +4 -0
  59. package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.json +50 -0
  60. package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.dbg.json +4 -0
  61. package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.json +336 -0
  62. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.dbg.json +4 -0
  63. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.json +299 -0
  64. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.dbg.json +4 -0
  65. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.json +202 -0
  66. package/artifacts/contracts/instance/component/IComponent.sol/IComponent.dbg.json +4 -0
  67. package/artifacts/contracts/instance/component/IComponent.sol/IComponent.json +10 -0
  68. package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.dbg.json +4 -0
  69. package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.json +205 -0
  70. package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.dbg.json +4 -0
  71. package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.json +217 -0
  72. package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.dbg.json +4 -0
  73. package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.json +141 -0
  74. package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.dbg.json +4 -0
  75. package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.json +24 -0
  76. package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycle.dbg.json +4 -0
  77. package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycle.json +134 -0
  78. package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycleModule.dbg.json +4 -0
  79. package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycleModule.json +182 -0
  80. package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.dbg.json +4 -0
  81. package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.json +221 -0
  82. package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicy.dbg.json +4 -0
  83. package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicy.json +10 -0
  84. package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.dbg.json +4 -0
  85. package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.json +254 -0
  86. package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.dbg.json +4 -0
  87. package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.json +254 -0
  88. package/artifacts/contracts/instance/pool/IPoolModule.sol/IPool.dbg.json +4 -0
  89. package/artifacts/contracts/instance/pool/IPoolModule.sol/IPool.json +10 -0
  90. package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.dbg.json +4 -0
  91. package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.json +129 -0
  92. package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.dbg.json +4 -0
  93. package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.json +155 -0
  94. package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.dbg.json +4 -0
  95. package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.json +75 -0
  96. package/artifacts/contracts/instance/product/IProductService.sol/IProductService.dbg.json +4 -0
  97. package/artifacts/contracts/instance/product/IProductService.sol/IProductService.json +127 -0
  98. package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.dbg.json +4 -0
  99. package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.json +75 -0
  100. package/artifacts/contracts/instance/product/ProductService.sol/ProductService.dbg.json +4 -0
  101. package/artifacts/contracts/instance/product/ProductService.sol/ProductService.json +196 -0
  102. package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasury.dbg.json +4 -0
  103. package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasury.json +10 -0
  104. package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasuryModule.dbg.json +4 -0
  105. package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasuryModule.json +490 -0
  106. package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.dbg.json +4 -0
  107. package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.json +45 -0
  108. package/artifacts/contracts/instance/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +4 -0
  109. package/artifacts/contracts/instance/treasury/TreasuryModule.sol/TreasuryModule.json +490 -0
  110. package/artifacts/contracts/mock/Dip.sol/DIP.dbg.json +4 -0
  111. package/artifacts/contracts/mock/Dip.sol/DIP.json +338 -0
  112. package/artifacts/contracts/mock/TestPool.sol/TestPool.dbg.json +4 -0
  113. package/artifacts/contracts/mock/TestPool.sol/TestPool.json +294 -0
  114. package/artifacts/contracts/mock/TestProduct.sol/TestProduct.dbg.json +4 -0
  115. package/artifacts/contracts/mock/TestProduct.sol/TestProduct.json +384 -0
  116. package/artifacts/contracts/mock/Usdc.sol/USDC.dbg.json +4 -0
  117. package/artifacts/contracts/mock/Usdc.sol/USDC.json +338 -0
  118. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +4 -0
  119. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +534 -0
  120. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +4 -0
  121. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +452 -0
  122. package/artifacts/contracts/registry/IRegistry.sol/IOwnable.dbg.json +4 -0
  123. package/artifacts/contracts/registry/IRegistry.sol/IOwnable.json +24 -0
  124. package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.dbg.json +4 -0
  125. package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.json +166 -0
  126. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +4 -0
  127. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +188 -0
  128. package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.dbg.json +4 -0
  129. package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.json +49 -0
  130. package/artifacts/contracts/registry/Registry.sol/Registerable.dbg.json +4 -0
  131. package/artifacts/contracts/registry/Registry.sol/Registerable.json +166 -0
  132. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +4 -0
  133. package/artifacts/contracts/registry/Registry.sol/Registry.json +256 -0
  134. package/artifacts/contracts/registry/Registry.sol/RegistryLinked.dbg.json +4 -0
  135. package/artifacts/contracts/registry/Registry.sol/RegistryLinked.json +60 -0
  136. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +4 -0
  137. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +174 -0
  138. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +4 -0
  139. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +10 -0
  140. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +4 -0
  141. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +92 -0
  142. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +4 -0
  143. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +92 -0
  144. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +4 -0
  145. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +92 -0
  146. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +4 -0
  147. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +174 -0
  148. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +4 -0
  149. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +479 -0
  150. package/contracts/components/Component.sol +77 -0
  151. package/contracts/components/IPool.sol +15 -0
  152. package/contracts/components/IProduct.sol +16 -0
  153. package/contracts/components/Pool.sol +52 -0
  154. package/contracts/components/Product.sol +89 -0
  155. package/contracts/experiment/errors/Require.sol +38 -0
  156. package/contracts/experiment/errors/Revert.sol +44 -0
  157. package/contracts/experiment/inheritance/A.sol +53 -0
  158. package/contracts/experiment/inheritance/B.sol +28 -0
  159. package/contracts/experiment/inheritance/C.sol +34 -0
  160. package/contracts/experiment/inheritance/IA.sol +13 -0
  161. package/contracts/experiment/inheritance/IB.sol +10 -0
  162. package/contracts/experiment/inheritance/IC.sol +12 -0
  163. package/contracts/experiment/statemachine/Dummy.sol +27 -0
  164. package/contracts/experiment/statemachine/ISM.sol +25 -0
  165. package/contracts/experiment/statemachine/README.md +112 -0
  166. package/contracts/experiment/statemachine/SM.sol +57 -0
  167. package/contracts/experiment/statemachine/SimpleStateMachine.sol +31 -0
  168. package/contracts/experiment/types/TypeA.sol +47 -0
  169. package/contracts/experiment/types/TypeB.sol +29 -0
  170. package/contracts/instance/IInstance.sol +25 -0
  171. package/contracts/instance/Instance.sol +72 -0
  172. package/contracts/instance/access/Access.sol +165 -0
  173. package/contracts/instance/access/IAccess.sol +63 -0
  174. package/contracts/instance/component/ComponentModule.sol +274 -0
  175. package/contracts/instance/component/IComponent.sol +74 -0
  176. package/contracts/instance/lifecycle/ILifecycle.sol +47 -0
  177. package/contracts/instance/lifecycle/LifecycleModule.sol +88 -0
  178. package/contracts/instance/policy/IPolicy.sol +50 -0
  179. package/contracts/instance/policy/PolicyModule.sol +114 -0
  180. package/contracts/instance/pool/IPoolModule.sol +23 -0
  181. package/contracts/instance/pool/PoolModule.sol +81 -0
  182. package/contracts/instance/product/IProductService.sol +36 -0
  183. package/contracts/instance/product/ProductService.sol +136 -0
  184. package/contracts/instance/treasury/ITreasury.sol +91 -0
  185. package/contracts/instance/treasury/TokenHandler.sol +24 -0
  186. package/contracts/instance/treasury/TreasuryModule.sol +168 -0
  187. package/contracts/mock/TestPool.sol +16 -0
  188. package/contracts/mock/TestProduct.sol +39 -0
  189. package/contracts/mock/Usdc.sol +26 -0
  190. package/contracts/registry/ChainNft.sol +135 -0
  191. package/contracts/registry/IChainNft.sol +21 -0
  192. package/contracts/registry/IRegistry.sol +67 -0
  193. package/contracts/registry/Registry.sol +182 -0
  194. package/contracts/types/Blocknumber.sol +118 -0
  195. package/contracts/types/ChainId.sol +38 -0
  196. package/contracts/types/Fee.sol +32 -0
  197. package/contracts/types/NftId.sol +51 -0
  198. package/contracts/types/ObjectType.sol +107 -0
  199. package/contracts/types/StateId.sol +91 -0
  200. package/contracts/types/Timestamp.sol +102 -0
  201. package/contracts/types/UFixed.sol +210 -0
  202. package/package.json +19 -9
  203. package/artifacts/contracts/Dip.sol/DIP.dbg.json +0 -4
  204. package/artifacts/contracts/Dip.sol/DIP.json +0 -338
  205. package/artifacts/contracts/Lock.sol/Lock.dbg.json +0 -4
  206. package/artifacts/contracts/Lock.sol/Lock.json +0 -74
  207. package/contracts/Lock.sol +0 -34
  208. /package/contracts/{Dip.sol → mock/Dip.sol} +0 -0
package/README.md CHANGED
@@ -1,8 +1,16 @@
1
1
  # gif-next (Generic Insurance Framework next version)
2
2
 
3
+ ## Submodules checkout
4
+
5
+ This repository uses submodules. To checkout or update to the latest submodules, run the following command after updating to any revision (or checking out the repository)
6
+
7
+ ```shell
8
+ git submodule update --recursive
9
+ ```
10
+
3
11
  ## Hardhat
4
12
 
5
- ### Commands
13
+ ### NPM Commands
6
14
 
7
15
  ```shell
8
16
  npm run build
@@ -13,6 +21,46 @@ npm run test-with-gas
13
21
  npm run coverage
14
22
  ```
15
23
 
24
+ ### Deployment
25
+
26
+ ```
27
+ hh run --network <networkname> scripts/deploy.ts
28
+ ```
29
+
30
+ Networks:
31
+ - hardhat (dynamically created network - https://hardhat.org/hardhat-network/docs/overview)
32
+ - anvil (anvsil chain running in container next when using devcontainer)
33
+ - mumbai (polygon testnet, requires WEB3_INFURA_PROJECT_ID)
34
+ - mainnet (polygon mainnet, requires WEB3_INFURA_PROJECT_ID)
35
+
36
+
37
+ #### Deply all script
38
+
39
+ The deploy all script will deploy all required contracts and create a test instance with a test product and a test pool.
40
+
41
+ ```
42
+ hh run --network <networkname> scripts/deploy_all.ts
43
+ ```
44
+
45
+ Environment variables:
46
+
47
+ - `SKIP_VERIFICATION` set to `true` to skip etherscan verification (required for ganacht and anvil)
48
+ - `WEB3_INFURA_PROJECT_ID` set to infura project id (required for mumbai and mainnet)
49
+ - `WALLET_MNEMONIC` the mnemonic of the wallet to use for deployment (required for mumbai and mainnet)
50
+ - `ETHERSCAN_API_KEY` `POLYGONSCAN_API_KEY` the api key for etherscan/polygonscan (required for mumbai and mainnet)
51
+
52
+
53
+ ### Console
54
+
55
+ ```
56
+ hh console --network <networkname>
57
+
58
+ me = hre.ethers.Wallet.fromPhrase('...')
59
+ provider = hre.ethers.provider
60
+ await provider.getBalance(me)
61
+ ```
62
+
63
+
16
64
  ### Documentation
17
65
 
18
66
  https://hardhat.org/hardhat-runner/docs/guides/compile-contracts
@@ -25,9 +73,104 @@ https://hardhat.org/hardhat-runner/docs/guides/compile-contracts
25
73
  forge build
26
74
 
27
75
  forge test
76
+
77
+ # run single test case
78
+ forge test --mt test_decimals
79
+
80
+ # run single test case with substantial logginglogging
81
+ # to include logs as well use -vvvvv
82
+ forge test -vvvv --mt test_decimals
83
+
84
+ # provide gas report for a single test
85
+ forge test --mt test_decimals --gas-report
86
+
87
+ forge coverage
28
88
  ```
29
89
 
90
+ Chisel session
91
+ ```typescript
92
+ import "./contracts/components/Component.sol";
93
+ import "./contracts/components/IPool.sol";
94
+ import "./contracts/components/IProduct.sol";
95
+ import "./contracts/components/Pool.sol";
96
+ import "./contracts/components/Product.sol";
97
+ import "./contracts/instance/access/Access.sol";
98
+ import "./contracts/instance/access/IAccess.sol";
99
+ import "./contracts/instance/component/ComponentModule.sol";
100
+ import "./contracts/instance/component/IComponent.sol";
101
+ import "./contracts/instance/IInstance.sol";
102
+ import "./contracts/instance/policy/IPolicy.sol";
103
+ import "./contracts/instance/policy/PolicyModule.sol";
104
+ import "./contracts/instance/product/IProductService.sol";
105
+ import "./contracts/instance/product/ProductService.sol";
106
+ import "./contracts/registry/IRegistry.sol";
107
+
108
+ import {Instance} from "./contracts/instance/Instance.sol";
109
+ import {Registry} from "./contracts/registry/Registry.sol";
110
+ import {DeployAll} from "./scripts/DeployAll.s.sol";
111
+ import {TestPool} from "./test_forge/mock/TestPool.sol";
112
+ import {TestProduct} from "./test_forge/mock/TestProduct.sol";
113
+
114
+ string memory instanceOwnerName = "instanceOwner";
115
+ address instanceOwner = vm.addr(uint256(keccak256(abi.encodePacked(instanceOwnerName))));
116
+
117
+ string memory productOwnerName = "productOwner";
118
+ address productOwner = vm.addr(uint256(keccak256(abi.encodePacked(productOwnerName))));
119
+
120
+ string memory poolOwnerName = "poolOwner";
121
+ address poolOwner = vm.addr(uint256(keccak256(abi.encodePacked(poolOwnerName))));
122
+
123
+ string memory customerName = "customer";
124
+ address customer = vm.addr(uint256(keccak256(abi.encodePacked(customerName))));
125
+
126
+ DeployAll deployer = new DeployAll();
127
+ (
128
+ Registry registry,
129
+ Instance instance,
130
+ TestProduct product,
131
+ TestPool pool
132
+ ) = deployer.run(
133
+ instanceOwner,
134
+ productOwner,
135
+ poolOwner);
136
+
137
+ ProductService ps = ProductService(address(registry));
138
+
139
+ uint256 bundleNftId = 99;
140
+ uint256 sumInsuredAmount = 1000*10**6;
141
+ uint256 premiumAmount = 110*10**6;
142
+ uint256 lifetime =365*24*3600;
143
+ uint256 policyNftId = ps.createApplicationForBundle(customer, bundleNftId, sumInsuredAmount, premiumAmount, lifetime);
144
+
145
+ ```
146
+
147
+
30
148
  ### Documentation
31
149
 
32
150
  https://book.getfoundry.sh/reference/
33
151
 
152
+ ## Style Guide
153
+
154
+ Solidity code is to be written according to the [Solidity Style Guide](https://docs.soliditylang.org/en/latest/style-guide.html).
155
+
156
+ Documentation of the code should be written inline using [NatSpec](https://docs.soliditylang.org/en/latest/natspec-format.html).
157
+
158
+ ### Naming conventions
159
+
160
+ Additionally, we use the following naming conventions:
161
+
162
+ - Function arguments and return types: If using custom data types, make the name include the type by appending the Type to the argument name, e.g. `function getInfo(NftId bundleNftId)` instead of `function getInfo(NftId bundleId)`. Background: Custom data types are lost when using the ABI or Typescript binding classes (e.g. instead of `NftID` a `uint96` is used), so the type needs to be included in the name to make it clear what the argument is without having to look at the documentation or checking the solidity source code.
163
+ - When naming a field or an attribute `id` and the context is not clear, call it `nftId` instead so its clear what type if id it is as there will be multiple ids for different kind of objects. Example: if you the function has a bundle nft id and a policy nft id as arguments, call them `bundleNftId` and `policyNftId` instead of `id` and `policyId`. In case of doubt, be a bit more verbose for the sake of clarity.
164
+ - When naming things, remember that the code will likely be used in Javascript/Typescript as well, so avoid names that are reserved in Javascript/Typescript. A list of reserved words in Javascript can be found [here](https://www.w3schools.com/js/js_reserved.asp) and a list of reserved words in Typescript can be found [here](https://www.tektutorialshub.com/typescript/identifiers-keywords-in-typescript/).
165
+
166
+ ### Automatic code formatting
167
+
168
+ We use prettier and the solidity plugin to format the code automatically.
169
+ The plugin is configured to use the style guide mentioned above.
170
+ To execute format checks run `npm run styleCheck`.
171
+ To execute formatting run `npm run styleFix`.
172
+
173
+ ### Linting
174
+
175
+ We use solhint to lint the code.
176
+ To execute linting run `npm run lint`.
@@ -0,0 +1,4 @@
1
+ {
2
+ "_format": "hh-sol-dbg-1",
3
+ "buildInfo": "../../../build-info/371956c35f778b248bb1774ada1ed516.json"
4
+ }
@@ -0,0 +1,205 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "Component",
4
+ "sourceName": "contracts/components/Component.sol",
5
+ "abi": [
6
+ {
7
+ "anonymous": false,
8
+ "inputs": [
9
+ {
10
+ "indexed": false,
11
+ "internalType": "uint256",
12
+ "name": "idx",
13
+ "type": "uint256"
14
+ },
15
+ {
16
+ "indexed": false,
17
+ "internalType": "address",
18
+ "name": "module",
19
+ "type": "address"
20
+ },
21
+ {
22
+ "indexed": false,
23
+ "internalType": "string",
24
+ "name": "comment",
25
+ "type": "string"
26
+ }
27
+ ],
28
+ "name": "LogDebug",
29
+ "type": "event"
30
+ },
31
+ {
32
+ "inputs": [],
33
+ "name": "getData",
34
+ "outputs": [
35
+ {
36
+ "internalType": "bytes",
37
+ "name": "data",
38
+ "type": "bytes"
39
+ }
40
+ ],
41
+ "stateMutability": "view",
42
+ "type": "function"
43
+ },
44
+ {
45
+ "inputs": [],
46
+ "name": "getInitialOwner",
47
+ "outputs": [
48
+ {
49
+ "internalType": "address",
50
+ "name": "deployer",
51
+ "type": "address"
52
+ }
53
+ ],
54
+ "stateMutability": "view",
55
+ "type": "function"
56
+ },
57
+ {
58
+ "inputs": [],
59
+ "name": "getInstance",
60
+ "outputs": [
61
+ {
62
+ "internalType": "contract IInstance",
63
+ "name": "instance",
64
+ "type": "address"
65
+ }
66
+ ],
67
+ "stateMutability": "view",
68
+ "type": "function"
69
+ },
70
+ {
71
+ "inputs": [],
72
+ "name": "getNftId",
73
+ "outputs": [
74
+ {
75
+ "internalType": "NftId",
76
+ "name": "nftId",
77
+ "type": "uint96"
78
+ }
79
+ ],
80
+ "stateMutability": "view",
81
+ "type": "function"
82
+ },
83
+ {
84
+ "inputs": [],
85
+ "name": "getOwner",
86
+ "outputs": [
87
+ {
88
+ "internalType": "address",
89
+ "name": "owner",
90
+ "type": "address"
91
+ }
92
+ ],
93
+ "stateMutability": "view",
94
+ "type": "function"
95
+ },
96
+ {
97
+ "inputs": [],
98
+ "name": "getParentNftId",
99
+ "outputs": [
100
+ {
101
+ "internalType": "NftId",
102
+ "name": "",
103
+ "type": "uint96"
104
+ }
105
+ ],
106
+ "stateMutability": "view",
107
+ "type": "function"
108
+ },
109
+ {
110
+ "inputs": [],
111
+ "name": "getRegistry",
112
+ "outputs": [
113
+ {
114
+ "internalType": "contract IRegistry",
115
+ "name": "registry",
116
+ "type": "address"
117
+ }
118
+ ],
119
+ "stateMutability": "view",
120
+ "type": "function"
121
+ },
122
+ {
123
+ "inputs": [],
124
+ "name": "getToken",
125
+ "outputs": [
126
+ {
127
+ "internalType": "contract IERC20Metadata",
128
+ "name": "token",
129
+ "type": "address"
130
+ }
131
+ ],
132
+ "stateMutability": "view",
133
+ "type": "function"
134
+ },
135
+ {
136
+ "inputs": [],
137
+ "name": "getType",
138
+ "outputs": [
139
+ {
140
+ "internalType": "ObjectType",
141
+ "name": "objectType",
142
+ "type": "uint8"
143
+ }
144
+ ],
145
+ "stateMutability": "view",
146
+ "type": "function"
147
+ },
148
+ {
149
+ "inputs": [],
150
+ "name": "getWallet",
151
+ "outputs": [
152
+ {
153
+ "internalType": "address",
154
+ "name": "walletAddress",
155
+ "type": "address"
156
+ }
157
+ ],
158
+ "stateMutability": "view",
159
+ "type": "function"
160
+ },
161
+ {
162
+ "inputs": [],
163
+ "name": "isRegisterable",
164
+ "outputs": [
165
+ {
166
+ "internalType": "bool",
167
+ "name": "",
168
+ "type": "bool"
169
+ }
170
+ ],
171
+ "stateMutability": "pure",
172
+ "type": "function"
173
+ },
174
+ {
175
+ "inputs": [],
176
+ "name": "isRegistered",
177
+ "outputs": [
178
+ {
179
+ "internalType": "bool",
180
+ "name": "",
181
+ "type": "bool"
182
+ }
183
+ ],
184
+ "stateMutability": "view",
185
+ "type": "function"
186
+ },
187
+ {
188
+ "inputs": [],
189
+ "name": "register",
190
+ "outputs": [
191
+ {
192
+ "internalType": "NftId",
193
+ "name": "componentId",
194
+ "type": "uint96"
195
+ }
196
+ ],
197
+ "stateMutability": "nonpayable",
198
+ "type": "function"
199
+ }
200
+ ],
201
+ "bytecode": "0x",
202
+ "deployedBytecode": "0x",
203
+ "linkReferences": {},
204
+ "deployedLinkReferences": {}
205
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "_format": "hh-sol-dbg-1",
3
+ "buildInfo": "../../../build-info/371956c35f778b248bb1774ada1ed516.json"
4
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "InstanceLinked",
4
+ "sourceName": "contracts/components/Component.sol",
5
+ "abi": [
6
+ {
7
+ "inputs": [
8
+ {
9
+ "internalType": "address",
10
+ "name": "instance",
11
+ "type": "address"
12
+ }
13
+ ],
14
+ "stateMutability": "nonpayable",
15
+ "type": "constructor"
16
+ },
17
+ {
18
+ "inputs": [],
19
+ "name": "getInstance",
20
+ "outputs": [
21
+ {
22
+ "internalType": "contract IInstance",
23
+ "name": "instance",
24
+ "type": "address"
25
+ }
26
+ ],
27
+ "stateMutability": "view",
28
+ "type": "function"
29
+ }
30
+ ],
31
+ "bytecode": "0x608060405234801561001057600080fd5b5060405161011438038061011483398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6082806100926000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063de7b5d1414602d575b600080fd5b600054604080516001600160a01b039092168252519081900360200190f3fea264697066735822122073a0ea8fa4352d28b2a129d826cfd42d4c8f65d3a006cdf283aa909e0fac0e4264736f6c63430008140033",
32
+ "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060285760003560e01c8063de7b5d1414602d575b600080fd5b600054604080516001600160a01b039092168252519081900360200190f3fea264697066735822122073a0ea8fa4352d28b2a129d826cfd42d4c8f65d3a006cdf283aa909e0fac0e4264736f6c63430008140033",
33
+ "linkReferences": {},
34
+ "deployedLinkReferences": {}
35
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "_format": "hh-sol-dbg-1",
3
+ "buildInfo": "../../../build-info/371956c35f778b248bb1774ada1ed516.json"
4
+ }
@@ -0,0 +1,255 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "IPoolComponent",
4
+ "sourceName": "contracts/components/IPool.sol",
5
+ "abi": [
6
+ {
7
+ "anonymous": false,
8
+ "inputs": [
9
+ {
10
+ "indexed": false,
11
+ "internalType": "uint256",
12
+ "name": "idx",
13
+ "type": "uint256"
14
+ },
15
+ {
16
+ "indexed": false,
17
+ "internalType": "address",
18
+ "name": "module",
19
+ "type": "address"
20
+ },
21
+ {
22
+ "indexed": false,
23
+ "internalType": "string",
24
+ "name": "comment",
25
+ "type": "string"
26
+ }
27
+ ],
28
+ "name": "LogDebug",
29
+ "type": "event"
30
+ },
31
+ {
32
+ "inputs": [],
33
+ "name": "getData",
34
+ "outputs": [
35
+ {
36
+ "internalType": "bytes",
37
+ "name": "data",
38
+ "type": "bytes"
39
+ }
40
+ ],
41
+ "stateMutability": "view",
42
+ "type": "function"
43
+ },
44
+ {
45
+ "inputs": [],
46
+ "name": "getInitialOwner",
47
+ "outputs": [
48
+ {
49
+ "internalType": "address",
50
+ "name": "initialOwner",
51
+ "type": "address"
52
+ }
53
+ ],
54
+ "stateMutability": "view",
55
+ "type": "function"
56
+ },
57
+ {
58
+ "inputs": [],
59
+ "name": "getInstance",
60
+ "outputs": [
61
+ {
62
+ "internalType": "contract IInstance",
63
+ "name": "instance",
64
+ "type": "address"
65
+ }
66
+ ],
67
+ "stateMutability": "view",
68
+ "type": "function"
69
+ },
70
+ {
71
+ "inputs": [],
72
+ "name": "getNftId",
73
+ "outputs": [
74
+ {
75
+ "internalType": "NftId",
76
+ "name": "nftId",
77
+ "type": "uint96"
78
+ }
79
+ ],
80
+ "stateMutability": "view",
81
+ "type": "function"
82
+ },
83
+ {
84
+ "inputs": [],
85
+ "name": "getOwner",
86
+ "outputs": [
87
+ {
88
+ "internalType": "address",
89
+ "name": "owner",
90
+ "type": "address"
91
+ }
92
+ ],
93
+ "stateMutability": "view",
94
+ "type": "function"
95
+ },
96
+ {
97
+ "inputs": [],
98
+ "name": "getParentNftId",
99
+ "outputs": [
100
+ {
101
+ "internalType": "NftId",
102
+ "name": "parentNftId",
103
+ "type": "uint96"
104
+ }
105
+ ],
106
+ "stateMutability": "view",
107
+ "type": "function"
108
+ },
109
+ {
110
+ "inputs": [],
111
+ "name": "getPerformanceFee",
112
+ "outputs": [
113
+ {
114
+ "components": [
115
+ {
116
+ "internalType": "UFixed",
117
+ "name": "fractionalFee",
118
+ "type": "uint256"
119
+ },
120
+ {
121
+ "internalType": "uint256",
122
+ "name": "fixedFee",
123
+ "type": "uint256"
124
+ }
125
+ ],
126
+ "internalType": "struct Fee",
127
+ "name": "performanceFee",
128
+ "type": "tuple"
129
+ }
130
+ ],
131
+ "stateMutability": "view",
132
+ "type": "function"
133
+ },
134
+ {
135
+ "inputs": [],
136
+ "name": "getRegistry",
137
+ "outputs": [
138
+ {
139
+ "internalType": "contract IRegistry",
140
+ "name": "registry",
141
+ "type": "address"
142
+ }
143
+ ],
144
+ "stateMutability": "view",
145
+ "type": "function"
146
+ },
147
+ {
148
+ "inputs": [],
149
+ "name": "getStakingFee",
150
+ "outputs": [
151
+ {
152
+ "components": [
153
+ {
154
+ "internalType": "UFixed",
155
+ "name": "fractionalFee",
156
+ "type": "uint256"
157
+ },
158
+ {
159
+ "internalType": "uint256",
160
+ "name": "fixedFee",
161
+ "type": "uint256"
162
+ }
163
+ ],
164
+ "internalType": "struct Fee",
165
+ "name": "stakingFee",
166
+ "type": "tuple"
167
+ }
168
+ ],
169
+ "stateMutability": "view",
170
+ "type": "function"
171
+ },
172
+ {
173
+ "inputs": [],
174
+ "name": "getToken",
175
+ "outputs": [
176
+ {
177
+ "internalType": "contract IERC20Metadata",
178
+ "name": "token",
179
+ "type": "address"
180
+ }
181
+ ],
182
+ "stateMutability": "view",
183
+ "type": "function"
184
+ },
185
+ {
186
+ "inputs": [],
187
+ "name": "getType",
188
+ "outputs": [
189
+ {
190
+ "internalType": "ObjectType",
191
+ "name": "objectType",
192
+ "type": "uint8"
193
+ }
194
+ ],
195
+ "stateMutability": "view",
196
+ "type": "function"
197
+ },
198
+ {
199
+ "inputs": [],
200
+ "name": "getWallet",
201
+ "outputs": [
202
+ {
203
+ "internalType": "address",
204
+ "name": "walletAddress",
205
+ "type": "address"
206
+ }
207
+ ],
208
+ "stateMutability": "view",
209
+ "type": "function"
210
+ },
211
+ {
212
+ "inputs": [],
213
+ "name": "isRegisterable",
214
+ "outputs": [
215
+ {
216
+ "internalType": "bool",
217
+ "name": "",
218
+ "type": "bool"
219
+ }
220
+ ],
221
+ "stateMutability": "pure",
222
+ "type": "function"
223
+ },
224
+ {
225
+ "inputs": [],
226
+ "name": "isRegistered",
227
+ "outputs": [
228
+ {
229
+ "internalType": "bool",
230
+ "name": "",
231
+ "type": "bool"
232
+ }
233
+ ],
234
+ "stateMutability": "view",
235
+ "type": "function"
236
+ },
237
+ {
238
+ "inputs": [],
239
+ "name": "register",
240
+ "outputs": [
241
+ {
242
+ "internalType": "NftId",
243
+ "name": "nftId",
244
+ "type": "uint96"
245
+ }
246
+ ],
247
+ "stateMutability": "nonpayable",
248
+ "type": "function"
249
+ }
250
+ ],
251
+ "bytecode": "0x",
252
+ "deployedBytecode": "0x",
253
+ "linkReferences": {},
254
+ "deployedLinkReferences": {}
255
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "_format": "hh-sol-dbg-1",
3
+ "buildInfo": "../../../build-info/371956c35f778b248bb1774ada1ed516.json"
4
+ }