@defisaver/positions-sdk 0.0.201-fluid-dev-4 → 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.
- package/cjs/config/contracts.d.ts +15 -0
- package/cjs/config/contracts.js +7 -2
- package/cjs/fluid/index.js +3 -3
- 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.js +4 -4
- 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 +1 -1
- package/src/config/contracts.js +7 -2
- package/src/fluid/index.ts +4 -4
- package/src/markets/fluid/index.ts +56 -59
- package/src/services/priceService.ts +29 -0
- package/src/types/fluid.ts +0 -8
|
@@ -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/cjs/config/contracts.js
CHANGED
|
@@ -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": {
|
package/cjs/fluid/index.js
CHANGED
|
@@ -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.
|
|
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);
|
|
@@ -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;
|
|
@@ -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.js
CHANGED
|
@@ -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);
|
|
@@ -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;
|
|
@@ -1692,60 +1692,62 @@ export const WSTETH_CBBTC_16_BASE = (networkId = NetworkNumber.Eth) => ({
|
|
|
1692
1692
|
collateralAsset: 'wstETH',
|
|
1693
1693
|
debtAsset: 'cbBTC',
|
|
1694
1694
|
});
|
|
1695
|
-
export const ETH_SUSDS_17_BASE = (networkId = NetworkNumber.Eth) => ({
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
});
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1695
|
+
// export const ETH_SUSDS_17_BASE = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1696
|
+
// stableBased: true,
|
|
1697
|
+
// btcBased: false,
|
|
1698
|
+
// wstETHBased: false,
|
|
1699
|
+
// ethBased: true,
|
|
1700
|
+
// type: FluidVaultType.T1,
|
|
1701
|
+
// id: 17,
|
|
1702
|
+
// chainIds: [NetworkNumber.Base],
|
|
1703
|
+
// label: 'ETH / sUSDS Market 17',
|
|
1704
|
+
// shortLabel: 'ETH/sUSDS',
|
|
1705
|
+
// value: FluidBaseVersions.ETH_SUSDS_17_BASE,
|
|
1706
|
+
// url: 'eth-susds-17-base',
|
|
1707
|
+
// marketAddress: '0x3996464c0fCCa8183e13ea5E5e74375e2c8744Dd',
|
|
1708
|
+
// hasSmartCollateral: false,
|
|
1709
|
+
// hasSmartDebt: false,
|
|
1710
|
+
// collateralAsset: 'ETH',
|
|
1711
|
+
// debtAsset: 'sSUDS',
|
|
1712
|
+
// });
|
|
1713
|
+
//
|
|
1714
|
+
// export const WSTETH_SUSDS_18_BASE = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1715
|
+
// stableBased: true,
|
|
1716
|
+
// btcBased: false,
|
|
1717
|
+
// wstETHBased: true,
|
|
1718
|
+
// ethBased: true,
|
|
1719
|
+
// type: FluidVaultType.T1,
|
|
1720
|
+
// id: 18,
|
|
1721
|
+
// chainIds: [NetworkNumber.Base],
|
|
1722
|
+
// label: 'wstETH / sUSDS Market 18',
|
|
1723
|
+
// shortLabel: 'wstETH/sUSDS',
|
|
1724
|
+
// value: FluidBaseVersions.WSTETH_SUSDS_18_BASE,
|
|
1725
|
+
// url: 'wsteth-susds-18-base',
|
|
1726
|
+
// marketAddress: '0xBc345229C1b52e4c30530C614BB487323BA38Da5',
|
|
1727
|
+
// hasSmartCollateral: false,
|
|
1728
|
+
// hasSmartDebt: false,
|
|
1729
|
+
// collateralAsset: 'wstETH',
|
|
1730
|
+
// debtAsset: 'sUSDS',
|
|
1731
|
+
// });
|
|
1732
|
+
//
|
|
1733
|
+
// export const CBBTC_SUSDS_19_BASE = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1734
|
+
// stableBased: true,
|
|
1735
|
+
// btcBased: false,
|
|
1736
|
+
// wstETHBased: false,
|
|
1737
|
+
// ethBased: false,
|
|
1738
|
+
// type: FluidVaultType.T1,
|
|
1739
|
+
// id: 19,
|
|
1740
|
+
// chainIds: [NetworkNumber.Base],
|
|
1741
|
+
// label: 'cbBTC / sUSDS Market 19',
|
|
1742
|
+
// shortLabel: 'cbBTC/sUSDS',
|
|
1743
|
+
// value: FluidBaseVersions.CBBTC_SUSDS_19_BASE,
|
|
1744
|
+
// url: 'cbbtc-susds-19-base',
|
|
1745
|
+
// marketAddress: '0xF2c8F54447cbd591C396b0Dd7ac15FAF552d0FA4',
|
|
1746
|
+
// hasSmartCollateral: false,
|
|
1747
|
+
// hasSmartDebt: false,
|
|
1748
|
+
// collateralAsset: 'cbBTC',
|
|
1749
|
+
// debtAsset: 'sUSDS',
|
|
1750
|
+
// });
|
|
1749
1751
|
export const FluidMarkets = (networkId) => ({
|
|
1750
1752
|
[FluidMainnetVersion.ETH_USDC_1]: ETH_USDC_1(networkId),
|
|
1751
1753
|
[FluidMainnetVersion.ETH_USDT_2]: ETH_USDT_2(networkId),
|
|
@@ -1843,9 +1845,6 @@ export const FluidMarkets = (networkId) => ({
|
|
|
1843
1845
|
[FluidBaseVersions.ETH_CBBTC_14_BASE]: ETH_CBBTC_14_BASE(networkId),
|
|
1844
1846
|
[FluidBaseVersions.WEETH_CBBTC_15_BASE]: WEETH_CBBTC_15_BASE(networkId),
|
|
1845
1847
|
[FluidBaseVersions.WSTETH_CBBTC_16_BASE]: WSTETH_CBBTC_16_BASE(networkId),
|
|
1846
|
-
[FluidBaseVersions.ETH_SUSDS_17_BASE]: ETH_SUSDS_17_BASE(networkId),
|
|
1847
|
-
[FluidBaseVersions.WSTETH_SUSDS_18_BASE]: WSTETH_SUSDS_18_BASE(networkId),
|
|
1848
|
-
[FluidBaseVersions.CBBTC_SUSDS_19_BASE]: CBBTC_SUSDS_19_BASE(networkId),
|
|
1849
1848
|
});
|
|
1850
1849
|
export const getFluidVersionsDataForNetwork = (network) => (Object.values(FluidMarkets(network)).filter(({ chainIds, marketAddress, type }) => !!marketAddress && chainIds.includes(network) && type === FluidVaultType.T1));
|
|
1851
1850
|
export const getFluidMarketInfoById = (vaultId, network = 1) => getFluidVersionsDataForNetwork(network).find(({ id }) => id === vaultId);
|
|
@@ -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,6 +12,7 @@ import { getAssetInfo } from '@defisaver/tokens';
|
|
|
12
12
|
import { COMPPriceFeedContract, ETHPriceFeedContract, USDCPriceFeedContract, WstETHPriceFeedContract, } from '../contracts';
|
|
13
13
|
import { NetworkNumber } from '../types/common';
|
|
14
14
|
import { multicall } from '../multicall';
|
|
15
|
+
import { getEthAmountForDecimals } from './utils';
|
|
15
16
|
export const getEthPrice = (web3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
17
|
const contract = ETHPriceFeedContract(web3, NetworkNumber.Eth);
|
|
17
18
|
const price = yield contract.methods.latestAnswer().call();
|
|
@@ -47,6 +48,32 @@ export const getWstETHPrice = (web3) => __awaiter(void 0, void 0, void 0, functi
|
|
|
47
48
|
const wstETHRate = new Dec(multicallRes[1].answer).div(1e8);
|
|
48
49
|
return new Dec(ethPrice).mul(wstETHRate).toString();
|
|
49
50
|
});
|
|
51
|
+
// 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
|
|
52
|
+
export const getWstETHPriceFluid = (web3, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
const wstETHFeedContract = WstETHPriceFeedContract(web3, network);
|
|
54
|
+
const ethFeedContract = ETHPriceFeedContract(web3, network);
|
|
55
|
+
const calls = [
|
|
56
|
+
{
|
|
57
|
+
target: ethFeedContract.options.address,
|
|
58
|
+
abiItem: ethFeedContract.options.jsonInterface.find(({ name }) => name === 'latestAnswer'),
|
|
59
|
+
params: [],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
target: wstETHFeedContract.options.address,
|
|
63
|
+
abiItem: wstETHFeedContract.options.jsonInterface.find(({ name }) => name === 'latestRoundData'),
|
|
64
|
+
params: [],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
target: wstETHFeedContract.options.address,
|
|
68
|
+
abiItem: wstETHFeedContract.options.jsonInterface.find(({ name }) => name === 'decimals'),
|
|
69
|
+
params: [],
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
const multicallRes = yield multicall(calls, web3, network);
|
|
73
|
+
const ethPrice = new Dec(multicallRes[0][0]).div(1e8);
|
|
74
|
+
const wstETHRate = getEthAmountForDecimals(multicallRes[1].answer, multicallRes[2][0]);
|
|
75
|
+
return new Dec(ethPrice).mul(wstETHRate).toString();
|
|
76
|
+
});
|
|
50
77
|
// chainlink price feed available only on mainnet
|
|
51
78
|
export const getChainlinkAssetAddress = (symbol, network) => {
|
|
52
79
|
// Chainlink only has BTC/USD feed so we use that for BTC derivatives
|
package/esm/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/esm/types/fluid.js
CHANGED
|
@@ -7,8 +7,6 @@ export var FluidMainnetVersion;
|
|
|
7
7
|
FluidMainnetVersion["WSTETH_USDC_4"] = "WSTETH_USDC_4";
|
|
8
8
|
FluidMainnetVersion["WSTETH_USDT_5"] = "WSTETH_USDT_5";
|
|
9
9
|
FluidMainnetVersion["WEETH_WSTETH_6"] = "WEETH_WSTETH_6";
|
|
10
|
-
FluidMainnetVersion["SUSDE_USDC_7"] = "SUSDE_USDC_7";
|
|
11
|
-
FluidMainnetVersion["SUSDE_USDT_8"] = "SUSDE_USDT_8";
|
|
12
10
|
FluidMainnetVersion["WEETH_USDC_9"] = "WEETH_USDC_9";
|
|
13
11
|
FluidMainnetVersion["WEETH_USDT_10"] = "WEETH_USDT_10";
|
|
14
12
|
FluidMainnetVersion["ETH_USDC_11"] = "ETH_USDC_11";
|
|
@@ -33,7 +31,6 @@ export var FluidMainnetVersion;
|
|
|
33
31
|
FluidMainnetVersion["CBBTC_USDT_30"] = "CBBTC_USDT_30";
|
|
34
32
|
FluidMainnetVersion["ETH_CBBTC_31"] = "ETH_CBBTC_31";
|
|
35
33
|
FluidMainnetVersion["WEETH_CBBTC_32"] = "WEETH_CBBTC_32";
|
|
36
|
-
FluidMainnetVersion["WSTETH_CBBTC_33"] = "WSTETH_CBBTC_33";
|
|
37
34
|
FluidMainnetVersion["WSTETH_ETH_WSTETH_ETH_44"] = "WSTETH_ETH_WSTETH_ETH_44";
|
|
38
35
|
FluidMainnetVersion["ETH_USDC_USDT_45"] = "ETH_USDC_USDT_45";
|
|
39
36
|
FluidMainnetVersion["WSTETH_USDC_USDT_46"] = "WSTETH_USDC_USDT_46";
|
|
@@ -49,8 +46,6 @@ export var FluidMainnetVersion;
|
|
|
49
46
|
FluidMainnetVersion["SUSDE_GHO_56"] = "SUSDE_GHO_56";
|
|
50
47
|
FluidMainnetVersion["WEETH_GHO_57"] = "WEETH_GHO_57";
|
|
51
48
|
FluidMainnetVersion["SUSDS_GHO_58"] = "SUSDS_GHO_58";
|
|
52
|
-
FluidMainnetVersion["WBTC_GHO_59"] = "WBTC_GHO_59";
|
|
53
|
-
FluidMainnetVersion["CBBTC_GHO_60"] = "CBBTC_GHO_60";
|
|
54
49
|
FluidMainnetVersion["GHO_USDC_GHO_USDC_61"] = "GHO_USDC_GHO_USDC_61";
|
|
55
50
|
FluidMainnetVersion["WEETH_ETH_WSTETH_74"] = "WEETH_ETH_WSTETH_74";
|
|
56
51
|
FluidMainnetVersion["USDC_ETH_USDC_ETH_77"] = "USDC_ETH_USDC_ETH_77";
|
|
@@ -106,9 +101,6 @@ export var FluidBaseVersions;
|
|
|
106
101
|
FluidBaseVersions["ETH_CBBTC_14_BASE"] = "ETH_CBBTC_14_BASE";
|
|
107
102
|
FluidBaseVersions["WEETH_CBBTC_15_BASE"] = "WEETH_CBBTC_15_BASE";
|
|
108
103
|
FluidBaseVersions["WSTETH_CBBTC_16_BASE"] = "WSTETH_CBBTC_16_BASE";
|
|
109
|
-
FluidBaseVersions["ETH_SUSDS_17_BASE"] = "ETH_SUSDS_17_BASE";
|
|
110
|
-
FluidBaseVersions["WSTETH_SUSDS_18_BASE"] = "WSTETH_SUSDS_18_BASE";
|
|
111
|
-
FluidBaseVersions["CBBTC_SUSDS_19_BASE"] = "CBBTC_SUSDS_19_BASE";
|
|
112
104
|
})(FluidBaseVersions || (FluidBaseVersions = {}));
|
|
113
105
|
export var FluidMainnetDepositToken;
|
|
114
106
|
(function (FluidMainnetDepositToken) {
|
package/package.json
CHANGED
package/src/config/contracts.js
CHANGED
|
@@ -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": {
|
package/src/fluid/index.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { FluidView } from '../types/contracts/generated';
|
|
|
19
19
|
import { chunkAndMulticall } from '../multicall';
|
|
20
20
|
import { getFluidMarketInfoById, getFluidVersionsDataForNetwork, getFTokenAddress } from '../markets';
|
|
21
21
|
import { USD_QUOTE } from '../constants';
|
|
22
|
-
import { getChainlinkAssetAddress,
|
|
22
|
+
import { getChainlinkAssetAddress, getWstETHPriceFluid } from '../services/priceService';
|
|
23
23
|
|
|
24
24
|
export const EMPTY_USED_ASSET = {
|
|
25
25
|
isSupplied: false,
|
|
@@ -43,8 +43,8 @@ const parseVaultType = (vaultType: number) => {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
const parseMarketData = async (web3: Web3, data: FluidView.VaultDataStructOutputStruct, network: NetworkNumber) => {
|
|
46
|
-
const collAsset = getAssetInfoByAddress(data.supplyToken0);
|
|
47
|
-
const debtAsset = getAssetInfoByAddress(data.borrowToken0);
|
|
46
|
+
const collAsset = getAssetInfoByAddress(data.supplyToken0, network);
|
|
47
|
+
const debtAsset = getAssetInfoByAddress(data.borrowToken0, network);
|
|
48
48
|
|
|
49
49
|
const supplyRate = new Dec(data.supplyRateVault).div(100).toString();
|
|
50
50
|
const borrowRate = new Dec(data.borrowRateVault).div(100).toString();
|
|
@@ -60,7 +60,7 @@ const parseMarketData = async (web3: Web3, data: FluidView.VaultDataStructOutput
|
|
|
60
60
|
let loanTokenPrice;
|
|
61
61
|
if (debtAsset.symbol === 'wstETH') {
|
|
62
62
|
// need to handle wstETH for l2s inside getWstETHPrice
|
|
63
|
-
loanTokenPrice = await
|
|
63
|
+
loanTokenPrice = await getWstETHPriceFluid(web3, network);
|
|
64
64
|
} else if (isMainnet) {
|
|
65
65
|
const feedRegistryContract = FeedRegistryContract(web3, NetworkNumber.Eth);
|
|
66
66
|
loanTokenPrice = isTokenUSDA ? '100000000' : await feedRegistryContract.methods.latestAnswer(loanTokenFeedAddress, USD_QUOTE).call();
|
|
@@ -1797,62 +1797,62 @@ export const WSTETH_CBBTC_16_BASE = (networkId: NetworkNumber = NetworkNumber.Et
|
|
|
1797
1797
|
debtAsset: 'cbBTC',
|
|
1798
1798
|
});
|
|
1799
1799
|
|
|
1800
|
-
export const ETH_SUSDS_17_BASE = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
});
|
|
1818
|
-
|
|
1819
|
-
export const WSTETH_SUSDS_18_BASE = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
});
|
|
1837
|
-
|
|
1838
|
-
export const CBBTC_SUSDS_19_BASE = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
});
|
|
1800
|
+
// export const ETH_SUSDS_17_BASE = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1801
|
+
// stableBased: true,
|
|
1802
|
+
// btcBased: false,
|
|
1803
|
+
// wstETHBased: false,
|
|
1804
|
+
// ethBased: true,
|
|
1805
|
+
// type: FluidVaultType.T1,
|
|
1806
|
+
// id: 17,
|
|
1807
|
+
// chainIds: [NetworkNumber.Base],
|
|
1808
|
+
// label: 'ETH / sUSDS Market 17',
|
|
1809
|
+
// shortLabel: 'ETH/sUSDS',
|
|
1810
|
+
// value: FluidBaseVersions.ETH_SUSDS_17_BASE,
|
|
1811
|
+
// url: 'eth-susds-17-base',
|
|
1812
|
+
// marketAddress: '0x3996464c0fCCa8183e13ea5E5e74375e2c8744Dd',
|
|
1813
|
+
// hasSmartCollateral: false,
|
|
1814
|
+
// hasSmartDebt: false,
|
|
1815
|
+
// collateralAsset: 'ETH',
|
|
1816
|
+
// debtAsset: 'sSUDS',
|
|
1817
|
+
// });
|
|
1818
|
+
//
|
|
1819
|
+
// export const WSTETH_SUSDS_18_BASE = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1820
|
+
// stableBased: true,
|
|
1821
|
+
// btcBased: false,
|
|
1822
|
+
// wstETHBased: true,
|
|
1823
|
+
// ethBased: true,
|
|
1824
|
+
// type: FluidVaultType.T1,
|
|
1825
|
+
// id: 18,
|
|
1826
|
+
// chainIds: [NetworkNumber.Base],
|
|
1827
|
+
// label: 'wstETH / sUSDS Market 18',
|
|
1828
|
+
// shortLabel: 'wstETH/sUSDS',
|
|
1829
|
+
// value: FluidBaseVersions.WSTETH_SUSDS_18_BASE,
|
|
1830
|
+
// url: 'wsteth-susds-18-base',
|
|
1831
|
+
// marketAddress: '0xBc345229C1b52e4c30530C614BB487323BA38Da5',
|
|
1832
|
+
// hasSmartCollateral: false,
|
|
1833
|
+
// hasSmartDebt: false,
|
|
1834
|
+
// collateralAsset: 'wstETH',
|
|
1835
|
+
// debtAsset: 'sUSDS',
|
|
1836
|
+
// });
|
|
1837
|
+
//
|
|
1838
|
+
// export const CBBTC_SUSDS_19_BASE = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1839
|
+
// stableBased: true,
|
|
1840
|
+
// btcBased: false,
|
|
1841
|
+
// wstETHBased: false,
|
|
1842
|
+
// ethBased: false,
|
|
1843
|
+
// type: FluidVaultType.T1,
|
|
1844
|
+
// id: 19,
|
|
1845
|
+
// chainIds: [NetworkNumber.Base],
|
|
1846
|
+
// label: 'cbBTC / sUSDS Market 19',
|
|
1847
|
+
// shortLabel: 'cbBTC/sUSDS',
|
|
1848
|
+
// value: FluidBaseVersions.CBBTC_SUSDS_19_BASE,
|
|
1849
|
+
// url: 'cbbtc-susds-19-base',
|
|
1850
|
+
// marketAddress: '0xF2c8F54447cbd591C396b0Dd7ac15FAF552d0FA4',
|
|
1851
|
+
// hasSmartCollateral: false,
|
|
1852
|
+
// hasSmartDebt: false,
|
|
1853
|
+
// collateralAsset: 'cbBTC',
|
|
1854
|
+
// debtAsset: 'sUSDS',
|
|
1855
|
+
// });
|
|
1856
1856
|
|
|
1857
1857
|
export const FluidMarkets = (networkId: NetworkNumber) => ({
|
|
1858
1858
|
[FluidMainnetVersion.ETH_USDC_1]: ETH_USDC_1(networkId),
|
|
@@ -1953,9 +1953,6 @@ export const FluidMarkets = (networkId: NetworkNumber) => ({
|
|
|
1953
1953
|
[FluidBaseVersions.ETH_CBBTC_14_BASE]: ETH_CBBTC_14_BASE(networkId),
|
|
1954
1954
|
[FluidBaseVersions.WEETH_CBBTC_15_BASE]: WEETH_CBBTC_15_BASE(networkId),
|
|
1955
1955
|
[FluidBaseVersions.WSTETH_CBBTC_16_BASE]: WSTETH_CBBTC_16_BASE(networkId),
|
|
1956
|
-
[FluidBaseVersions.ETH_SUSDS_17_BASE]: ETH_SUSDS_17_BASE(networkId),
|
|
1957
|
-
[FluidBaseVersions.WSTETH_SUSDS_18_BASE]: WSTETH_SUSDS_18_BASE(networkId),
|
|
1958
|
-
[FluidBaseVersions.CBBTC_SUSDS_19_BASE]: CBBTC_SUSDS_19_BASE(networkId),
|
|
1959
1956
|
});
|
|
1960
1957
|
|
|
1961
1958
|
export const getFluidVersionsDataForNetwork = (network: NetworkNumber) => (
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '../contracts';
|
|
10
10
|
import { NetworkNumber } from '../types/common';
|
|
11
11
|
import { multicall } from '../multicall';
|
|
12
|
+
import { getEthAmountForDecimals } from './utils';
|
|
12
13
|
|
|
13
14
|
export const getEthPrice = async (web3: Web3) => {
|
|
14
15
|
const contract = ETHPriceFeedContract(web3, NetworkNumber.Eth);
|
|
@@ -52,6 +53,34 @@ export const getWstETHPrice = async (web3: Web3) => {
|
|
|
52
53
|
|
|
53
54
|
return new Dec(ethPrice).mul(wstETHRate).toString();
|
|
54
55
|
};
|
|
56
|
+
// 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
|
|
57
|
+
export const getWstETHPriceFluid = async (web3: Web3, network: NetworkNumber) => {
|
|
58
|
+
const wstETHFeedContract = WstETHPriceFeedContract(web3, network);
|
|
59
|
+
const ethFeedContract = ETHPriceFeedContract(web3, network);
|
|
60
|
+
const calls = [
|
|
61
|
+
{
|
|
62
|
+
target: ethFeedContract.options.address,
|
|
63
|
+
abiItem: ethFeedContract.options.jsonInterface.find(({ name }) => name === 'latestAnswer'),
|
|
64
|
+
params: [],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
target: wstETHFeedContract.options.address,
|
|
68
|
+
abiItem: wstETHFeedContract.options.jsonInterface.find(({ name }) => name === 'latestRoundData'),
|
|
69
|
+
params: [],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
target: wstETHFeedContract.options.address,
|
|
73
|
+
abiItem: wstETHFeedContract.options.jsonInterface.find(({ name }) => name === 'decimals'),
|
|
74
|
+
params: [],
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
const multicallRes = await multicall(calls, web3, network);
|
|
78
|
+
|
|
79
|
+
const ethPrice = new Dec(multicallRes[0][0]).div(1e8);
|
|
80
|
+
const wstETHRate = getEthAmountForDecimals(multicallRes[1].answer, multicallRes[2][0]);
|
|
81
|
+
|
|
82
|
+
return new Dec(ethPrice).mul(wstETHRate).toString();
|
|
83
|
+
};
|
|
55
84
|
|
|
56
85
|
// chainlink price feed available only on mainnet
|
|
57
86
|
export const getChainlinkAssetAddress = (symbol: string, network: NetworkNumber) => {
|
package/src/types/fluid.ts
CHANGED
|
@@ -26,8 +26,6 @@ export enum FluidMainnetVersion {
|
|
|
26
26
|
WSTETH_USDC_4 = 'WSTETH_USDC_4',
|
|
27
27
|
WSTETH_USDT_5 = 'WSTETH_USDT_5',
|
|
28
28
|
WEETH_WSTETH_6 = 'WEETH_WSTETH_6',
|
|
29
|
-
SUSDE_USDC_7 = 'SUSDE_USDC_7',
|
|
30
|
-
SUSDE_USDT_8 = 'SUSDE_USDT_8',
|
|
31
29
|
WEETH_USDC_9 = 'WEETH_USDC_9',
|
|
32
30
|
WEETH_USDT_10 = 'WEETH_USDT_10',
|
|
33
31
|
ETH_USDC_11 = 'ETH_USDC_11',
|
|
@@ -52,7 +50,6 @@ export enum FluidMainnetVersion {
|
|
|
52
50
|
CBBTC_USDT_30 = 'CBBTC_USDT_30',
|
|
53
51
|
ETH_CBBTC_31 = 'ETH_CBBTC_31',
|
|
54
52
|
WEETH_CBBTC_32 = 'WEETH_CBBTC_32',
|
|
55
|
-
WSTETH_CBBTC_33 = 'WSTETH_CBBTC_33',
|
|
56
53
|
WSTETH_ETH_WSTETH_ETH_44 = 'WSTETH_ETH_WSTETH_ETH_44',
|
|
57
54
|
ETH_USDC_USDT_45 = 'ETH_USDC_USDT_45',
|
|
58
55
|
WSTETH_USDC_USDT_46 = 'WSTETH_USDC_USDT_46',
|
|
@@ -68,8 +65,6 @@ export enum FluidMainnetVersion {
|
|
|
68
65
|
SUSDE_GHO_56 = 'SUSDE_GHO_56',
|
|
69
66
|
WEETH_GHO_57 = 'WEETH_GHO_57',
|
|
70
67
|
SUSDS_GHO_58 = 'SUSDS_GHO_58',
|
|
71
|
-
WBTC_GHO_59 = 'WBTC_GHO_59',
|
|
72
|
-
CBBTC_GHO_60 = 'CBBTC_GHO_60',
|
|
73
68
|
GHO_USDC_GHO_USDC_61 = 'GHO_USDC_GHO_USDC_61',
|
|
74
69
|
WEETH_ETH_WSTETH_74 = 'WEETH_ETH_WSTETH_74',
|
|
75
70
|
USDC_ETH_USDC_ETH_77 = 'USDC_ETH_USDC_ETH_77',
|
|
@@ -125,9 +120,6 @@ export enum FluidBaseVersions {
|
|
|
125
120
|
ETH_CBBTC_14_BASE = 'ETH_CBBTC_14_BASE',
|
|
126
121
|
WEETH_CBBTC_15_BASE = 'WEETH_CBBTC_15_BASE',
|
|
127
122
|
WSTETH_CBBTC_16_BASE = 'WSTETH_CBBTC_16_BASE',
|
|
128
|
-
ETH_SUSDS_17_BASE = 'ETH_SUSDS_17_BASE',
|
|
129
|
-
WSTETH_SUSDS_18_BASE = 'WSTETH_SUSDS_18_BASE',
|
|
130
|
-
CBBTC_SUSDS_19_BASE = 'CBBTC_SUSDS_19_BASE',
|
|
131
123
|
}
|
|
132
124
|
|
|
133
125
|
export type FluidVersions = FluidArbitrumVersion | FluidBaseVersions | FluidMainnetVersion;
|