@defisaver/positions-sdk 0.0.201-fluid-dev-4 → 0.0.201-fluid-dev-6
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/.mocharc.json +4 -4
- package/.nvmrc +1 -1
- package/README.md +69 -69
- package/cjs/config/contracts.d.ts +15 -0
- package/cjs/config/contracts.js +7 -2
- package/cjs/fluid/index.d.ts +14 -0
- package/cjs/fluid/index.js +32 -5
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/markets/fluid/index.d.ts +0 -6
- package/cjs/markets/fluid/index.js +57 -62
- package/cjs/services/priceService.d.ts +1 -0
- package/cjs/services/priceService.js +29 -1
- package/cjs/types/fluid.d.ts +1 -9
- package/cjs/types/fluid.js +0 -8
- package/esm/config/contracts.d.ts +15 -0
- package/esm/config/contracts.js +7 -2
- package/esm/fluid/index.d.ts +14 -0
- package/esm/fluid/index.js +32 -6
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/markets/fluid/index.d.ts +0 -6
- package/esm/markets/fluid/index.js +56 -57
- package/esm/services/priceService.d.ts +1 -0
- package/esm/services/priceService.js +27 -0
- package/esm/types/fluid.d.ts +1 -9
- package/esm/types/fluid.js +0 -8
- package/package.json +51 -51
- package/src/aaveV2/index.ts +227 -227
- package/src/aaveV3/index.ts +625 -625
- package/src/assets/index.ts +60 -60
- package/src/chickenBonds/index.ts +123 -123
- package/src/compoundV2/index.ts +220 -220
- package/src/compoundV3/index.ts +291 -291
- package/src/config/contracts.js +1122 -1117
- package/src/constants/index.ts +6 -6
- package/src/contracts.ts +134 -134
- package/src/curveUsd/index.ts +229 -229
- package/src/eulerV2/index.ts +303 -303
- package/src/exchange/index.ts +17 -17
- package/src/fluid/index.ts +329 -298
- package/src/helpers/aaveHelpers/index.ts +198 -198
- package/src/helpers/chickenBondsHelpers/index.ts +23 -23
- package/src/helpers/compoundHelpers/index.ts +246 -246
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/eulerHelpers/index.ts +232 -232
- package/src/helpers/fluidHelpers/index.ts +53 -53
- package/src/helpers/index.ts +11 -11
- package/src/helpers/liquityV2Helpers/index.ts +79 -79
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +94 -94
- package/src/helpers/morphoBlueHelpers/index.ts +365 -365
- package/src/helpers/sparkHelpers/index.ts +150 -150
- package/src/index.ts +52 -52
- package/src/liquity/index.ts +116 -116
- package/src/liquityV2/index.ts +227 -227
- package/src/llamaLend/index.ts +275 -275
- package/src/maker/index.ts +117 -117
- package/src/markets/aave/index.ts +152 -152
- package/src/markets/aave/marketAssets.ts +44 -44
- package/src/markets/compound/index.ts +213 -213
- package/src/markets/compound/marketsAssets.ts +82 -82
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/fluid/index.ts +2002 -2005
- package/src/markets/index.ts +27 -27
- package/src/markets/liquityV2/index.ts +43 -43
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +895 -895
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +10 -10
- package/src/moneymarket/moneymarketCommonService.ts +80 -80
- package/src/morphoAaveV2/index.ts +256 -256
- package/src/morphoAaveV3/index.ts +631 -631
- package/src/morphoBlue/index.ts +202 -202
- package/src/multicall/index.ts +33 -33
- package/src/services/dsrService.ts +15 -15
- package/src/services/priceService.ts +91 -62
- package/src/services/utils.ts +59 -59
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +461 -461
- package/src/staking/staking.ts +220 -220
- package/src/types/aave.ts +271 -271
- package/src/types/chickenBonds.ts +45 -45
- package/src/types/common.ts +84 -84
- package/src/types/compound.ts +131 -131
- package/src/types/curveUsd.ts +118 -118
- package/src/types/euler.ts +171 -171
- package/src/types/fluid.ts +263 -271
- package/src/types/index.ts +11 -11
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +118 -118
- package/src/types/llamaLend.ts +155 -155
- package/src/types/maker.ts +50 -50
- package/src/types/morphoBlue.ts +192 -192
- package/src/types/spark.ts +131 -131
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RSETH_WSTETH_79 = exports.RSETH_ETH_WSTETH_78 = exports.USDC_ETH_USDC_ETH_77 = exports.WEETH_ETH_WSTETH_74 = exports.GHO_USDC_GHO_USDC_61 = exports.SUSDS_GHO_58 = exports.WEETH_GHO_57 = exports.SUSDE_GHO_56 = exports.WSTETH_GHO_55 = exports.ETH_GHO_54 = exports.WBTC_CBBTC_USDT_53 = exports.WBTC_CBBTC_USDC_52 = exports.WBTC_CBBTC_WBTC_CBBTC_51 = exports.SUSDE_USDC_USDT_50 = exports.CBBTC_USDC_USDT_49 = exports.WBTC_USDC_USDT_48 = exports.WEETH_USDC_USDT_47 = exports.WSTETH_USDC_USDT_46 = exports.ETH_USDC_USDT_45 = exports.WSTETH_ETH_WSTETH_ETH_44 = exports.WEETH_CBBTC_32 = exports.ETH_CBBTC_31 = exports.CBBTC_USDT_30 = exports.CBBTC_USDC_29 = exports.CBBTC_ETH_28 = exports.WEETHS_WSTETH_27 = exports.WEETH_WBTC_26 = exports.WSTETH_WBTC_25 = exports.ETH_WBTC_24 = exports.WBTC_ETH_23 = exports.WBTC_USDT_22 = exports.WBTC_USDC_21 = exports.WEETH_USDT_20 = exports.WEETH_USDC_19 = exports.SUSDE_USDT_18 = exports.SUSDE_USDC_17 = exports.WEETH_WSTETH_16 = exports.WSTETH_USDT_15 = exports.WSTETH_USDC_14 = exports.WSTETH_ETH_13 = exports.ETH_USDT_12 = exports.ETH_USDC_11 = exports.WEETH_USDT_10 = exports.WEETH_USDC_9 = exports.WEETH_WSTETH_6 = exports.WSTETH_USDT_5 = exports.WSTETH_USDC_4 = exports.WSTETH_ETH_3 = exports.ETH_USDT_2 = exports.ETH_USDC_1 = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.getFTokenAddress = exports.FluidFTokens = void 0;
|
|
4
|
+
exports.getFTokenAddress = exports.FluidFTokens = exports.getFluidMarketInfoById = exports.getFluidVersionsDataForNetwork = exports.FluidMarkets = exports.WSTETH_CBBTC_16_BASE = exports.WEETH_CBBTC_15_BASE = exports.ETH_CBBTC_14_BASE = exports.CBBTC_ETH_13_BASE = exports.WSTETH_EURC_12_BASE = exports.WEETH_EURC_11_BASE = exports.ETH_EURC_10_BASE = exports.CBETH_EURC_9_BASE = exports.CBBTC_EURC_8_BASE = exports.CBBTC_USDC_7_BASE = exports.CBETH_USDC_6_BASE = exports.WEETH_USDC_5_BASE = exports.WEETH_WSTETH_4_BASE = exports.WSTETH_ETH_3_BASE = exports.WSTETH_USDC_2_BASE = exports.ETH_USDC_1_BASE = exports.WBTC_USDC_USDT_26_ARB = exports.WEETH_USDC_USDT_25_ARB = exports.WSTETH_USDC_USDT_24_ARB = exports.ETH_USDC_USDT_23_ARB = exports.USDC_ETH_USDC_ETH_22_ARB = exports.WEETH_WBTC_21_ARB = exports.WSTETH_WBTC_20_ARB = exports.ETH_WBTC_19_ARB = exports.WBTC_ETH_18_ARB = exports.WEETH_ETH_WSTETH_17_ARB = exports.WSTETH_ETH_WSTETH_ETH_16_ARB = exports.WBTC_USDT_13_ARB = exports.WBTC_USDC_12_ARB = exports.ARB_USDT_11_ARB = exports.ARB_USDC_10_ARB = exports.ETH_ARB_9_ARB = exports.WEETH_USDT_8_ARB = exports.WEETH_USDC_7_ARB = exports.WEETH_WSTETH_6_ARB = exports.WSTETH_ETH_5_ARB = exports.WSTETH_USDT_4_ARB = exports.WSTETH_USDC_3_ARB = exports.ETH_USDT_2_ARB = exports.ETH_USDC_1_ARB = exports.LBTC_CBBTC_WBTC_97 = exports.USDE_USDT_USDT_93 = exports.SUSDE_USDT_USDT_92 = exports.WEETHS_ETH_WSTETH_80 = void 0;
|
|
6
5
|
const common_1 = require("../../types/common");
|
|
7
6
|
const types_1 = require("../../types");
|
|
8
7
|
const ETH_USDC_1 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
@@ -1791,63 +1790,62 @@ const WSTETH_CBBTC_16_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
1791
1790
|
debtAsset: 'cbBTC',
|
|
1792
1791
|
});
|
|
1793
1792
|
exports.WSTETH_CBBTC_16_BASE = WSTETH_CBBTC_16_BASE;
|
|
1794
|
-
const ETH_SUSDS_17_BASE = (networkId =
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
});
|
|
1812
|
-
|
|
1813
|
-
const WSTETH_SUSDS_18_BASE = (networkId =
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
});
|
|
1831
|
-
|
|
1832
|
-
const CBBTC_SUSDS_19_BASE = (networkId =
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
});
|
|
1850
|
-
exports.CBBTC_SUSDS_19_BASE = CBBTC_SUSDS_19_BASE;
|
|
1793
|
+
// export const ETH_SUSDS_17_BASE = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1794
|
+
// stableBased: true,
|
|
1795
|
+
// btcBased: false,
|
|
1796
|
+
// wstETHBased: false,
|
|
1797
|
+
// ethBased: true,
|
|
1798
|
+
// type: FluidVaultType.T1,
|
|
1799
|
+
// id: 17,
|
|
1800
|
+
// chainIds: [NetworkNumber.Base],
|
|
1801
|
+
// label: 'ETH / sUSDS Market 17',
|
|
1802
|
+
// shortLabel: 'ETH/sUSDS',
|
|
1803
|
+
// value: FluidBaseVersions.ETH_SUSDS_17_BASE,
|
|
1804
|
+
// url: 'eth-susds-17-base',
|
|
1805
|
+
// marketAddress: '0x3996464c0fCCa8183e13ea5E5e74375e2c8744Dd',
|
|
1806
|
+
// hasSmartCollateral: false,
|
|
1807
|
+
// hasSmartDebt: false,
|
|
1808
|
+
// collateralAsset: 'ETH',
|
|
1809
|
+
// debtAsset: 'sSUDS',
|
|
1810
|
+
// });
|
|
1811
|
+
//
|
|
1812
|
+
// export const WSTETH_SUSDS_18_BASE = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1813
|
+
// stableBased: true,
|
|
1814
|
+
// btcBased: false,
|
|
1815
|
+
// wstETHBased: true,
|
|
1816
|
+
// ethBased: true,
|
|
1817
|
+
// type: FluidVaultType.T1,
|
|
1818
|
+
// id: 18,
|
|
1819
|
+
// chainIds: [NetworkNumber.Base],
|
|
1820
|
+
// label: 'wstETH / sUSDS Market 18',
|
|
1821
|
+
// shortLabel: 'wstETH/sUSDS',
|
|
1822
|
+
// value: FluidBaseVersions.WSTETH_SUSDS_18_BASE,
|
|
1823
|
+
// url: 'wsteth-susds-18-base',
|
|
1824
|
+
// marketAddress: '0xBc345229C1b52e4c30530C614BB487323BA38Da5',
|
|
1825
|
+
// hasSmartCollateral: false,
|
|
1826
|
+
// hasSmartDebt: false,
|
|
1827
|
+
// collateralAsset: 'wstETH',
|
|
1828
|
+
// debtAsset: 'sUSDS',
|
|
1829
|
+
// });
|
|
1830
|
+
//
|
|
1831
|
+
// export const CBBTC_SUSDS_19_BASE = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1832
|
+
// stableBased: true,
|
|
1833
|
+
// btcBased: false,
|
|
1834
|
+
// wstETHBased: false,
|
|
1835
|
+
// ethBased: false,
|
|
1836
|
+
// type: FluidVaultType.T1,
|
|
1837
|
+
// id: 19,
|
|
1838
|
+
// chainIds: [NetworkNumber.Base],
|
|
1839
|
+
// label: 'cbBTC / sUSDS Market 19',
|
|
1840
|
+
// shortLabel: 'cbBTC/sUSDS',
|
|
1841
|
+
// value: FluidBaseVersions.CBBTC_SUSDS_19_BASE,
|
|
1842
|
+
// url: 'cbbtc-susds-19-base',
|
|
1843
|
+
// marketAddress: '0xF2c8F54447cbd591C396b0Dd7ac15FAF552d0FA4',
|
|
1844
|
+
// hasSmartCollateral: false,
|
|
1845
|
+
// hasSmartDebt: false,
|
|
1846
|
+
// collateralAsset: 'cbBTC',
|
|
1847
|
+
// debtAsset: 'sUSDS',
|
|
1848
|
+
// });
|
|
1851
1849
|
const FluidMarkets = (networkId) => ({
|
|
1852
1850
|
[types_1.FluidMainnetVersion.ETH_USDC_1]: (0, exports.ETH_USDC_1)(networkId),
|
|
1853
1851
|
[types_1.FluidMainnetVersion.ETH_USDT_2]: (0, exports.ETH_USDT_2)(networkId),
|
|
@@ -1945,9 +1943,6 @@ const FluidMarkets = (networkId) => ({
|
|
|
1945
1943
|
[types_1.FluidBaseVersions.ETH_CBBTC_14_BASE]: (0, exports.ETH_CBBTC_14_BASE)(networkId),
|
|
1946
1944
|
[types_1.FluidBaseVersions.WEETH_CBBTC_15_BASE]: (0, exports.WEETH_CBBTC_15_BASE)(networkId),
|
|
1947
1945
|
[types_1.FluidBaseVersions.WSTETH_CBBTC_16_BASE]: (0, exports.WSTETH_CBBTC_16_BASE)(networkId),
|
|
1948
|
-
[types_1.FluidBaseVersions.ETH_SUSDS_17_BASE]: (0, exports.ETH_SUSDS_17_BASE)(networkId),
|
|
1949
|
-
[types_1.FluidBaseVersions.WSTETH_SUSDS_18_BASE]: (0, exports.WSTETH_SUSDS_18_BASE)(networkId),
|
|
1950
|
-
[types_1.FluidBaseVersions.CBBTC_SUSDS_19_BASE]: (0, exports.CBBTC_SUSDS_19_BASE)(networkId),
|
|
1951
1946
|
});
|
|
1952
1947
|
exports.FluidMarkets = FluidMarkets;
|
|
1953
1948
|
const getFluidVersionsDataForNetwork = (network) => (Object.values((0, exports.FluidMarkets)(network)).filter(({ chainIds, marketAddress, type }) => !!marketAddress && chainIds.includes(network) && type === types_1.FluidVaultType.T1));
|
|
@@ -4,4 +4,5 @@ export declare const getEthPrice: (web3: Web3) => Promise<string>;
|
|
|
4
4
|
export declare const getUSDCPrice: (web3: Web3) => Promise<string>;
|
|
5
5
|
export declare const getCompPrice: (web3: Web3) => Promise<string>;
|
|
6
6
|
export declare const getWstETHPrice: (web3: Web3) => Promise<string>;
|
|
7
|
+
export declare const getWstETHPriceFluid: (web3: Web3, network: NetworkNumber) => Promise<string>;
|
|
7
8
|
export declare const getChainlinkAssetAddress: (symbol: string, network: NetworkNumber) => string;
|
|
@@ -12,12 +12,13 @@ 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.getChainlinkAssetAddress = exports.getWstETHPrice = exports.getCompPrice = exports.getUSDCPrice = exports.getEthPrice = void 0;
|
|
15
|
+
exports.getChainlinkAssetAddress = exports.getWstETHPriceFluid = exports.getWstETHPrice = exports.getCompPrice = exports.getUSDCPrice = exports.getEthPrice = void 0;
|
|
16
16
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
17
17
|
const tokens_1 = require("@defisaver/tokens");
|
|
18
18
|
const contracts_1 = require("../contracts");
|
|
19
19
|
const common_1 = require("../types/common");
|
|
20
20
|
const multicall_1 = require("../multicall");
|
|
21
|
+
const utils_1 = require("./utils");
|
|
21
22
|
const getEthPrice = (web3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
23
|
const contract = (0, contracts_1.ETHPriceFeedContract)(web3, common_1.NetworkNumber.Eth);
|
|
23
24
|
const price = yield contract.methods.latestAnswer().call();
|
|
@@ -57,6 +58,33 @@ const getWstETHPrice = (web3) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
57
58
|
return new decimal_js_1.default(ethPrice).mul(wstETHRate).toString();
|
|
58
59
|
});
|
|
59
60
|
exports.getWstETHPrice = getWstETHPrice;
|
|
61
|
+
// this is a fixed version, the original version is above but requires to refactor comp v3 function, so it's easier to just copy the function for now
|
|
62
|
+
const getWstETHPriceFluid = (web3, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
const wstETHFeedContract = (0, contracts_1.WstETHPriceFeedContract)(web3, network);
|
|
64
|
+
const ethFeedContract = (0, contracts_1.ETHPriceFeedContract)(web3, network);
|
|
65
|
+
const calls = [
|
|
66
|
+
{
|
|
67
|
+
target: ethFeedContract.options.address,
|
|
68
|
+
abiItem: ethFeedContract.options.jsonInterface.find(({ name }) => name === 'latestAnswer'),
|
|
69
|
+
params: [],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
target: wstETHFeedContract.options.address,
|
|
73
|
+
abiItem: wstETHFeedContract.options.jsonInterface.find(({ name }) => name === 'latestRoundData'),
|
|
74
|
+
params: [],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
target: wstETHFeedContract.options.address,
|
|
78
|
+
abiItem: wstETHFeedContract.options.jsonInterface.find(({ name }) => name === 'decimals'),
|
|
79
|
+
params: [],
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
const multicallRes = yield (0, multicall_1.multicall)(calls, web3, network);
|
|
83
|
+
const ethPrice = new decimal_js_1.default(multicallRes[0][0]).div(1e8);
|
|
84
|
+
const wstETHRate = (0, utils_1.getEthAmountForDecimals)(multicallRes[1].answer, multicallRes[2][0]);
|
|
85
|
+
return new decimal_js_1.default(ethPrice).mul(wstETHRate).toString();
|
|
86
|
+
});
|
|
87
|
+
exports.getWstETHPriceFluid = getWstETHPriceFluid;
|
|
60
88
|
// chainlink price feed available only on mainnet
|
|
61
89
|
const getChainlinkAssetAddress = (symbol, network) => {
|
|
62
90
|
// Chainlink only has BTC/USD feed so we use that for BTC derivatives
|
package/cjs/types/fluid.d.ts
CHANGED
|
@@ -24,8 +24,6 @@ export declare enum FluidMainnetVersion {
|
|
|
24
24
|
WSTETH_USDC_4 = "WSTETH_USDC_4",
|
|
25
25
|
WSTETH_USDT_5 = "WSTETH_USDT_5",
|
|
26
26
|
WEETH_WSTETH_6 = "WEETH_WSTETH_6",
|
|
27
|
-
SUSDE_USDC_7 = "SUSDE_USDC_7",
|
|
28
|
-
SUSDE_USDT_8 = "SUSDE_USDT_8",
|
|
29
27
|
WEETH_USDC_9 = "WEETH_USDC_9",
|
|
30
28
|
WEETH_USDT_10 = "WEETH_USDT_10",
|
|
31
29
|
ETH_USDC_11 = "ETH_USDC_11",
|
|
@@ -50,7 +48,6 @@ export declare enum FluidMainnetVersion {
|
|
|
50
48
|
CBBTC_USDT_30 = "CBBTC_USDT_30",
|
|
51
49
|
ETH_CBBTC_31 = "ETH_CBBTC_31",
|
|
52
50
|
WEETH_CBBTC_32 = "WEETH_CBBTC_32",
|
|
53
|
-
WSTETH_CBBTC_33 = "WSTETH_CBBTC_33",
|
|
54
51
|
WSTETH_ETH_WSTETH_ETH_44 = "WSTETH_ETH_WSTETH_ETH_44",
|
|
55
52
|
ETH_USDC_USDT_45 = "ETH_USDC_USDT_45",
|
|
56
53
|
WSTETH_USDC_USDT_46 = "WSTETH_USDC_USDT_46",
|
|
@@ -66,8 +63,6 @@ export declare enum FluidMainnetVersion {
|
|
|
66
63
|
SUSDE_GHO_56 = "SUSDE_GHO_56",
|
|
67
64
|
WEETH_GHO_57 = "WEETH_GHO_57",
|
|
68
65
|
SUSDS_GHO_58 = "SUSDS_GHO_58",
|
|
69
|
-
WBTC_GHO_59 = "WBTC_GHO_59",
|
|
70
|
-
CBBTC_GHO_60 = "CBBTC_GHO_60",
|
|
71
66
|
GHO_USDC_GHO_USDC_61 = "GHO_USDC_GHO_USDC_61",
|
|
72
67
|
WEETH_ETH_WSTETH_74 = "WEETH_ETH_WSTETH_74",
|
|
73
68
|
USDC_ETH_USDC_ETH_77 = "USDC_ETH_USDC_ETH_77",
|
|
@@ -120,10 +115,7 @@ export declare enum FluidBaseVersions {
|
|
|
120
115
|
CBBTC_ETH_13_BASE = "CBBTC_ETH_13_BASE",
|
|
121
116
|
ETH_CBBTC_14_BASE = "ETH_CBBTC_14_BASE",
|
|
122
117
|
WEETH_CBBTC_15_BASE = "WEETH_CBBTC_15_BASE",
|
|
123
|
-
WSTETH_CBBTC_16_BASE = "WSTETH_CBBTC_16_BASE"
|
|
124
|
-
ETH_SUSDS_17_BASE = "ETH_SUSDS_17_BASE",
|
|
125
|
-
WSTETH_SUSDS_18_BASE = "WSTETH_SUSDS_18_BASE",
|
|
126
|
-
CBBTC_SUSDS_19_BASE = "CBBTC_SUSDS_19_BASE"
|
|
118
|
+
WSTETH_CBBTC_16_BASE = "WSTETH_CBBTC_16_BASE"
|
|
127
119
|
}
|
|
128
120
|
export type FluidVersions = FluidArbitrumVersion | FluidBaseVersions | FluidMainnetVersion;
|
|
129
121
|
export declare enum FluidMainnetDepositToken {
|
package/cjs/types/fluid.js
CHANGED
|
@@ -10,8 +10,6 @@ var FluidMainnetVersion;
|
|
|
10
10
|
FluidMainnetVersion["WSTETH_USDC_4"] = "WSTETH_USDC_4";
|
|
11
11
|
FluidMainnetVersion["WSTETH_USDT_5"] = "WSTETH_USDT_5";
|
|
12
12
|
FluidMainnetVersion["WEETH_WSTETH_6"] = "WEETH_WSTETH_6";
|
|
13
|
-
FluidMainnetVersion["SUSDE_USDC_7"] = "SUSDE_USDC_7";
|
|
14
|
-
FluidMainnetVersion["SUSDE_USDT_8"] = "SUSDE_USDT_8";
|
|
15
13
|
FluidMainnetVersion["WEETH_USDC_9"] = "WEETH_USDC_9";
|
|
16
14
|
FluidMainnetVersion["WEETH_USDT_10"] = "WEETH_USDT_10";
|
|
17
15
|
FluidMainnetVersion["ETH_USDC_11"] = "ETH_USDC_11";
|
|
@@ -36,7 +34,6 @@ var FluidMainnetVersion;
|
|
|
36
34
|
FluidMainnetVersion["CBBTC_USDT_30"] = "CBBTC_USDT_30";
|
|
37
35
|
FluidMainnetVersion["ETH_CBBTC_31"] = "ETH_CBBTC_31";
|
|
38
36
|
FluidMainnetVersion["WEETH_CBBTC_32"] = "WEETH_CBBTC_32";
|
|
39
|
-
FluidMainnetVersion["WSTETH_CBBTC_33"] = "WSTETH_CBBTC_33";
|
|
40
37
|
FluidMainnetVersion["WSTETH_ETH_WSTETH_ETH_44"] = "WSTETH_ETH_WSTETH_ETH_44";
|
|
41
38
|
FluidMainnetVersion["ETH_USDC_USDT_45"] = "ETH_USDC_USDT_45";
|
|
42
39
|
FluidMainnetVersion["WSTETH_USDC_USDT_46"] = "WSTETH_USDC_USDT_46";
|
|
@@ -52,8 +49,6 @@ var FluidMainnetVersion;
|
|
|
52
49
|
FluidMainnetVersion["SUSDE_GHO_56"] = "SUSDE_GHO_56";
|
|
53
50
|
FluidMainnetVersion["WEETH_GHO_57"] = "WEETH_GHO_57";
|
|
54
51
|
FluidMainnetVersion["SUSDS_GHO_58"] = "SUSDS_GHO_58";
|
|
55
|
-
FluidMainnetVersion["WBTC_GHO_59"] = "WBTC_GHO_59";
|
|
56
|
-
FluidMainnetVersion["CBBTC_GHO_60"] = "CBBTC_GHO_60";
|
|
57
52
|
FluidMainnetVersion["GHO_USDC_GHO_USDC_61"] = "GHO_USDC_GHO_USDC_61";
|
|
58
53
|
FluidMainnetVersion["WEETH_ETH_WSTETH_74"] = "WEETH_ETH_WSTETH_74";
|
|
59
54
|
FluidMainnetVersion["USDC_ETH_USDC_ETH_77"] = "USDC_ETH_USDC_ETH_77";
|
|
@@ -109,9 +104,6 @@ var FluidBaseVersions;
|
|
|
109
104
|
FluidBaseVersions["ETH_CBBTC_14_BASE"] = "ETH_CBBTC_14_BASE";
|
|
110
105
|
FluidBaseVersions["WEETH_CBBTC_15_BASE"] = "WEETH_CBBTC_15_BASE";
|
|
111
106
|
FluidBaseVersions["WSTETH_CBBTC_16_BASE"] = "WSTETH_CBBTC_16_BASE";
|
|
112
|
-
FluidBaseVersions["ETH_SUSDS_17_BASE"] = "ETH_SUSDS_17_BASE";
|
|
113
|
-
FluidBaseVersions["WSTETH_SUSDS_18_BASE"] = "WSTETH_SUSDS_18_BASE";
|
|
114
|
-
FluidBaseVersions["CBBTC_SUSDS_19_BASE"] = "CBBTC_SUSDS_19_BASE";
|
|
115
107
|
})(FluidBaseVersions || (exports.FluidBaseVersions = FluidBaseVersions = {}));
|
|
116
108
|
var FluidMainnetDepositToken;
|
|
117
109
|
(function (FluidMainnetDepositToken) {
|
|
@@ -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
|
}
|
package/esm/config/contracts.js
CHANGED
|
@@ -1014,7 +1014,9 @@ module.exports = {
|
|
|
1014
1014
|
"ETHPriceFeed": {
|
|
1015
1015
|
"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" }],
|
|
1016
1016
|
"networks": {
|
|
1017
|
-
"1": { "address": "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" }
|
|
1017
|
+
"1": { "address": "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" },
|
|
1018
|
+
"8453": { "address": "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70" },
|
|
1019
|
+
"42161": { "address": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612" }
|
|
1018
1020
|
},
|
|
1019
1021
|
},
|
|
1020
1022
|
"USDCPriceFeed": {
|
|
@@ -1026,7 +1028,9 @@ module.exports = {
|
|
|
1026
1028
|
"WstETHPriceFeed": {
|
|
1027
1029
|
"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" }],
|
|
1028
1030
|
"networks": {
|
|
1029
|
-
"1": { "address": "0x4F67e4d9BD67eFa28236013288737D39AeF48e79" }
|
|
1031
|
+
"1": { "address": "0x4F67e4d9BD67eFa28236013288737D39AeF48e79" },
|
|
1032
|
+
"8453": { "address": "0x43a5C292A453A3bF3606fa856197f09D7B74251a" },
|
|
1033
|
+
"42161": { "address": "0xb523AE262D20A936BC152e6023996e46FDC2A95D" }
|
|
1030
1034
|
}
|
|
1031
1035
|
},
|
|
1032
1036
|
"MorphoBlueView": {
|
|
@@ -1072,6 +1076,7 @@ module.exports = {
|
|
|
1072
1076
|
"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" }],
|
|
1073
1077
|
"networks": {
|
|
1074
1078
|
"8453": { "address": "0x7dFF34190d0307fC234fc7E8C152C9715083eB02" },
|
|
1079
|
+
"42161": { "address": "0x158E27De8B5E5bC3FA1C6D5b365a291c54f6b0Fd" }
|
|
1075
1080
|
}
|
|
1076
1081
|
},
|
|
1077
1082
|
"LlamaLendView": {
|
package/esm/fluid/index.d.ts
CHANGED
|
@@ -44,4 +44,18 @@ export declare const getFluidTokenData: (web3: Web3, network: NetworkNumber, tok
|
|
|
44
44
|
totalDeposited: string;
|
|
45
45
|
withdrawable: string;
|
|
46
46
|
apy: string;
|
|
47
|
+
depositRate: string;
|
|
48
|
+
withdrawRate: string;
|
|
49
|
+
}>;
|
|
50
|
+
export declare const getFluidDepositData: (web3: Web3, network: NetworkNumber, token: string, address: EthAddress) => Promise<{
|
|
51
|
+
fTokenAddress: any;
|
|
52
|
+
fTokenSymbol: string;
|
|
53
|
+
decimals: string;
|
|
54
|
+
totalDeposited: string;
|
|
55
|
+
withdrawable: string;
|
|
56
|
+
apy: string;
|
|
57
|
+
depositRate: string;
|
|
58
|
+
withdrawRate: string;
|
|
59
|
+
deposited: string;
|
|
60
|
+
depositedShares: string;
|
|
47
61
|
}>;
|
package/esm/fluid/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import Dec from 'decimal.js';
|
|
11
|
-
import {
|
|
11
|
+
import { getAssetInfo, getAssetInfoByAddress } from '@defisaver/tokens';
|
|
12
12
|
import { NetworkNumber } from '../types/common';
|
|
13
13
|
import { FluidVaultType, } from '../types';
|
|
14
14
|
import { DFSFeedRegistryContract, FeedRegistryContract, FluidViewContract } from '../contracts';
|
|
@@ -17,7 +17,7 @@ import { getFluidAggregatedData } from '../helpers/fluidHelpers';
|
|
|
17
17
|
import { chunkAndMulticall } from '../multicall';
|
|
18
18
|
import { getFluidMarketInfoById, getFluidVersionsDataForNetwork, getFTokenAddress } from '../markets';
|
|
19
19
|
import { USD_QUOTE } from '../constants';
|
|
20
|
-
import { getChainlinkAssetAddress,
|
|
20
|
+
import { getChainlinkAssetAddress, getWstETHPriceFluid } from '../services/priceService';
|
|
21
21
|
export const EMPTY_USED_ASSET = {
|
|
22
22
|
isSupplied: false,
|
|
23
23
|
isBorrowed: false,
|
|
@@ -38,8 +38,8 @@ const parseVaultType = (vaultType) => {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
const parseMarketData = (web3, data, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
-
const collAsset = getAssetInfoByAddress(data.supplyToken0);
|
|
42
|
-
const debtAsset = getAssetInfoByAddress(data.borrowToken0);
|
|
41
|
+
const collAsset = getAssetInfoByAddress(data.supplyToken0, network);
|
|
42
|
+
const debtAsset = getAssetInfoByAddress(data.borrowToken0, network);
|
|
43
43
|
const supplyRate = new Dec(data.supplyRateVault).div(100).toString();
|
|
44
44
|
const borrowRate = new Dec(data.borrowRateVault).div(100).toString();
|
|
45
45
|
const oracleScaleFactor = new Dec(27).add(debtAsset.decimals).sub(collAsset.decimals).toString();
|
|
@@ -51,7 +51,7 @@ const parseMarketData = (web3, data, network) => __awaiter(void 0, void 0, void
|
|
|
51
51
|
let loanTokenPrice;
|
|
52
52
|
if (debtAsset.symbol === 'wstETH') {
|
|
53
53
|
// need to handle wstETH for l2s inside getWstETHPrice
|
|
54
|
-
loanTokenPrice = yield
|
|
54
|
+
loanTokenPrice = yield getWstETHPriceFluid(web3, network);
|
|
55
55
|
}
|
|
56
56
|
else if (isMainnet) {
|
|
57
57
|
const feedRegistryContract = FeedRegistryContract(web3, NetworkNumber.Eth);
|
|
@@ -211,8 +211,10 @@ export const getFluidTokenData = (web3, network, token) => __awaiter(void 0, voi
|
|
|
211
211
|
const fTokenAddress = getFTokenAddress(token, network);
|
|
212
212
|
const data = yield view.methods.getFTokenData(fTokenAddress).call();
|
|
213
213
|
const supplyRate = new Dec(data.supplyRate).div(100).toString();
|
|
214
|
+
const rewardsRate = new Dec(data.rewardsRate).div(1e12).toString();
|
|
214
215
|
const decimals = data.decimals;
|
|
215
|
-
const
|
|
216
|
+
const depositRate = new Dec(getEthAmountForDecimals(data.convertToShares, decimals)).toString();
|
|
217
|
+
const withdrawRate = new Dec(getEthAmountForDecimals(data.convertToAssets, decimals)).toString();
|
|
216
218
|
return {
|
|
217
219
|
fTokenAddress,
|
|
218
220
|
fTokenSymbol: data.symbol,
|
|
@@ -220,5 +222,29 @@ export const getFluidTokenData = (web3, network, token) => __awaiter(void 0, voi
|
|
|
220
222
|
totalDeposited: getEthAmountForDecimals(data.totalAssets, decimals),
|
|
221
223
|
withdrawable: getEthAmountForDecimals(data.withdrawable, decimals),
|
|
222
224
|
apy: new Dec(supplyRate).add(rewardsRate).toString(),
|
|
225
|
+
depositRate,
|
|
226
|
+
withdrawRate,
|
|
227
|
+
};
|
|
228
|
+
});
|
|
229
|
+
export const getFluidDepositData = (web3, network, token, address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
230
|
+
const view = FluidViewContract(web3, network);
|
|
231
|
+
const fTokenAddress = getFTokenAddress(token, network);
|
|
232
|
+
const { fTokenData, userPosition } = yield view.methods.getUserEarnPositionWithFToken(fTokenAddress, address).call();
|
|
233
|
+
const supplyRate = new Dec(fTokenData.supplyRate).div(100).toString();
|
|
234
|
+
const rewardsRate = new Dec(fTokenData.rewardsRate).div(1e12).toString();
|
|
235
|
+
const decimals = fTokenData.decimals;
|
|
236
|
+
const depositRate = new Dec(getEthAmountForDecimals(fTokenData.convertToShares, decimals)).toString();
|
|
237
|
+
const withdrawRate = new Dec(getEthAmountForDecimals(fTokenData.convertToAssets, decimals)).toString();
|
|
238
|
+
return {
|
|
239
|
+
fTokenAddress,
|
|
240
|
+
fTokenSymbol: fTokenData.symbol,
|
|
241
|
+
decimals,
|
|
242
|
+
totalDeposited: getEthAmountForDecimals(fTokenData.totalAssets, decimals),
|
|
243
|
+
withdrawable: getEthAmountForDecimals(fTokenData.withdrawable, decimals),
|
|
244
|
+
apy: new Dec(supplyRate).add(rewardsRate).toString(),
|
|
245
|
+
depositRate,
|
|
246
|
+
withdrawRate,
|
|
247
|
+
deposited: getEthAmountForDecimals(userPosition.underlyingAssets, decimals),
|
|
248
|
+
depositedShares: getEthAmountForDecimals(userPosition.fTokenShares, decimals),
|
|
223
249
|
};
|
|
224
250
|
});
|
|
@@ -105,73 +105,73 @@ export const getApyAfterValuesEstimation = (selectedMarket, actions, web3, netwo
|
|
|
105
105
|
return { borrowRate, supplyRate };
|
|
106
106
|
});
|
|
107
107
|
const API_URL = 'https://blue-api.morpho.org/graphql';
|
|
108
|
-
const MARKET_QUERY = `
|
|
109
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
110
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
111
|
-
reallocatableLiquidityAssets
|
|
112
|
-
targetBorrowUtilization
|
|
113
|
-
loanAsset {
|
|
114
|
-
address
|
|
115
|
-
decimals
|
|
116
|
-
priceUsd
|
|
117
|
-
}
|
|
118
|
-
state {
|
|
119
|
-
liquidityAssets
|
|
120
|
-
borrowAssets
|
|
121
|
-
supplyAssets
|
|
122
|
-
}
|
|
123
|
-
publicAllocatorSharedLiquidity {
|
|
124
|
-
assets
|
|
125
|
-
vault {
|
|
126
|
-
address
|
|
127
|
-
name
|
|
128
|
-
}
|
|
129
|
-
allocationMarket {
|
|
130
|
-
uniqueKey
|
|
131
|
-
loanAsset {
|
|
132
|
-
address
|
|
133
|
-
}
|
|
134
|
-
collateralAsset {
|
|
135
|
-
address
|
|
136
|
-
}
|
|
137
|
-
irmAddress
|
|
138
|
-
oracle {
|
|
139
|
-
address
|
|
140
|
-
}
|
|
141
|
-
lltv
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
loanAsset {
|
|
145
|
-
address
|
|
146
|
-
}
|
|
147
|
-
collateralAsset {
|
|
148
|
-
address
|
|
149
|
-
}
|
|
150
|
-
oracle {
|
|
151
|
-
address
|
|
152
|
-
}
|
|
153
|
-
irmAddress
|
|
154
|
-
lltv
|
|
155
|
-
}
|
|
156
|
-
}
|
|
108
|
+
const MARKET_QUERY = `
|
|
109
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
110
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
111
|
+
reallocatableLiquidityAssets
|
|
112
|
+
targetBorrowUtilization
|
|
113
|
+
loanAsset {
|
|
114
|
+
address
|
|
115
|
+
decimals
|
|
116
|
+
priceUsd
|
|
117
|
+
}
|
|
118
|
+
state {
|
|
119
|
+
liquidityAssets
|
|
120
|
+
borrowAssets
|
|
121
|
+
supplyAssets
|
|
122
|
+
}
|
|
123
|
+
publicAllocatorSharedLiquidity {
|
|
124
|
+
assets
|
|
125
|
+
vault {
|
|
126
|
+
address
|
|
127
|
+
name
|
|
128
|
+
}
|
|
129
|
+
allocationMarket {
|
|
130
|
+
uniqueKey
|
|
131
|
+
loanAsset {
|
|
132
|
+
address
|
|
133
|
+
}
|
|
134
|
+
collateralAsset {
|
|
135
|
+
address
|
|
136
|
+
}
|
|
137
|
+
irmAddress
|
|
138
|
+
oracle {
|
|
139
|
+
address
|
|
140
|
+
}
|
|
141
|
+
lltv
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
loanAsset {
|
|
145
|
+
address
|
|
146
|
+
}
|
|
147
|
+
collateralAsset {
|
|
148
|
+
address
|
|
149
|
+
}
|
|
150
|
+
oracle {
|
|
151
|
+
address
|
|
152
|
+
}
|
|
153
|
+
irmAddress
|
|
154
|
+
lltv
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
157
|
`;
|
|
158
|
-
const REWARDS_QUERY = `
|
|
159
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
160
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
161
|
-
uniqueKey
|
|
162
|
-
state {
|
|
163
|
-
rewards {
|
|
164
|
-
amountPerSuppliedToken
|
|
165
|
-
supplyApr
|
|
166
|
-
amountPerBorrowedToken
|
|
167
|
-
borrowApr
|
|
168
|
-
asset {
|
|
169
|
-
address
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
158
|
+
const REWARDS_QUERY = `
|
|
159
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
160
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
161
|
+
uniqueKey
|
|
162
|
+
state {
|
|
163
|
+
rewards {
|
|
164
|
+
amountPerSuppliedToken
|
|
165
|
+
supplyApr
|
|
166
|
+
amountPerBorrowedToken
|
|
167
|
+
borrowApr
|
|
168
|
+
asset {
|
|
169
|
+
address
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
175
|
`;
|
|
176
176
|
/**
|
|
177
177
|
* Get reallocatable liquidity to a given market and target borrow utilization
|
|
@@ -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,6 @@ 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;
|