@1delta/margin-fetcher 0.0.110 → 0.0.111
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.js
CHANGED
|
@@ -21915,7 +21915,7 @@ var fetchMainPrices = async (chainIds, rpcOverrides, lists = {}) => {
|
|
|
21915
21915
|
const multicallPromises = chainIds.map(async (chainId) => {
|
|
21916
21916
|
let aaveForks = aaves?.[chainId];
|
|
21917
21917
|
if (chainId === Chain.KAIA_MAINNET)
|
|
21918
|
-
aaveForks = aaveForks?.filter((a) => a !== Lender.
|
|
21918
|
+
aaveForks = aaveForks?.filter((a) => a !== Lender.KLAP);
|
|
21919
21919
|
if (chainId === Chain.GNOSIS)
|
|
21920
21920
|
aaveForks = aaveForks?.filter((a) => a !== Lender.AGAVE);
|
|
21921
21921
|
if (chainId === Chain.ETHEREUM_MAINNET)
|
|
@@ -22068,7 +22068,8 @@ var fetchMainPrices = async (chainIds, rpcOverrides, lists = {}) => {
|
|
|
22068
22068
|
chainId,
|
|
22069
22069
|
aaveSlice,
|
|
22070
22070
|
queries,
|
|
22071
|
-
lists[chainId]?.list
|
|
22071
|
+
lists[chainId]?.list,
|
|
22072
|
+
allPrices
|
|
22072
22073
|
);
|
|
22073
22074
|
offset += aaveCalls.length;
|
|
22074
22075
|
const uniswapSlice = result.slice(offset, offset + uniswapCalls.length);
|
|
@@ -22828,16 +22829,27 @@ function getExponentForOracle(chainId, fork) {
|
|
|
22828
22829
|
if (chainId === Chain.ARBITRUM_ONE && fork === Lender.RADIANT_V2) return 10n;
|
|
22829
22830
|
return AAVE_V2_LENDERS.includes(fork) ? 0n : 10n;
|
|
22830
22831
|
}
|
|
22831
|
-
var parseAaveResults = (chainId, data, queries, list = {}) => {
|
|
22832
|
+
var parseAaveResults = (chainId, data, queries, list = {}, otherPrices = {}) => {
|
|
22832
22833
|
let prices = {};
|
|
22834
|
+
function scaler() {
|
|
22835
|
+
if (chainId !== Chain.KAIA_MAINNET) return (p, l) => p;
|
|
22836
|
+
return (p, l) => {
|
|
22837
|
+
const scale = l === Lender.KLAYBANK ? otherPrices["KAIA"] ?? prices["KAIA"] : 1;
|
|
22838
|
+
return p * scale;
|
|
22839
|
+
};
|
|
22840
|
+
}
|
|
22841
|
+
const getScale = scaler();
|
|
22833
22842
|
data.forEach((d, i) => {
|
|
22834
22843
|
if (d !== "0x") {
|
|
22835
22844
|
const details = queries[i];
|
|
22836
22845
|
details.assets.forEach((a, j) => {
|
|
22837
22846
|
const oracleId = list[a]?.assetGroup ?? chainId + "-" + a;
|
|
22838
|
-
prices[oracleId] =
|
|
22839
|
-
|
|
22840
|
-
|
|
22847
|
+
prices[oracleId] = getScale(
|
|
22848
|
+
formatAavePrice(
|
|
22849
|
+
d[j].toString(),
|
|
22850
|
+
getExponentForOracle(chainId, details.fork)
|
|
22851
|
+
),
|
|
22852
|
+
details.fork
|
|
22841
22853
|
);
|
|
22842
22854
|
});
|
|
22843
22855
|
}
|