@etherisc/gif-next 0.0.2-fc8b370-882 → 0.0.2-fe34d97-357

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. package/README.md +36 -0
  2. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
  3. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
  4. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  5. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  6. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  7. package/artifacts/contracts/components/Pool.sol/Pool.json +72 -4
  8. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  9. package/artifacts/contracts/components/Product.sol/Product.json +46 -3
  10. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  11. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  12. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  13. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  14. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  15. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  16. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  17. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  18. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
  22. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  28. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  29. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +540 -401
  30. package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +1 -1
  31. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  32. package/artifacts/contracts/instance/Instance.sol/Instance.json +640 -469
  33. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
  34. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  35. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +18 -0
  36. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  37. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +49 -0
  38. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  39. package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +1 -1
  40. package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +1 -1
  41. package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +18 -0
  42. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  43. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +41 -23
  44. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  45. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +4 -4
  46. package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +1 -1
  47. package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +1 -1
  48. package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +1 -1
  49. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +1 -1
  50. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +1 -1
  51. package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +1 -1
  52. package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +17 -48
  53. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +1 -1
  54. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +1 -1
  55. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +18 -49
  56. package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.dbg.json +1 -1
  57. package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.json +2 -2
  58. package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensation.dbg.json +1 -1
  59. package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensationModule.dbg.json +1 -1
  60. package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
  61. package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +36 -88
  62. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +1 -1
  63. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +1 -1
  64. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.json +36 -88
  65. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +1 -1
  66. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +65 -38
  68. package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
  69. package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +65 -38
  70. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +1 -1
  71. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +1 -1
  72. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +0 -5
  73. package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
  74. package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +0 -5
  75. package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +1 -1
  76. package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +1 -1
  77. package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.json +123 -1
  78. package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +1 -1
  79. package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +145 -5
  80. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +1 -1
  81. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +1 -1
  82. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +166 -168
  83. package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  84. package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +2 -2
  85. package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +1 -1
  86. package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +167 -169
  87. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
  88. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +21 -21
  89. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
  90. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  91. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  92. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +71 -0
  93. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  94. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +6 -6
  95. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  96. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +97 -26
  97. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  98. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
  99. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  100. package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  101. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  102. package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
  103. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  104. package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +1 -1
  105. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  106. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  107. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  108. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  109. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  110. package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +1 -1
  111. package/artifacts/contracts/test/TestPool.sol/TestPool.json +72 -4
  112. package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +1 -1
  113. package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +90 -4
  114. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  115. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
  116. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  117. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  118. package/artifacts/contracts/test/TestService.sol/TestService.json +2 -2
  119. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  120. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  121. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  122. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  123. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  124. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  125. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  126. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  127. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  128. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
  129. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  130. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
  131. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  132. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  133. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  134. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  135. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +4 -0
  136. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +86 -0
  137. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  138. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  139. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  140. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +1 -1
  141. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  142. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  143. package/contracts/components/BaseComponent.sol +7 -1
  144. package/contracts/components/Pool.sol +20 -3
  145. package/contracts/components/Product.sol +69 -5
  146. package/contracts/instance/IInstance.sol +3 -4
  147. package/contracts/instance/Instance.sol +7 -4
  148. package/contracts/instance/base/IInstanceBase.sol +5 -0
  149. package/contracts/instance/base/IKeyValueStore.sol +4 -3
  150. package/contracts/instance/base/InstanceBase.sol +6 -2
  151. package/contracts/instance/base/KeyValueStore.sol +12 -7
  152. package/contracts/instance/base/Lifecycle.sol +15 -10
  153. package/contracts/instance/base/ModuleBase.sol +18 -17
  154. package/contracts/instance/module/bundle/BundleModule.sol +10 -11
  155. package/contracts/instance/module/bundle/IBundle.sol +4 -11
  156. package/contracts/instance/module/compensation/CompensationModule.sol +11 -2
  157. package/contracts/instance/module/component/ComponentModule.sol +39 -53
  158. package/contracts/instance/module/component/IComponent.sol +6 -30
  159. package/contracts/instance/module/policy/IPolicy.sol +11 -9
  160. package/contracts/instance/module/policy/PolicyModule.sol +35 -19
  161. package/contracts/instance/module/pool/IPoolModule.sol +0 -1
  162. package/contracts/instance/module/pool/PoolModule.sol +12 -9
  163. package/contracts/instance/module/risk/IRisk.sol +19 -2
  164. package/contracts/instance/module/risk/RiskModule.sol +64 -2
  165. package/contracts/instance/module/treasury/ITreasury.sol +35 -42
  166. package/contracts/instance/module/treasury/TreasuryModule.sol +96 -77
  167. package/contracts/instance/service/ComponentOwnerService.sol +19 -34
  168. package/contracts/instance/service/IProductService.sol +21 -1
  169. package/contracts/instance/service/PoolService.sol +10 -4
  170. package/contracts/instance/service/ProductService.sol +120 -68
  171. package/contracts/registry/Registry.sol +2 -2
  172. package/contracts/test/TestPool.sol +4 -2
  173. package/contracts/test/TestProduct.sol +25 -3
  174. package/contracts/types/ObjectType.sol +20 -8
  175. package/contracts/types/RiskId.sol +43 -0
  176. package/package.json +1 -1
