@gearbox-protocol/sdk 13.5.0-next.1 → 13.5.0-next.2

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 (56) hide show
  1. package/dist/cjs/dev/AccountOpener.js +5 -45
  2. package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +6 -339
  3. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +1 -13
  4. package/dist/cjs/sdk/base/TokensMeta.js +7 -151
  5. package/dist/cjs/sdk/base/token-types.js +0 -6
  6. package/dist/cjs/sdk/chain/chains.js +1 -2
  7. package/dist/cjs/sdk/constants/addresses.js +3 -0
  8. package/dist/cjs/sdk/market/MarketRegister.js +0 -3
  9. package/dist/cjs/sdk/market/MarketSuite.js +0 -3
  10. package/dist/cjs/sdk/market/ZapperRegister.js +0 -4
  11. package/dist/cjs/sdk/market/pool/PoolSuite.js +0 -3
  12. package/dist/cjs/sdk/market/pool/PoolV310Contract.js +2 -17
  13. package/dist/cjs/sdk/market/pool/index.js +0 -4
  14. package/dist/cjs/sdk/pools/PoolService.js +43 -122
  15. package/dist/cjs/sdk/pools/constants.js +37 -0
  16. package/dist/esm/dev/AccountOpener.js +6 -47
  17. package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +6 -339
  18. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +1 -13
  19. package/dist/esm/sdk/base/TokensMeta.js +7 -155
  20. package/dist/esm/sdk/base/token-types.js +0 -4
  21. package/dist/esm/sdk/chain/chains.js +1 -2
  22. package/dist/esm/sdk/constants/addresses.js +2 -0
  23. package/dist/esm/sdk/market/MarketRegister.js +0 -3
  24. package/dist/esm/sdk/market/MarketSuite.js +0 -3
  25. package/dist/esm/sdk/market/ZapperRegister.js +0 -4
  26. package/dist/esm/sdk/market/pool/PoolSuite.js +0 -3
  27. package/dist/esm/sdk/market/pool/PoolV310Contract.js +2 -17
  28. package/dist/esm/sdk/market/pool/index.js +0 -2
  29. package/dist/esm/sdk/pools/PoolService.js +32 -115
  30. package/dist/esm/sdk/pools/constants.js +13 -0
  31. package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +5 -103
  32. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +2 -4
  33. package/dist/types/sdk/accounts/types.d.ts +6 -130
  34. package/dist/types/sdk/base/TokensMeta.d.ts +3 -20
  35. package/dist/types/sdk/base/token-types.d.ts +1 -21
  36. package/dist/types/sdk/base/types.d.ts +3 -0
  37. package/dist/types/sdk/chain/chains.d.ts +1 -1
  38. package/dist/types/sdk/constants/addresses.d.ts +4 -0
  39. package/dist/types/sdk/market/MarketSuite.d.ts +0 -2
  40. package/dist/types/sdk/market/pool/PoolSuite.d.ts +0 -2
  41. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -6
  42. package/dist/types/sdk/market/pool/index.d.ts +0 -2
  43. package/dist/types/sdk/market/types.d.ts +1 -1
  44. package/dist/types/sdk/pools/PoolService.d.ts +24 -0
  45. package/dist/types/sdk/pools/constants.d.ts +7 -0
  46. package/dist/types/sdk/pools/types.d.ts +9 -8
  47. package/package.json +1 -1
  48. package/dist/cjs/abi/310/iSecuritizeDegenNFT.js +0 -263
  49. package/dist/cjs/abi/310/iSecuritizeKYCFactory.js +0 -278
  50. package/dist/cjs/sdk/market/pool/SecuritizeKYCFactory.js +0 -97
  51. package/dist/esm/abi/310/iSecuritizeDegenNFT.js +0 -239
  52. package/dist/esm/abi/310/iSecuritizeKYCFactory.js +0 -254
  53. package/dist/esm/sdk/market/pool/SecuritizeKYCFactory.js +0 -73
  54. package/dist/types/abi/310/iSecuritizeDegenNFT.d.ts +0 -324
  55. package/dist/types/abi/310/iSecuritizeKYCFactory.d.ts +0 -322
  56. package/dist/types/sdk/market/pool/SecuritizeKYCFactory.d.ts +0 -345
