@gearbox-protocol/sdk 16.0.0-next.46 → 16.0.0-next.47

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 (52) hide show
  1. package/dist/cjs/onchain/index.js +0 -2
  2. package/dist/cjs/onchain/market/MarketSuite.js +9 -1
  3. package/dist/cjs/onchain/market/credit/CreditSuite.js +1 -2
  4. package/dist/cjs/onchain/market/pool/PoolV310Contract.js +25 -0
  5. package/dist/cjs/onchain/pools/PoolService.js +5 -56
  6. package/dist/cjs/onchain/pools/index.js +0 -2
  7. package/dist/cjs/preview/preview/previewPoolPositionOperation.js +31 -12
  8. package/dist/cjs/preview/simulate/index.js +1 -1
  9. package/dist/cjs/preview/simulate/simulateOperation.js +1 -1
  10. package/dist/cjs/preview/simulate/simulatePoolOperation.js +2 -0
  11. package/dist/cjs/sdk/prepare/PrepareApi.js +5 -6
  12. package/dist/esm/dev/AccountOpener.js +1 -1
  13. package/dist/esm/dev/withdrawalUtils.js +1 -1
  14. package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
  15. package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  16. package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  17. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  18. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  19. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  20. package/dist/esm/onchain/base/TokensMeta.js +3 -3
  21. package/dist/esm/onchain/core/createAddressProvider.js +1 -1
  22. package/dist/esm/onchain/index.js +2 -2
  23. package/dist/esm/onchain/market/MarketSuite.js +9 -1
  24. package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
  25. package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
  26. package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
  27. package/dist/esm/onchain/market/credit/CreditSuite.js +1 -2
  28. package/dist/esm/onchain/market/pool/PoolV310Contract.js +26 -1
  29. package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
  30. package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
  31. package/dist/esm/onchain/pools/PoolService.js +7 -56
  32. package/dist/esm/onchain/pools/index.js +2 -2
  33. package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
  34. package/dist/esm/preview/preview/previewPoolPositionOperation.js +33 -14
  35. package/dist/esm/preview/simulate/index.js +1 -1
  36. package/dist/esm/preview/simulate/simulateOperation.js +1 -1
  37. package/dist/esm/preview/simulate/simulatePoolOperation.js +2 -2
  38. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  39. package/dist/esm/sdk/prepare/PrepareApi.js +5 -6
  40. package/dist/types/model/positions.d.ts +4 -1
  41. package/dist/types/model/previews.d.ts +28 -12
  42. package/dist/types/onchain/index.d.ts +3 -3
  43. package/dist/types/onchain/market/MarketSuite.d.ts +6 -0
  44. package/dist/types/onchain/market/pool/PoolV310Contract.d.ts +12 -0
  45. package/dist/types/onchain/market/pool/types.d.ts +18 -0
  46. package/dist/types/onchain/pools/PoolService.d.ts +2 -29
  47. package/dist/types/onchain/pools/index.d.ts +3 -3
  48. package/dist/types/onchain/pools/types.d.ts +1 -40
  49. package/dist/types/preview/simulate/simulatePoolOperation.d.ts +18 -1
  50. package/dist/types/preview/simulate/types.d.ts +12 -4
  51. package/dist/types/sdk/prepare/types.d.ts +6 -4
  52. package/package.json +1 -1
@@ -704,8 +704,6 @@ exports.toCreditAccountSlice = require_onchain_accounts_intents_utils_credit_acc
704
704
  exports.toNetTransfers = require_onchain_market_adapters_transferHelpers.toNetTransfers;
705
705
  exports.toPendingWithdrawal = require_onchain_accounts_withdrawal_compressor_AbstractWithdrawalCompressorContract.toPendingWithdrawal;
706
706
  exports.toRequestableWithdrawal = require_onchain_accounts_withdrawal_compressor_AbstractWithdrawalCompressorContract.toRequestableWithdrawal;
707
- exports.toShares = require_onchain_pools_PoolService.toShares;
708
- exports.toSharesUp = require_onchain_pools_PoolService.toSharesUp;
709
707
  exports.toSignificant = require_onchain_utils_formatter.toSignificant;
710
708
  exports.toToken = require_onchain_validation_token.toToken;
711
709
  exports.toTokenAmount = require_onchain_validation_token.toTokenAmount;
@@ -128,6 +128,14 @@ var MarketSuite = class extends require_onchain_base_SDKConstruct.SDKConstruct {
128
128
  };
