@1delta/margin-fetcher 5.0.33 → 5.0.34
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/index.d.ts +5 -0
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -3468,6 +3468,11 @@ interface FraxlendPairRaw {
|
|
|
3468
3468
|
* THE gate for native looping. Owner-mutable in both directions and set per
|
|
3469
3469
|
* pair, so it can never be cached across a roster or inferred from config.
|
|
3470
3470
|
* `false` here means `leveragedPosition` reverts `BadSwapper()`.
|
|
3471
|
+
*
|
|
3472
|
+
* It is ANDed with the swapper's OWN global kill switch (`shutoff()`, read
|
|
3473
|
+
* once per roster) before it is published, because the two failures are
|
|
3474
|
+
* indistinguishable to a caller: while the lever is shut off every loop
|
|
3475
|
+
* reverts `ShutOff()` on every pair, and nothing on the pair says so.
|
|
3471
3476
|
*/
|
|
3472
3477
|
leverageSwapperApproved: boolean;
|
|
3473
3478
|
/** Echo of which swapper was probed, so a consumer can encode the loop
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { fetchTokenLists, fetchTokenList, aavePools, compoundV3Pools, initConfig
|
|
|
7
7
|
import lodash from 'lodash';
|
|
8
8
|
import { Chain } from '@1delta/chain-registry';
|
|
9
9
|
import { multicallRetryUniversal, getEvmClient, getEvmChain, getEvmClientUniversal } from '@1delta/providers';
|
|
10
|
-
import { LiquityTroveManagerAbi, LiquityActivePoolAbi, LiquityStabilityPoolAbi, LiquityPriceFeedAbi, LiquitySortedTrovesAbi, RiverTroveManagerAbi, RiverStabilityPoolAbi, TellerMarketRegistryAbi, TellerV2Abi, InverseMarketAbi, InverseOracleAbi, InverseDbrAbi, Erc20Abi, LlamaLendControllerAbi, LlamaLendControllerV1Abi, LlamaLendControllerV2Abi, LlamaLendVaultAbi, LlamaLendAmmAbi, MetaMorphoAbi, ExactlyPreviewerAbi, ExactlyAuditorAbi, LenderCommitmentGroupAbi, ResupplyRegistryAbi, ResupplyPairAbi, ResupplyUtilitiesAbi, ResupplyRewardHandlerAbi, ResupplyPairEmissionsAbi, ConvexPoolUtilAbi, FraxlendPairAbi, FrankencoinPositionAbi, FluidLendingResolverAbi, FluidVaultResolverAbi, FluidLiquidityResolverAbi, MoolahVaultAbi, UsddVatAbi, UsddJugAbi, UsddSpotAbi, MorphoLensAbi, AaveV4SpokeAbi, AaveV4OracleAbi, AaveV4HubAbi, DolomiteMarginAbi, GearboxMarketCompressorV310Abi, MorphoBlueAbi, MidnightAbi, TermRepoTokenAbi, TermRepoServicerAbi, TermRepoCollateralManagerAbi, LiquityTroveNFTAbi, LiquityCollSurplusPoolAbi, TellerCollateralManagerAbi, TermMaxViewerAbi, InverseEscrowAbi, CurvanceMarketManagerAbi, CurvanceCTokenAbi, GearboxCreditAccountCompressorV310Abi, UsddCdpManagerAbi, UsddProxyRegistryAbi, CurvanceProtocolReaderAbi, CurvanceCentralRegistryAbi, TermPriceConsumerAbi, CurvanceOracleManagerAbi, TermMaxOracleAggregatorV2Abi } from '@1delta/abis';
|
|
10
|
+
import { LiquityTroveManagerAbi, LiquityActivePoolAbi, LiquityStabilityPoolAbi, LiquityPriceFeedAbi, LiquitySortedTrovesAbi, RiverTroveManagerAbi, RiverStabilityPoolAbi, TellerMarketRegistryAbi, TellerV2Abi, InverseMarketAbi, InverseOracleAbi, InverseDbrAbi, Erc20Abi, LlamaLendControllerAbi, LlamaLendControllerV1Abi, LlamaLendControllerV2Abi, LlamaLendVaultAbi, LlamaLendAmmAbi, MetaMorphoAbi, ExactlyPreviewerAbi, ExactlyAuditorAbi, LenderCommitmentGroupAbi, ResupplyRegistryAbi, ResupplyPairAbi, ResupplyUtilitiesAbi, ResupplyRewardHandlerAbi, ResupplyPairEmissionsAbi, ConvexPoolUtilAbi, FraxlendPairAbi, FraxlendLeverAbi, FrankencoinPositionAbi, FluidLendingResolverAbi, FluidVaultResolverAbi, FluidLiquidityResolverAbi, MoolahVaultAbi, UsddVatAbi, UsddJugAbi, UsddSpotAbi, MorphoLensAbi, AaveV4SpokeAbi, AaveV4OracleAbi, AaveV4HubAbi, DolomiteMarginAbi, GearboxMarketCompressorV310Abi, MorphoBlueAbi, MidnightAbi, TermRepoTokenAbi, TermRepoServicerAbi, TermRepoCollateralManagerAbi, LiquityTroveNFTAbi, LiquityCollSurplusPoolAbi, TellerCollateralManagerAbi, TermMaxViewerAbi, InverseEscrowAbi, CurvanceMarketManagerAbi, CurvanceCTokenAbi, GearboxCreditAccountCompressorV310Abi, UsddCdpManagerAbi, UsddProxyRegistryAbi, CurvanceProtocolReaderAbi, CurvanceCentralRegistryAbi, TermPriceConsumerAbi, CurvanceOracleManagerAbi, TermMaxOracleAggregatorV2Abi } from '@1delta/abis';
|
|
11
11
|
export { MorphoLensAbi } from '@1delta/abis';
|
|
12
12
|
import { prepareDebitDataMulticall, prepareLenderDebitMulticall, parseDebitDataResult, parseLenderDebitResult, getPermit2ContractAddress, getLstAcceptedInputs, getCompoundV3CometAddress as getCompoundV3CometAddress$1, getMorphoAddress, getAaveCollateralTokenAddress, getSiloHalfForUnderlying, bandLtvCurve, InitMarginAddresses } from '@1delta/calldata-sdk';
|
|
13
13
|
import { proxyNativeFetch } from '@1delta/proxy-fetch';
|
|
@@ -24095,12 +24095,18 @@ async function fetchFraxlendPairs(lender, chainId) {
|
|
|
24095
24095
|
{ address: pair, name: "isLiquidatePaused", params: [] },
|
|
24096
24096
|
{ address: pair, name: "isInterestPaused", params: [] }
|
|
24097
24097
|
]);
|
|
24098
|
+
if (swapper) {
|
|
24099
|
+
pauseCalls.push({ address: swapper, name: "shutoff", params: [] });
|
|
24100
|
+
}
|
|
24098
24101
|
const pauseRes = await multicallRetryUniversal({
|
|
24099
24102
|
chain: chainId,
|
|
24100
24103
|
calls: pauseCalls,
|
|
24101
|
-
abi: pauseCalls.map(
|
|
24104
|
+
abi: pauseCalls.map(
|
|
24105
|
+
(c) => c.name === "shutoff" ? FraxlendLeverAbi : FraxlendPairAbi
|
|
24106
|
+
),
|
|
24102
24107
|
allowFailure: true
|
|
24103
24108
|
}).catch(() => []);
|
|
24109
|
+
const swapperShutoff = swapper ? bool(pauseRes?.[pauseCalls.length - 1]) : false;
|
|
24104
24110
|
const partials = [];
|
|
24105
24111
|
addresses.forEach((pair, i) => {
|
|
24106
24112
|
const s = res.slice(i * PAIR_READS, i * PAIR_READS + PAIR_READS);
|
|
@@ -24142,8 +24148,12 @@ async function fetchFraxlendPairs(lender, chainId) {
|
|
|
24142
24148
|
protocolLiquidationFee: 0n,
|
|
24143
24149
|
depositLimit: big3(depositLimit),
|
|
24144
24150
|
borrowLimit: big3(borrowLimit),
|
|
24145
|
-
totalAssetAmount: big3(
|
|
24146
|
-
|
|
24151
|
+
totalAssetAmount: big3(
|
|
24152
|
+
totalAsset.amount ?? totalAsset[0]
|
|
24153
|
+
),
|
|
24154
|
+
totalAssetShares: big3(
|
|
24155
|
+
totalAsset.shares ?? totalAsset[1]
|
|
24156
|
+
),
|
|
24147
24157
|
totalBorrowAmount: big3(
|
|
24148
24158
|
totalBorrow.amount ?? totalBorrow[0]
|
|
24149
24159
|
),
|
|
@@ -24173,7 +24183,7 @@ async function fetchFraxlendPairs(lender, chainId) {
|
|
|
24173
24183
|
isInterestPaused: bool(p[3]),
|
|
24174
24184
|
// Only meaningful when a swapper is configured; with none, the probe was
|
|
24175
24185
|
// against the zero address and must never read as "leverage available".
|
|
24176
|
-
leverageSwapperApproved: !!swapper && bool(swapperOk),
|
|
24186
|
+
leverageSwapperApproved: !!swapper && bool(swapperOk) && !swapperShutoff,
|
|
24177
24187
|
leverageSwapper: swapper
|
|
24178
24188
|
});
|
|
24179
24189
|
});
|
|
@@ -43942,6 +43952,7 @@ var RATE_ABI2 = [
|
|
|
43942
43952
|
];
|
|
43943
43953
|
var ZCHF_SAVINGS_KEY = "ZCHF_SAVINGS";
|
|
43944
43954
|
var zchfSavingsKey = (chainId) => chainId === Chain.ETHEREUM_MAINNET ? ZCHF_SAVINGS_KEY : `${ZCHF_SAVINGS_KEY}::${chainId}`;
|
|
43955
|
+
var SVZCHF_GROUP_KEY = "SavingsVault ZCHF::svZCHF";
|
|
43945
43956
|
var aprFromRatePPM = (ppm) => Number(ppm) / 1e4;
|
|
43946
43957
|
var fetchRateOnChain = async (d) => {
|
|
43947
43958
|
const [ppm] = await multicallRetryUniversal({
|
|
@@ -43999,6 +44010,8 @@ var frankencoinSavingsFetcher = {
|
|
|
43999
44010
|
}
|
|
44000
44011
|
failures.push(`${d.chainId}: ${String(leg.reason)}`);
|
|
44001
44012
|
});
|
|
44013
|
+
const ethRate = out[zchfSavingsKey(Chain.ETHEREUM_MAINNET)];
|
|
44014
|
+
if (ethRate !== void 0) out[SVZCHF_GROUP_KEY] = ethRate;
|
|
44002
44015
|
if (Object.keys(out).length === 0) {
|
|
44003
44016
|
throw new Error(
|
|
44004
44017
|
`Frankencoin: every savings module failed (${failures.join("; ")}${apiLeg instanceof Error ? `; api: ${apiLeg.message}` : ""})`
|