@@ -1,9 +1,6 @@
1
1
  import {
2
- decodeAbiParameters,
3
2
  erc20Abi
4
3
  } from "viem";
5
- import { iSecuritizeDegenNFTAbi } from "../../abi/310/iSecuritizeDegenNFT.js";
6
- import { iSecuritizeKYCFactoryAbi } from "../../abi/310/iSecuritizeKYCFactory.js";
7
4
  import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
8
5
  import { iVersionAbi } from "../../abi/iVersion.js";
9
6
  import {
@@ -12,10 +9,6 @@ import {
12
9
  bytes32ToString,
13
10
  formatBN
14
11
  } from "../utils/index.js";
15
- import {
16
- KYC_UNDERLYING_DEFAULT,
17
- KYC_UNDERLYING_ON_DEMAND
18
- } from "./token-types.js";
19
12
  class TokensMeta extends AddressMap {
20
13
  #client;
21
14
  #tokenDataLoaded = new AddressSet();
@@ -72,32 +65,6 @@ class TokensMeta extends AddressMap {
72
65
  }
73
66
  return !!t.contractType?.startsWith("PHANTOM_TOKEN::");
74
67
  }
75
- /**
76
- * Returns true if the token is a KYC underlying token, throws if the token data is not loaded
77
- * @param t
78
- * @returns
79
- */
80
- isKYCUnderlying(t) {
81
- if (!this.#tokenDataLoaded.has(t.addr)) {
82
- throw new Error(
83
- `extended token data not loaded for ${t.symbol} (${t.addr})`
84
- );
85
- }
86
- return !!t.contractType?.startsWith("KYC_UNDERLYING::");
87
- }
88
- /**
89
- * Returns true if the token is a DSToken, throws if the token data is not loaded
90
- * @param t
91
- * @returns
92
- */
93
- isDSToken(t) {
94
- if (!this.#tokenDataLoaded.has(t.addr)) {
95
- throw new Error(
96
- `extended token data not loaded for ${t.symbol} (${t.addr})`
97
- );
98
- }
99
- return !!t.isDSToken;
100
- }
101
68
  /**
102
69
  * Returns a map of all phantom tokens
103
70
  * Throws if token data is not loaded
@@ -111,28 +78,6 @@ class TokensMeta extends AddressMap {
111
78
  }
112
79
  return result;
113
80
  }
114
- /**
115
- * Returns a map of all KYC underlying tokens
116
- * Throws if token data is not loaded
117
- */
118
- get kycUnderlyings() {
119
- const result = new AddressMap();
120
- for (const [token, meta] of this.entries()) {
121
- if (this.isKYCUnderlying(meta)) {
122
- result.upsert(token, meta);
123
- }
124
- }
125
- return result;
126
- }
127
- get dsTokens() {
128
- const result = new AddressMap();
129
- for (const [token, meta] of this.entries()) {
130
- if (this.isDSToken(meta)) {
131
- result.upsert(token, meta);
132
- }
133
- }
134
- return result;
135
- }
136
81
  formatBN(arg0, arg1, arg2) {
137
82
  const token = typeof arg0 === "object" ? arg0.token : arg0;
138
83
  const amount = typeof arg0 === "object" ? arg0.balance : arg1;
@@ -162,7 +107,8 @@ class TokensMeta extends AddressMap {
162
107
  return meta;
163
108
  }
164
109
  /**
165
- * Loads token information about phantom tokens, KYC underlying tokens and DSTokens
110
+ * Loads token information about phantom tokens
111
+ * Other special tokens may be loaded here in the future
166
112
  *
167
113
  * @param tokens - tokens to load data for, defaults to all tokens
168
114
  */
@@ -191,116 +137,22 @@ class TokensMeta extends AddressMap {
191
137
  batchSize: 0
192
138
  });
193
139
  this.#logger?.debug(`loaded ${resp.length} contract types`);
194
- const kycFactories = new AddressSet();
195
140
  for (let i = 0; i < tokensToLoad.length; i++) {
196
- const meta = this.#overrideTokenMeta(
197
- tokensToLoad[i],
198
- resp[2 * i],
199
- resp[2 * i + 1]
200
- );
141
+ this.#overrideTokenMeta(tokensToLoad[i], resp[2 * i], resp[2 * i + 1]);
201
142
  this.#tokenDataLoaded.add(tokensToLoad[i]);
202
- if (this.isKYCUnderlying(meta)) {
203
- kycFactories.add(meta.kycFactory);
204
- }
205
143
  }