129
129
  }
130
130
  /**
131
+ * Whether `token` is this market's pool underlying or the asset it wraps
132
+ * (dcUSDC or USDC on an RWA pool). Amounts in either unit are 1:1 with the
133
+ * figure {@link toUnderlyingAmount} reports.
134
+ */
135
+ isUnderlyingLike(token) {
136
+ return (0, viem.isAddressEqual)(token, this.underlying) || (0, viem.isAddressEqual)(token, this.unwrappedUnderlying);
137
+ }
138
+ /**
131
139
  * Prices a figure already denominated in this market's underlying — a debt,
132
140
  * a TVL, a payout — as the read model reports one.
133
141
  *
@@ -166,7 +174,7 @@ var MarketSuite = class extends require_onchain_base_SDKConstruct.SDKConstruct {
166
174
  seen.upsert(this.unwrappedUnderlying, this.underlyingToken);
167
175
  for (const zapper of this.sdk.marketRegister.poolZappers(this.pool.pool.address)) {
168
176
  const tokenIn = zapper.tokenIn.addr;
169
- if ((0, viem.isAddressEqual)(tokenIn, this.pool.underlying) || (0, viem.isAddressEqual)(tokenIn, this.unwrappedUnderlying)) continue;
177
+ if (this.isUnderlyingLike(tokenIn)) continue;
170
178
  seen.upsert(tokenIn, this.tokensMeta.mustGetToken(tokenIn));
171
179
  }
172
180
  return seen.values();
@@ -392,8 +392,7 @@ var CreditSuite = class extends require_onchain_base_SDKConstruct.SDKConstruct {
392
392
  */
393
393
  #allowedDepositTokens(targetCollateral) {
394
394
  const unwrappedUnderlying = this.market.unwrappedUnderlying;
395
- const contractUnderlying = this.underlying;
396
- const skip = (token) => (0, viem.isAddressEqual)(token, unwrappedUnderlying) || (0, viem.isAddressEqual)(token, contractUnderlying) || (0, viem.isAddressEqual)(token, targetCollateral);
395
+ const skip = (token) => this.market.isUnderlyingLike(token) || (0, viem.isAddressEqual)(token, targetCollateral);
397
396
  return [
398
397
  unwrappedUnderlying,
399
398
  targetCollateral,
@@ -51,6 +51,31 @@ var PoolV310Contract = class extends require_onchain_base_BaseContract.BaseContr
51
51
  return this.totalSupply * this.dieselRate / require_onchain_constants_math.RAY;
52
52
  }
53
53
  /**
54
+ * {@inheritDoc IPoolContract.getShareBalance}
55
+ */
56
+ async getShareBalance(wallet, blockNumber) {
57
+ return this.client.readContract({
58
+ address: this.address,
59
+ abi: this.abi,
60
+ functionName: "balanceOf",
61
+ args: [wallet],
62
+ blockNumber
63
+ });
64
+ }
65
+ /**
66
+ * {@inheritDoc IPoolContract.sharesToUnderlying}
67
+ */
68
+ sharesToUnderlying(shares) {
69
+ return this.dieselRate === 0n ? shares : shares * this.dieselRate / require_onchain_constants_math.RAY;
70
+ }
71
+ /**
72
+ * {@inheritDoc IPoolContract.underlyingToShares}
73
+ */
74
+ underlyingToShares(underlying, roundUp = false) {
75
+ if (this.dieselRate === 0n) return underlying;
76
+ return roundUp ? (underlying * require_onchain_constants_math.RAY + this.dieselRate - 1n) / this.dieselRate : underlying * require_onchain_constants_math.RAY / this.dieselRate;
77
+ }
78
+ /**
54
79
  * {@inheritDoc IPoolContract.unwrappedUnderlying}
55
80
  */
