@gearbox-protocol/sdk 8.2.0-next.3 → 8.2.1

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.
@@ -47,15 +47,13 @@ class DegenDistributorsPlugin extends import_sdk.BasePlugin {
47
47
  acc[cfgLC] = distributors[index];
48
48
  return acc;
49
49
  }, {});
50
+ this.#distributors = new import_sdk.AddressMap(void 0, MAP_LABEL);
50
51
  this.sdk.marketRegister.markets.forEach((m) => {
51
52
  const pool = m.pool.pool.address;
52
53
  const cfg = m.configurator.address;
53
54
  const cfgLC = cfg.toLowerCase();
54
55
  const r = distributorByConfigurator?.[cfgLC];
55
56
  if (r.status === "fulfilled") {
56
- if (!this.#distributors) {
57
- this.#distributors = new import_sdk.AddressMap(void 0, MAP_LABEL);
58
- }
59
57
  this.#distributors.upsert(pool, r.value);
60
58
  } else {
61
59
  this.sdk.logger?.error(
@@ -51,17 +51,12 @@ class Pools7DAgoPlugin extends import_sdk.BasePlugin {
51
51
  ),
52
52
  blockNumber: import_sdk.BigIntMath.max(0n, targetBlock)
53
53
  });
54
+ this.#pools7DAgo = new import_sdk.AddressMap(void 0, MAP_LABEL);
54
55
  resp.forEach((r, index) => {
55
56
  const m = markets[index];
56
57
  const cfg = m.configurator.address;
57
58
  const pool = m.pool.pool.address;
58
59
  if (r.status === "success") {
59
- if (!this.#pools7DAgo) {
60
- this.#pools7DAgo = new import_sdk.AddressMap(
61
- void 0,
62
- MAP_LABEL
63
- );
64
- }
65
60
  this.#pools7DAgo.upsert(m.pool.pool.address, {
66
61
  dieselRate: r.result.dieselRate,
67
62
  pool
@@ -64,11 +64,11 @@ const chains = {
64
64
  network: "Mainnet",
65
65
  defaultMarketConfigurators: {
66
66
  "0x354fe9f450F60b8547f88BE042E4A45b46128a06": "Chaos Labs",
67
- "0x4d427D418342d8CE89a7634c3a402851978B680A": "K3"
68
- },
69
- testMarketConfigurators: {
70
- "0xc168343c791d56dd1da4b4b8b0cc1c1ec1a16e6b": "cp0x"
67
+ "0x4d427D418342d8CE89a7634c3a402851978B680A": "K3",
68
+ "0xc168343c791d56dd1da4b4b8b0cc1c1ec1a16e6b": "cp0x",
69
+ "0x3b56538833fc02f4f0e75609390f26ded0c32e42": "Re7"
71
70
  },
71
+ testMarketConfigurators: {},
72
72
  isPublic: true,
73
73
  wellKnownToken: {
74
74
  address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
@@ -204,6 +204,12 @@ class RouterV300Contract extends import_AbstractRouterContract.AbstractRouterCon
204
204
  leftover,
205
205
  connectors
206
206
  });
207
+ const force = ca.tokens.some(
208
+ (b) => b.token.toLowerCase() === import_sdk_gov_legacy.tokenDataByNetwork.Mainnet.stkcvxRLUSDUSDC.toLowerCase() && b.balance > 10n
209
+ );
210
+ if (force) {
211
+ this.logger?.warn("applying stkcvxRLUSDUSDC workaround");
212
+ }
207
213
  let results = [];
208
214
  for (const po of pathOptions) {
209
215
  const { result: result2 } = await this.contract.simulate.findBestClosePath(
@@ -215,7 +221,7 @@ class RouterV300Contract extends import_AbstractRouterContract.AbstractRouterCon
215
221
  BigInt(slippage),
216
222
  po,
217
223
  BigInt(LOOPS_PER_TX),
218
- false
224
+ force
219
225
  ],
220
226
  {
221
227
  gas: GAS_PER_BLOCK
@@ -38,7 +38,8 @@ const ALIASES = {
38
38
  PT_corn_pumpBTC_26DEC2024: "p.c.pumpBTC(26.12.24)",
39
39
  PT_sUSDe_27MAR2025: "p.sUSDe(27.03.25)",
40
40
  PT_sUSDe_29MAY2025: "p.sUSDe(29.05.25)",
41
- PT_beraSTONE_10APR2025: "p.beraSTONE(10.04.25)"
41
+ PT_beraSTONE_10APR2025: "p.beraSTONE(10.04.25)",
42
+ PT_uptBTC_14AUG2025: "p.uptBTC(14.08.25)"
42
43
  };
43
44
  class TokenData {
44
45
  address;
@@ -24,15 +24,13 @@ class DegenDistributorsPlugin extends BasePlugin {
24
24
  acc[cfgLC] = distributors[index];
25
25
  return acc;
26
26
  }, {});
27
+ this.#distributors = new AddressMap(void 0, MAP_LABEL);
27
28
  this.sdk.marketRegister.markets.forEach((m) => {
28
29
  const pool = m.pool.pool.address;
29
30
  const cfg = m.configurator.address;
30
31
  const cfgLC = cfg.toLowerCase();
31
32
  const r = distributorByConfigurator?.[cfgLC];
32
33
  if (r.status === "fulfilled") {
33
- if (!this.#distributors) {
34
- this.#distributors = new AddressMap(void 0, MAP_LABEL);
35
- }
36
34
  this.#distributors.upsert(pool, r.value);
37
35
  } else {
38
36
  this.sdk.logger?.error(
@@ -35,17 +35,12 @@ class Pools7DAgoPlugin extends BasePlugin {
35
35
  ),
36
36
  blockNumber: BigIntMath.max(0n, targetBlock)
37
37
  });
38
+ this.#pools7DAgo = new AddressMap(void 0, MAP_LABEL);
38
39
  resp.forEach((r, index) => {
39
40
  const m = markets[index];
40
41
  const cfg = m.configurator.address;
41
42
  const pool = m.pool.pool.address;
42
43
  if (r.status === "success") {
43
- if (!this.#pools7DAgo) {
44
- this.#pools7DAgo = new AddressMap(
45
- void 0,
46
- MAP_LABEL
47
- );
48
- }
49
44
  this.#pools7DAgo.upsert(m.pool.pool.address, {
50
45
  dieselRate: r.result.dieselRate,
51
46
  pool
@@ -48,11 +48,11 @@ const chains = {
48
48
  network: "Mainnet",
49
49
  defaultMarketConfigurators: {
50
50
  "0x354fe9f450F60b8547f88BE042E4A45b46128a06": "Chaos Labs",
51
- "0x4d427D418342d8CE89a7634c3a402851978B680A": "K3"
52
- },
53
- testMarketConfigurators: {
54
- "0xc168343c791d56dd1da4b4b8b0cc1c1ec1a16e6b": "cp0x"
51
+ "0x4d427D418342d8CE89a7634c3a402851978B680A": "K3",
52
+ "0xc168343c791d56dd1da4b4b8b0cc1c1ec1a16e6b": "cp0x",
53
+ "0x3b56538833fc02f4f0e75609390f26ded0c32e42": "Re7"
55
54
  },
55
+ testMarketConfigurators: {},
56
56
  isPublic: true,
57
57
  wellKnownToken: {
58
58
  address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
@@ -2,7 +2,7 @@ import { encodeFunctionData, getContract } from "viem";
2
2
  import { iRouterV300Abi, iSwapperV300Abi } from "../../abi/routerV300.js";
3
3
  import { iCreditFacadeV300MulticallAbi } from "../../abi/v300.js";
4
4
  import { PERCENTAGE_FACTOR } from "../constants/index.js";
5
- import { getConnectors } from "../sdk-gov-legacy/index.js";
5
+ import { getConnectors, tokenDataByNetwork } from "../sdk-gov-legacy/index.js";
6
6
  import { AbstractRouterContract } from "./AbstractRouterContract.js";
7
7
  import { assetsMap, balancesMap, compareRouterResults } from "./helpers.js";
8
8
  import { PathOptionFactory } from "./PathOptionFactory.js";
@@ -181,6 +181,12 @@ class RouterV300Contract extends AbstractRouterContract {
181
181
  leftover,
182
182
  connectors
183
183
  });
184
+ const force = ca.tokens.some(
185
+ (b) => b.token.toLowerCase() === tokenDataByNetwork.Mainnet.stkcvxRLUSDUSDC.toLowerCase() && b.balance > 10n
186
+ );
187
+ if (force) {
188
+ this.logger?.warn("applying stkcvxRLUSDUSDC workaround");
189
+ }
184
190
  let results = [];
185
191
  for (const po of pathOptions) {
186
192
  const { result: result2 } = await this.contract.simulate.findBestClosePath(
@@ -192,7 +198,7 @@ class RouterV300Contract extends AbstractRouterContract {
192
198
  BigInt(slippage),
193
199
  po,
194
200
  BigInt(LOOPS_PER_TX),
195
- false
201
+ force
196
202
  ],
197
203
  {
198
204
  gas: GAS_PER_BLOCK
@@ -15,7 +15,8 @@ const ALIASES = {
15
15
  PT_corn_pumpBTC_26DEC2024: "p.c.pumpBTC(26.12.24)",
16
16
  PT_sUSDe_27MAR2025: "p.sUSDe(27.03.25)",
17
17
  PT_sUSDe_29MAY2025: "p.sUSDe(29.05.25)",
18
- PT_beraSTONE_10APR2025: "p.beraSTONE(10.04.25)"
18
+ PT_beraSTONE_10APR2025: "p.beraSTONE(10.04.25)",
19
+ PT_uptBTC_14AUG2025: "p.uptBTC(14.08.25)"
19
20
  };
20
21
  class TokenData {
21
22
  address;
@@ -1,6 +1,6 @@
1
1
  import type { Address, Chain } from "viem";
2
2
  import { z } from "zod";
3
- export type Curator = "Chaos Labs" | "K3" | "cp0x";
3
+ export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7";
4
4
  export interface GearboxChain extends Chain {
5
5
  network: NetworkType;
6
6
  defaultMarketConfigurators: Record<Address, Curator>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "8.2.0-next.3",
3
+ "version": "8.2.1",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",