@defisaver/positions-sdk 0.0.201-fluid-dev-3 → 0.0.201-fluid-dev-5

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.
@@ -6715,6 +6715,12 @@ export namespace ETHPriceFeed {
6715
6715
  "1": {
6716
6716
  address: string;
6717
6717
  };
6718
+ "8453": {
6719
+ address: string;
6720
+ };
6721
+ "42161": {
6722
+ address: string;
6723
+ };
6718
6724
  };
6719
6725
  export { networks_73 as networks };
6720
6726
  }
@@ -6799,6 +6805,12 @@ export namespace WstETHPriceFeed {
6799
6805
  "1": {
6800
6806
  address: string;
6801
6807
  };
6808
+ "8453": {
6809
+ address: string;
6810
+ };
6811
+ "42161": {
6812
+ address: string;
6813
+ };
6802
6814
  };
6803
6815
  export { networks_75 as networks };
6804
6816
  }
@@ -7283,6 +7295,9 @@ export namespace DFSFeedRegistry {
7283
7295
  "8453": {
7284
7296
  address: string;
7285
7297
  };
7298
+ "42161": {
7299
+ address: string;
7300
+ };
7286
7301
  };
7287
7302
  export { networks_78 as networks };
7288
7303
  }
@@ -1015,7 +1015,9 @@ module.exports = {
1015
1015
  "ETHPriceFeed": {
1016
1016
  "abi": [{ "inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }, { "internalType": "address", "name": "_accessController", "type": "address" }], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "int256", "name": "current", "type": "int256" }, { "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "updatedAt", "type": "uint256" }], "name": "AnswerUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "startedBy", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "startedAt", "type": "uint256" }], "name": "NewRound", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }], "name": "OwnershipTransferRequested", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "accessController", "outputs": [{ "internalType": "contract AccessControllerInterface", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "aggregator", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }], "name": "confirmAggregator", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "description", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_roundId", "type": "uint256" }], "name": "getAnswer", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint80", "name": "_roundId", "type": "uint80" }], "name": "getRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_roundId", "type": "uint256" }], "name": "getTimestamp", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestAnswer", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestRound", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestTimestamp", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "name": "phaseAggregators", "outputs": [{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "phaseId", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }], "name": "proposeAggregator", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "proposedAggregator", "outputs": [{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint80", "name": "_roundId", "type": "uint80" }], "name": "proposedGetRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proposedLatestRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_accessController", "type": "address" }], "name": "setController", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_to", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "version", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
1017
1017
  "networks": {
1018
- "1": { "address": "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" }
1018
+ "1": { "address": "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" },
1019
+ "8453": { "address": "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70" },
1020
+ "42161": { "address": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612" }
1019
1021
  },
1020
1022
  },
1021
1023
  "USDCPriceFeed": {
@@ -1027,7 +1029,9 @@ module.exports = {
1027
1029
  "WstETHPriceFeed": {
1028
1030
  "abi": [{ "inputs": [{ "internalType": "address", "name": "stETHtoETHPriceFeed_", "type": "address" }, { "internalType": "address", "name": "wstETH_", "type": "address" }, { "internalType": "uint8", "name": "decimals_", "type": "uint8" }], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "BadDecimals", "type": "error" }, { "inputs": [], "name": "InvalidInt256", "type": "error" }, { "inputs": [], "name": "decimals", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "description", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "stETHToETHPriceFeedDecimals", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "stETHtoETHPriceFeed", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "version", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "wstETH", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "wstETHScale", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }],
1029
1031
  "networks": {
1030
- "1": { "address": "0x4F67e4d9BD67eFa28236013288737D39AeF48e79" }
1032
+ "1": { "address": "0x4F67e4d9BD67eFa28236013288737D39AeF48e79" },
1033
+ "8453": { "address": "0x43a5C292A453A3bF3606fa856197f09D7B74251a" },
1034
+ "42161": { "address": "0xb523AE262D20A936BC152e6023996e46FDC2A95D" }
1031
1035
  }
1032
1036
  },
1033
1037
  "MorphoBlueView": {
@@ -1073,6 +1077,7 @@ module.exports = {
1073
1077
  "abi": [{ "inputs": [], "name": "NonContractCall", "type": "error" }, { "inputs": [], "name": "SenderNotAdmin", "type": "error" }, { "inputs": [], "name": "SenderNotOwner", "type": "error" }, { "inputs": [], "name": "adminVault", "outputs": [{ "internalType": "contract AdminVault", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }, { "internalType": "address", "name": "", "type": "address" }], "name": "aggregators", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "base", "type": "address" }, { "internalType": "address", "name": "quote", "type": "address" }], "name": "getFeed", "outputs": [{ "internalType": "address", "name": "aggregator", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "kill", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "base", "type": "address" }, { "internalType": "address", "name": "quote", "type": "address" }], "name": "latestRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "base", "type": "address" }, { "internalType": "address", "name": "quote", "type": "address" }, { "internalType": "address", "name": "aggregator", "type": "address" }], "name": "setFeed", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address[]", "name": "bases", "type": "address[]" }, { "internalType": "address[]", "name": "quotes", "type": "address[]" }, { "internalType": "address[]", "name": "aggregator", "type": "address[]" }], "name": "setFeeds", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_token", "type": "address" }, { "internalType": "address", "name": "_receiver", "type": "address" }, { "internalType": "uint256", "name": "_amount", "type": "uint256" }], "name": "withdrawStuckFunds", "outputs": [], "stateMutability": "nonpayable", "type": "function" }],
1074
1078
  "networks": {
1075
1079
  "8453": { "address": "0x7dFF34190d0307fC234fc7E8C152C9715083eB02" },
1080
+ "42161": { "address": "0x158E27De8B5E5bC3FA1C6D5b365a291c54f6b0Fd" }
1076
1081
  }
1077
1082
  },
1078
1083
  "LlamaLendView": {
@@ -37,3 +37,11 @@ export declare const getFluidPositionWithMarket: (web3: Web3, network: NetworkNu
37
37
  marketData: FluidMarketData;
38
38
  }>;
39
39
  export declare const getAllFluidMarketDataChunked: (network: NetworkNumber, web3: Web3) => Promise<FluidMarketData[]>;
40
+ export declare const getFluidTokenData: (web3: Web3, network: NetworkNumber, token: string) => Promise<{
41
+ fTokenAddress: any;
42
+ fTokenSymbol: string;
43
+ decimals: string;
44
+ totalDeposited: string;
45
+ withdrawable: string;
46
+ apy: string;
47
+ }>;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getAllFluidMarketDataChunked = exports.getFluidPositionWithMarket = exports.getFluidPosition = exports.getFluidVaultIdsForUser = exports.getFluidMarketData = exports.EMPTY_FLUID_DATA = exports.EMPTY_USED_ASSET = void 0;
15
+ exports.getFluidTokenData = exports.getAllFluidMarketDataChunked = exports.getFluidPositionWithMarket = exports.getFluidPosition = exports.getFluidVaultIdsForUser = exports.getFluidMarketData = exports.EMPTY_FLUID_DATA = exports.EMPTY_USED_ASSET = void 0;
16
16
  const decimal_js_1 = __importDefault(require("decimal.js"));
17
17
  const tokens_1 = require("@defisaver/tokens");
18
18
  const common_1 = require("../types/common");
@@ -44,8 +44,8 @@ const parseVaultType = (vaultType) => {
44
44
  }
45
45
  };
46
46
  const parseMarketData = (web3, data, network) => __awaiter(void 0, void 0, void 0, function* () {
47
- const collAsset = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken0);
48
- const debtAsset = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0);
47
+ const collAsset = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken0, network);
48
+ const debtAsset = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
49
49
  const supplyRate = new decimal_js_1.default(data.supplyRateVault).div(100).toString();
50
50
  const borrowRate = new decimal_js_1.default(data.borrowRateVault).div(100).toString();
51
51
  const oracleScaleFactor = new decimal_js_1.default(27).add(debtAsset.decimals).sub(collAsset.decimals).toString();
@@ -57,7 +57,7 @@ const parseMarketData = (web3, data, network) => __awaiter(void 0, void 0, void
57
57
  let loanTokenPrice;
58
58
  if (debtAsset.symbol === 'wstETH') {
59
59
  // need to handle wstETH for l2s inside getWstETHPrice
60
- loanTokenPrice = yield (0, priceService_1.getWstETHPrice)(web3);
60
+ loanTokenPrice = yield (0, priceService_1.getWstETHPriceFluid)(web3, network);
61
61
  }
62
62
  else if (isMainnet) {
63
63
  const feedRegistryContract = (0, contracts_1.FeedRegistryContract)(web3, common_1.NetworkNumber.Eth);
@@ -213,6 +213,24 @@ const getAllFluidMarketDataChunked = (network, web3) => __awaiter(void 0, void 0
213
213
  params: [version.marketAddress],
214
214
  }));
215
215
  const data = yield (0, multicall_1.chunkAndMulticall)(calls, 10, 'latest', web3, network);
216
+ // @ts-ignore
216
217
  return Promise.all(data.map((item, i) => __awaiter(void 0, void 0, void 0, function* () { return parseMarketData(web3, item.vaultData, network); })));
217
218
  });