56
81
  get unwrappedUnderlying() {
@@ -30,25 +30,6 @@ function payoutCeiling(market) {
30
30
  return market.priceOracle.toAmount(pool.underlying, pool.pool.availableLiquidity * LIQUIDITY_SAFETY_NUM / LIQUIDITY_SAFETY_DENOM);
31
31
  }
32
32
  var PoolService = class extends require_onchain_base_SDKConstruct.SDKConstruct {
33
- /**
34
- * {@inheritDoc IPoolsService.getShareBalance}
35
- */
36
- async getShareBalance(props) {
37
- return this.client.readContract({
38
- address: this.sdk.marketRegister.findByPool(props.pool).pool.pool.address,
39
- abi: require_abi_iERC20.ierc20Abi,
40
- functionName: "balanceOf",
41
- args: [props.wallet],
42
- blockNumber: props.blockNumber
43
- });
44
- }
45
- /**
46
- * {@inheritDoc IPoolsService.sharesToUnderlying}
47
- */
48
- sharesToUnderlying(pool, shares) {
49
- const market = this.sdk.marketRegister.findByPool(pool);
50
- return market.toUnderlyingAmount(shares * market.pool.pool.dieselRate / require_onchain_constants_math.RAY);
51
- }
52
33
  /**
53
34
  * {@inheritDoc IPoolsService.getDepositTokensIn}
54
35
  */
@@ -165,7 +146,7 @@ var PoolService = class extends require_onchain_base_SDKConstruct.SDKConstruct {
165
146
  const { zapper } = this.getDepositMetadata(poolAddr, tokenIn, tokenOut);
166
147
  return {
167
148
  tokenIn: toTokenAmount(tokenIn, amount),
168
- tokenOut: toTokenAmount(tokenOut, toShares(pool.pool, amount)),
149
+ tokenOut: toTokenAmount(tokenOut, pool.pool.underlyingToShares(amount)),
169
150
  zapper: zapper?.baseParams.addr
170
151
  };
171
152
  }
@@ -185,7 +166,7 @@ var PoolService = class extends require_onchain_base_SDKConstruct.SDKConstruct {
185
166
  });
186
167
  const { zapper } = this.getWithdrawalMetadata(poolAddr, tokenIn, tokenOut);
187
168
  return {
188
- tokenIn: toTokenAmount(tokenIn, toSharesUp(pool.pool, amount)),
169
+ tokenIn: toTokenAmount(tokenIn, pool.pool.underlyingToShares(amount * require_onchain_constants_math.PERCENTAGE_FACTOR / (require_onchain_constants_math.PERCENTAGE_FACTOR - pool.pool.withdrawFee), true)),
189
170
  tokenOut: toTokenAmount(tokenOut, amount),
190
171
  zapper: zapper?.baseParams.addr,
191
172
  availableLiquidity: payoutCeiling(market)
@@ -208,7 +189,7 @@ var PoolService = class extends require_onchain_base_SDKConstruct.SDKConstruct {
208
189
  const { zapper } = this.getWithdrawalMetadata(poolAddr, tokenIn, tokenOut);
209
190
  return {
210
191
  tokenIn: toTokenAmount(tokenIn, amount),
211
- tokenOut: toTokenAmount(tokenOut, toAssets(pool.pool, amount)),
192
+ tokenOut: toTokenAmount(tokenOut, pool.pool.sharesToUnderlying(amount) * (require_onchain_constants_math.PERCENTAGE_FACTOR - pool.pool.withdrawFee) / require_onchain_constants_math.PERCENTAGE_FACTOR),
212
193
  zapper: zapper?.baseParams.addr,
213
194
  availableLiquidity: payoutCeiling(market)
214
195
  };
@@ -240,7 +221,7 @@ var PoolService = class extends require_onchain_base_SDKConstruct.SDKConstruct {
240
221
  }
241
222
  const poolContract = this.sdk.marketRegister.findByPool(pool).pool.pool;
242
223
  if (meta.zapper instanceof require_onchain_market_zapper_IETHZapperContract.IETHZapperContract || meta.zapper instanceof require_onchain_market_zapper_IERC20ZapperContract.IERC20ZapperContract) {
243
- const shares = mode === "withdraw" ? toSharesUp(poolContract, amount) : amount;
224
+ const shares = mode === "withdraw" ? poolContract.underlyingToShares(amount * require_onchain_constants_math.PERCENTAGE_FACTOR / (require_onchain_constants_math.PERCENTAGE_FACTOR - poolContract.withdrawFee), true) : amount;
244
225
  const tx = permit ? meta.zapper.redeemWithPermit(shares, wallet, permit.deadline, permit.v, permit.r, permit.s) : meta.zapper.redeem(shares, wallet);
245
226
  return {
246
227
  tx,
@@ -434,42 +415,10 @@ var PoolService = class extends require_onchain_base_SDKConstruct.SDKConstruct {
434
415
  chainId: this.chainId,
435
416
  pool: pool.address,
436
417
  underlyingToken: market.underlyingToken,
437
- netValue: this.sharesToUnderlying(pool.address, shares),
418
+ netValue: market.toUnderlyingAmount(pool.sharesToUnderlying(shares)),
438
419
  apy: { organicApy: require_onchain_market_math.rayToBps(pool.supplyRate) }
439
420
  };
440
421
  }
441
422
  };
442
- /**
443
- * Shares minted for `assets`, as `previewDeposit` would report them.
444
- *
445
- * Both directions convert through the diesel rate — underlying per RAY of
446
- * shares — because that is the rate the pool itself divides by, and the only
447
- * exact one the SDK holds: `totalAssets` is this rate multiplied out, so
448
- * converting back through it costs a wei on large amounts. Rounds down, as
449
- * minting does.
450
- */
451
- function toShares(pool, assets) {
452
- const { dieselRate } = pool;
453
- return dieselRate === 0n ? assets : assets * require_onchain_constants_math.RAY / dieselRate;
454
- }
455
- /**
456
- * Shares a withdrawal of `assets` burns, as `previewWithdraw` would report
457
- * them: {@link toShares} rounded the other way, since the burn has to cover
458
- * the payout the caller asked for.
459
- */
460
- function toSharesUp(pool, assets) {
461
- const { dieselRate } = pool;
462
- return dieselRate === 0n ? assets : (assets * require_onchain_constants_math.RAY + dieselRate - 1n) / dieselRate;
463
- }
464
- /**
465
- * Underlying paid out for `shares`, as `previewRedeem` would report it:
466
- * {@link toShares} run backwards, less the pool's withdrawal fee.
467
- */
468
- function toAssets(pool, shares) {
469
- const { dieselRate, withdrawFee } = pool;
470
- return (dieselRate === 0n ? shares : shares * dieselRate / require_onchain_constants_math.RAY) * (require_onchain_constants_math.PERCENTAGE_FACTOR - withdrawFee) / require_onchain_constants_math.PERCENTAGE_FACTOR;
471
- }
472
423
  //#endregion
473
424
  exports.PoolService = PoolService;
474
- exports.toShares = toShares;
475
- exports.toSharesUp = toSharesUp;
@@ -2,5 +2,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_pools_PoolService = require("./PoolService.js");
3
3
  require("./types.js");
4
4
  exports.PoolService = require_onchain_pools_PoolService.PoolService;
5
- exports.toShares = require_onchain_pools_PoolService.toShares;
6
- exports.toSharesUp = require_onchain_pools_PoolService.toSharesUp;
@@ -1,29 +1,48 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_abi_iERC20 = require("../../abi/iERC20.js");
2
3
  const require_model_result = require("../../model/result.js");
3
4
  require("../../model/index.js");
5
+ const require_preview_simulate_errors = require("../simulate/errors.js");
4
6
  const require_preview_simulate_simulatePoolOperation = require("../simulate/simulatePoolOperation.js");
5
- require("../simulate/index.js");
6
7
  //#region src/preview/preview/previewPoolPositionOperation.ts
7
8
  async function previewPoolPositionOperation(input, operation, options) {
8
- const { sdk, to, calldata } = input;
9
+ const { sdk } = input;
9
10
  const { tokenIn, tokenOut } = operation;
10
11
  const market = sdk.marketRegister.findByPool(operation.pool);
11
- const answer = await require_preview_simulate_simulatePoolOperation.simulatePoolOperation({
12
- sdk,
13
- operation,
14
- to,
15
- calldata
16
- }, options);
17
- if (require_model_result.isSDKError(answer)) return answer;
18
- const sim = answer.data;
12
+ const pool = market.pool.pool;
13
+ const holder = "owner" in operation ? operation.owner : operation.receiver;
14
+ let previewAmount;
15
+ let shares;
16
+ try {
17
+ [previewAmount, shares] = await sdk.client.multicall({
18
+ contracts: [require_preview_simulate_simulatePoolOperation.previewContract(operation), {
19
+ address: operation.pool,
20
+ abi: require_abi_iERC20.ierc20Abi,
21
+ functionName: "balanceOf",
22
+ args: [holder]
23
+ }],
24
+ allowFailure: false,
25
+ batchSize: 0,
26
+ blockNumber: options?.blockNumber
27
+ });
28
+ } catch (cause) {
29
+ const error = require_preview_simulate_errors.asPreviewSimulationError(cause, "multicall");
30
+ options?.logger?.error(error, "pool operation simulation failed");
31
+ return require_model_result.sdkErr(error);
32
+ }
33
+ const sim = require_preview_simulate_simulatePoolOperation.amountsInOut(operation, previewAmount);
34
+ const inflow = operation.operation === "Deposit" || operation.operation === "Mint";
35
+ const after = shares + (inflow ? sim.amountOut : -sim.amountIn);
19
36
  return require_model_result.sdkOk({
20
37
  operation: operation.operation,
21
38
  pool: operation.pool,
22
39
  name: sdk.tokensMeta.mustGetToken(operation.pool).name,
23
40
  underlyingToken: market.underlyingToken,
24
- shareRate: market.pool.pool.dieselRate,
41
+ shareRate: pool.dieselRate,
25
42
  tokenIn: market.priceOracle.toTokenAmount(tokenIn, sim.amountIn),
26
- tokenOut: market.priceOracle.toTokenAmount(tokenOut, sim.amountOut)
43
+ tokenOut: market.priceOracle.toTokenAmount(tokenOut, sim.amountOut),
44
+ curator: market.curator,
45
+ netValue: market.toUnderlyingAmount(pool.sharesToUnderlying(after > 0n ? after : 0n))
27
46
  });
28
47
  }
29
48
  //#endregion
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_preview_simulate_errors = require("./errors.js");
3
- const require_preview_simulate_simulateFacadeOperation = require("./simulateFacadeOperation.js");
4
3
  const require_preview_simulate_simulatePoolOperation = require("./simulatePoolOperation.js");
4
+ const require_preview_simulate_simulateFacadeOperation = require("./simulateFacadeOperation.js");
5
5
  const require_preview_simulate_simulateRWAOperation = require("./simulateRWAOperation.js");
6
6
  const require_preview_simulate_simulateOperation = require("./simulateOperation.js");
7
7
  exports.asPreviewSimulationError = require_preview_simulate_errors.asPreviewSimulationError;
@@ -3,8 +3,8 @@ const require_model_result = require("../../model/result.js");
3
3
  require("../../model/index.js");
4
4
  const require_preview_parse_types = require("../parse/types.js");
5
5
  require("../parse/index.js");
6
- const require_preview_simulate_simulateFacadeOperation = require("./simulateFacadeOperation.js");
7
6
  const require_preview_simulate_simulatePoolOperation = require("./simulatePoolOperation.js");
7
+ const require_preview_simulate_simulateFacadeOperation = require("./simulateFacadeOperation.js");
8
8
  const require_preview_simulate_simulateRWAOperation = require("./simulateRWAOperation.js");
9
9
  //#region src/preview/simulate/simulateOperation.ts
10
10
  /**
@@ -104,4 +104,6 @@ async function simulatePoolOperation(input, options = {}) {
104
104
  }
105
105
  }
106
106
  //#endregion
107
+ exports.amountsInOut = amountsInOut;
108
+ exports.previewContract = previewContract;
107
109
  exports.simulatePoolOperation = simulatePoolOperation;
@@ -552,14 +552,13 @@ function routed(result, at) {
552
552
  * a screen can show.
553
553
  **/
554
554
  async function lpState(sdk, pool, wallet, simulation, moved) {
555
- const after = await sdk.pools.getShareBalance({
556
- pool,
557
- wallet
558
- }) + (moved.mints ?? -moved.burns);
555
+ const market = sdk.marketRegister.findByPool(pool);
556
+ const poolContract = market.pool.pool;
557
+ const after = await poolContract.getShareBalance(wallet) + (moved.mints ?? -moved.burns);
559
558
  return {
560
559
  ...simulation,
561
- curator: sdk.marketRegister.findByPool(pool).curator,
562
- positionAfter: sdk.pools.sharesToUnderlying(pool, after > 0n ? after : 0n)
560
+ curator: market.curator,
561
+ netValue: market.toUnderlyingAmount(poolContract.sharesToUnderlying(after > 0n ? after : 0n))
563
562
  };
564
563
  }
565
564
  /**
@@ -1,5 +1,5 @@
1
- import { ierc20Abi } from "../abi/iERC20.js";
2
1
  import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
2
+ import { ierc20Abi } from "../abi/iERC20.js";
3
3
  import { AddressMap } from "../onchain/utils/AddressMap.js";
4
4
  import { AddressSet } from "../onchain/utils/AddressSet.js";
5
5
  import { AssetsMap } from "../onchain/utils/AssetsMap.js";
@@ -1,6 +1,6 @@
1
- import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
2
1
  import { getNetworkType } from "../onchain/chain/chains.js";
3
2
  import { getWithdrawalCompressorAddress } from "../onchain/accounts/withdrawal-compressor/addresses.js";
3
+ import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
4
4
  import "../onchain/index.js";
5
5
  import { iMidasDataFeedAbi, iMidasRedemptionVaultAbi, midasGatewayAbi, midasRedeemerAbi, midasRedemptionVaultPhantomTokenAbi, securitizeRedeemerAbi, securitizeRedemptionGatewayAbi, securitizeRedemptionPhantomTokenAbi } from "./withdrawalAbi.js";
6
6
  import { erc20Abi, hexToString, parseAbi, parseEther } from "viem";
@@ -1,5 +1,3 @@
1
- import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
2
- import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
3
1
  import { AP_REWARDS_COMPRESSOR } from "../constants/address-provider.js";
4
2
  import { ADDRESS_0X0 } from "../constants/addresses.js";
5
3
  import { MAX_UINT256 } from "../constants/math.js";
@@ -10,6 +8,8 @@ import "../base/index.js";
10
8
  import { AccountBotsService } from "./bots/AccountBotsService.js";
11
9
  import "./bots/index.js";
12
10
  import { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
11
+ import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
12
+ import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
13
13
  import { expectedBalanceDeltas } from "../market/credit/expectedBalanceDeltas.js";
14
14
  import "../market/index.js";
15
15
  import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
@@ -1,4 +1,3 @@
1
- import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
2
1
  import { AddressSet } from "../../utils/AddressSet.js";
3
2
  import { bytes32ToString } from "../../utils/bytes32ToString.js";
4
3
  import { ADDRESS_0X0 } from "../../constants/addresses.js";
@@ -20,6 +19,7 @@ import { SecuritizeLiquidatorContract } from "../../market/rwa/securitize/Securi
20
19
  import "../../market/rwa/securitize/index.js";
21
20
  import "../../market/index.js";
22
21
  import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
22
+ import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
23
23
  import { skipLiquidatableAccount } from "./skipLiquidatableAccount.js";
24
24
  //#region src/onchain/accounts/liquidations/LiquidationsService.ts
25
25
  /**
@@ -1,9 +1,9 @@
1
- import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
2
1
  import { BaseContract } from "../../base/BaseContract.js";
3
2
  import "../../base/index.js";
4
3
  import { sdkErr, sdkOk } from "../../../model/result.js";
5
4
  import "../../../model/index.js";
6
5
  import { decodeDelayedIntent } from "./intent-codec.js";
6
+ import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
7
7
  //#region src/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.ts
8
8
  const abi = iRedemptionLoggerV310Abi;
9
9
  /**
@@ -1,5 +1,5 @@
1
- import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
2
1
  import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
2
+ import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
3
3
  //#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.ts
4
4
  const abi = iWithdrawalCompressorV310Abi;
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
2
1
  import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
2
+ import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
3
3
  //#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.ts
4
4
  const abi = iWithdrawalCompressorV311Abi;
5
5
  /**
@@ -1,6 +1,6 @@
1
- import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
2
1
  import { encodeDelayedIntent } from "./intent-codec.js";
3
2
  import { AbstractWithdrawalCompressorContract, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./AbstractWithdrawalCompressorContract.js";
3
+ import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
4
4
  import { toWithdrawalStatus } from "./types.js";
5
5
  //#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.ts
6
6
  const abi = iWithdrawalCompressorV313Abi;
@@ -1,12 +1,12 @@
1
- import { iExpirableAbi } from "../../abi/iExpirable.js";
2
- import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
3
- import { iVersionAbi } from "../../abi/iVersion.js";
4
1
  import { AddressMap } from "../utils/AddressMap.js";
5
2
  import { AddressSet } from "../utils/AddressSet.js";
6
3
  import { bytes32ToString } from "../utils/bytes32ToString.js";
7
4
  import { getAssetType } from "../chain/chains.js";
8
5
  import { formatBN } from "../utils/formatter.js";
9
6
  import "../utils/index.js";
7
+ import { iExpirableAbi } from "../../abi/iExpirable.js";
8
+ import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
9
+ import { iVersionAbi } from "../../abi/iVersion.js";
10
10
  import { SdkRWADataNotLoadedError } from "../core/errors.js";
11
11
  import { executeMulticallBatches } from "../utils/viem/executeMulticallBatches.js";
12
12
  //#region src/onchain/base/TokensMeta.ts
@@ -1,8 +1,8 @@
1
- import { iVersionAbi } from "../../abi/iVersion.js";
2
1
  import { AP_MARKET_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR } from "../constants/address-provider.js";
3
2
  import { isV310 } from "../constants/versions.js";
4
3
  import "../constants/index.js";
5
4
  import { hexEq } from "../utils/hex.js";
5
+ import { iVersionAbi } from "../../abi/iVersion.js";
6
6
  import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
7
7
  //#region src/onchain/core/createAddressProvider.ts
8
8
  const OVERRIDE_ADDRESSES = { Mainnet: {
@@ -224,7 +224,7 @@ import "./opportunities/index.js";
224
224
  import { BasePlugin } from "./plugins/BasePlugin.js";
225
225
  import { PluginStateVersionError } from "./plugins/errors.js";
226
226
  import "./plugins/index.js";
227
- import { PoolService, toShares, toSharesUp } from "./pools/PoolService.js";
227
+ import { PoolService } from "./pools/PoolService.js";
228
228
  import "./pools/index.js";
229
229
  import { calcBorrowRate } from "./positions/calcBorrowRate.js";
230
230
  import { calcHealthFactor } from "./positions/calcHealthFactor.js";
@@ -244,4 +244,4 @@ import { MultichainSDK } from "./MultichainSDK.js";
244
244
  import { attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
245
245
  import "./types/index.js";
246
246
  import "./validation/index.js";
247
- export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, borrowable, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, childLogger, classifyCurveOperation, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isMalformedPreviewError, isPhantomToken, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, raise, rayToBps, rayToNumber, refuse, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
247
+ export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, borrowable, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, childLogger, classifyCurveOperation, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isMalformedPreviewError, isPhantomToken, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, raise, rayToBps, rayToNumber, refuse, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
@@ -127,6 +127,14 @@ var MarketSuite = class extends SDKConstruct {
127
127
  };
128
128
  }
129
129
  /**
130
+ * Whether `token` is this market's pool underlying or the asset it wraps
131
+ * (dcUSDC or USDC on an RWA pool). Amounts in either unit are 1:1 with the
132
+ * figure {@link toUnderlyingAmount} reports.
133
+ */
134
+ isUnderlyingLike(token) {
135
+ return isAddressEqual(token, this.underlying) || isAddressEqual(token, this.unwrappedUnderlying);
136
+ }
137
+ /**
130
138
  * Prices a figure already denominated in this market's underlying — a debt,
131
139
  * a TVL, a payout — as the read model reports one.
132
140
  *
@@ -165,7 +173,7 @@ var MarketSuite = class extends SDKConstruct {
165
173
  seen.upsert(this.unwrappedUnderlying, this.underlyingToken);
166
174
  for (const zapper of this.sdk.marketRegister.poolZappers(this.pool.pool.address)) {
167
175
  const tokenIn = zapper.tokenIn.addr;
168
- if (isAddressEqual(tokenIn, this.pool.underlying) || isAddressEqual(tokenIn, this.unwrappedUnderlying)) continue;
176
+ if (this.isUnderlyingLike(tokenIn)) continue;
169
177
  seen.upsert(tokenIn, this.tokensMeta.mustGetToken(tokenIn));
170
178
  }
171
179
  return seen.values();
@@ -1,5 +1,5 @@
1
- import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
2
1
  import { AbstractAdapterContract } from "./AbstractAdapter.js";
2
+ import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
3
3
  //#region src/onchain/market/adapters/contracts/AccountMigratorAdapterContract.ts
4
4
  const abi = accountMigratorAbi;
5
5
  const protocolAbi = accountMigratorAbi;
@@ -1,6 +1,6 @@
1
- import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
2
1
  import { MissingSerializedParamsError } from "../../../base/errors.js";
3
2
  import "../../../base/index.js";
3
+ import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
4
4
  import { iERC4626Abi } from "../abi/targetContractAbi.js";
5
5
  import { fnSigToName, swapFromTransfers } from "../transferHelpers.js";
6
6
  import { AbstractAdapterContract } from "./AbstractAdapter.js";
@@ -1,7 +1,7 @@
1
- import { iPausableAbi } from "../../../abi/iPausable.js";
2
1
  import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
3
2
  import { BaseContract } from "../../base/BaseContract.js";
4
3
  import "../../base/index.js";
4
+ import { iPausableAbi } from "../../../abi/iPausable.js";
5
5
  //#region src/onchain/market/credit/CreditFacadeV310BaseContract.ts
6
6
  const abi = [
7
7
  ...iCreditFacadeV310Abi,
@@ -391,8 +391,7 @@ var CreditSuite = class extends SDKConstruct {
391
391
  */
392
392
  #allowedDepositTokens(targetCollateral) {
393
393
  const unwrappedUnderlying = this.market.unwrappedUnderlying;
394
- const contractUnderlying = this.underlying;
395
- const skip = (token) => isAddressEqual(token, unwrappedUnderlying) || isAddressEqual(token, contractUnderlying) || isAddressEqual(token, targetCollateral);
394
+ const skip = (token) => this.market.isUnderlyingLike(token) || isAddressEqual(token, targetCollateral);
396
395
  return [
397
396
  unwrappedUnderlying,
398
397
  targetCollateral,
@@ -1,4 +1,3 @@
1
- import { iPausableAbi } from "../../../abi/iPausable.js";
2
1
  import { iPoolV310Abi } from "../../../abi/310/generated.js";
3
2
  import { AddressMap } from "../../utils/AddressMap.js";
4
3
  import { RAY } from "../../constants/math.js";
@@ -8,6 +7,7 @@ import "../../utils/index.js";
8
7
  import { SdkRWADataNotLoadedError } from "../../core/errors.js";
9
8
  import { BaseContract } from "../../base/BaseContract.js";
10
9
  import "../../base/index.js";
10
+ import { iPausableAbi } from "../../../abi/iPausable.js";
11
11
  //#region src/onchain/market/pool/PoolV310Contract.ts
12
12
  const abi = [...iPoolV310Abi, ...iPausableAbi];
13
13
  var PoolV310Contract = class extends BaseContract {
@@ -50,6 +50,31 @@ var PoolV310Contract = class extends BaseContract {
50
50
  return this.totalSupply * this.dieselRate / RAY;
51
51
  }
52
52
  /**
53
+ * {@inheritDoc IPoolContract.getShareBalance}
54
+ */
55
+ async getShareBalance(wallet, blockNumber) {
56
+ return this.client.readContract({
57
+ address: this.address,
58
+ abi: this.abi,
59
+ functionName: "balanceOf",
60
+ args: [wallet],
61
+ blockNumber
62
+ });
63
+ }
64
+ /**
65
+ * {@inheritDoc IPoolContract.sharesToUnderlying}
66
+ */
67
+ sharesToUnderlying(shares) {
68
+ return this.dieselRate === 0n ? shares : shares * this.dieselRate / RAY;
69
+ }
70
+ /**
71
+ * {@inheritDoc IPoolContract.underlyingToShares}
72
+ */
73
+ underlyingToShares(underlying, roundUp = false) {
74
+ if (this.dieselRate === 0n) return underlying;
75
+ return roundUp ? (underlying * RAY + this.dieselRate - 1n) / this.dieselRate : underlying * RAY / this.dieselRate;
76
+ }
77
+ /**
53
78
  * {@inheritDoc IPoolContract.unwrappedUnderlying}
54
79
  */
55
80
  get unwrappedUnderlying() {
@@ -1,5 +1,5 @@
1
- import { iethZapperAbi } from "../../../abi/iETHZapper.js";
2
1
  import { ZapperContract } from "./ZapperContract.js";
2
+ import { iethZapperAbi } from "../../../abi/iETHZapper.js";
3
3
  //#region src/onchain/market/zapper/IETHZapperContract.ts
4
4
  const abi = iethZapperAbi;
5
5
  var IETHZapperContract = class extends ZapperContract {
@@ -1,8 +1,8 @@
1
- import { iZapperAbi } from "../../../abi/iZapper.js";
2
1
  import { BaseContract } from "../../base/BaseContract.js";
3
2
  import "../../base/index.js";
4
3
  import { sdkErr, sdkOk } from "../../../model/result.js";
5
4
  import "../../../model/index.js";
5
+ import { iZapperAbi } from "../../../abi/iZapper.js";
6
6
  //#region src/onchain/market/zapper/ZapperContract.ts
7
7
  /**
8
8
  * Base contract for every Gearbox zapper. Specialized zappers (e.g.