@@ -0,0 +1,86 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "RiskIdLib",
4
+ "sourceName": "contracts/types/RiskId.sol",
5
+ "abi": [
6
+ {
7
+ "inputs": [
8
+ {
9
+ "internalType": "RiskId",
10
+ "name": "id",
11
+ "type": "bytes8"
12
+ }
13
+ ],
14
+ "name": "toKey32",
15
+ "outputs": [
16
+ {
17
+ "internalType": "Key32",
18
+ "name": "key",
19
+ "type": "bytes32"
20
+ }
21
+ ],
22
+ "stateMutability": "pure",
23
+ "type": "function"
24
+ },
25
+ {
26
+ "inputs": [
27
+ {
28
+ "internalType": "RiskId",
29
+ "name": "id",
30
+ "type": "bytes8"
31
+ }
32
+ ],
33
+ "name": "toKeyId",
34
+ "outputs": [
35
+ {
36
+ "internalType": "KeyId",
37
+ "name": "keyId",
38
+ "type": "bytes31"
39
+ }
40
+ ],
41
+ "stateMutability": "pure",
42
+ "type": "function"
43
+ },
44
+ {
45
+ "inputs": [
46
+ {
47
+ "internalType": "string",
48
+ "name": "risk",
49
+ "type": "string"
50
+ }
51
+ ],
52
+ "name": "toRiskId",
53
+ "outputs": [
54
+ {
55
+ "internalType": "RiskId",
56
+ "name": "",
57
+ "type": "bytes8"
58
+ }
59
+ ],
60
+ "stateMutability": "pure",
61
+ "type": "function"
62
+ }
63
+ ],
64
+ "bytecode": "0x61032f61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361061004b5760003560e01c80632cf96bf9146100505780634a7485ba1461008357806355ee6275146100af575b600080fd5b61006b61005e36600461019a565b6001600160c01b03191690565b60405160ff1990911681526020015b60405180910390f35b6100966100913660046101e1565b6100d0565b6040516001600160c01b0319909116815260200161007a565b6100c26100bd36600461019a565b610100565b60405190815260200161007a565b6000816040516020016100e39190610292565b604051602081830303815290604052805190602001209050919050565b600073__$c8f743efd2b4f0c9300f2558c784479d3e$__63f48016ce60c86001600160c01b031985166040516001600160e01b031960e085901b16815260ff909216600483015260ff19166024820152604401602060405180830381865af4158015610170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019491906102e0565b92915050565b6000602082840312156101ac57600080fd5b81356001600160c01b0319811681146101c457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156101f357600080fd5b813567ffffffffffffffff8082111561020b57600080fd5b818401915084601f83011261021f57600080fd5b813581811115610231576102316101cb565b604051601f8201601f19908116603f01168101908382118183101715610259576102596101cb565b8160405282815287602084870101111561027257600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208083528351808285015260005b818110156102bf578581018301518582016040015282016102a3565b506000604082860101526040601f19601f8301168501019250505092915050565b6000602082840312156102f257600080fd5b505191905056fea264697066735822122069f4e6edc9ea69a4eaafc3119fcaaf2bfb13257d0e2b18f8c55816c118a572a664736f6c63430008140033",
65
+ "deployedBytecode": "0x730000000000000000000000000000000000000000301460806040526004361061004b5760003560e01c80632cf96bf9146100505780634a7485ba1461008357806355ee6275146100af575b600080fd5b61006b61005e36600461019a565b6001600160c01b03191690565b60405160ff1990911681526020015b60405180910390f35b6100966100913660046101e1565b6100d0565b6040516001600160c01b0319909116815260200161007a565b6100c26100bd36600461019a565b610100565b60405190815260200161007a565b6000816040516020016100e39190610292565b604051602081830303815290604052805190602001209050919050565b600073__$c8f743efd2b4f0c9300f2558c784479d3e$__63f48016ce60c86001600160c01b031985166040516001600160e01b031960e085901b16815260ff909216600483015260ff19166024820152604401602060405180830381865af4158015610170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019491906102e0565b92915050565b6000602082840312156101ac57600080fd5b81356001600160c01b0319811681146101c457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156101f357600080fd5b813567ffffffffffffffff8082111561020b57600080fd5b818401915084601f83011261021f57600080fd5b813581811115610231576102316101cb565b604051601f8201601f19908116603f01168101908382118183101715610259576102596101cb565b8160405282815287602084870101111561027257600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208083528351808285015260005b818110156102bf578581018301518582016040015282016102a3565b506000604082860101526040601f19601f8301168501019250505092915050565b6000602082840312156102f257600080fd5b505191905056fea264697066735822122069f4e6edc9ea69a4eaafc3119fcaaf2bfb13257d0e2b18f8c55816c118a572a664736f6c63430008140033",
66
+ "linkReferences": {
67
+ "contracts/types/Key32.sol": {
68
+ "Key32Lib": [
69
+ {
70
+ "length": 20,
71
+ "start": 318
72
+ }
73
+ ]
74
+ }
75
+ },
76
+ "deployedLinkReferences": {
77
+ "contracts/types/Key32.sol": {
78
+ "Key32Lib": [
79
+ {
80
+ "length": 20,
81
+ "start": 260
82
+ }
83
+ ]
84
+ }
85
+ }
86
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/ac8b1a0ba35c3a8a508882d70043ad3f.json"
3
+ "buildInfo": "../../../build-info/01797c1a22420f170e92428a4c013a0c.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/ac8b1a0ba35c3a8a508882d70043ad3f.json"
3
+ "buildInfo": "../../../build-info/01797c1a22420f170e92428a4c013a0c.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/ac8b1a0ba35c3a8a508882d70043ad3f.json"
3
+ "buildInfo": "../../../build-info/01797c1a22420f170e92428a4c013a0c.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/ac8b1a0ba35c3a8a508882d70043ad3f.json"
3
+ "buildInfo": "../../../build-info/01797c1a22420f170e92428a4c013a0c.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/ac8b1a0ba35c3a8a508882d70043ad3f.json"
3
+ "buildInfo": "../../../build-info/01797c1a22420f170e92428a4c013a0c.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/ac8b1a0ba35c3a8a508882d70043ad3f.json"
3
+ "buildInfo": "../../../build-info/01797c1a22420f170e92428a4c013a0c.json"
4
4
  }
