@gearbox-protocol/sdk 16.0.0-next.7 → 16.0.0-next.8
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.
- package/dist/cjs/onchain/accounts/intents/math.js +2 -2
- package/dist/cjs/onchain/accounts/intents/maxWithdrawCollateral.js +2 -5
- package/dist/cjs/onchain/utils/bigint-math.js +9 -0
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/onchain/accounts/intents/math.js +2 -2
- package/dist/esm/onchain/accounts/intents/maxWithdrawCollateral.js +2 -5
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/onchain/base/TokensMeta.js +3 -3
- package/dist/esm/onchain/chain/detectNetwork.js +1 -1
- package/dist/esm/onchain/core/createAddressProvider.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/onchain/pools/PoolService.js +1 -1
- package/dist/esm/onchain/utils/bigint-math.js +9 -0
- package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/GearboxSDK.js +2 -2
- package/dist/types/onchain/utils/bigint-math.d.ts +9 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_onchain_utils_bigint_math = require("../../utils/bigint-math.js");
|
|
2
3
|
const require_onchain_constants_math = require("../../constants/math.js");
|
|
3
4
|
const require_onchain_accounts_intents_types = require("./types.js");
|
|
4
5
|
//#region src/onchain/accounts/intents/math.ts
|
|
@@ -32,10 +33,9 @@ function maxProportionalWithdrawal(position, band) {
|
|
|
32
33
|
if (debt === 0n) return allButLast;
|
|
33
34
|
const repayable = debt - band.minDebt;
|
|
34
35
|
if (repayable < 0n) return 0n;
|
|
35
|
-
const bound = ceilDiv(collateral * (repayable + 1n), debt) - 1n;
|
|
36
|
+
const bound = require_onchain_utils_bigint_math.BigIntMath.ceilDiv(collateral * (repayable + 1n), debt) - 1n;
|
|
36
37
|
return bound < allButLast ? bound : allButLast;
|
|
37
38
|
}
|
|
38
|
-
const ceilDiv = (a, b) => (a + b - 1n) / b;
|
|
39
39
|
/** Total leverage cannot drop below 1x — that would be negative debt. */
|
|
40
40
|
function assertLeverageAtLeastOne(leverage) {
|
|
41
41
|
if (leverage < 100n) throw new require_onchain_accounts_intents_types.IntentPreviewError("leverageOutOfRange", `target leverage ${leverage} is below 1x`);
|
|
@@ -57,8 +57,8 @@ function maxWithdrawCollateral(props) {
|
|
|
57
57
|
const targetLt = BigInt(creditManager.liquidationThresholds.get(target.token) ?? 0);
|
|
58
58
|
const targetUsd = safeUsd(priceOracle, target.token, target.balance);
|
|
59
59
|
if (targetLt === 0n || !targetUsd) return 0n;
|
|
60
|
-
const keptUsd = ceilDiv(shortfall, targetLt);
|
|
61
|
-
const kept = ceilDiv(target.balance * keptUsd, targetUsd);
|
|
60
|
+
const keptUsd = require_onchain_utils_bigint_math.BigIntMath.ceilDiv(shortfall, targetLt);
|
|
61
|
+
const kept = require_onchain_utils_bigint_math.BigIntMath.ceilDiv(target.balance * keptUsd, targetUsd);
|
|
62
62
|
return kept >= target.balance ? 0n : target.balance - kept;
|
|
63
63
|
}
|
|
64
64
|
/** USD value at the main feed, or `undefined` when the token has no price. */
|
|
@@ -82,8 +82,5 @@ function safeUsd(oracle, token, amount) {
|
|
|
82
82
|
return main;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
function ceilDiv(a, b) {
|
|
86
|
-
return (a + b - 1n) / b;
|
|
87
|
-
}
|
|
88
85
|
//#endregion
|
|
89
86
|
exports.maxWithdrawCollateral = maxWithdrawCollateral;
|
|
@@ -42,6 +42,15 @@ var BigIntMath = class {
|
|
|
42
42
|
* @returns A non-positive bigint representation of `a`.
|
|
43
43
|
*/
|
|
44
44
|
static neg = (a) => a > 0 ? a * -1n : a;
|
|
45
|
+
/**
|
|
46
|
+
* Divides rounding toward positive infinity.
|
|
47
|
+
*
|
|
48
|
+
* @param a - Dividend; must not be negative.
|
|
49
|
+
* @param b - Divisor; must be positive — zero throws, negative returns
|
|
50
|
+
* nonsense rather than the ceiling.
|
|
51
|
+
* @returns The smallest integer that is at least `a / b`.
|
|
52
|
+
**/
|
|
53
|
+
static ceilDiv = (a, b) => (a + b - 1n) / b;
|
|
45
54
|
};
|
|
46
55
|
//#endregion
|
|
47
56
|
exports.BigIntMath = BigIntMath;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { ierc20Abi } from "../abi/iERC20.js";
|
|
1
2
|
import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
|
|
2
3
|
import { AddressMap } from "../onchain/utils/AddressMap.js";
|
|
3
4
|
import { AddressSet } from "../onchain/utils/AddressSet.js";
|
|
4
5
|
import { AssetsMap } from "../onchain/utils/AssetsMap.js";
|
|
5
6
|
import { childLogger } from "../onchain/utils/childLogger.js";
|
|
6
|
-
import { ierc20Abi } from "../abi/iERC20.js";
|
|
7
7
|
import "../onchain/constants/addresses.js";
|
|
8
8
|
import { MAX_UINT256, PERCENTAGE_FACTOR } from "../onchain/constants/math.js";
|
|
9
9
|
import { SDKConstruct } from "../onchain/base/SDKConstruct.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
|
|
1
2
|
import { getNetworkType } from "../onchain/chain/chains.js";
|
|
2
3
|
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,3 +1,5 @@
|
|
|
1
|
+
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
2
|
+
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
1
3
|
import { AP_REWARDS_COMPRESSOR } from "../constants/address-provider.js";
|
|
2
4
|
import { ADDRESS_0X0 } from "../constants/addresses.js";
|
|
3
5
|
import { MAX_UINT256 } from "../constants/math.js";
|
|
@@ -8,8 +10,6 @@ import "../base/index.js";
|
|
|
8
10
|
import { AccountBotsService } from "./bots/AccountBotsService.js";
|
|
9
11
|
import "./bots/index.js";
|
|
10
12
|
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,3 +1,4 @@
|
|
|
1
|
+
import { BigIntMath } from "../../utils/bigint-math.js";
|
|
1
2
|
import { LEVERAGE_DECIMALS } from "../../constants/math.js";
|
|
2
3
|
import { IntentPreviewError } from "./types.js";
|
|
3
4
|
//#region src/onchain/accounts/intents/math.ts
|
|
@@ -31,10 +32,9 @@ function maxProportionalWithdrawal(position, band) {
|
|
|
31
32
|
if (debt === 0n) return allButLast;
|
|
32
33
|
const repayable = debt - band.minDebt;
|
|
33
34
|
if (repayable < 0n) return 0n;
|
|
34
|
-
const bound = ceilDiv(collateral * (repayable + 1n), debt) - 1n;
|
|
35
|
+
const bound = BigIntMath.ceilDiv(collateral * (repayable + 1n), debt) - 1n;
|
|
35
36
|
return bound < allButLast ? bound : allButLast;
|
|
36
37
|
}
|
|
37
|
-
const ceilDiv = (a, b) => (a + b - 1n) / b;
|
|
38
38
|
/** Total leverage cannot drop below 1x — that would be negative debt. */
|
|
39
39
|
function assertLeverageAtLeastOne(leverage) {
|
|
40
40
|
if (leverage < 100n) throw new IntentPreviewError("leverageOutOfRange", `target leverage ${leverage} is below 1x`);
|
|
@@ -56,8 +56,8 @@ function maxWithdrawCollateral(props) {
|
|
|
56
56
|
const targetLt = BigInt(creditManager.liquidationThresholds.get(target.token) ?? 0);
|
|
57
57
|
const targetUsd = safeUsd(priceOracle, target.token, target.balance);
|
|
58
58
|
if (targetLt === 0n || !targetUsd) return 0n;
|
|
59
|
-
const keptUsd = ceilDiv(shortfall, targetLt);
|
|
60
|
-
const kept = ceilDiv(target.balance * keptUsd, targetUsd);
|
|
59
|
+
const keptUsd = BigIntMath.ceilDiv(shortfall, targetLt);
|
|
60
|
+
const kept = BigIntMath.ceilDiv(target.balance * keptUsd, targetUsd);
|
|
61
61
|
return kept >= target.balance ? 0n : target.balance - kept;
|
|
62
62
|
}
|
|
63
63
|
/** USD value at the main feed, or `undefined` when the token has no price. */
|
|
@@ -81,8 +81,5 @@ function safeUsd(oracle, token, amount) {
|
|
|
81
81
|
return main;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
function ceilDiv(a, b) {
|
|
85
|
-
return (a + b - 1n) / b;
|
|
86
|
-
}
|
|
87
84
|
//#endregion
|
|
88
85
|
export { maxWithdrawCollateral };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
1
2
|
import { AddressSet } from "../../utils/AddressSet.js";
|
|
2
3
|
import { bytes32ToString } from "../../utils/bytes32ToString.js";
|
|
3
4
|
import { ADDRESS_0X0 } from "../../constants/addresses.js";
|
|
@@ -19,7 +20,6 @@ import { SecuritizeLiquidatorContract } from "../../market/rwa/securitize/Securi
|
|
|
19
20
|
import "../../market/rwa/securitize/index.js";
|
|
20
21
|
import "../../market/index.js";
|
|
21
22
|
import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
|
|
22
|
-
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
23
23
|
//#region src/onchain/accounts/liquidations/LiquidationsService.ts
|
|
24
24
|
/**
|
|
25
25
|
* Service for discovering liquidatable credit accounts and previewing manual
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
1
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
2
3
|
import "../../base/index.js";
|
|
3
4
|
import { decodeDelayedIntent } from "./intent-codec.js";
|
|
4
|
-
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
5
5
|
import { InvalidDelayedIntentError } from "./errors.js";
|
|
6
6
|
//#region src/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.ts
|
|
7
7
|
const abi = iRedemptionLoggerV310Abi;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
1
|
import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
|
|
2
|
+
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
3
3
|
//#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV310Abi;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
1
|
import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
|
|
2
|
+
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.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";
|
|
1
2
|
import { encodeDelayedIntent } from "./intent-codec.js";
|
|
2
3
|
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";
|
|
1
4
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
2
5
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
3
6
|
import { bytes32ToString } from "../utils/bytes32ToString.js";
|
|
4
7
|
import { getAssetType } from "../chain/chains.js";
|
|
5
8
|
import { formatBN } from "../utils/formatter.js";
|
|
6
9
|
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";
|
|
1
2
|
import { AP_MARKET_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR } from "../constants/address-provider.js";
|
|
2
3
|
import { isV310 } from "../constants/versions.js";
|
|
3
4
|
import "../constants/index.js";
|
|
4
5
|
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: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
2
1
|
import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
|
|
2
|
+
import { AbstractAdapterContract } from "./AbstractAdapter.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";
|
|
1
2
|
import { MissingSerializedParamsError } from "../../../base/errors.js";
|
|
2
3
|
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";
|
|
1
2
|
import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
|
|
2
3
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
4
|
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,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
1
2
|
import { iPoolV310Abi } from "../../../abi/310/generated.js";
|
|
2
3
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
3
4
|
import { RAY } from "../../constants/math.js";
|
|
@@ -7,7 +8,6 @@ import "../../utils/index.js";
|
|
|
7
8
|
import { SdkRWADataNotLoadedError } from "../../core/errors.js";
|
|
8
9
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
9
10
|
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 {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ZapperContract } from "./ZapperContract.js";
|
|
2
1
|
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
2
|
+
import { ZapperContract } from "./ZapperContract.js";
|
|
3
3
|
//#region src/onchain/market/zapper/IETHZapperContract.ts
|
|
4
4
|
const abi = iethZapperAbi;
|
|
5
5
|
var IETHZapperContract = class extends ZapperContract {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
1
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
2
3
|
import "../../base/index.js";
|
|
3
|
-
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
4
4
|
import { UnsupportedZapperFunctionError } from "./errors.js";
|
|
5
5
|
//#region src/onchain/market/zapper/ZapperContract.ts
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AddressSet } from "../utils/AddressSet.js";
|
|
2
1
|
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
2
|
+
import { AddressSet } from "../utils/AddressSet.js";
|
|
3
3
|
import "../constants/addresses.js";
|
|
4
4
|
import { PERCENTAGE_FACTOR, RAY } from "../constants/math.js";
|
|
5
5
|
import "../constants/index.js";
|
|
@@ -41,6 +41,15 @@ var BigIntMath = class {
|
|
|
41
41
|
* @returns A non-positive bigint representation of `a`.
|
|
42
42
|
*/
|
|
43
43
|
static neg = (a) => a > 0 ? a * -1n : a;
|
|
44
|
+
/**
|
|
45
|
+
* Divides rounding toward positive infinity.
|
|
46
|
+
*
|
|
47
|
+
* @param a - Dividend; must not be negative.
|
|
48
|
+
* @param b - Divisor; must be positive — zero throws, negative returns
|
|
49
|
+
* nonsense rather than the ceiling.
|
|
50
|
+
* @returns The smallest integer that is at least `a / b`.
|
|
51
|
+
**/
|
|
52
|
+
static ceilDiv = (a, b) => (a + b - 1n) / b;
|
|
44
53
|
};
|
|
45
54
|
//#endregion
|
|
46
55
|
export { BigIntMath };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { errorAbis } from "../../../abi/errors.js";
|
|
2
|
-
import { generateCastTraceCall } from "./cast.js";
|
|
3
2
|
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
3
|
+
import { generateCastTraceCall } from "./cast.js";
|
|
4
4
|
import { simulateMulticall } from "./simulateMulticall.js";
|
|
5
5
|
import { BaseError, CallExecutionError, ContractFunctionRevertedError, decodeFunctionData, decodeFunctionResult, encodeFunctionData, parseAbi } from "viem";
|
|
6
6
|
import { getAction, parseAccount } from "viem/utils";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iPoolV310Abi } from "../../abi/310/generated.js";
|
|
2
1
|
import { iZapperAbi } from "../../abi/iZapper.js";
|
|
2
|
+
import { iPoolV310Abi } from "../../abi/310/generated.js";
|
|
3
3
|
import { asPreviewSimulationError } from "./errors.js";
|
|
4
4
|
//#region src/preview/simulate/simulatePoolOperation.ts
|
|
5
5
|
function previewRead(operation) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
1
2
|
import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
|
|
2
3
|
import { AddressMap } from "../../onchain/utils/AddressMap.js";
|
|
3
|
-
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
4
4
|
import "../../onchain/index.js";
|
|
5
5
|
import { UnexpectedFacadeEventOrderError } from "./errors.js";
|
|
6
6
|
import { getAddress, isAddressEqual, parseEventLogs } from "viem";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { toChainIds } from "../onchain/chain/chains.js";
|
|
2
2
|
import { MultichainSDK } from "../onchain/MultichainSDK.js";
|
|
3
3
|
import "../onchain/index.js";
|
|
4
|
+
import { GearboxAPI } from "../offchain/GearboxAPI.js";
|
|
5
|
+
import "../offchain/index.js";
|
|
4
6
|
import { assertSameChains } from "./errors/assertSameChains.js";
|
|
5
7
|
import { MissingSourceError } from "./errors/MissingSourceError.js";
|
|
6
8
|
import "./errors/index.js";
|
|
7
|
-
import { GearboxAPI } from "../offchain/GearboxAPI.js";
|
|
8
|
-
import "../offchain/index.js";
|
|
9
9
|
import { LiquidationsNamespace } from "./liquidations/LiquidationsNamespace.js";
|
|
10
10
|
import "./liquidations/index.js";
|
|
11
11
|
import "./utils/mergeChains.js";
|
|
@@ -37,6 +37,15 @@ declare class BigIntMath {
|
|
|
37
37
|
* @returns A non-positive bigint representation of `a`.
|
|
38
38
|
*/
|
|
39
39
|
static neg: (a: bigint) => bigint;
|
|
40
|
+
/**
|
|
41
|
+
* Divides rounding toward positive infinity.
|
|
42
|
+
*
|
|
43
|
+
* @param a - Dividend; must not be negative.
|
|
44
|
+
* @param b - Divisor; must be positive — zero throws, negative returns
|
|
45
|
+
* nonsense rather than the ceiling.
|
|
46
|
+
* @returns The smallest integer that is at least `a / b`.
|
|
47
|
+
**/
|
|
48
|
+
static ceilDiv: (a: bigint, b: bigint) => bigint;
|
|
40
49
|
}
|
|
41
50
|
//#endregion
|
|
42
51
|
export { BigIntMath };
|