206
- this.#logger?.debug(`found ${kycFactories.size} KYC factories`);
207
- await this.#loadDSTokens(kycFactories);
208
144
  }
209
- #overrideTokenMeta(token, contractTypeResp, serializeResp) {
145
+ #overrideTokenMeta(token, contractTypeResp, _serializeResp) {
210
146
  const meta = this.mustGet(token);
211
147
  if (contractTypeResp.status === "success") {
212
148
  const contractType = bytes32ToString(contractTypeResp.result);
213
- if (contractType.startsWith("KYC_UNDERLYING::")) {
214
- if (serializeResp.status === "success") {
215
- this.#overrideKYCUnderlying(meta, contractType, serializeResp.result);
216
- } else {
217
- throw new Error(
218
- `token ${meta.symbol} (${token}) is ${contractType} but serialize failed: ${serializeResp.error}`
219
- );
220
- }
221
- } else {
222
- this.upsert(token, {
223
- ...meta,
224
- contractType
225
- });
226
- }
227
- this.#logger?.debug(`token ${meta.symbol} is ${contractType}`);
228
- }
229
- return this.mustGet(token);
230
- }
231
- #overrideKYCUnderlying(meta, contractType, serialized) {
232
- if (contractType === KYC_UNDERLYING_DEFAULT) {
233
- const decoded = decodeAbiParameters(
234
- [
235
- { type: "address", name: "kycFactory" },
236
- { type: "address", name: "asset" }
237
- ],
238
- serialized
239
- );
240
- this.upsert(meta.addr, {
241
- ...meta,
242
- contractType,
243
- kycFactory: decoded[0],
244
- asset: decoded[1]
245
- });
246
- } else if (contractType === KYC_UNDERLYING_ON_DEMAND) {
247
- const decoded = decodeAbiParameters(
248
- [
249
- { type: "address", name: "kycFactory" },
250
- { type: "address", name: "asset" },
251
- { type: "address", name: "pool" },
252
- { type: "address", name: "liquidityProvider" }
253
- ],
254
- serialized
255
- );
256
- this.upsert(meta.addr, {
257
- ...meta,
258
- contractType,
259
- kycFactory: decoded[0],
260
- asset: decoded[1],
261
- pool: decoded[2],
262
- liquidityProvider: decoded[3]
263
- });
264
- }
265
- }
266
- async #loadDSTokens(kycFactories) {
267
- const degenNFTs = await this.#client.multicall({
268
- contracts: kycFactories.map((address) => {
269
- return {
270
- address,
271
- abi: iSecuritizeKYCFactoryAbi,
272
- functionName: "getDegenNFT"
273
- };
274
- }),
275
- allowFailure: false,
276
- batchSize: 0
277
- });
278
- const resp = await this.#client.multicall({
279
- contracts: degenNFTs.map((address) => {
280
- return {
281
- address,
282
- abi: iSecuritizeDegenNFTAbi,
283
- functionName: "getDSTokens"
284
- };
285
- }),
286
- allowFailure: false,
287
- batchSize: 0
288
- });
289
- const dsToken = new AddressSet(resp.flat());
290
- const tokensToLoad = dsToken.difference(new Set(this.keys()));
291
- this.#logger?.debug(
292
- `found ${dsToken.size} DSTokens in KYC factories, need to load ${tokensToLoad.size} basic metadata`
293
- );
294
- await this.#loadWithoutCompressor(tokensToLoad);
295
- for (const token of dsToken) {
296
- const meta = this.mustGet(token);
297
149
  this.upsert(token, {
298
150
  ...meta,
299
- isDSToken: true
151
+ contractType
300
152
  });
301
- this.#tokenDataLoaded.add(token);
302
- this.#logger?.debug(`token ${meta.symbol} (${token}) is a DSToken`);
153
+ this.#logger?.debug(`token ${meta.symbol} is ${contractType}`);
303
154
  }
155
+ return this.mustGet(token);
304
156
  }
305
157
  async #loadWithoutCompressor(tokens_) {
