@defisaver/positions-sdk 2.1.122-shifter-dev → 2.1.122-shifter-1-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/compoundV3/index.js
CHANGED
|
@@ -116,13 +116,11 @@ const _getCompoundV3AccountBalances = (provider, network, block, addressMapping,
|
|
|
116
116
|
if (!address) {
|
|
117
117
|
return balances;
|
|
118
118
|
}
|
|
119
|
-
const market = (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
[(0, compound_1.COMPOUND_V3_USDCe)(network).baseMarketAddress.toLowerCase()]: (0, compound_1.COMPOUND_V3_USDCe)(network),
|
|
125
|
-
})[marketAddress.toLowerCase()];
|
|
119
|
+
const market = Object.values((0, compound_1.CompoundMarkets)(network)).find((m) => (m.baseMarketAddress
|
|
120
|
+
&& m.baseMarketAddress !== constants_1.ZERO_ADDRESS
|
|
121
|
+
&& m.baseMarketAddress.toLowerCase() === marketAddress.toLowerCase()));
|
|
122
|
+
if (!market)
|
|
123
|
+
throw new Error(`Unsupported Compound V3 market address ${marketAddress} on network ${network}`);
|
|
126
124
|
const loanInfoContract = (0, contracts_1.CompV3ViewContractViem)(provider, network, block);
|
|
127
125
|
const loanInfo = yield loanInfoContract.read.getLoanData([market.baseMarketAddress, address], (0, viem_1.setViemBlockNumber)(block));
|
|
128
126
|
const baseAssetInfo = (0, tokens_1.getAssetInfo)((0, utils_1.wethToEth)(market.baseAsset), network);
|
package/esm/compoundV3/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { ethToWeth, wethToEth } from '../services/utils';
|
|
|
16
16
|
import { ZERO_ADDRESS } from '../constants';
|
|
17
17
|
import { calculateBorrowingAssetLimit } from '../moneymarket';
|
|
18
18
|
import { formatBaseData, formatMarketData, getCompoundV3AggregatedData, getIncentiveApys, } from '../helpers/compoundHelpers';
|
|
19
|
-
import {
|
|
19
|
+
import { CompoundMarkets } from '../markets/compound';
|
|
20
20
|
import { getEthPrice, getCompPrice, getUSDCPrice, getWstETHPrice, } from '../services/priceService';
|
|
21
21
|
import { getViemProvider, setViemBlockNumber } from '../services/viem';
|
|
22
22
|
const getSupportedAssetsAddressesForMarket = (selectedMarket, network) => selectedMarket.collAssets.map(asset => getAssetInfo(ethToWeth(asset), network)).map(addr => addr.address.toLowerCase());
|
|
@@ -108,13 +108,11 @@ export const _getCompoundV3AccountBalances = (provider, network, block, addressM
|
|
|
108
108
|
if (!address) {
|
|
109
109
|
return balances;
|
|
110
110
|
}
|
|
111
|
-
const market = (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
[COMPOUND_V3_USDCe(network).baseMarketAddress.toLowerCase()]: COMPOUND_V3_USDCe(network),
|
|
117
|
-
})[marketAddress.toLowerCase()];
|
|
111
|
+
const market = Object.values(CompoundMarkets(network)).find((m) => (m.baseMarketAddress
|
|
112
|
+
&& m.baseMarketAddress !== ZERO_ADDRESS
|
|
113
|
+
&& m.baseMarketAddress.toLowerCase() === marketAddress.toLowerCase()));
|
|
114
|
+
if (!market)
|
|
115
|
+
throw new Error(`Unsupported Compound V3 market address ${marketAddress} on network ${network}`);
|
|
118
116
|
const loanInfoContract = CompV3ViewContractViem(provider, network, block);
|
|
119
117
|
const loanInfo = yield loanInfoContract.read.getLoanData([market.baseMarketAddress, address], setViemBlockNumber(block));
|
|
120
118
|
const baseAssetInfo = getAssetInfo(wethToEth(market.baseAsset), network);
|
package/package.json
CHANGED
package/src/compoundV3/index.ts
CHANGED
|
@@ -19,9 +19,7 @@ import { calculateBorrowingAssetLimit } from '../moneymarket';
|
|
|
19
19
|
import {
|
|
20
20
|
formatBaseData, formatMarketData, getCompoundV3AggregatedData, getIncentiveApys,
|
|
21
21
|
} from '../helpers/compoundHelpers';
|
|
22
|
-
import {
|
|
23
|
-
COMPOUND_V3_ETH, COMPOUND_V3_USDBC, COMPOUND_V3_USDC, COMPOUND_V3_USDCe, COMPOUND_V3_USDT,
|
|
24
|
-
} from '../markets/compound';
|
|
22
|
+
import { CompoundMarkets } from '../markets/compound';
|
|
25
23
|
import {
|
|
26
24
|
getEthPrice, getCompPrice, getUSDCPrice, getWstETHPrice,
|
|
27
25
|
} from '../services/priceService';
|
|
@@ -134,13 +132,13 @@ export const _getCompoundV3AccountBalances = async (provider: Client, network: N
|
|
|
134
132
|
return balances;
|
|
135
133
|
}
|
|
136
134
|
|
|
137
|
-
const market = (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
135
|
+
const market = Object.values(CompoundMarkets(network)).find((m) => (
|
|
136
|
+
m.baseMarketAddress
|
|
137
|
+
&& m.baseMarketAddress !== ZERO_ADDRESS
|
|
138
|
+
&& m.baseMarketAddress.toLowerCase() === marketAddress.toLowerCase()
|
|
139
|
+
));
|
|
140
|
+
|
|
141
|
+
if (!market) throw new Error(`Unsupported Compound V3 market address ${marketAddress} on network ${network}`);
|
|
144
142
|
|
|
145
143
|
const loanInfoContract = CompV3ViewContractViem(provider, network, block);
|
|
146
144
|
const loanInfo = await loanInfoContract.read.getLoanData([market.baseMarketAddress, address], setViemBlockNumber(block));
|