218
219
  exports.getAllFluidMarketDataChunked = getAllFluidMarketDataChunked;
220
+ const getFluidTokenData = (web3, network, token) => __awaiter(void 0, void 0, void 0, function* () {
221
+ const view = (0, contracts_1.FluidViewContract)(web3, network);
222
+ const fTokenAddress = (0, markets_1.getFTokenAddress)(token, network);
223
+ const data = yield view.methods.getFTokenData(fTokenAddress).call();
224
+ const supplyRate = new decimal_js_1.default(data.supplyRate).div(100).toString();
225
+ const decimals = data.decimals;
226
+ const rewardsRate = new decimal_js_1.default((0, tokens_1.assetAmountInEth)(data.rewardsRate)).div(100).toString();
227
+ return {
228
+ fTokenAddress,
229
+ fTokenSymbol: data.symbol,
230
+ decimals,
231
+ totalDeposited: (0, utils_1.getEthAmountForDecimals)(data.totalAssets, decimals),
232
+ withdrawable: (0, utils_1.getEthAmountForDecimals)(data.withdrawable, decimals),
233
+ apy: new decimal_js_1.default(supplyRate).add(rewardsRate).toString(),
234
+ };
235
+ });
236
+ exports.getFluidTokenData = getFluidTokenData;
@@ -94,9 +94,6 @@ export declare const CBBTC_ETH_13_BASE: (networkId?: NetworkNumber) => FluidMark
94
94
  export declare const ETH_CBBTC_14_BASE: (networkId?: NetworkNumber) => FluidMarketInfo;
