@etherisc/gif-next 0.0.2-6e4c272-998 → 0.0.2-70d92f6-918

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 (112) hide show
  1. package/README.md +8 -0
  2. package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
  3. package/artifacts/contracts/components/Component.sol/InstanceLinked.dbg.json +1 -1
  4. package/artifacts/contracts/components/Component.sol/InstanceLinked.json +2 -2
  5. package/artifacts/contracts/components/IPool.sol/IPoolComponent.dbg.json +1 -1
  6. package/artifacts/contracts/components/IProduct.sol/IProductComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  8. package/artifacts/contracts/components/Pool.sol/Pool.json +4 -4
  9. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  10. package/artifacts/contracts/components/Product.sol/Product.json +4 -4
  11. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  12. package/artifacts/contracts/experiment/errors/Require.sol/Require.json +2 -2
  13. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  14. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +2 -2
  15. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  16. package/artifacts/contracts/experiment/inheritance/A.sol/A.json +2 -2
  17. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  18. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +2 -2
  19. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
  27. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
  31. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
  33. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +2 -2
  35. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  36. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +2 -2
  37. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  38. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  39. package/artifacts/contracts/instance/Instance.sol/Instance.json +18 -18
  40. package/artifacts/contracts/instance/access/Access.sol/AccessModule.dbg.json +1 -1
  41. package/artifacts/contracts/instance/access/IAccess.sol/IAccess.dbg.json +1 -1
  42. package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.dbg.json +1 -1
  43. package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.dbg.json +1 -1
  44. package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.dbg.json +1 -1
  45. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
  46. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.dbg.json +1 -1
  47. package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.json +12 -12
  48. package/artifacts/contracts/instance/component/IComponent.sol/IComponent.dbg.json +1 -1
  49. package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.dbg.json +1 -1
  50. package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.dbg.json +1 -1
  51. package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.dbg.json +1 -1
  52. package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.dbg.json +1 -1
  53. package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  54. package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycleModule.dbg.json +1 -1
  55. package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.dbg.json +1 -1
  56. package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.json +2 -2
  57. package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicy.dbg.json +1 -1
  58. package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.dbg.json +1 -1
  59. package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
  60. package/artifacts/contracts/instance/pool/IPoolModule.sol/IPool.dbg.json +1 -1
  61. package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.dbg.json +1 -1
  62. package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
  63. package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.dbg.json +1 -1
  64. package/artifacts/contracts/instance/product/IProductService.sol/IProductService.dbg.json +1 -1
  65. package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.dbg.json +1 -1
  66. package/artifacts/contracts/instance/product/ProductService.sol/ProductService.dbg.json +1 -1
  67. package/artifacts/contracts/instance/product/ProductService.sol/ProductService.json +14 -14
  68. package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasury.dbg.json +1 -1
  69. package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasuryModule.dbg.json +1 -1
  70. package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  71. package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.json +2 -2
  72. package/artifacts/contracts/instance/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +1 -1
  73. package/artifacts/contracts/mock/Dip.sol/DIP.dbg.json +4 -0
  74. package/artifacts/contracts/mock/Dip.sol/DIP.json +338 -0
  75. package/artifacts/contracts/mock/TestPool.sol/TestPool.dbg.json +4 -0
  76. package/artifacts/contracts/mock/TestPool.sol/TestPool.json +294 -0
  77. package/artifacts/contracts/mock/TestProduct.sol/TestProduct.dbg.json +4 -0
  78. package/artifacts/contracts/mock/TestProduct.sol/TestProduct.json +384 -0
  79. package/artifacts/contracts/mock/Usdc.sol/USDC.dbg.json +4 -0
  80. package/artifacts/contracts/mock/Usdc.sol/USDC.json +338 -0
  81. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  82. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  83. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
  84. package/artifacts/contracts/registry/IRegistry.sol/IOwnable.dbg.json +1 -1
  85. package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.dbg.json +1 -1
  86. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  87. package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.dbg.json +1 -1
  88. package/artifacts/contracts/registry/Registry.sol/Registerable.dbg.json +1 -1
  89. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  90. package/artifacts/contracts/registry/Registry.sol/Registry.json +10 -10
  91. package/artifacts/contracts/registry/Registry.sol/RegistryLinked.dbg.json +1 -1
  92. package/artifacts/contracts/registry/Registry.sol/RegistryLinked.json +2 -2
  93. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  94. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
  95. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  96. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +2 -2
  97. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  98. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
  99. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  100. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  101. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  102. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  103. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  104. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +2 -2
  105. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +1 -1
  106. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +37 -11
  107. package/contracts/mock/Dip.sol +26 -0
  108. package/contracts/mock/TestPool.sol +16 -0
  109. package/contracts/mock/TestProduct.sol +39 -0
  110. package/contracts/mock/Usdc.sol +26 -0
  111. package/contracts/types/UFixed.sol +18 -14
  112. package/package.json +5 -2
