@gearbox-protocol/sdk 2.1.2 → 2.1.3

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.
@@ -54,23 +54,23 @@ struct RedStonePriceFeedData {
54
54
  }
55
55
 
56
56
  contract PriceFeedDataLive {
57
- uint16 networkId;
58
-
59
- mapping(uint16 => ChainlinkPriceFeedData[]) chainlinkPriceFeedsByNetwork;
60
- mapping(uint16 => SingeTokenPriceFeedData[]) zeroPriceFeedsByNetwork;
61
- mapping(uint16 => CurvePriceFeedData[]) curvePriceFeedsByNetwork;
62
- mapping(uint16 => CurvePriceFeedData[]) curveCryptoPriceFeedsByNetwork;
63
- mapping(uint16 => TheSamePriceFeedData[]) theSamePriceFeedsByNetwork;
64
- mapping(uint16 => SingeTokenPriceFeedData[]) yearnPriceFeedsByNetwork;
65
- mapping(uint16 => BoundedPriceFeedData[]) boundedPriceFeedsByNetwork;
66
- mapping(uint16 => CompositePriceFeedData[]) compositePriceFeedsByNetwork;
67
- mapping(uint16 => SingeTokenPriceFeedData) wstethPriceFeedByNetwork;
68
- mapping(uint16 => GenericLPPriceFeedData[]) wrappedAaveV2PriceFeedsByNetwork;
69
- mapping(uint16 => GenericLPPriceFeedData[]) compoundV2PriceFeedsByNetwork;
70
- mapping(uint16 => GenericLPPriceFeedData[]) erc4626PriceFeedsByNetwork;
71
- mapping(uint16 => RedStonePriceFeedData[]) redStonePriceFeedsByNetwork;
72
-
73
- constructor(uint16 _networkId) {
57
+ uint256 networkId;
58
+
59
+ mapping(uint256 => ChainlinkPriceFeedData[]) chainlinkPriceFeedsByNetwork;
60
+ mapping(uint256 => SingeTokenPriceFeedData[]) zeroPriceFeedsByNetwork;
61
+ mapping(uint256 => CurvePriceFeedData[]) curvePriceFeedsByNetwork;
62
+ mapping(uint256 => CurvePriceFeedData[]) curveCryptoPriceFeedsByNetwork;
63
+ mapping(uint256 => TheSamePriceFeedData[]) theSamePriceFeedsByNetwork;
64
+ mapping(uint256 => SingeTokenPriceFeedData[]) yearnPriceFeedsByNetwork;
65
+ mapping(uint256 => BoundedPriceFeedData[]) boundedPriceFeedsByNetwork;
66
+ mapping(uint256 => CompositePriceFeedData[]) compositePriceFeedsByNetwork;
67
+ mapping(uint256 => SingeTokenPriceFeedData) wstethPriceFeedByNetwork;
68
+ mapping(uint256 => GenericLPPriceFeedData[]) wrappedAaveV2PriceFeedsByNetwork;
69
+ mapping(uint256 => GenericLPPriceFeedData[]) compoundV2PriceFeedsByNetwork;
70
+ mapping(uint256 => GenericLPPriceFeedData[]) erc4626PriceFeedsByNetwork;
71
+ mapping(uint256 => RedStonePriceFeedData[]) redStonePriceFeedsByNetwork;
72
+
73
+ constructor(uint256 _networkId) {
74
74
  networkId = _networkId;
75
75
  // ------------------------ 1INCH ------------------------
76
76
  chainlinkPriceFeedsByNetwork[1].push(
@@ -17,9 +17,8 @@ struct TokenData {
17
17
  }
18
18
 
19
19
  contract TokensDataLive {
20
- uint16 public immutable networkId;
21
- mapping(uint16 => TokenData[]) tokenDataByNetwork;
22
- mapping(uint16 => address) usdcByNetwork;
20
+ mapping(uint256 => TokenData[]) tokenDataByNetwork;
21
+ mapping(uint256 => address) usdcByNetwork;
23
22
 
24
23
  uint16[] public connectedNetworks;
25
24
 
@@ -1015,15 +1014,13 @@ contract TokensDataLive {
1015
1014
  tokenType: TokenType.AAVE_V2_A_TOKEN
1016
1015
  })
1017
1016
  );
1018
-
1019
- networkId = getNetworkId();
1020
1017
  }
1021
1018
 
1022
1019
  function getTokenData() external view returns (TokenData[] memory) {
1023
- return tokenDataByNetwork[networkId];
1020
+ return tokenDataByNetwork[block.chainid];
1024
1021
  }
1025
1022
 
1026
- function getNetworkId() internal view returns (uint16) {
1023
+ function getNetworkId() internal view returns (uint256) {
1027
1024
  if (block.chainid == 1337 || block.chainid == 31337) {
1028
1025
  uint256 len = connectedNetworks.length;
1029
1026
  for (uint256 i = 0; i < len; i++) {
@@ -1031,11 +1028,8 @@ contract TokensDataLive {
1031
1028
  return connectedNetworks[i];
1032
1029
  }
1033
1030
  }
1034
-
1035
- revert("No network found");
1036
- } else {
1037
- return uint16(block.chainid);
1038
1031
  }
1032
+ return block.chainid;
1039
1033
  }
1040
1034
 
1041
1035
  function checkNetworkId(uint16 _networkId) internal view returns (bool) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",