306
158
  if (tokens_.size === 0) {
@@ -7,10 +7,6 @@ const PHANTOM_TOKEN_CONTRACT_TYPES = [
7
7
  "PHANTOM_TOKEN::STAKING_REWARDS",
8
8
  "PHANTOM_TOKEN::UPSHIFT_WITHDRAW"
9
9
  ];
10
- const KYC_UNDERLYING_DEFAULT = "KYC_UNDERLYING::DEFAULT";
11
- const KYC_UNDERLYING_ON_DEMAND = "KYC_UNDERLYING::ON_DEMAND";
12
10
  export {
13
- KYC_UNDERLYING_DEFAULT,
14
- KYC_UNDERLYING_ON_DEMAND,
15
11
  PHANTOM_TOKEN_CONTRACT_TYPES
16
12
  };
@@ -65,8 +65,7 @@ const chains = {
65
65
  "0x601067eba24bb5b558a184fc082525637e96a42d": "Gami Labs"
66
66
  },
67
67
  testMarketConfigurators: {
68
- "0x99df7330bf42d596af2e9d9836d4fc2077c574aa": "M11 Credit",
69
- "0xE0527dE5908B3fc2e054B7eEE0DeF6c9965AbF24": "Securitize"
68
+ "0x99df7330bf42d596af2e9d9836d4fc2077c574aa": "M11 Credit"
70
69
  },
71
70
  isPublic: true,
72
71
  wellKnownToken: {
@@ -1,8 +1,10 @@
1
1
  const MULTICALL_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11";
2
2
  const ADDRESS_0X0 = "0x0000000000000000000000000000000000000000";
3
3
  const NOT_DEPLOYED = "0xNOT DEPLOYED";
4
+ const NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
4
5
  export {
5
6
  ADDRESS_0X0,
6
7
  MULTICALL_ADDRESS,
8
+ NATIVE_ADDRESS,
7
9
  NOT_DEPLOYED
8
10
  };
@@ -10,9 +10,6 @@ import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
10
10
  import { MarketSuite } from "./MarketSuite.js";
11
11
  import { ZapperRegister } from "./ZapperRegister.js";
12
12
  class MarketRegister extends ZapperRegister {
13
- /**
14
- * Mapping pool.address -> MarketSuite
15
- */
16
13
  #markets = new AddressMap(void 0, "markets");
17
14
  #marketFilter;
18
15
  #marketConfigurators = new AddressMap(
@@ -44,9 +44,6 @@ class MarketSuite extends SDKConstruct {
44
44
  get underlying() {
45
45
  return this.pool.underlying;
46
46
  }
47
- async getKYCFactory() {
48
- return this.pool.getKYCFactory();
49
- }
50
47
  get dirty() {
51
48
  return this.configurator.dirty || this.pool.dirty || this.priceOracle.dirty || this.creditManagers.some((cm) => cm.dirty);
52
49
  }
@@ -53,9 +53,6 @@ class ZapperRegister extends SDKConstruct {
53
53
  );
54
54
  }
55
55
  }
56
- for (const z of KYC_ZAPPERS[this.networkType] ?? []) {
57
- this.#addZapper({ ...z, type: "kyc" });
58
- }
59
56
  for (const z of MIGRATION_ZAPPERS[this.networkType] ?? []) {
60
57
  this.#addZapper({ ...z, type: "migration" });
61
58
  }
@@ -213,7 +210,6 @@ const MIGRATION_ZAPPERS = {
213
210
  }
214
211
  ]
215
212
  };
216
- const KYC_ZAPPERS = {};
217
213
  export {
218
214
  ZapperRegister
219
215
  };