@@ -0,0 +1,26 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5
+
6
+ contract USDC is ERC20 {
7
+
8
+ // https://etherscan.io/token/0xc719d010b63e5bbf2c0551872cd5316ed26acd83#readContract
9
+ string public constant NAME = "USDC - DUMMY";
10
+ string public constant SYMBOL = "USDC";
11
+ uint8 public constant DECIMALS = 6;
12
+ uint256 public constant INITIAL_SUPPLY = 10**9 * 10**DECIMALS; // 1 Billion 1'000'000'000
13
+ // decimals == 18 (openzeppelin erc20 default)
14
+ constructor()
15
+ ERC20(NAME, SYMBOL)
16
+ {
17
+ _mint(
18
+ _msgSender(),
19
+ INITIAL_SUPPLY
20
+ );
21
+ }
22
+
23
+ function decimals() public pure override returns(uint8) {
24
+ return DECIMALS;
25
+ }
26
+ }
@@ -76,21 +76,25 @@ function deltaUFixed(UFixed a, UFixed b) pure returns (UFixed) {
76
76
  }
77
77
 
78
78
  library UFixedMathLib {
79
- enum Rounding {
80
- /// @dev Round down - floor(value)
81
- Down,
82
- /// @dev Round up - ceil(value)
83
- Up,
84
- /// @dev Round half up - round(value)
85
- HalfUp
86
- }
87
79
 
88
80
  int8 public constant EXP = 18;
89
81
  uint256 public constant MULTIPLIER = 10 ** uint256(int256(EXP));
90
82
  uint256 public constant MULTIPLIER_HALF = MULTIPLIER / 2;
91
83
 
92
- /// @dev Default rounding mode used by ftoi is HalfUp
93
- Rounding public constant ROUNDING_DEFAULT = Rounding.HalfUp;
84
+ /// @dev returns the rounding mode DOWN - 0.4 becomes 0, 0.5 becomes 0, 0.6 becomes 0
85
+ function ROUNDING_DOWN() public pure returns (uint8) {
86
+ return uint8(0);
87
+ }
88
+
89
+ /// @dev returns the rounding mode UP - 0.4 becomes 1, 0.5 becomes 1, 0.6 becomes 1
90
+ function ROUNDING_UP() public pure returns (uint8) {
91
+ return uint8(1);
92
+ }
93
+
94
+ /// @dev returns the rounding mode HALF_UP - 0.4 becomes 0, 0.5 becomes 1, 0.6 becomes 1
95
+ function ROUNDING_HALF_UP() public pure returns (uint8) {
96
+ return uint8(2);
97
+ }
94
98
 
95
99
  /// @dev returns the decimals precision of the UFixed type
96
100
  function decimals() public pure returns (uint256) {
@@ -113,12 +117,12 @@ library UFixedMathLib {
113
117
 
114
118
  /// @dev Converts a UFixed to a uint256.
115
119
  function ftoi(UFixed a) public pure returns (uint256) {
116
- return ftoi(a, ROUNDING_DEFAULT);
120
+ return ftoi(a, ROUNDING_HALF_UP());
117
121
  }
118
122
 
119
123
  /// @dev Converts a UFixed to a uint256 with given rounding mode.
120
- function ftoi(UFixed a, Rounding rounding) public pure returns (uint256) {
121
- if (rounding == Rounding.HalfUp) {
124
+ function ftoi(UFixed a, uint8 rounding) public pure returns (uint256) {
125
+ if (rounding == ROUNDING_HALF_UP()) {
122
126
  return
123
127
  Math.mulDiv(
124
128
  UFixed.unwrap(a) + MULTIPLIER_HALF,
@@ -126,7 +130,7 @@ library UFixedMathLib {
126
130
  MULTIPLIER,
127
131
  Math.Rounding.Down
128
132
  );
129
- } else if (rounding == Rounding.Down) {
133
+ } else if (rounding == ROUNDING_DOWN()) {
130
134
  return
131
135
  Math.mulDiv(
132
136
  UFixed.unwrap(a),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etherisc/gif-next",
3
- "version": "0.0.2-6e4c272-998",
3
+ "version": "0.0.2-70d92f6-918",
4
4
  "description": "This is the repository for the next version of the Generic Insurance Framework (GIF) smart contracts. ",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -38,6 +38,9 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@openzeppelin/contracts": "^4.9.3",
41
- "@openzeppelin/contracts-upgradeable": "^4.9.3"
41
+ "@openzeppelin/contracts-upgradeable": "^4.9.3",
42
+ "abi-coder": "^5.0.0",
43
+ "ethers": "^6.7.1",
44
+ "winston": "^3.10.0"
42
45
  }
43
46
  }