@gearbox-protocol/sdk 1.15.1 → 1.15.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.
@@ -132,6 +132,9 @@ var PoolRewards = /** @class */ (function () {
132
132
  totalSupplyRange.addValue(e.blockNumber, totalSupply);
133
133
  }
134
134
  else {
135
+ if (!balances[from]) {
136
+ console.log("FROM", from);
137
+ }
135
138
  balances[from] = balances[from].sub(e.args.value);
136
139
  balancesRange[from].addValue(e.blockNumber, balances[from]);
137
140
  }
@@ -168,10 +171,12 @@ var PoolRewards = /** @class */ (function () {
168
171
  for (var i = 0; i < keys.length; i++) {
169
172
  var curBlock = keys[i];
170
173
  var nextBlock = i === keys.length - 1 ? toBlock : keys[i + 1];
171
- total = total.add(balancesArr[i]
172
- .mul(nextBlock - curBlock)
173
- .mul(rewardsArr[i])
174
- .div(totalSupplyArr[i]));
174
+ if (!totalSupplyArr[i].isZero()) {
175
+ total = total.add(balancesArr[i]
176
+ .mul(nextBlock - curBlock)
177
+ .mul(rewardsArr[i])
178
+ .div(totalSupplyArr[i]));
179
+ }
175
180
  }
176
181
  return total;
177
182
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "1.15.1",
3
+ "version": "1.15.3",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",