@@ -55,9 +55,6 @@ class PoolSuite extends SDKConstruct {
55
55
  get underlying() {
56
56
  return this.pool.underlying;
57
57
  }
58
- async getKYCFactory() {
59
- return this.pool.getKYCFactory();
60
- }
61
58
  get dirty() {
62
59
  return this.pool.dirty || this.rateKeeper.dirty || this.pqk.dirty || this.interestRateModel.dirty;
63
60
  }
@@ -7,20 +7,16 @@ import {
7
7
  formatBNvalue,
8
8
  percentFmt
9
9
  } from "../../utils/index.js";
10
- import { SecuritizeKYCFactory } from "./SecuritizeKYCFactory.js";
11
10
  const abi = [...iPoolV310Abi, ...iPausableAbi];
12
11
  class PoolV310Contract extends BaseContract {
13
12
  creditManagerDebtParams;
14
- #sdk;
15
- #kycFactory;
16
- constructor(sdk, data) {
13
+ constructor(options, data) {
17
14
  const { baseParams, creditManagerDebtParams, ...rest } = data;
18
- super(sdk, {
15
+ super(options, {
19
16
  ...data.baseParams,
20
17
  name: `PoolV3(${data.name})`,
21
18
  abi
22
19
  });
23
- this.#sdk = sdk;
24
20
  Object.assign(this, rest);
25
21
  this.creditManagerDebtParams = new AddressMap(
26
22
  creditManagerDebtParams.map((p) => [p.creditManager, p])
@@ -32,17 +28,6 @@ class PoolV310Contract extends BaseContract {
32
28
  symbol: data.symbol
33
29
  });
34
30
  }
35
- async getKYCFactory() {
36
- if (this.#kycFactory) {
37
- return this.#kycFactory;
38
- }
39
- await this.#sdk.tokensMeta.loadTokenData(this.underlying);
40
- const u = this.#sdk.tokensMeta.mustGet(this.underlying);
41
- if (this.#sdk.tokensMeta.isKYCUnderlying(u)) {
42
- this.#kycFactory = new SecuritizeKYCFactory(this.#sdk, u.kycFactory);
43
- }
44
- return this.#kycFactory;
45
- }
46
31
  stateHuman(raw = true) {
47
32
  return {
48
33
  ...super.stateHuman(raw),
@@ -1,6 +1,4 @@
1
1
  export * from "./GaugeContract.js";
2
2
  export * from "./LinearInterestRateModelContract.js";
3
3
  export * from "./PoolSuite.js";
4
- export * from "./PoolV310Contract.js";
5
- export * from "./SecuritizeKYCFactory.js";
6
4
  export * from "./types.js";
@@ -1,82 +1,35 @@
1
1
  import { iPoolV310Abi } from "../../abi/310/generated.js";
2
- import { ierc20Abi } from "../../abi/iERC20.js";
3
2
  import { ierc20ZapperDepositsAbi } from "../../abi/iERC20ZapperDeposits.js";
4
3
  import { iethZapperDepositsAbi } from "../../abi/iETHZapperDeposits.js";
5
4
  import { iZapperAbi } from "../../abi/iZapper.js";
6
- import {
7
- KYC_UNDERLYING_DEFAULT,
8
- KYC_UNDERLYING_ON_DEMAND,
9
- SDKConstruct
10
- } from "../base/index.js";
11
- import { AddressSet, hexEq } from "../index.js";
12
- import { AddressMap } from "../utils/index.js";
13
- const NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
14
- const POOL_TOKENS_TO_MIGRATE = new AddressMap([
15
- // v2 diesels
16
- ["0x6CFaF95457d7688022FC53e7AbE052ef8DFBbdBA", "dDAI"],
17
- ["0xc411dB5f5Eb3f7d552F9B8454B2D74097ccdE6E3", "dUSDC"],
18
- ["0xe753260F1955e8678DCeA8887759e07aa57E8c54", "dWBTC"],
19
- ["0xF21fc650C1B34eb0FDE786D52d23dA99Db3D6278", "dWETH"],
20
- ["0x2158034dB06f06dcB9A786D2F1F8c38781bA779d", "dwstETH"],
21
- ["0x8A1112AFef7F4FC7c066a77AABBc01b3Fff31D47", "dFRAX"]
22
- ]);
5
+ import { SDKConstruct } from "../base/index.js";
6
+ import { NATIVE_ADDRESS } from "../constants/index.js";
7
+ import { AddressSet, hexEq } from "../utils/index.js";
8
+ import { POOL_TOKENS_TO_MIGRATE } from "./constants.js";
23
9
  class PoolService extends SDKConstruct {
10
+ /**
11
+ * @inheritdoc IPoolsService.getDepositTokensIn
12
+ */
24
13
  getDepositTokensIn(pool) {
25
- const underlying = this.#describeUnderlying(pool);
26
- if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
27
- switch (underlying.contractType) {
28
- case KYC_UNDERLYING_DEFAULT:
29
- return this.#depositTokensIn(pool, false);
30
- case KYC_UNDERLYING_ON_DEMAND:
31
- return [underlying.asset];
32
- }
33
- }
34
14
  return this.#depositTokensIn(pool, true);
35
15
  }
16
+ /**
17
+ * @inheritdoc IPoolsService.getDepositTokensOut
18
+ */
36
19
  getDepositTokensOut(pool, tokenIn) {
37
- const underlying = this.#describeUnderlying(pool);
38
- if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
39
- switch (underlying.contractType) {
40
- case KYC_UNDERLYING_DEFAULT:
41
- return this.#depositTokensOut(pool, tokenIn, false);
42
- case KYC_UNDERLYING_ON_DEMAND:
43
- return [];
44
- }
45
- }
46
20
  return this.#depositTokensOut(pool, tokenIn, true);
47
21
  }
22
+ /**
23
+ * @inheritdoc IPoolsService.getDepositMetadata
24
+ */
48
25
  getDepositMetadata(pool, tokenIn, tokenOut) {
49
- const underlying = this.#describeUnderlying(pool);
50
- if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
51
- switch (underlying.contractType) {
52
- case KYC_UNDERLYING_DEFAULT: {
53
- return this.#depositMetadata(
54
- "kyc-default",
55
- pool,
56
- tokenIn,
57
- tokenOut,
58
- false
59
- );
60
- }
61
- case KYC_UNDERLYING_ON_DEMAND:
62
- return {
63
- zapper: void 0,
64
- approveTarget: underlying.liquidityProvider,
65
- permissible: false,
66
- type: "kyc-on-demand"
67
- };
68
- }
69
- }
70
26
  return this.#depositMetadata("classic", pool, tokenIn, tokenOut, true);
71
27
  }
28
+ /**
29
+ * @inheritdoc IPoolsService.addLiquidity
30
+ */
72
31
  addLiquidity(props) {
73
32
  const { collateral, meta, permit, referralCode, pool, wallet } = props;
74
- const underlying = this.#describeUnderlying(pool);
75
- if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
76
- if (underlying.contractType === KYC_UNDERLYING_ON_DEMAND) {
77
- return void 0;
78
- }
79
- }
80
33
  const { zapper } = meta;
81
34
  if (zapper && hexEq(zapper.tokenIn.addr, NATIVE_ADDRESS)) {
82
35
  return {
@@ -115,43 +68,23 @@ class PoolService extends SDKConstruct {
115
68
  };
116
69
  }
117
70
  }
71
+ /**
72
+ * @inheritdoc IPoolsService.getWithdrawalTokensIn
73
+ */
118
74
  getWithdrawalTokensIn(pool) {
119
- const underlying = this.#describeUnderlying(pool);
120
- if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
121
- switch (underlying.contractType) {
122
- case KYC_UNDERLYING_DEFAULT:
123
- return this.#withdrawalTokensIn(pool, false);
124
- case KYC_UNDERLYING_ON_DEMAND:
125
- return [];
126
- }
127
- }
128
75
  return this.#withdrawalTokensIn(pool, true);
129
76
  }
77
+ /**
78
+ * @inheritdoc IPoolsService.getWithdrawalTokensOut
79
+ */
130
80
  getWithdrawalTokensOut(pool, tokenIn) {
131
- const underlying = this.#describeUnderlying(pool);
132
- if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
133
- switch (underlying.contractType) {
134
- case KYC_UNDERLYING_DEFAULT:
135
- return this.#withdrawalTokensOut(pool, tokenIn, false);
136
- case KYC_UNDERLYING_ON_DEMAND:
137
- return [underlying.asset];
138
- }
139
- }
140
81
  return this.#withdrawalTokensOut(pool, tokenIn, true);
141
82
  }
83
+ /**
84
+ * @inheritdoc IPoolsService.removeLiquidity
85
+ */
142
86
  removeLiquidity(props) {
143
87
  const { pool, amount, meta, wallet, permit } = props;
144
- const underlying = this.#describeUnderlying(pool);
145
- if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
146
- if (underlying.contractType === KYC_UNDERLYING_ON_DEMAND) {
147
- return {
148
- abi: ierc20Abi,
149
- functionName: "approve",
150
- args: [underlying.liquidityProvider, 0n],
151
- target: underlying.asset
152
- };
153
- }
154
- }
155
88
  if (meta.zapper) {
156
89
  return permit ? {
157
90
  target: meta.zapper.baseParams.addr,
@@ -179,31 +112,14 @@ class PoolService extends SDKConstruct {
179
112
  args: [amount, wallet, wallet]
180
113
  };
181
114
  }
115
+ /**
116
+ * @inheritdoc IPoolsService.getWithdrawalMetadata
117
+ */
182
118
  getWithdrawalMetadata(pool, tokenIn, tokenOut) {
183
- const underlying = this.#describeUnderlying(pool);
184
- if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
185
- switch (underlying.contractType) {
186
- case KYC_UNDERLYING_DEFAULT: {
187
- return this.#withdrawalMetadata(
188
- "kyc-default",
189
- pool,
190
- tokenIn,
191
- tokenOut,
192
- false
193
- );
194
- }
195
- case KYC_UNDERLYING_ON_DEMAND:
196
- return {
197
- zapper: void 0,
198
- approveTarget: void 0,
199
- permissible: false,
200
- type: "kyc-on-demand"
201
- };
202
- }
203
- }
204
119
  return this.#withdrawalMetadata("classic", pool, tokenIn, tokenOut, true);
205
120
  }
206
121
  /**
122
+ * TODO: do we still need this after v3.0 deprecation?
207
123
  * Filter out v2 diesel tokens (can come from migration v2 -> v3 zappers)
208
124
  * Also omits "migration" zappers (v3 -> v3.1) since they are treated in a different way
209
125
  */
@@ -294,6 +210,7 @@ class PoolService extends SDKConstruct {
294
210
  return r;
295
211
  }
296
212
  /**
213
+ * TODO: do we still need this after v3.0 deprecation?
297
214
  * Filter out v2 diesel tokens (can come from migration v2 -> v3 zappers)
298
215
  * Also omits "migration" zappers (v3 -> v3.1) since they are treated in a different way
299
216
  */
@@ -331,7 +248,7 @@ class PoolService extends SDKConstruct {
331
248
  zapper,
332
249
  // zapper or pool itself
333
250
  approveTarget: zapper?.baseParams.addr ?? pool.pool.address,
334
- // TODO: instead of permissible, return permitType зависимости от tokenIn
251
+ // TODO: instead of permissible, return permitType depending on tokenIn
335
252
  // "none" | "eip2612" | "dai_like";
336
253
  permissible: !!zapper && !hexEq(tokenIn, NATIVE_ADDRESS),
337
254
  type
@@ -355,7 +272,7 @@ class PoolService extends SDKConstruct {
355
272
  zapper,
356
273
  // zapper or pool itself
357
274
  approveTarget: zapper?.baseParams.addr,
358
- // TODO: instead of permissible, return permitType зависимости от tokenIn
275
+ // TODO: instead of permissible, return permitType depending on tokenIn
359
276
  // "none" | "eip2612" | "dai_like";
360
277
  permissible: !!zapper,
361
278
  type
@@ -0,0 +1,13 @@
1
+ import { AddressMap } from "../utils/index.js";
2
+ const POOL_TOKENS_TO_MIGRATE = new AddressMap([
3
+ // v2 diesels
4
+ ["0x6CFaF95457d7688022FC53e7AbE052ef8DFBbdBA", "dDAI"],
5
+ ["0xc411dB5f5Eb3f7d552F9B8454B2D74097ccdE6E3", "dUSDC"],
6
+ ["0xe753260F1955e8678DCeA8887759e07aa57E8c54", "dWBTC"],
7
+ ["0xF21fc650C1B34eb0FDE786D52d23dA99Db3D6278", "dWETH"],
8
+ ["0x2158034dB06f06dcB9A786D2F1F8c38781bA779d", "dwstETH"],
9
+ ["0x8A1112AFef7F4FC7c066a77AABBc01b3Fff31D47", "dFRAX"]
10
+ ]);
11
+ export {
12
+ POOL_TOKENS_TO_MIGRATE
13
+ };