@@ -13,6 +13,7 @@ import {IInstance} from "../instance/IInstance.sol";
13
13
  import {IComponent, IComponentModule} from "../instance/module/component/IComponent.sol";
14
14
  import {IComponentOwnerService} from "../instance/service/IComponentOwnerService.sol";
15
15
  import {IBaseComponent} from "./IBaseComponent.sol";
16
+ import {Fee, FeeLib} from "../types/Fee.sol";
16
17
  import {NftId} from "../types/NftId.sol";
17
18
 
18
19
  abstract contract BaseComponent is
@@ -25,6 +26,8 @@ abstract contract BaseComponent is
25
26
  address internal _wallet;
26
27
  IERC20Metadata internal _token;
27
28
  IInstance internal _instance;
29
+ bool internal _isRegistered;
30
+ Fee internal _zeroFee;
28
31
 
29
32
  constructor(
30
33
  address registry,
@@ -43,6 +46,8 @@ abstract contract BaseComponent is
43
46
  _componentOwnerService = _instance.getComponentOwnerService();
44
47
  _wallet = address(this);
45
48
  _token = IERC20Metadata(token);
49
+ _isRegistered = false;
50
+ _zeroFee = FeeLib.zeroFee();
46
51
  }
47
52
 
48
53
  // from registerable
@@ -57,7 +62,8 @@ abstract contract BaseComponent is
57
62
  "ERROR:COB:INSTANCE_NOT_REGISTERED"
58
63
  );
59
64
 
60
- componentId = _componentOwnerService.register(this);
65
+ _isRegistered = true;
66
+ return _componentOwnerService.register(this);
61
67
  }
