@gearbox-protocol/periphery-v3 1.7.0-next.52 → 1.7.0-next.54

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.
@@ -71,9 +71,8 @@ contract GaugeCompressor is IGaugeCompressor {
71
71
  }
72
72
  }
73
73
 
74
- assembly {
75
- mstore(result, validGauges)
76
- }
74
+ return _trim(result, validGauges);
75
+
77
76
  }
78
77
 
79
78
  /// @dev Returns gauge info for a specific gauge
@@ -189,4 +188,13 @@ contract GaugeCompressor is IGaugeCompressor {
189
188
  }
190
189
  return false;
191
190
  }
191
+
192
+ function _trim(GaugeInfo[] memory array, uint256 validGauges) internal pure returns (GaugeInfo[] memory result) {
193
+ result = new GaugeInfo[](validGauges);
194
+
195
+ for (uint256 i = 0; i < validGauges; ++i) {
196
+ result[i] = array[i];
197
+ }
198
+ return result;
199
+ }
192
200
  }
@@ -130,12 +130,16 @@ contract RewardsCompressor is IRewardsCompressor {
130
130
  IBaseRewardPool rewardPool,
131
131
  address stakedPhantomToken
132
132
  ) internal view returns (RewardInfo[] memory rewards) {
133
- address[4] memory extraRewards = [
134
- convexAdapter.extraReward1(),
135
- convexAdapter.extraReward2(),
136
- convexAdapter.extraReward3(),
137
- convexAdapter.extraReward4()
138
- ];
133
+ address[4] memory extraRewards =
134
+ [convexAdapter.extraReward1(), convexAdapter.extraReward2(), address(0), address(0)];
135
+
136
+ try convexAdapter.extraReward3() returns (address extraReward3) {
137
+ extraRewards[2] = extraReward3;
138
+ } catch {}
139
+
140
+ try convexAdapter.extraReward4() returns (address extraReward4) {
141
+ extraRewards[3] = extraReward4;
142
+ } catch {}
139
143
 
140
144
  uint256 extraRewardsLength = rewardPool.extraRewardsLength();
141
145
  rewards = new RewardInfo[](0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/periphery-v3",
3
- "version": "1.7.0-next.52",
3
+ "version": "1.7.0-next.54",
4
4
  "main": "index.js",
5
5
  "repository": "git@github.com:Gearbox-protocol/periphery-v3.git",
6
6
  "author": "Mikael <26343374+0xmikko@users.noreply.github.com>",