95
95
  export declare const WEETH_CBBTC_15_BASE: (networkId?: NetworkNumber) => FluidMarketInfo;
96
96
  export declare const WSTETH_CBBTC_16_BASE: (networkId?: NetworkNumber) => FluidMarketInfo;
97
- export declare const ETH_SUSDS_17_BASE: (networkId?: NetworkNumber) => FluidMarketInfo;
98
- export declare const WSTETH_SUSDS_18_BASE: (networkId?: NetworkNumber) => FluidMarketInfo;
99
- export declare const CBBTC_SUSDS_19_BASE: (networkId?: NetworkNumber) => FluidMarketInfo;
100
97
  export declare const FluidMarkets: (networkId: NetworkNumber) => {
101
98
  ETH_USDC_1: FluidMarketInfo;
102
99
  ETH_USDT_2: FluidMarketInfo;
@@ -192,9 +189,27 @@ export declare const FluidMarkets: (networkId: NetworkNumber) => {
192
189
  ETH_CBBTC_14_BASE: FluidMarketInfo;
193
190
  WEETH_CBBTC_15_BASE: FluidMarketInfo;
194
191
  WSTETH_CBBTC_16_BASE: FluidMarketInfo;
195
- ETH_SUSDS_17_BASE: FluidMarketInfo;
196
- WSTETH_SUSDS_18_BASE: FluidMarketInfo;
197
- CBBTC_SUSDS_19_BASE: FluidMarketInfo;
198
192
  };
199
193
  export declare const getFluidVersionsDataForNetwork: (network: NetworkNumber) => FluidMarketInfo[];
200
194
  export declare const getFluidMarketInfoById: (vaultId: number, network?: NetworkNumber) => FluidMarketInfo | undefined;
195
+ export declare const FluidFTokens: (networkId: NetworkNumber) => {
196
+ ETH: string;
197
+ USDC: string;
198
+ USDT: string;
199
+ wstETH: string;
200
+ GHO: string;
201
+ sUSDS: string;
202
+ } | {
203
+ ETH: string;
204
+ USDC: string;
205
+ USDT: string;
206
+ wstETH: string;
207
+ ARB: string;
208
+ } | {
209
+ ETH: string;
210
+ USDC: string;
211
+ EURC: string;
212
+ wstETH: string;
213
+ sUSDS: string;
214
+ };
215
+ export declare const getFTokenAddress: (token: string, networkId: NetworkNumber) => any;