@defisaver/positions-sdk 2.1.158 → 2.1.159-shifter-v2-dev
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/cjs/aaveV2/index.js +2 -0
- package/cjs/config/contracts.d.ts +516 -4
- package/cjs/config/contracts.js +17 -5
- package/cjs/contracts.d.ts +120 -0
- package/cjs/fluid/index.d.ts +5 -0
- package/cjs/fluid/index.js +36 -1
- package/cjs/helpers/aaveHelpers/index.js +3 -0
- package/cjs/helpers/aaveV4Helpers/index.js +1 -0
- package/cjs/helpers/compoundHelpers/index.js +2 -0
- package/cjs/helpers/curveUsdHelpers/index.js +2 -0
- package/cjs/helpers/fluidHelpers/index.js +1 -0
- package/cjs/helpers/liquityV2Helpers/index.js +1 -0
- package/cjs/helpers/llamaLendHelpers/index.js +2 -0
- package/cjs/helpers/makerHelpers/index.d.ts +1 -1
- package/cjs/helpers/makerHelpers/index.js +2 -2
- package/cjs/helpers/morphoBlueHelpers/index.js +2 -0
- package/cjs/helpers/morphoMidnightHelpers/index.js +2 -0
- package/cjs/helpers/sparkHelpers/index.js +1 -0
- package/cjs/liquity/index.js +8 -1
- package/cjs/maker/index.d.ts +7 -2
- package/cjs/maker/index.js +32 -12
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +3 -1
- package/cjs/markets/maker/index.d.ts +1 -0
- package/cjs/markets/maker/index.js +13 -0
- package/cjs/morphoMidnight/index.js +3 -0
- package/cjs/portfolio/index.d.ts +5 -1
- package/cjs/portfolio/index.js +276 -0
- package/cjs/savings/index.js +6 -6
- package/cjs/savings/morphoVaults/index.d.ts +15 -3
- package/cjs/savings/morphoVaults/index.js +97 -26
- package/cjs/types/aave.d.ts +2 -0
- package/cjs/types/aaveV4.d.ts +1 -0
- package/cjs/types/compound.d.ts +2 -0
- package/cjs/types/fluid.d.ts +1 -0
- package/cjs/types/liquity.d.ts +1 -0
- package/cjs/types/liquityV2.d.ts +2 -0
- package/cjs/types/maker.d.ts +1 -0
- package/cjs/types/morphoBlue.d.ts +2 -0
- package/cjs/types/morphoMidnight.d.ts +2 -0
- package/cjs/types/portfolio.d.ts +26 -10
- package/cjs/types/spark.d.ts +2 -0
- package/esm/aaveV2/index.js +2 -0
- package/esm/config/contracts.d.ts +516 -4
- package/esm/config/contracts.js +17 -5
- package/esm/contracts.d.ts +120 -0
- package/esm/fluid/index.d.ts +5 -0
- package/esm/fluid/index.js +33 -0
- package/esm/helpers/aaveHelpers/index.js +3 -0
- package/esm/helpers/aaveV4Helpers/index.js +1 -0
- package/esm/helpers/compoundHelpers/index.js +2 -0
- package/esm/helpers/curveUsdHelpers/index.js +2 -0
- package/esm/helpers/fluidHelpers/index.js +1 -0
- package/esm/helpers/liquityV2Helpers/index.js +1 -0
- package/esm/helpers/llamaLendHelpers/index.js +2 -0
- package/esm/helpers/makerHelpers/index.d.ts +1 -1
- package/esm/helpers/makerHelpers/index.js +2 -2
- package/esm/helpers/morphoBlueHelpers/index.js +2 -0
- package/esm/helpers/morphoMidnightHelpers/index.js +2 -0
- package/esm/helpers/sparkHelpers/index.js +1 -0
- package/esm/liquity/index.js +8 -1
- package/esm/maker/index.d.ts +7 -2
- package/esm/maker/index.js +31 -13
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/markets/maker/index.d.ts +1 -0
- package/esm/markets/maker/index.js +10 -0
- package/esm/morphoMidnight/index.js +4 -1
- package/esm/portfolio/index.d.ts +5 -1
- package/esm/portfolio/index.js +278 -3
- package/esm/savings/index.js +6 -6
- package/esm/savings/morphoVaults/index.d.ts +15 -3
- package/esm/savings/morphoVaults/index.js +93 -24
- package/esm/types/aave.d.ts +2 -0
- package/esm/types/aaveV4.d.ts +1 -0
- package/esm/types/compound.d.ts +2 -0
- package/esm/types/fluid.d.ts +1 -0
- package/esm/types/liquity.d.ts +1 -0
- package/esm/types/liquityV2.d.ts +2 -0
- package/esm/types/maker.d.ts +1 -0
- package/esm/types/morphoBlue.d.ts +2 -0
- package/esm/types/morphoMidnight.d.ts +2 -0
- package/esm/types/portfolio.d.ts +26 -10
- package/esm/types/spark.d.ts +2 -0
- package/package.json +1 -1
- package/src/aaveV2/index.ts +2 -0
- package/src/config/contracts.ts +17 -5
- package/src/fluid/index.ts +40 -0
- package/src/helpers/aaveHelpers/index.ts +3 -0
- package/src/helpers/aaveV4Helpers/index.ts +1 -0
- package/src/helpers/compoundHelpers/index.ts +2 -0
- package/src/helpers/curveUsdHelpers/index.ts +2 -0
- package/src/helpers/fluidHelpers/index.ts +1 -0
- package/src/helpers/liquityV2Helpers/index.ts +1 -0
- package/src/helpers/llamaLendHelpers/index.ts +2 -0
- package/src/helpers/makerHelpers/index.ts +2 -1
- package/src/helpers/morphoBlueHelpers/index.ts +2 -0
- package/src/helpers/morphoMidnightHelpers/index.ts +2 -0
- package/src/helpers/sparkHelpers/index.ts +1 -0
- package/src/liquity/index.ts +8 -1
- package/src/maker/index.ts +62 -29
- package/src/markets/index.ts +2 -1
- package/src/markets/maker/index.ts +10 -0
- package/src/morphoMidnight/index.ts +4 -1
- package/src/portfolio/index.ts +259 -2
- package/src/savings/index.ts +6 -6
- package/src/savings/morphoVaults/index.ts +108 -27
- package/src/types/aave.ts +3 -0
- package/src/types/aaveV4.ts +1 -0
- package/src/types/compound.ts +2 -0
- package/src/types/fluid.ts +1 -0
- package/src/types/liquity.ts +2 -0
- package/src/types/liquityV2.ts +2 -0
- package/src/types/maker.ts +2 -0
- package/src/types/morphoBlue.ts +2 -0
- package/src/types/morphoMidnight.ts +2 -0
- package/src/types/portfolio.ts +31 -12
- package/src/types/spark.ts +2 -0
package/src/portfolio/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
CrvUsdMarkets,
|
|
8
8
|
LiquityV2Markets,
|
|
9
9
|
LlamaLendMarkets,
|
|
10
|
+
MakerActiveIlks,
|
|
10
11
|
MorphoBlueMarkets,
|
|
11
12
|
MorphoMidnightMarkets,
|
|
12
13
|
SparkMarkets,
|
|
@@ -27,6 +28,7 @@ import {
|
|
|
27
28
|
LlamaLendGlobalMarketData,
|
|
28
29
|
MorphoBlueMarketInfo,
|
|
29
30
|
MorphoMidnightMarketInfo,
|
|
31
|
+
PortfolioMarketsData,
|
|
30
32
|
PortfolioPositionsData,
|
|
31
33
|
SparkMarketsData,
|
|
32
34
|
} from '../types';
|
|
@@ -36,13 +38,13 @@ import { _getCurveUsdGlobalData, _getCurveUsdUserData } from '../curveUsd';
|
|
|
36
38
|
import { _getLlamaLendGlobalData, _getLlamaLendUserData } from '../llamaLend';
|
|
37
39
|
import { _getAaveV3AccountData, _getAaveV3MarketData, getStakeAaveData } from '../aaveV3';
|
|
38
40
|
import { ZERO_ADDRESS } from '../constants';
|
|
39
|
-
import { _getMakerCdpData, _getUserCdps } from '../maker';
|
|
41
|
+
import { _getMakerCdpData, _getMakerIlksData, _getUserCdps } from '../maker';
|
|
40
42
|
import { _getAaveV2AccountData, _getAaveV2MarketsData } from '../aaveV2';
|
|
41
43
|
import { _getCompoundV2AccountData, _getCompoundV2MarketsData } from '../compoundV2';
|
|
42
44
|
import { getViemProvider } from '../services/viem';
|
|
43
45
|
import { _getLiquityTroveInfo, getLiquityStakingData } from '../liquity';
|
|
44
46
|
import { _getLiquityV2MarketData, getLiquitySAndYBold, getLiquityV2Staking } from '../liquityV2';
|
|
45
|
-
import { _getAllUserEarnPositionsWithFTokens, _getUserPositionsPortfolio } from '../fluid';
|
|
47
|
+
import { _getAllFluidMarketDataPortfolio, _getAllUserEarnPositionsWithFTokens, _getUserPositionsPortfolio } from '../fluid';
|
|
46
48
|
import { getUmbrellaData } from '../umbrella';
|
|
47
49
|
import { getMerklUnclaimedRewards, getUnclaimedRewardsForAllMarkets } from '../claiming/aaveV3';
|
|
48
50
|
import { fetchSparkAirdropRewards, fetchSparkRewards } from '../claiming/spark';
|
|
@@ -479,6 +481,8 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
479
481
|
})).flat(),
|
|
480
482
|
...morphoMidnightMarkets.map((market) => addresses.map(async (address) => {
|
|
481
483
|
try {
|
|
484
|
+
// Markets are created lazily on the first position, so an uncreated one can hold no position.
|
|
485
|
+
if (!morphoMidnightMarketsData[market.value]?.isCreated) return;
|
|
482
486
|
const accData = await _getMorphoMidnightAccountData(client, network, address, market, morphoMidnightMarketsData[market.value]);
|
|
483
487
|
if (new Dec(accData.suppliedUsd).gt(0)) positions[address.toLowerCase() as EthAddress].morphoMidnight[market.value] = { error: '', data: accData };
|
|
484
488
|
} catch (error) {
|
|
@@ -589,4 +593,257 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
589
593
|
};
|
|
590
594
|
}
|
|
591
595
|
|
|
596
|
+
|
|
597
|
+
export async function getShifterPortfolioData(provider: EthereumProvider, network: NetworkNumber, defaultProvider: EthereumProvider, addresses: EthAddress[], isSim = false): Promise<{
|
|
598
|
+
positions: PortfolioPositionsData;
|
|
599
|
+
markets: PortfolioMarketsData;
|
|
600
|
+
}> {
|
|
601
|
+
const isMainnet = network === NetworkNumber.Eth;
|
|
602
|
+
const isFluidSupported = [NetworkNumber.Eth, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Plasma].includes(network);
|
|
603
|
+
|
|
604
|
+
const morphoMarkets = Object.values(MorphoBlueMarkets(network)).filter((market) => market.chainIds.includes(network));
|
|
605
|
+
const compoundV3Markets = Object.values(CompoundMarkets(network)).filter((market) => market.chainIds.includes(network) && market.value !== CompoundVersions.CompoundV2);
|
|
606
|
+
const sparkMarkets = Object.values(SparkMarkets(network)).filter((market) => market.chainIds.includes(network));
|
|
607
|
+
const aaveV3Markets = [AaveVersions.AaveV3, AaveVersions.AaveV3Lido, AaveVersions.AaveV3Etherfi].map((version) => AaveMarkets(network)[version]).filter((market) => market.chainIds.includes(network));
|
|
608
|
+
const aaveV2Markets = [AaveVersions.AaveV2].map((version) => AaveMarkets(network)[version]).filter((market) => market.chainIds.includes(network));
|
|
609
|
+
const compoundV2Markets = [CompoundVersions.CompoundV2].map((version) => CompoundMarkets(network)[version]).filter((market) => market.chainIds.includes(network));
|
|
610
|
+
const crvUsdMarkets = Object.values(CrvUsdMarkets(network)).filter((market) => market.chainIds.includes(network));
|
|
611
|
+
const llamaLendMarkets = [NetworkNumber.Eth, NetworkNumber.Arb].includes(network) ? Object.values(LlamaLendMarkets(network)).filter((market) => market.chainIds.includes(network)) : [];
|
|
612
|
+
const liquityV2Markets = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)) : [];
|
|
613
|
+
const aaveV4Spokes = Object.values(AaveV4Spokes(network)).filter((market) => market.chainIds.includes(network));
|
|
614
|
+
|
|
615
|
+
const args: [NetworkNumber, any?] = [network, { batch: { multicall: { batchSize: isSim ? 2_000 : 2_500_000 } } }];
|
|
616
|
+
const client = getViemProvider(provider, ...args);
|
|
617
|
+
const defaultClient = getViemProvider(defaultProvider, ...args);
|
|
618
|
+
|
|
619
|
+
const markets: PortfolioMarketsData = {
|
|
620
|
+
morphoMarketsData: {},
|
|
621
|
+
morphoMidnightMarketsData: {}, // Morpho Midnight is not fetched for the shifter; key kept so the payload shape is stable
|
|
622
|
+
compoundV3MarketsData: {},
|
|
623
|
+
sparkMarketsData: {},
|
|
624
|
+
aaveV3MarketsData: {},
|
|
625
|
+
aaveV2MarketsData: {},
|
|
626
|
+
compoundV2MarketsData: {},
|
|
627
|
+
crvUsdMarketsData: {},
|
|
628
|
+
llamaLendMarketsData: {},
|
|
629
|
+
liquityV2MarketsData: {},
|
|
630
|
+
aaveV4SpokesData: {},
|
|
631
|
+
fluidMarketsData: {},
|
|
632
|
+
makerMarketsData: {},
|
|
633
|
+
};
|
|
634
|
+
const makerCdps: Record<string, CdpInfo[]> = {};
|
|
635
|
+
|
|
636
|
+
const positions: PortfolioPositionsData = {};
|
|
637
|
+
|
|
638
|
+
for (const address of addresses) {
|
|
639
|
+
positions[address.toLowerCase() as EthAddress] = {
|
|
640
|
+
aaveV3: {},
|
|
641
|
+
aaveV4: {},
|
|
642
|
+
morphoBlue: {},
|
|
643
|
+
morphoMidnight: {}, // not fetched for the shifter (see markets above)
|
|
644
|
+
compoundV3: {},
|
|
645
|
+
spark: {},
|
|
646
|
+
maker: {},
|
|
647
|
+
aaveV2: {},
|
|
648
|
+
compoundV2: {},
|
|
649
|
+
liquity: {},
|
|
650
|
+
crvUsd: {},
|
|
651
|
+
llamaLend: {},
|
|
652
|
+
fluid: {
|
|
653
|
+
error: '',
|
|
654
|
+
data: {},
|
|
655
|
+
},
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
await Promise.allSettled([
|
|
660
|
+
// === MARKET DATA (needs to be fetched first) ===
|
|
661
|
+
...morphoMarkets.map(async (market) => {
|
|
662
|
+
markets.morphoMarketsData[market.value] = await _getMorphoBluePortfolioMarketData(client, network, market);
|
|
663
|
+
}),
|
|
664
|
+
...compoundV3Markets.map(async (market) => {
|
|
665
|
+
markets.compoundV3MarketsData[market.value] = await _getCompoundV3MarketsData(client, network, market, defaultClient);
|
|
666
|
+
}),
|
|
667
|
+
...sparkMarkets.map(async (market) => {
|
|
668
|
+
markets.sparkMarketsData[market.value] = await _getSparkMarketsData(client, network, market);
|
|
669
|
+
}),
|
|
670
|
+
...aaveV3Markets.map(async (market) => {
|
|
671
|
+
markets.aaveV3MarketsData[market.value] = await _getAaveV3MarketData(client, network, market);
|
|
672
|
+
}),
|
|
673
|
+
...aaveV4Spokes.map(async (spoke) => {
|
|
674
|
+
markets.aaveV4SpokesData[spoke.value] = await _getAaveV4SpokeData(client, network, spoke);
|
|
675
|
+
}),
|
|
676
|
+
...aaveV2Markets.map(async (market) => {
|
|
677
|
+
markets.aaveV2MarketsData[market.value] = await _getAaveV2MarketsData(client, network, market);
|
|
678
|
+
}),
|
|
679
|
+
...compoundV2Markets.map(async (market) => {
|
|
680
|
+
markets.compoundV2MarketsData[market.value] = await _getCompoundV2MarketsData(client, network);
|
|
681
|
+
}),
|
|
682
|
+
...crvUsdMarkets.map(async (market) => {
|
|
683
|
+
markets.crvUsdMarketsData[market.value] = await _getCurveUsdGlobalData(client, network, market);
|
|
684
|
+
}),
|
|
685
|
+
...llamaLendMarkets.map(async (market) => {
|
|
686
|
+
markets.llamaLendMarketsData[market.value] = await _getLlamaLendGlobalData(client, network, market);
|
|
687
|
+
}),
|
|
688
|
+
...liquityV2Markets.map(async (market) => {
|
|
689
|
+
markets.liquityV2MarketsData[market.value] = await _getLiquityV2MarketData(client, network, market);
|
|
690
|
+
}),
|
|
691
|
+
(async () => {
|
|
692
|
+
if (!isFluidSupported) return;
|
|
693
|
+
try {
|
|
694
|
+
markets.fluidMarketsData = await _getAllFluidMarketDataPortfolio(client, network);
|
|
695
|
+
} catch (error) {
|
|
696
|
+
console.error('Error fetching Fluid markets data:', error);
|
|
697
|
+
}
|
|
698
|
+
})(),
|
|
699
|
+
(async () => {
|
|
700
|
+
if (!isMainnet) return; // Maker CDPs are only available on mainnet
|
|
701
|
+
try {
|
|
702
|
+
markets.makerMarketsData = await _getMakerIlksData(client, network, MakerActiveIlks);
|
|
703
|
+
} catch (error) {
|
|
704
|
+
console.error('Error fetching Maker ilks data:', error);
|
|
705
|
+
}
|
|
706
|
+
})(),
|
|
707
|
+
|
|
708
|
+
// === INDEPENDENT USER DATA (doesn't depend on market data) ===
|
|
709
|
+
...addresses.map(async (address) => {
|
|
710
|
+
if (!isMainnet) return; // Maker CDPs are only available on mainnet
|
|
711
|
+
const makerCdp = await _getUserCdps(client, network, address);
|
|
712
|
+
makerCdps[address.toLowerCase() as EthAddress] = makerCdp;
|
|
713
|
+
}),
|
|
714
|
+
...addresses.map(async (address) => {
|
|
715
|
+
try {
|
|
716
|
+
if (!isFluidSupported) return; // Fluid is not available on Optimism
|
|
717
|
+
const userPositions = (await _getUserPositionsPortfolio(client, network, address));
|
|
718
|
+
for (const position of userPositions) {
|
|
719
|
+
if (position.userData && new Dec(position.userData.suppliedUsd).gt(0)) {
|
|
720
|
+
positions[address.toLowerCase() as EthAddress].fluid.data[position.userData.nftId] = position.userData;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
} catch (error) {
|
|
724
|
+
console.error(`Error fetching Fluid positions for address ${address}:`, error);
|
|
725
|
+
positions[address.toLowerCase() as EthAddress].fluid = {
|
|
726
|
+
error: `Error fetching Fluid positions for address ${address}`,
|
|
727
|
+
data: {},
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
}),
|
|
731
|
+
]);
|
|
732
|
+
|
|
733
|
+
await Promise.all([
|
|
734
|
+
...aaveV3Markets.map((market) => addresses.map(async (address) => {
|
|
735
|
+
try {
|
|
736
|
+
const accData = await _getAaveV3AccountData(client, network, address, { selectedMarket: market, ...markets.aaveV3MarketsData[market.value] });
|
|
737
|
+
if (new Dec(accData.suppliedUsd).gt(0)) positions[address.toLowerCase() as EthAddress].aaveV3[market.value] = { error: '', data: accData };
|
|
738
|
+
} catch (error) {
|
|
739
|
+
console.error(`Error fetching AaveV3 account data for address ${address} on market ${market.value}:`, error);
|
|
740
|
+
positions[address.toLowerCase() as EthAddress].aaveV3[market.value] = { error: `Error fetching AaveV3 account data for address ${address} on market ${market.value}`, data: null };
|
|
741
|
+
}
|
|
742
|
+
})).flat(),
|
|
743
|
+
...aaveV4Spokes.map((spoke) => addresses.map(async (address) => {
|
|
744
|
+
try {
|
|
745
|
+
const accData = await _getAaveV4AccountData(client, network, markets.aaveV4SpokesData[spoke.value], address);
|
|
746
|
+
if (new Dec(accData.suppliedUsd).gt(0)) positions[address.toLowerCase() as EthAddress].aaveV4[spoke.value] = { error: '', data: accData };
|
|
747
|
+
} catch (error) {
|
|
748
|
+
console.error(`Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}:`, error);
|
|
749
|
+
positions[address.toLowerCase() as EthAddress].aaveV4[spoke.value] = { error: `Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}`, data: null };
|
|
750
|
+
}
|
|
751
|
+
})).flat(),
|
|
752
|
+
...morphoMarkets.map((market) => addresses.map(async (address) => {
|
|
753
|
+
try {
|
|
754
|
+
const accData = await _getMorphoBlueAccountData(client, network, address, market, markets.morphoMarketsData[market.value]);
|
|
755
|
+
if (new Dec(accData.suppliedUsd).gt(0)) positions[address.toLowerCase() as EthAddress].morphoBlue[market.value] = { error: '', data: accData };
|
|
756
|
+
} catch (error) {
|
|
757
|
+
console.error(`Error fetching MorphoBlue account data for address ${address} on market ${market.value}:`, error);
|
|
758
|
+
positions[address.toLowerCase() as EthAddress].morphoBlue[market.value] = { error: `Error fetching MorphoBlue account data for address ${address} on market ${market.value}`, data: null };
|
|
759
|
+
}
|
|
760
|
+
})).flat(),
|
|
761
|
+
...compoundV3Markets.map((market) => addresses.map(async (address) => {
|
|
762
|
+
try {
|
|
763
|
+
const accData = await _getCompoundV3AccountData(client, network, address, ZERO_ADDRESS, { selectedMarket: market, assetsData: markets.compoundV3MarketsData[market.value].assetsData });
|
|
764
|
+
if (new Dec(accData.suppliedUsd).gt(0)) positions[address.toLowerCase() as EthAddress].compoundV3[market.value] = { error: '', data: accData };
|
|
765
|
+
} catch (error) {
|
|
766
|
+
console.error(`Error fetching CompoundV3 account data for address ${address} on market ${market.value}:`, error);
|
|
767
|
+
positions[address.toLowerCase() as EthAddress].compoundV3[market.value] = { error: `Error fetching CompoundV3 account data for address ${address} on market ${market.value}`, data: null };
|
|
768
|
+
}
|
|
769
|
+
})).flat(),
|
|
770
|
+
...sparkMarkets.map((market) => addresses.map(async (address) => {
|
|
771
|
+
try {
|
|
772
|
+
const accData = await _getSparkAccountData(client, network, address, { selectedMarket: market, assetsData: markets.sparkMarketsData[market.value].assetsData, eModeCategoriesData: markets.sparkMarketsData[market.value].eModeCategoriesData });
|
|
773
|
+
if (new Dec(accData.suppliedUsd).gt(0)) positions[address.toLowerCase() as EthAddress].spark[market.value] = { error: '', data: accData };
|
|
774
|
+
} catch (error) {
|
|
775
|
+
console.error(`Error fetching Spark account data for address ${address} on market ${market.value}:`, error);
|
|
776
|
+
positions[address.toLowerCase() as EthAddress].spark[market.value] = { error: `Error fetching Spark account data for address ${address} on market ${market.value}`, data: null };
|
|
777
|
+
}
|
|
778
|
+
})).flat(),
|
|
779
|
+
...addresses.map(async (address) => makerCdps[address.toLowerCase() as EthAddress]?.map(async (cdpInfo) => {
|
|
780
|
+
try {
|
|
781
|
+
// reuse ilk data fetched for the markets payload; ilks outside the active set are fetched on demand
|
|
782
|
+
const cdpData = await _getMakerCdpData(client, network, cdpInfo, markets.makerMarketsData[cdpInfo.ilkLabel]);
|
|
783
|
+
if (cdpData) {
|
|
784
|
+
positions[address.toLowerCase() as EthAddress].maker[cdpInfo.id] = { error: '', data: cdpData };
|
|
785
|
+
}
|
|
786
|
+
} catch (error) {
|
|
787
|
+
console.error(`Error fetching Maker CDP data for address ${address} with ID ${cdpInfo.id}:`, error);
|
|
788
|
+
positions[address.toLowerCase() as EthAddress].maker[cdpInfo.id] = { error: `Error fetching Maker CDP data for address ${address} with ID ${cdpInfo.id}`, data: null };
|
|
789
|
+
}
|
|
790
|
+
})).flat(),
|
|
791
|
+
...aaveV2Markets.map((market) => addresses.map(async (address) => {
|
|
792
|
+
try {
|
|
793
|
+
const accData = await _getAaveV2AccountData(client, network, address, markets.aaveV2MarketsData[market.value].assetsData, market);
|
|
794
|
+
if (new Dec(accData.suppliedUsd).gt(0)) positions[address.toLowerCase() as EthAddress].aaveV2[market.value] = { error: '', data: accData };
|
|
795
|
+
} catch (error) {
|
|
796
|
+
console.error(`Error fetching AaveV2 account data for address ${address}:`, error);
|
|
797
|
+
positions[address.toLowerCase() as EthAddress].aaveV2[market.value] = { error: `Error fetching AaveV2 account data for address ${address}`, data: null };
|
|
798
|
+
}
|
|
799
|
+
})).flat(),
|
|
800
|
+
...compoundV2Markets.map((market) => addresses.map(async (address) => {
|
|
801
|
+
try {
|
|
802
|
+
const accData = await _getCompoundV2AccountData(client, network, address, markets.compoundV2MarketsData[market.value].assetsData);
|
|
803
|
+
if (new Dec(accData.suppliedUsd).gt(0)) positions[address.toLowerCase() as EthAddress].compoundV2[market.value] = { error: '', data: accData };
|
|
804
|
+
} catch (error) {
|
|
805
|
+
console.error(`Error fetching CompoundV2 account data for address ${address}:`, error);
|
|
806
|
+
positions[address.toLowerCase() as EthAddress].compoundV2[market.value] = { error: `Error fetching CompoundV2 account data for address ${address}`, data: null };
|
|
807
|
+
}
|
|
808
|
+
})).flat(),
|
|
809
|
+
...addresses.map(async (address) => {
|
|
810
|
+
try {
|
|
811
|
+
if (!isMainnet) return; // Liquity trove info is only available on mainnet
|
|
812
|
+
const troveInfo = await _getLiquityTroveInfo(client, network, address);
|
|
813
|
+
if (new Dec(troveInfo.collateral).gt(0)) positions[address.toLowerCase() as EthAddress].liquity = { error: '', data: troveInfo };
|
|
814
|
+
} catch (error) {
|
|
815
|
+
console.error(`Error fetching Liquity trove info for address ${address}:`, error);
|
|
816
|
+
positions[address.toLowerCase() as EthAddress].liquity = { error: `Error fetching Liquity trove info for address ${address}`, data: null };
|
|
817
|
+
}
|
|
818
|
+
}),
|
|
819
|
+
...crvUsdMarkets.map((market) => addresses.map(async (address) => {
|
|
820
|
+
try {
|
|
821
|
+
const accData = await _getCurveUsdUserData(client, network, address, market, markets.crvUsdMarketsData[market.value].activeBand);
|
|
822
|
+
if (new Dec(accData.suppliedUsd).gt(0) || new Dec(accData.borrowedUsd).gt(0)) {
|
|
823
|
+
positions[address.toLowerCase() as EthAddress].crvUsd[market.value] = { error: '', data: { ...accData, borrowRate: markets.crvUsdMarketsData[market.value].borrowRate } };
|
|
824
|
+
}
|
|
825
|
+
} catch (error) {
|
|
826
|
+
console.error(`Error fetching Curve USD account data for address ${address} on market ${market.value}:`, error);
|
|
827
|
+
positions[address.toLowerCase() as EthAddress].crvUsd[market.value] = { error: `Error fetching Curve USD account data for address ${address} on market ${market.value}`, data: null };
|
|
828
|
+
}
|
|
829
|
+
})).flat(),
|
|
830
|
+
...llamaLendMarkets.map((market) => addresses.map(async (address) => {
|
|
831
|
+
try {
|
|
832
|
+
const accData = await _getLlamaLendUserData(client, network, address, market, markets.llamaLendMarketsData[market.value]);
|
|
833
|
+
if (new Dec(accData.suppliedUsd).gt(0) || new Dec(accData.borrowedUsd).gt(0)) {
|
|
834
|
+
positions[address.toLowerCase() as EthAddress].llamaLend[market.value] = { error: '', data: { ...accData, borrowRate: markets.llamaLendMarketsData[market.value].borrowRate } };
|
|
835
|
+
}
|
|
836
|
+
} catch (error) {
|
|
837
|
+
console.error(`Error fetching LlamaLend account data for address ${address} on market ${market.value}:`, error);
|
|
838
|
+
positions[address.toLowerCase() as EthAddress].llamaLend[market.value] = { error: `Error fetching LlamaLend account data for address ${address} on market ${market.value}`, data: null };
|
|
839
|
+
}
|
|
840
|
+
})).flat(),
|
|
841
|
+
]);
|
|
842
|
+
|
|
843
|
+
return {
|
|
844
|
+
positions,
|
|
845
|
+
markets,
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
|
|
592
849
|
export * from './discovery';
|
package/src/savings/index.ts
CHANGED
|
@@ -43,15 +43,15 @@ export const getSavingsData = async (
|
|
|
43
43
|
|
|
44
44
|
await Promise.all([
|
|
45
45
|
...(network === NetworkNumber.Eth ? [
|
|
46
|
-
|
|
46
|
+
(async () => {
|
|
47
47
|
try {
|
|
48
|
-
const
|
|
49
|
-
const data = await morphoVaults.
|
|
50
|
-
savingsData
|
|
48
|
+
const vaults = morphoVaultsList.map((vaultKey) => morphoVaults.morphoVaultsOptions.getMorphoVault(vaultKey));
|
|
49
|
+
const data = await morphoVaults.getMorphoVaultsData(provider, network, vaults, accounts);
|
|
50
|
+
Object.assign(savingsData, data);
|
|
51
51
|
} catch (err) {
|
|
52
|
-
console.error(
|
|
52
|
+
console.error('[getSavingsData] Error fetching morpho vaults:', err);
|
|
53
53
|
}
|
|
54
|
-
}),
|
|
54
|
+
})(),
|
|
55
55
|
...yearnVaultsList.map(async (vaultKey) => {
|
|
56
56
|
try {
|
|
57
57
|
const vault = yearnVaults.yearnVaultsOptions.getYearnVault(vaultKey);
|
|
@@ -3,52 +3,100 @@ import Dec from 'decimal.js';
|
|
|
3
3
|
import { request as graphqlRequest } from 'graphql-request';
|
|
4
4
|
import { assetAmountInEth } from '@defisaver/tokens';
|
|
5
5
|
import * as morphoVaultsOptions from './options';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
EthAddress, EthereumProvider, NetworkNumber, MorphoVault, MorphoVaultType, SavingsVaultData,
|
|
8
|
+
} from '../../types';
|
|
7
9
|
import { getViemProvider } from '../../services/viem';
|
|
8
10
|
import { getMorphoVaultContractViem } from '../../contracts';
|
|
9
|
-
import { MorphoVault, SavingsVaultData } from '../../types';
|
|
10
11
|
|
|
11
12
|
export {
|
|
12
13
|
morphoVaultsOptions,
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
const MORPHO_BLUE_API = 'https://api.morpho.org/graphql';
|
|
17
|
+
|
|
18
|
+
// Morpho API caps list page size at 100 items
|
|
19
|
+
const MORPHO_API_PAGE_SIZE = 100;
|
|
20
|
+
|
|
21
|
+
const vaultsLiquidityQuery = `
|
|
22
|
+
query VaultsLiquidity($addresses: [String!], $chainIds: [Int!]) {
|
|
23
|
+
vaults(first: ${MORPHO_API_PAGE_SIZE}, where: { address_in: $addresses, chainId_in: $chainIds }) {
|
|
24
|
+
items {
|
|
25
|
+
address
|
|
26
|
+
liquidity {
|
|
27
|
+
underlying
|
|
28
|
+
}
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
}`;
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Fetches liquidity for all given vaults in a single API request (chunked if over the page cap),
|
|
35
|
+
* returned as a map keyed by lowercased vault address. A vault missing from the API response is
|
|
36
|
+
* absent from the map.
|
|
37
|
+
*/
|
|
38
|
+
export const fetchMorphoVaultsLiquidity = async (network: NetworkNumber, vaults: MorphoVault[]): Promise<Record<string, string>> => {
|
|
39
|
+
const chunks: MorphoVault[][] = [];
|
|
40
|
+
for (let i = 0; i < vaults.length; i += MORPHO_API_PAGE_SIZE) chunks.push(vaults.slice(i, i + MORPHO_API_PAGE_SIZE));
|
|
41
|
+
|
|
42
|
+
const liquidityByAddress: Record<string, string> = {};
|
|
43
|
+
await Promise.all(chunks.map(async (chunk) => {
|
|
44
|
+
const data = await graphqlRequest(MORPHO_BLUE_API, vaultsLiquidityQuery, {
|
|
45
|
+
addresses: chunk.map((vault) => vault.address),
|
|
46
|
+
chainIds: [network],
|
|
47
|
+
// the BigInt scalar serializes as a JSON number when it fits in Number.MAX_SAFE_INTEGER, a string otherwise
|
|
48
|
+
}) as { vaults: { items: { address: string, liquidity: { underlying: string | number | null } | null }[] | null } };
|
|
32
49
|
|
|
33
|
-
|
|
50
|
+
(data.vaults.items || []).forEach((item) => {
|
|
51
|
+
if (item?.liquidity?.underlying !== undefined && item.liquidity?.underlying !== null) {
|
|
52
|
+
liquidityByAddress[item.address.toLowerCase()] = String(item.liquidity.underlying);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}));
|
|
56
|
+
return liquidityByAddress;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const getBatchedViemProvider = (provider: EthereumProvider, network: NetworkNumber) => getViemProvider(provider, network, {
|
|
60
|
+
batch: {
|
|
61
|
+
multicall: {
|
|
62
|
+
batchSize: 250_000,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const getMorphoVaultChainData = async (provider: Client, morphoVault: MorphoVault, accounts: EthAddress[]) => {
|
|
34
68
|
const morphoVaultContract = getMorphoVaultContractViem(provider, morphoVault.address);
|
|
35
69
|
|
|
36
70
|
const shares: Record<EthAddress, bigint> = {};
|
|
37
71
|
|
|
38
|
-
const [totalAssets, totalSupply, decimals, decimalsOffset
|
|
72
|
+
const [totalAssets, totalSupply, decimals, decimalsOffset] = await Promise.all([
|
|
39
73
|
morphoVaultContract.read.totalAssets(),
|
|
40
74
|
morphoVaultContract.read.totalSupply(),
|
|
41
75
|
morphoVaultContract.read.decimals(),
|
|
42
76
|
morphoVaultContract.read.DECIMALS_OFFSET(),
|
|
43
|
-
graphqlRequest(MORPHO_BLUE_API, vaultDataQuery, { address: morphoVault.address, chainId: network }),
|
|
44
77
|
...accounts.map(async (account) => {
|
|
45
78
|
const share = await morphoVaultContract.read.balanceOf([account]);
|
|
46
79
|
shares[account] = share;
|
|
47
80
|
}),
|
|
48
81
|
]);
|
|
49
82
|
|
|
83
|
+
return {
|
|
84
|
+
totalAssets, totalSupply, decimals, decimalsOffset, shares,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const formatMorphoVaultData = (
|
|
89
|
+
morphoVault: MorphoVault,
|
|
90
|
+
chainData: Awaited<ReturnType<typeof getMorphoVaultChainData>>,
|
|
91
|
+
liquidityUnderlying: string,
|
|
92
|
+
accounts: EthAddress[],
|
|
93
|
+
): SavingsVaultData => {
|
|
94
|
+
const {
|
|
95
|
+
totalAssets, totalSupply, decimals, decimalsOffset, shares,
|
|
96
|
+
} = chainData;
|
|
97
|
+
|
|
50
98
|
const poolSize = assetAmountInEth(totalAssets.toString(), morphoVault.asset);
|
|
51
|
-
const liquidity = assetAmountInEth(
|
|
99
|
+
const liquidity = assetAmountInEth(liquidityUnderlying, morphoVault.asset);
|
|
52
100
|
|
|
53
101
|
const supplied: Record<EthAddress, string> = {};
|
|
54
102
|
accounts.forEach((account) => {
|
|
@@ -67,12 +115,45 @@ export const _getMorphoVaultData = async (provider: Client, network: NetworkNumb
|
|
|
67
115
|
};
|
|
68
116
|
};
|
|
69
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Fetches data for all given vaults with a single Morpho API request for their liquidity,
|
|
120
|
+
* instead of one request per vault. The on-chain reads run in parallel with the API request.
|
|
121
|
+
* A vault whose on-chain reads fail or that is missing from the API response is left out of
|
|
122
|
+
* the result; a failed API request rejects, leaving all vaults out.
|
|
123
|
+
*/
|
|
124
|
+
export const _getMorphoVaultsData = async (provider: Client, network: NetworkNumber, vaults: MorphoVault[], accounts: EthAddress[]): Promise<Partial<Record<MorphoVaultType, SavingsVaultData>>> => {
|
|
125
|
+
const [liquidityByAddress, chainData] = await Promise.all([
|
|
126
|
+
fetchMorphoVaultsLiquidity(network, vaults),
|
|
127
|
+
Promise.all(vaults.map((vault) => getMorphoVaultChainData(provider, vault, accounts).catch((err) => {
|
|
128
|
+
console.error(`[getMorphoVaultsData] Error fetching on-chain data for morpho vault ${vault.type}:`, err);
|
|
129
|
+
return null;
|
|
130
|
+
}))),
|
|
131
|
+
]);
|
|
132
|
+
|
|
133
|
+
const savingsData: Partial<Record<MorphoVaultType, SavingsVaultData>> = {};
|
|
134
|
+
vaults.forEach((vault, i) => {
|
|
135
|
+
const vaultChainData = chainData[i];
|
|
136
|
+
if (!vaultChainData) return;
|
|
137
|
+
const liquidityUnderlying = liquidityByAddress[vault.address.toLowerCase()];
|
|
138
|
+
if (liquidityUnderlying === undefined) {
|
|
139
|
+
console.error(`[getMorphoVaultsData] Vault ${vault.type} (${vault.address}) missing from Morpho API response`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
savingsData[vault.type] = formatMorphoVaultData(vault, vaultChainData, liquidityUnderlying, accounts);
|
|
143
|
+
});
|
|
144
|
+
return savingsData;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export async function getMorphoVaultsData(provider: EthereumProvider, network: NetworkNumber, vaults: MorphoVault[], accounts: EthAddress[]): Promise<Partial<Record<MorphoVaultType, SavingsVaultData>>> {
|
|
148
|
+
return _getMorphoVaultsData(getBatchedViemProvider(provider, network), network, vaults, accounts);
|
|
149
|
+
}
|
|
150
|
+
|
|
70
151
|
export async function getMorphoVaultData(provider: EthereumProvider, network: NetworkNumber, morphoVault: MorphoVault, accounts: EthAddress[]): Promise<SavingsVaultData> {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
152
|
+
const [liquidityByAddress, chainData] = await Promise.all([
|
|
153
|
+
fetchMorphoVaultsLiquidity(network, [morphoVault]),
|
|
154
|
+
getMorphoVaultChainData(getBatchedViemProvider(provider, network), morphoVault, accounts),
|
|
155
|
+
]);
|
|
156
|
+
const liquidityUnderlying = liquidityByAddress[morphoVault.address.toLowerCase()];
|
|
157
|
+
if (liquidityUnderlying === undefined) throw new Error(`Vault ${morphoVault.address} missing from Morpho API response`);
|
|
158
|
+
return formatMorphoVaultData(morphoVault, chainData, liquidityUnderlying, accounts);
|
|
159
|
+
}
|
package/src/types/aave.ts
CHANGED
|
@@ -143,6 +143,8 @@ export interface AavePositionData extends MMPositionData {
|
|
|
143
143
|
collRatio: string,
|
|
144
144
|
// Safety ratio as evaluated by automation bots (LTV-0 collateral credited at LLTV - 5%). Aave v3 only.
|
|
145
145
|
safetyRatioWithLtvZeroFallback?: string,
|
|
146
|
+
// Normalised safety ratio (100 = liquidation on every protocol). Aave v3: the LTV-0 fallback ratio, Aave v2: `ratio`.
|
|
147
|
+
safetyRatio?: string,
|
|
146
148
|
suppliedUsd: string,
|
|
147
149
|
borrowedUsd: string,
|
|
148
150
|
borrowLimitUsd: string,
|
|
@@ -177,6 +179,7 @@ export interface AaveV3AggregatedPositionData {
|
|
|
177
179
|
collRatio: string,
|
|
178
180
|
borrowLimitWithLtvZeroFallbackUsd: string,
|
|
179
181
|
safetyRatioWithLtvZeroFallback: string,
|
|
182
|
+
safetyRatio: string,
|
|
180
183
|
netApy: string,
|
|
181
184
|
incentiveUsd: string,
|
|
182
185
|
totalInterestUsd: string,
|
package/src/types/aaveV4.ts
CHANGED
package/src/types/compound.ts
CHANGED
|
@@ -112,6 +112,7 @@ export interface CompoundAggregatedPositionData {
|
|
|
112
112
|
leftToBorrowUsd: string,
|
|
113
113
|
ratio: string,
|
|
114
114
|
collRatio: string,
|
|
115
|
+
safetyRatio: string,
|
|
115
116
|
netApy: string,
|
|
116
117
|
incentiveUsd: string,
|
|
117
118
|
totalInterestUsd: string,
|
|
@@ -132,6 +133,7 @@ export interface CompoundAggregatedPositionData {
|
|
|
132
133
|
export interface CompoundPositionData extends MMPositionData {
|
|
133
134
|
ratio: string,
|
|
134
135
|
minRatio: string,
|
|
136
|
+
safetyRatio?: string,
|
|
135
137
|
suppliedUsd: string,
|
|
136
138
|
borrowedUsd: string,
|
|
137
139
|
borrowLimitUsd: string,
|
package/src/types/fluid.ts
CHANGED
package/src/types/liquity.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface LiquityTroveInfo {
|
|
|
26
26
|
totalETH: string,
|
|
27
27
|
totalLUSD: string,
|
|
28
28
|
minCollateralRatio: number,
|
|
29
|
+
// Collateral ratio rebased so 100 sits on `minCollateralRatio` (normalised safety ratio).
|
|
30
|
+
safetyRatio: string,
|
|
29
31
|
priceForRecovery: string,
|
|
30
32
|
debtInFront: string,
|
|
31
33
|
exposure: string,
|
package/src/types/liquityV2.ts
CHANGED
|
@@ -104,6 +104,7 @@ export interface LiquityV2AggregatedTroveData {
|
|
|
104
104
|
liquidationPrice: string,
|
|
105
105
|
ratio: string,
|
|
106
106
|
collRatio: string,
|
|
107
|
+
safetyRatio: string,
|
|
107
108
|
exposure: string,
|
|
108
109
|
}
|
|
109
110
|
|
|
@@ -112,6 +113,7 @@ export interface LiquityV2TroveData {
|
|
|
112
113
|
troveId: string,
|
|
113
114
|
ratio: string,
|
|
114
115
|
collRatio: string,
|
|
116
|
+
safetyRatio?: string,
|
|
115
117
|
liqRatio: string,
|
|
116
118
|
borrowLimitRatio: string,
|
|
117
119
|
interestRate: string,
|
package/src/types/maker.ts
CHANGED
|
@@ -47,6 +47,8 @@ export interface CdpData {
|
|
|
47
47
|
debtAssetMarketPrice: string,
|
|
48
48
|
liquidationPrice: string,
|
|
49
49
|
ratio: string,
|
|
50
|
+
// Collateral ratio rebased so 100 sits on `liqPercent` (normalised safety ratio).
|
|
51
|
+
safetyRatio: string,
|
|
50
52
|
liqRatio: string,
|
|
51
53
|
liqPercent: number,
|
|
52
54
|
assetPrice: string,
|
package/src/types/morphoBlue.ts
CHANGED
|
@@ -206,6 +206,7 @@ export interface MorphoBlueAggregatedPositionData {
|
|
|
206
206
|
totalInterestUsd: string,
|
|
207
207
|
ltv: string,
|
|
208
208
|
ratio: string,
|
|
209
|
+
safetyRatio: string, // borrowLimitUsd / borrowedUsd as a percentage (100 = liquidation)
|
|
209
210
|
leveragedType: LeverageType,
|
|
210
211
|
leveragedAsset?: string,
|
|
211
212
|
currentVolatilePairRatio?: string,
|
|
@@ -229,6 +230,7 @@ export interface MorphoBluePositionData {
|
|
|
229
230
|
totalInterestUsd: string,
|
|
230
231
|
ltv: string,
|
|
231
232
|
ratio: string,
|
|
233
|
+
safetyRatio?: string,
|
|
232
234
|
leveragedType: LeverageType,
|
|
233
235
|
leveragedAsset?: string,
|
|
234
236
|
currentVolatilePairRatio?: string,
|
|
@@ -147,6 +147,7 @@ export type MorphoMidnightAssetsData = { [key: string]: MorphoMidnightAssetData
|
|
|
147
147
|
|
|
148
148
|
export interface MorphoMidnightMarketInfo {
|
|
149
149
|
id: string,
|
|
150
|
+
isCreated: boolean, // markets are created lazily on first position; until then the view returns a zeroed struct (id = 0x0, no prices)
|
|
150
151
|
loanToken: string,
|
|
151
152
|
collaterals: string[], // collateral symbols, index-aligned with the market's collateral set
|
|
152
153
|
maturity: number, // unix timestamp (seconds)
|
|
@@ -190,6 +191,7 @@ export interface MorphoMidnightAggregatedPositionData {
|
|
|
190
191
|
ltv: string,
|
|
191
192
|
ratio: string, // health ratio as a percentage (from MidnightView.ratio, 1e18-scaled)
|
|
192
193
|
healthRatio: string, // liquidationLimitUsd / borrowedUsd
|
|
194
|
+
safetyRatio: string, // borrowLimitUsd / borrowedUsd as a percentage (100 = liquidation)
|
|
193
195
|
leveragedType: LeverageType,
|
|
194
196
|
leveragedAsset?: string,
|
|
195
197
|
currentVolatilePairRatio?: string,
|