62
68
 
63
69
  // from component contract
@@ -15,6 +15,9 @@ contract Pool is BaseComponent, IPoolComponent {
15
15
  bool internal _isVerifying;
16
16
  UFixed internal _collateralizationLevel;
17
17
 
18
+ Fee internal _initialStakingFee;
19
+ Fee internal _initialPerformanceFee;
20
+
18
21
  // may be used to interact with instance by derived contracts
19
22
  IPoolService internal _poolService;
20
23
 
@@ -41,13 +44,17 @@ contract Pool is BaseComponent, IPoolComponent {
41
44
  // TODO refactor into tokenNftId
42
45
  address token,
43
46
  bool verifying,
44
- UFixed collateralizationLevel
47
+ UFixed collateralizationLevel,
48
+ Fee memory stakingFee,
49
+ Fee memory performanceFee
45
50
  )
46
51
  BaseComponent(registry, instanceNftId, token)
47
52
  {
48
53
  _isVerifying = verifying;
49
54
  // TODO add validation
50
55
  _collateralizationLevel = collateralizationLevel;
56
+ _initialStakingFee = stakingFee;
57
+ _initialPerformanceFee = performanceFee;
51
58
 
52
59
  _poolService = _instance.getPoolService();
53
60
  _productService = _instance.getProductService();
@@ -155,7 +162,12 @@ contract Pool is BaseComponent, IPoolComponent {
155
162
  override
156
163
  returns (Fee memory stakingFee)
157
164
  {
158
- return _instance.getPoolSetup(getNftId()).stakingFee;
165
+ NftId productNftId = _instance.getProductNftId(getNftId());
166
+ if (productNftId.gtz()) {
167
+ return _instance.getTreasuryInfo(productNftId).stakingFee;
168
+ } else {
169
+ return _initialStakingFee;
170
+ }
159
171
  }
160
172
 
161
173
  function getPerformanceFee()
@@ -164,7 +176,12 @@ contract Pool is BaseComponent, IPoolComponent {
164
176
  override
165
177
  returns (Fee memory performanceFee)
166
178
  {
167
- return _instance.getPoolSetup(getNftId()).performanceFee;
179
+ NftId productNftId = _instance.getProductNftId(getNftId());
180
+ if (productNftId.gtz()) {
181
+ return _instance.getTreasuryInfo(productNftId).performanceFee;
182
+ } else {
183
+ return _initialPerformanceFee;
184
+ }
168
185
  }
169
186
 
170
187
  // from registerable
@@ -1,31 +1,84 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.19;
3
3
 
4
+ import {IRisk} from "../instance/module/risk/IRisk.sol";
5
+ import {ITreasury} from "../instance/module/treasury/ITreasury.sol";
4
6
  import {IProductService} from "../instance/service/IProductService.sol";
5
7
  import {IProductComponent} from "./IProductComponent.sol";
6
8
  import {NftId} from "../types/NftId.sol";
7
9
  import {ObjectType, PRODUCT} from "../types/ObjectType.sol";
10
+ import {RiskId, RiskIdLib} from "../types/RiskId.sol";
11
+ import {StateId} from "../types/StateId.sol";
8
12
  import {Timestamp} from "../types/Timestamp.sol";
9
13
  import {Fee} from "../types/Fee.sol";
10
14
  import {BaseComponent} from "./BaseComponent.sol";
11
15
 
12
16
  contract Product is BaseComponent, IProductComponent {
13
- IProductService private _productService;
14
- address private _pool;
17
+ IProductService internal _productService;
18
+ address internal _pool;
19
+ Fee internal _initialPolicyFee;
20
+ Fee internal _initialProcessingFee;
15
21
 
16
22
  constructor(
17
23
  address registry,
18
24
  NftId instanceNftid,
19
25
  address token,
20
- address pool
26
+ address pool,
27
+ Fee memory policyFee,
28
+ Fee memory processingFee
21
29
  ) BaseComponent(registry, instanceNftid, token) {
22
30
  // TODO add validation
23
31
  _productService = _instance.getProductService();
24
32
  _pool = pool;
33
+ _initialPolicyFee = policyFee;
34
+ _initialProcessingFee = processingFee;
35
+ }
36
+
37
+ function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
38
+ return RiskIdLib.toRiskId(riskName);
39
+ }
40
+
41
+ function _createRisk(
42
+ RiskId id,
43
+ bytes memory data
44
+ ) internal {
45
+ _productService.createRisk(
46
+ id,
47
+ data
48
+ );
49
+ }
50
+
51
+ function _setRiskInfo(
52
+ RiskId id,
53
+ IRisk.RiskInfo memory info
54
+ ) internal {
55
+ _productService.setRiskInfo(
56
+ id,
57
+ info
58
+ );
59
+ }
60
+
61
+ function _updateRiskState(
62
+ RiskId id,
63
+ StateId state
64
+ ) internal {
65
+ _productService.updateRiskState(
66
+ id,
67
+ state
68
+ );
69
+ }
70
+
71
+ function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
72
+ return _instance.getRiskInfo(id);
73
+ }
74
+
75
+ function _getRiskState(RiskId id) internal view returns (StateId state) {
76
+ return _instance.getRiskState(id);
25
77
  }
26
78
 
27
79
  function _createApplication(
28
80
  address applicationOwner,
81
+ RiskId riskId,
29
82
  uint256 sumInsuredAmount,
30
83
  uint256 premiumAmount,
31
84
  uint256 lifetime,
@@ -33,6 +86,7 @@ contract Product is BaseComponent, IProductComponent {
33
86
  ) internal returns (NftId nftId) {
34
87
  nftId = _productService.createApplication(
35
88
  applicationOwner,
89
+ riskId,
36
90
  sumInsuredAmount,
37
91
  premiumAmount,
38
92
  lifetime,
@@ -98,7 +152,12 @@ contract Product is BaseComponent, IProductComponent {
98
152
  override
99
153
  returns (Fee memory policyFee)
100
154
  {
101
- return _instance.getProductSetup(getNftId()).policyFee;
155
+ NftId productNftId = getNftId();
156
+ if (address(_instance.getTokenHandler(productNftId)) != address(0)) {
157
+ return _instance.getTreasuryInfo(productNftId).policyFee;
158
+ } else {
159
+ return _initialPolicyFee;
160
+ }
102
161
  }
103
162
 
104
163
  function getProcessingFee()
@@ -107,7 +166,12 @@ contract Product is BaseComponent, IProductComponent {
107
166
  override
108
167
  returns (Fee memory processingFee)
109
168
  {
110
- return _instance.getProductSetup(getNftId()).processingFee;
169
+ NftId productNftId = getNftId();
170
+ if (address(_instance.getTokenHandler(productNftId)) != address(0)) {
171
+ return _instance.getTreasuryInfo(productNftId).processingFee;
172
+ } else {
173
+ return _initialProcessingFee;
174
+ }
111
175
  }
112
176
 
113
177
  // from registerable
@@ -33,18 +33,17 @@ interface IInstance is
33
33
  IAccessModule,
34
34
  IPolicyModule,
35
35
  IPoolModule,
36
+ IRiskModule,
36
37
  IBundleModule,
37
38
  IComponentModule,
38
39
  ITreasuryModule,
39
40
  ICompensationModule,
40
41
  IInstanceBase
41
42
  {
42
- function getRegistry() external view override (IBundleModule, IComponentModule, IPolicyModule, IRegisterable) returns (IRegistry registry);
43
+ function getRegistry() external view override (IPolicyModule, IRegisterable) returns (IRegistry registry);
43
44
  function getOwner() external view override (IOwnable, IAccessModule) returns(address owner);
44
45
 
45
- function hasRole(RoleId role, address member) external view override (IAccessModule, IComponentModule) returns (bool hasRole);
46
-
47
- function getKeyValueStore() external view override (IBundleModule, IInstanceBase) returns (IKeyValueStore keyValueStore);
46
+ function getKeyValueStore() external view override (IInstanceBase) returns (IKeyValueStore keyValueStore);
48
47
  function getComponentOwnerService() external view override (IInstanceBase, IComponentModule) returns(IComponentOwnerService);
49
48
  function getProductService() external view override (IInstanceBase, IBundleModule, IPolicyModule) returns(IProductService);
50
49
  function getPoolService() external view override (IInstanceBase, IBundleModule, IPoolModule) returns(IPoolService);
@@ -53,12 +53,15 @@ contract Instance is
53
53
  TreasuryModule()
54
54
  {
55
55
  initializeBundleModule(_keyValueStore);
56
+ initializeCompensationModule(_keyValueStore);
57
+ initializeComponentModule(_keyValueStore);
58
+ initializePolicyModule(_keyValueStore);
59
+ initializePoolModule(_keyValueStore);
60
+ initializeRiskModule(_keyValueStore);
56
61
  }
57
62
 
58
- function getRegistry() public view override (Registerable, IBundleModule, IComponentModule, IPolicyModule) returns (IRegistry registry) { return super.getRegistry(); }
59
- function getKeyValueStore() public view override (InstanceBase, IBundleModule) returns (IKeyValueStore keyValueStore) { return super.getKeyValueStore(); }
60
-
61
- function hasRole(RoleId role, address member) public view override (AccessModule, IComponentModule) returns (bool) { return super.hasRole(role, member); }
63
+ function getRegistry() public view override (Registerable, IPolicyModule) returns (IRegistry registry) { return super.getRegistry(); }
64
+ function getKeyValueStore() public view override (InstanceBase) returns (IKeyValueStore keyValueStore) { return super.getKeyValueStore(); }
62
65
 
63
66
  function getComponentOwnerService() external view override (IComponentModule, IInstanceBase) returns(IComponentOwnerService service) { return _componentOwnerService; }
64
67
  function getProductService() external view override (IBundleModule, IPolicyModule, IInstanceBase) returns(IProductService service) { return _productService; }
@@ -1,6 +1,9 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.19;
3
3
 
4
+ import {Key32} from "../../types/Key32.sol";
5
+ import {StateId} from "../../types/StateId.sol";
6
+
4
7
  import {IKeyValueStore} from "./IKeyValueStore.sol";
5
8
  import {IComponentOwnerService} from "../service/IComponentOwnerService.sol";
6
9
  import {IProductService} from "../service/IProductService.sol";
@@ -8,6 +11,8 @@ import {IPoolService} from "../service/IPoolService.sol";
8
11
 
9
12
  interface IInstanceBase {
10
13
  function getKeyValueStore() external view returns (IKeyValueStore keyValueStore);
14
+ function updateState(Key32 key, StateId state) external;
15
+
11
16
  function getComponentOwnerService() external view returns(IComponentOwnerService service);
12
17
  function getProductService() external view returns(IProductService service);
13
18
  function getPoolService() external view returns(IPoolService service);
@@ -29,9 +29,9 @@ interface IKeyValueStore is ILifecycle {
29
29
  Blocknumber createdIn;
30
30
  }
31
31
 
32
- event LogInfoCreated(Key key, StateId state, address createdBy);
33
- event LogInfoUpdated(Key key, StateId state, address updatedBy, Blocknumber lastUpdatedIn);
34
- event LogStateUpdated(Key key, StateId stateOld, StateId stateNew, address updatedBy, Blocknumber lastUpdatedIn);
32
+ event LogInfoCreated(Key key, StateId state, address createdBy, address txOrigin);
33
+ event LogInfoUpdated(Key key, StateId state, address updatedBy, address txOrigin, Blocknumber lastUpdatedIn);
34
+ event LogStateUpdated(Key key, StateId stateOld, StateId stateNew, address updatedBy, address txOrigin, Blocknumber lastUpdatedIn);
35
35
 
36
36
  // generic state changing functions
37
37
  function create(Key32 key, ObjectType objectType, bytes memory data) external;
@@ -46,4 +46,5 @@ interface IKeyValueStore is ILifecycle {
46
46
  function getState(Key32 key) external view returns (StateId state);
47
47
 
48
48
  function toKey32(ObjectType objectType, KeyId id) external pure returns(Key32);
49
+ function toKey(Key32 key32) external pure returns(Key memory key);
49
50
  }
@@ -3,11 +3,11 @@ pragma solidity ^0.8.19;
3
3
 
4
4
  import {Versionable} from "../../shared/Versionable.sol";
5
5
  import {Registerable} from "../../shared/Registerable.sol";
6
- // import {IRegistry} from "../registry/IRegistry.sol";
7
6
 
8
- // import {IInstance} from "./IInstance.sol";
9
7
  import {ObjectType, INSTANCE} from "../../types/ObjectType.sol";
8
+ import {Key32} from "../../types/Key32.sol";
10
9
  import {NftId} from "../../types/NftId.sol";
10
+ import {StateId} from "../../types/StateId.sol";
11
11
  import {Version, VersionPart, VersionLib} from "../../types/Version.sol";
12
12
 
13
13
  import {IComponentOwnerService} from "../service/IComponentOwnerService.sol";
@@ -46,6 +46,10 @@ abstract contract InstanceBase is
46
46
 
47
47
  function getKeyValueStore() public view virtual override returns (IKeyValueStore keyValueStore) { return _keyValueStore; }
48
48
 
49
+ function updateState(Key32 key, StateId state) external override {
50
+ _keyValueStore.updateState(key, state);
51
+ }
52
+
49
53
  // from versionable
50
54
  function getVersion()
51
55
  public
@@ -54,7 +54,8 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
54
54
  // set data
55
55
  _value[key32].data = data;
56
56
 
57
- emit LogInfoCreated(toKey(key32), initialState, createdBy);
57
+ // solhint-disable-next-line avoid-tx-origin
58
+ emit LogInfoCreated(toKey(key32), initialState, createdBy, tx.origin);
58
59
  }
59
60
 
60
61
  function update(Key32 key32, StateId state, bytes memory data)
@@ -78,8 +79,10 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
78
79
 
79
80
  // create log entries
80
81
  Key memory key = toKey(key32);
81
- emit LogStateUpdated(key, state, stateOld, updatedBy, lastUpdatedIn);
82
- emit LogInfoUpdated(key, state, updatedBy, lastUpdatedIn);
82
+ // solhint-disable-next-line avoid-tx-origin
83
+ emit LogStateUpdated(key, state, stateOld, updatedBy, tx.origin, lastUpdatedIn);
84
+ // solhint-disable-next-line avoid-tx-origin
85
+ emit LogInfoUpdated(key, state, updatedBy, tx.origin, lastUpdatedIn);
83
86
  }
84
87
 
85
88
  function updateData(Key32 key32, bytes memory data)
@@ -101,7 +104,8 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
101
104
 
102
105
  // create log entry
103
106
  Key memory key = toKey(key32);
104
- emit LogInfoUpdated(key, state, updatedBy, lastUpdatedIn);
107
+ // solhint-disable-next-line avoid-tx-origin
108
+ emit LogInfoUpdated(key, state, updatedBy, tx.origin, lastUpdatedIn);
105
109
  }
106
110
 
107
111
  function updateState(Key32 key32, StateId state)
@@ -122,7 +126,8 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
122
126
 
123
127
  // create log entry
124
128
  Key memory key = toKey(key32);
125
- emit LogStateUpdated(key, state, stateOld, updatedBy, lastUpdatedIn);
129
+ // solhint-disable-next-line avoid-tx-origin
130
+ emit LogStateUpdated(key, state, stateOld, updatedBy, tx.origin, lastUpdatedIn);
126
131
  }
127
132
 
128
133
  function exists(Key32 key32) public view returns (bool) {
@@ -145,11 +150,11 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
145
150
  return _value[key32].metadata.state;
146
151
  }
147
152
 
148
- function toKey32(ObjectType objectType, KeyId id) external pure returns(Key32) {
153
+ function toKey32(ObjectType objectType, KeyId id) external pure override returns(Key32) {
149
154
  return Key32Lib.toKey32(objectType, id);
150
155
  }
151
156
 
152
- function toKey(Key32 key32) public pure returns (Key memory key) {
157
+ function toKey(Key32 key32) public pure override returns (Key memory key) {
153
158
  (ObjectType objectType, KeyId id) = key32.toKey();
154
159
  return Key(objectType, id);
155
160
  }
@@ -2,7 +2,7 @@
2
2
  pragma solidity ^0.8.19;
3
3
 
4
4
  import {NftId} from "../../types/NftId.sol";
5
- import {ObjectType, PRODUCT, ORACLE, POOL, BUNDLE, POLICY} from "../../types/ObjectType.sol";
5
+ import {ObjectType, COMPONENT, BUNDLE, POLICY, RISK} from "../../types/ObjectType.sol";
6
6
  import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, UNDERWRITTEN, REVOKED, DECLINED} from "../../types/StateId.sol";
7
7
  import {ILifecycle} from "./ILifecycle.sol";
8
8
 
@@ -14,12 +14,10 @@ contract Lifecycle is ILifecycle {
14
14
  private _isValidTransition;
15
15
 
16
16
  constructor() {
17
- _setupComponentLifecycle(PRODUCT());
18
- _setupComponentLifecycle(ORACLE());
19
- _setupComponentLifecycle(POOL());
20
-
21
17
  _setupBundleLifecycle();
18
+ _setupComponentLifecycle();
22
19
  _setupPolicyLifecycle();
20
+ _setupRiskLifecycle();
23
21
  }
24
22
 
25
23
  function hasLifecycle(
@@ -70,11 +68,11 @@ contract Lifecycle is ILifecycle {
70
68
  return _isValidTransition[objectType][fromId][toId];
71
69
  }
72
70
 
73
- function _setupComponentLifecycle(ObjectType objectType) internal {
74
- _initialState[objectType] = ACTIVE();
75
- _isValidTransition[objectType][ACTIVE()][PAUSED()] = true;
76
- _isValidTransition[objectType][PAUSED()][ACTIVE()] = true;
77
- _isValidTransition[objectType][PAUSED()][ARCHIVED()] = true;
71
+ function _setupComponentLifecycle() internal {
72
+ _initialState[COMPONENT()] = ACTIVE();
73
+ _isValidTransition[COMPONENT()][ACTIVE()][PAUSED()] = true;
74
+ _isValidTransition[COMPONENT()][PAUSED()][ACTIVE()] = true;
75
+ _isValidTransition[COMPONENT()][PAUSED()][ARCHIVED()] = true;
78
76
  }
79
77
 
80
78
  function _setupBundleLifecycle() internal {
@@ -92,4 +90,11 @@ contract Lifecycle is ILifecycle {
92
90
  _isValidTransition[POLICY()][UNDERWRITTEN()][ACTIVE()] = true;
93
91
  _isValidTransition[POLICY()][ACTIVE()][CLOSED()] = true;
94
92
  }
93
+
94
+ function _setupRiskLifecycle() internal {
95
+ _initialState[RISK()] = ACTIVE();
96
+ _isValidTransition[RISK()][ACTIVE()][PAUSED()] = true;
97
+ _isValidTransition[RISK()][PAUSED()][ACTIVE()] = true;
98
+ _isValidTransition[RISK()][PAUSED()][ARCHIVED()] = true;
99
+ }
95
100
  }
@@ -16,37 +16,38 @@ import {IKeyValueStore} from "./IKeyValueStore.sol";
16
16
  abstract contract ModuleBase {
17
17
 
18
18
  IKeyValueStore private _store;
19
- ObjectType private _type;
20
19
 
21
- function _initialize(IKeyValueStore keyValueStore, ObjectType objectType) internal {
20
+ function _initialize(IKeyValueStore keyValueStore) internal {
22
21
  _store = keyValueStore;
23
- _type = objectType;
24
22
  }
25
23
 
26
- function _create(NftId nftId, bytes memory data) internal {
24
+ function _create(ObjectType objectType, Key32 key, bytes memory data) internal {
27
25
  _store.create(
28
- _toKey32(nftId),
29
- _type,
26
+ key,
27
+ objectType,
30
28
  data);
31
29
  }
32
30
 
33
- function _updateData(NftId nftId, bytes memory data) internal {
34
- _store.updateData(_toKey32(nftId), data);
31
+ function _create(ObjectType objectType, NftId nftId, bytes memory data) internal {
32
+ _store.create(
33
+ nftId.toKey32(objectType),
34
+ objectType,
35
+ data);
35
36
  }
36
37
 
37
- function _updateState(NftId nftId, StateId state) internal {
38
- _store.updateState(_toKey32(nftId), state);
38
+ function _updateData(ObjectType objectType, NftId nftId, bytes memory data) internal {
39
+ _store.updateData(nftId.toKey32(objectType), data);
39
40
  }
40
41
 
41
- function _getData(NftId nftId) internal view returns(bytes memory data) {
42
- return _store.getData(_toKey32(nftId));
42
+ function _updateState(ObjectType objectType, NftId nftId, StateId state) internal {
43
+ _store.updateState(nftId.toKey32(objectType), state);
43
44
  }
44
45
 
45
- function _getState(NftId nftId) internal view returns(StateId) {
46
- return _store.getState(_toKey32(nftId));
46
+ function _getData(ObjectType objectType, NftId nftId) internal view returns(bytes memory data) {
47
+ return _store.getData(nftId.toKey32(objectType));
47
48
  }
48
49
 
49
- function _toKey32(NftId nftId) internal view returns (Key32 key32) {
50
- return nftId.toKey32(_type);
51
- }
50
+ function _getState(ObjectType objectType, NftId nftId) internal view returns(StateId) {
51
+ return _store.getState(nftId.toKey32(objectType));
52
+ }
52
53
  }