@defisaver/positions-sdk 0.0.42 → 0.0.45
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 +18 -0
- package/cjs/config/contracts.js +5 -1
- package/cjs/curveUsd/index.d.ts +2 -2
- package/cjs/curveUsd/index.js +2 -2
- package/cjs/maker/index.d.ts +2 -2
- package/cjs/maker/index.js +14 -6
- package/cjs/markets/morphoBlue/index.d.ts +10 -0
- package/cjs/markets/morphoBlue/index.js +88 -1
- package/cjs/types/morphoBlue.d.ts +7 -1
- package/cjs/types/morphoBlue.js +5 -0
- package/esm/config/contracts.d.ts +18 -0
- package/esm/config/contracts.js +5 -1
- package/esm/curveUsd/index.d.ts +2 -2
- package/esm/curveUsd/index.js +2 -2
- package/esm/maker/index.d.ts +2 -2
- package/esm/maker/index.js +14 -6
- package/esm/markets/morphoBlue/index.d.ts +10 -0
- package/esm/markets/morphoBlue/index.js +82 -0
- package/esm/types/morphoBlue.d.ts +7 -1
- package/esm/types/morphoBlue.js +5 -0
- package/package.json +1 -1
- package/src/config/contracts.js +5 -1
- package/src/curveUsd/index.ts +2 -2
- package/src/maker/index.ts +23 -7
- package/src/markets/morphoBlue/index.ts +85 -0
- package/src/types/morphoBlue.ts +6 -0
|
@@ -4077,6 +4077,24 @@ export namespace McdView {
|
|
|
4077
4077
|
address: string;
|
|
4078
4078
|
createdBlock: number;
|
|
4079
4079
|
oldVersions: {
|
|
4080
|
+
"11183987": {
|
|
4081
|
+
abi: {
|
|
4082
|
+
inputs: {
|
|
4083
|
+
internalType: string;
|
|
4084
|
+
name: string;
|
|
4085
|
+
type: string;
|
|
4086
|
+
}[];
|
|
4087
|
+
name: string;
|
|
4088
|
+
outputs: {
|
|
4089
|
+
internalType: string;
|
|
4090
|
+
name: string;
|
|
4091
|
+
type: string;
|
|
4092
|
+
}[];
|
|
4093
|
+
stateMutability: string;
|
|
4094
|
+
type: string;
|
|
4095
|
+
}[];
|
|
4096
|
+
address: string;
|
|
4097
|
+
};
|
|
4080
4098
|
"14384301": {
|
|
4081
4099
|
abi: {
|
|
4082
4100
|
inputs: {
|
package/cjs/config/contracts.js
CHANGED
|
@@ -728,8 +728,12 @@ module.exports = {
|
|
|
728
728
|
"address": "0x922C795aE0be55Aaeb3FF51813B76AFc78e97C7c",
|
|
729
729
|
"createdBlock": 14410792,
|
|
730
730
|
"oldVersions": {
|
|
731
|
+
"11183987": {
|
|
732
|
+
"abi": [{ "inputs": [], "name": "MCD_MANAGER", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "VAT_ADDRESS", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "_getProxyOwner", "outputs": [{ "internalType": "address", "name": "userAddr", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_cdpId", "type": "uint256" }], "name": "getCdpInfo", "outputs": [{ "internalType": "address", "name": "urn", "type": "address" }, { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "userAddr", "type": "address" }, { "internalType": "bytes32", "name": "ilk", "type": "bytes32" }, { "internalType": "uint256", "name": "collateral", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "contract IManager", "name": "_manager", "type": "address" }, { "internalType": "uint256", "name": "_cdpId", "type": "uint256" }, { "internalType": "bytes32", "name": "_ilk", "type": "bytes32" }], "name": "getCdpInfo", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32[]", "name": "_ilks", "type": "bytes32[]" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getCropJoinCdps", "outputs": [{ "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }, { "internalType": "address[]", "name": "urns", "type": "address[]" }, { "internalType": "bytes32[]", "name": "ilks", "type": "bytes32[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "contract IManager", "name": "_manager", "type": "address" }, { "internalType": "uint256", "name": "_cdpId", "type": "uint256" }], "name": "getOwner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_ilk", "type": "bytes32" }], "name": "getPrice", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_managerAddr", "type": "address" }, { "internalType": "uint256", "name": "_vaultId", "type": "uint256" }], "name": "getRatio", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_mcdManager", "type": "address" }, { "internalType": "uint256", "name": "_vaultId", "type": "uint256" }], "name": "getUrnAndIlk", "outputs": [{ "internalType": "address", "name": "urn", "type": "address" }, { "internalType": "bytes32", "name": "ilk", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_managerAddr", "type": "address" }, { "internalType": "uint256", "name": "_vaultId", "type": "uint256" }, { "internalType": "bytes32", "name": "_ilk", "type": "bytes32" }], "name": "getVaultInfo", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "spotter", "outputs": [{ "internalType": "contract ISpotter", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "vat", "outputs": [{ "internalType": "contract IVat", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }],
|
|
733
|
+
"address": "0x68C61AF097b834c68eA6EA5e46aF6c04E8945B2d"
|
|
734
|
+
},
|
|
731
735
|
"14384301": {
|
|
732
|
-
"abi": [{ "inputs": [{ "internalType": "contract IManager", "name": "_manager", "type": "address" }, { "internalType": "uint256", "name": "_cdpId", "type": "uint256" }, { "internalType": "bytes32", "name": "_ilk", "type": "bytes32" }], "name": "getCdpInfo", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
|
|
736
|
+
"abi": [{ "inputs": [{ "internalType": "address", "name": "_mcdManager", "type": "address" }, { "internalType": "uint256", "name": "_vaultId", "type": "uint256" }], "name": "getUrnAndIlk", "outputs": [{ "internalType": "address", "name": "urn", "type": "address" }, { "internalType": "bytes32", "name": "ilk", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "contract IManager", "name": "_manager", "type": "address" }, { "internalType": "uint256", "name": "_cdpId", "type": "uint256" }, { "internalType": "bytes32", "name": "_ilk", "type": "bytes32" }], "name": "getCdpInfo", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
|
|
733
737
|
"address": "0x119a9B532FEe9Ce4a07F86f7053e635dD4E166F9"
|
|
734
738
|
}
|
|
735
739
|
}
|
package/cjs/curveUsd/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
|
-
import { CrvUSDGlobalMarketData, CrvUSDMarketData, CrvUSDUserData
|
|
2
|
+
import { CrvUSDGlobalMarketData, CrvUSDMarketData, CrvUSDUserData } from '../types';
|
|
3
3
|
import { Blockish, EthAddress, NetworkNumber, PositionBalances } from '../types/common';
|
|
4
4
|
export declare const getCurveUsdGlobalData: (web3: Web3, network: NetworkNumber, selectedMarket: CrvUSDMarketData) => Promise<CrvUSDGlobalMarketData>;
|
|
5
|
-
export declare const getCrvUsdAccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress,
|
|
5
|
+
export declare const getCrvUsdAccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress, controllerAddress: EthAddress) => Promise<PositionBalances>;
|
|
6
6
|
export declare const getCurveUsdUserData: (web3: Web3, network: NetworkNumber, address: string, selectedMarket: CrvUSDMarketData, activeBand: string) => Promise<CrvUSDUserData>;
|
|
7
7
|
export declare const getCurveUsdFullPositionData: (web3: Web3, network: NetworkNumber, address: string, selectedMarket: CrvUSDMarketData) => Promise<CrvUSDUserData>;
|
package/cjs/curveUsd/index.js
CHANGED
|
@@ -118,7 +118,7 @@ const getStatusForUser = (bandRange, activeBand, crvUSDSupplied, collSupplied) =
|
|
|
118
118
|
return types_1.CrvUSDStatus.SoftLiquidated; // or is fully soft liquidated
|
|
119
119
|
return types_1.CrvUSDStatus.Nonexistant;
|
|
120
120
|
};
|
|
121
|
-
const getCrvUsdAccountBalances = (web3, network, block, addressMapping, address,
|
|
121
|
+
const getCrvUsdAccountBalances = (web3, network, block, addressMapping, address, controllerAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
122
122
|
let balances = {
|
|
123
123
|
collateral: {},
|
|
124
124
|
debt: {},
|
|
@@ -127,7 +127,7 @@ const getCrvUsdAccountBalances = (web3, network, block, addressMapping, address,
|
|
|
127
127
|
return balances;
|
|
128
128
|
}
|
|
129
129
|
const contract = (0, contracts_1.CrvUSDViewContract)(web3, network, block);
|
|
130
|
-
const selectedMarket = (0, markets_1.CrvUsdMarkets)(network)
|
|
130
|
+
const selectedMarket = Object.values((0, markets_1.CrvUsdMarkets)(network)).find(i => i.controllerAddress.toLowerCase() === controllerAddress.toLowerCase());
|
|
131
131
|
const data = yield contract.methods.userData(selectedMarket.controllerAddress, address).call({}, block);
|
|
132
132
|
balances = {
|
|
133
133
|
collateral: {
|
package/cjs/maker/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
|
-
import { Blockish, NetworkNumber, PositionBalances } from '../types/common';
|
|
2
|
+
import { Blockish, EthAddress, NetworkNumber, PositionBalances } from '../types/common';
|
|
3
3
|
import { CdpData } from '../types';
|
|
4
|
-
export declare const getMakerAccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, cdpId: string) => Promise<PositionBalances>;
|
|
4
|
+
export declare const getMakerAccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, cdpId: string, _managerAddress?: EthAddress) => Promise<PositionBalances>;
|
|
5
5
|
export declare const getMakerCdpData: (web3: Web3, network: NetworkNumber, cdpId: string) => Promise<CdpData>;
|
package/cjs/maker/index.js
CHANGED
|
@@ -18,25 +18,33 @@ const tokens_1 = require("@defisaver/tokens");
|
|
|
18
18
|
const contracts_1 = require("../contracts");
|
|
19
19
|
const helpers_1 = require("../helpers");
|
|
20
20
|
const utils_1 = require("../services/utils");
|
|
21
|
-
const getMakerAccountBalances = (web3, network, block, addressMapping, cdpId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
const getMakerAccountBalances = (web3, network, block, addressMapping, cdpId, _managerAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
22
|
let balances = {
|
|
23
23
|
collateral: {},
|
|
24
24
|
debt: {},
|
|
25
25
|
};
|
|
26
|
+
const managerAddress = _managerAddress || '0x5ef30b9986345249bc32d8928B7ee64DE9435E39'; // Default CDP Manager (This is used only to differentiate BProtocol CDPs)
|
|
26
27
|
if (!cdpId) {
|
|
27
28
|
return balances;
|
|
28
29
|
}
|
|
29
30
|
const viewContract = (0, contracts_1.McdViewContract)(web3, network, block);
|
|
31
|
+
let ilk;
|
|
32
|
+
const needsIlk = new decimal_js_1.default(block).lt(14410792) && new decimal_js_1.default(block).gte(14384301);
|
|
33
|
+
if (needsIlk) {
|
|
34
|
+
ilk = (yield viewContract.methods.getUrnAndIlk(managerAddress, cdpId).call({}, block)).ilk;
|
|
35
|
+
}
|
|
30
36
|
// @ts-ignore
|
|
31
|
-
const cdpInfo = yield viewContract.methods.getCdpInfo(cdpId).call({}, block);
|
|
32
|
-
const ilkInfo = yield helpers_1.makerHelpers.getCollateralInfo(cdpInfo.ilk, web3, network, block);
|
|
33
|
-
const
|
|
37
|
+
const cdpInfo = yield viewContract.methods.getCdpInfo(...(needsIlk ? [managerAddress, cdpId, ilk] : [cdpId])).call({}, block);
|
|
38
|
+
const ilkInfo = yield helpers_1.makerHelpers.getCollateralInfo(needsIlk ? ilk : cdpInfo.ilk, web3, network, block);
|
|
39
|
+
const collateral = needsIlk ? cdpInfo[1] : cdpInfo.collateral;
|
|
40
|
+
const debt = needsIlk ? cdpInfo[0] : cdpInfo.debt;
|
|
41
|
+
const asset = (0, utils_1.wethToEth)((0, tokens_1.ilkToAsset)(needsIlk ? ilk : cdpInfo.ilk));
|
|
34
42
|
balances = {
|
|
35
43
|
collateral: {
|
|
36
|
-
[addressMapping ? (0, tokens_1.getAssetInfo)(asset, network).address.toLowerCase() : asset]: asset === 'WBTC' ? new decimal_js_1.default(
|
|
44
|
+
[addressMapping ? (0, tokens_1.getAssetInfo)(asset, network).address.toLowerCase() : asset]: asset === 'WBTC' ? new decimal_js_1.default(collateral).div(1e10).floor().toString() : collateral,
|
|
37
45
|
},
|
|
38
46
|
debt: {
|
|
39
|
-
[addressMapping ? (0, tokens_1.getAssetInfo)('DAI', network).address.toLowerCase() : 'DAI']: new decimal_js_1.default(
|
|
47
|
+
[addressMapping ? (0, tokens_1.getAssetInfo)('DAI', network).address.toLowerCase() : 'DAI']: new decimal_js_1.default(debt).times(ilkInfo.currentRate).div(1e27).floor()
|
|
40
48
|
.toString(),
|
|
41
49
|
},
|
|
42
50
|
};
|
|
@@ -2,7 +2,17 @@ import { MorphoBlueMarketData } from '../../types';
|
|
|
2
2
|
import { NetworkNumber } from '../../types/common';
|
|
3
3
|
export declare const MORPHO_BLUE_WSTETH_ETH: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
4
4
|
export declare const MORPHO_BLUE_WSTETH_USDC: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
5
|
+
export declare const MORPHO_BLUE_SDAI_USDC: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
6
|
+
export declare const MORPHO_BLUE_WBTC_USDC: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
7
|
+
export declare const MORPHO_BLUE_ETH_USDC: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
8
|
+
export declare const MORPHO_BLUE_WBTC_USDT: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
9
|
+
export declare const MORPHO_BLUE_WSTETH_USDT: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
5
10
|
export declare const MorphoBlueMarkets: (networkId: NetworkNumber) => {
|
|
6
11
|
readonly morphobluewstetheth: MorphoBlueMarketData;
|
|
7
12
|
readonly morphobluewstethusdc: MorphoBlueMarketData;
|
|
13
|
+
readonly morphobluesdaiusdc: MorphoBlueMarketData;
|
|
14
|
+
readonly morphobluewbtcusdc: MorphoBlueMarketData;
|
|
15
|
+
readonly morphoblueethusdc: MorphoBlueMarketData;
|
|
16
|
+
readonly morphobluewbtcusdt: MorphoBlueMarketData;
|
|
17
|
+
readonly morphobluewstethusdt: MorphoBlueMarketData;
|
|
8
18
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MorphoBlueMarkets = exports.MORPHO_BLUE_WSTETH_USDC = exports.MORPHO_BLUE_WSTETH_ETH = void 0;
|
|
3
|
+
exports.MorphoBlueMarkets = exports.MORPHO_BLUE_WSTETH_USDT = exports.MORPHO_BLUE_WBTC_USDT = exports.MORPHO_BLUE_ETH_USDC = exports.MORPHO_BLUE_WBTC_USDC = exports.MORPHO_BLUE_SDAI_USDC = exports.MORPHO_BLUE_WSTETH_USDC = exports.MORPHO_BLUE_WSTETH_ETH = void 0;
|
|
4
4
|
const types_1 = require("../../types");
|
|
5
5
|
const common_1 = require("../../types/common");
|
|
6
6
|
const MORPHO_BLUE_WSTETH_ETH = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
@@ -14,6 +14,7 @@ const MORPHO_BLUE_WSTETH_ETH = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
14
14
|
oracle: '0x2a01eb9496094da03c4e364def50f5ad1280ad72',
|
|
15
15
|
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
16
16
|
lltv: 0.945,
|
|
17
|
+
marketId: '0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec41',
|
|
17
18
|
// icon: SvgAdapter(protocolIcons.spark),
|
|
18
19
|
protocolName: 'morpho-blue',
|
|
19
20
|
});
|
|
@@ -29,12 +30,98 @@ const MORPHO_BLUE_WSTETH_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
29
30
|
oracle: '0x48F7E36EB6B826B2dF4B2E630B62Cd25e89E40e2',
|
|
30
31
|
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
31
32
|
lltv: 0.86,
|
|
33
|
+
marketId: '0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc',
|
|
32
34
|
// icon: SvgAdapter(protocolIcons.spark),
|
|
33
35
|
protocolName: 'morpho-blue',
|
|
34
36
|
});
|
|
35
37
|
exports.MORPHO_BLUE_WSTETH_USDC = MORPHO_BLUE_WSTETH_USDC;
|
|
38
|
+
const MORPHO_BLUE_SDAI_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
39
|
+
chainIds: [1],
|
|
40
|
+
label: 'Morpho Blue',
|
|
41
|
+
shortLabel: 'sDAI/USDC',
|
|
42
|
+
value: types_1.MorphoBlueVersions.MorphoBlueSDAIUSDC,
|
|
43
|
+
url: 'sdaiusdc',
|
|
44
|
+
loanToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
45
|
+
collateralToken: '0x83F20F44975D03b1b09e64809B757c47f942BEeA',
|
|
46
|
+
oracle: '0x6CAFE228eC0B0bC2D076577d56D35Fe704318f6d',
|
|
47
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
48
|
+
lltv: 0.965,
|
|
49
|
+
marketId: '0x06f2842602373d247c4934f7656e513955ccc4c377f0febc0d9ca2c3bcc191b1',
|
|
50
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
51
|
+
protocolName: 'morpho-blue',
|
|
52
|
+
});
|
|
53
|
+
exports.MORPHO_BLUE_SDAI_USDC = MORPHO_BLUE_SDAI_USDC;
|
|
54
|
+
const MORPHO_BLUE_WBTC_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
55
|
+
chainIds: [1],
|
|
56
|
+
label: 'Morpho Blue',
|
|
57
|
+
shortLabel: 'WBTC/USDC',
|
|
58
|
+
value: types_1.MorphoBlueVersions.MorphoBlueWBTCUSDC,
|
|
59
|
+
url: 'wbtcusdc',
|
|
60
|
+
loanToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
61
|
+
collateralToken: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
62
|
+
oracle: '0xDddd770BADd886dF3864029e4B377B5F6a2B6b83',
|
|
63
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
64
|
+
lltv: 0.86,
|
|
65
|
+
marketId: '0x3a85e619751152991742810df6ec69ce473daef99e28a64ab2340d7b7ccfee49',
|
|
66
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
67
|
+
protocolName: 'morpho-blue',
|
|
68
|
+
});
|
|
69
|
+
exports.MORPHO_BLUE_WBTC_USDC = MORPHO_BLUE_WBTC_USDC;
|
|
70
|
+
const MORPHO_BLUE_ETH_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
71
|
+
chainIds: [1],
|
|
72
|
+
label: 'Morpho Blue',
|
|
73
|
+
shortLabel: 'ETH/USDC',
|
|
74
|
+
value: types_1.MorphoBlueVersions.MorphoBlueEthUSDC,
|
|
75
|
+
url: 'ethusdc',
|
|
76
|
+
loanToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
77
|
+
collateralToken: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
78
|
+
oracle: '0xdC6fd5831277c693b1054e19E94047cB37c77615',
|
|
79
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
80
|
+
lltv: 0.915,
|
|
81
|
+
marketId: '0xf9acc677910cc17f650416a22e2a14d5da7ccb9626db18f1bf94efe64f92b372',
|
|
82
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
83
|
+
protocolName: 'morpho-blue',
|
|
84
|
+
});
|
|
85
|
+
exports.MORPHO_BLUE_ETH_USDC = MORPHO_BLUE_ETH_USDC;
|
|
86
|
+
const MORPHO_BLUE_WBTC_USDT = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
87
|
+
chainIds: [1],
|
|
88
|
+
label: 'Morpho Blue',
|
|
89
|
+
shortLabel: 'WBTC/USDT',
|
|
90
|
+
value: types_1.MorphoBlueVersions.MorphoBlueWBTCUSDT,
|
|
91
|
+
url: 'wbtcusdt',
|
|
92
|
+
loanToken: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
93
|
+
collateralToken: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
94
|
+
oracle: '0x008bF4B1cDA0cc9f0e882E0697f036667652E1ef',
|
|
95
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
96
|
+
lltv: 0.86,
|
|
97
|
+
marketId: '0xa921ef34e2fc7a27ccc50ae7e4b154e16c9799d3387076c421423ef52ac4df99',
|
|
98
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
99
|
+
protocolName: 'morpho-blue',
|
|
100
|
+
});
|
|
101
|
+
exports.MORPHO_BLUE_WBTC_USDT = MORPHO_BLUE_WBTC_USDT;
|
|
102
|
+
const MORPHO_BLUE_WSTETH_USDT = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
103
|
+
chainIds: [1],
|
|
104
|
+
label: 'Morpho Blue',
|
|
105
|
+
shortLabel: 'wstETH/USDT',
|
|
106
|
+
value: types_1.MorphoBlueVersions.MorphoBlueWstEthUSDT,
|
|
107
|
+
url: 'wstethusdt',
|
|
108
|
+
loanToken: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
109
|
+
collateralToken: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
|
|
110
|
+
oracle: '0x95DB30fAb9A3754e42423000DF27732CB2396992',
|
|
111
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
112
|
+
lltv: 0.86,
|
|
113
|
+
marketId: '0xe7e9694b754c4d4f7e21faf7223f6fa71abaeb10296a4c43a54a7977149687d2',
|
|
114
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
115
|
+
protocolName: 'morpho-blue',
|
|
116
|
+
});
|
|
117
|
+
exports.MORPHO_BLUE_WSTETH_USDT = MORPHO_BLUE_WSTETH_USDT;
|
|
36
118
|
const MorphoBlueMarkets = (networkId) => ({
|
|
37
119
|
[types_1.MorphoBlueVersions.MorphoBlueWstEthEth]: (0, exports.MORPHO_BLUE_WSTETH_ETH)(networkId),
|
|
38
120
|
[types_1.MorphoBlueVersions.MorphoBlueWstEthUSDC]: (0, exports.MORPHO_BLUE_WSTETH_USDC)(networkId),
|
|
121
|
+
[types_1.MorphoBlueVersions.MorphoBlueSDAIUSDC]: (0, exports.MORPHO_BLUE_SDAI_USDC)(networkId),
|
|
122
|
+
[types_1.MorphoBlueVersions.MorphoBlueWBTCUSDC]: (0, exports.MORPHO_BLUE_WBTC_USDC)(networkId),
|
|
123
|
+
[types_1.MorphoBlueVersions.MorphoBlueEthUSDC]: (0, exports.MORPHO_BLUE_ETH_USDC)(networkId),
|
|
124
|
+
[types_1.MorphoBlueVersions.MorphoBlueWBTCUSDT]: (0, exports.MORPHO_BLUE_WBTC_USDT)(networkId),
|
|
125
|
+
[types_1.MorphoBlueVersions.MorphoBlueWstEthUSDT]: (0, exports.MORPHO_BLUE_WSTETH_USDT)(networkId),
|
|
39
126
|
});
|
|
40
127
|
exports.MorphoBlueMarkets = MorphoBlueMarkets;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { MMUsedAssets, NetworkNumber } from './common';
|
|
2
2
|
export declare enum MorphoBlueVersions {
|
|
3
3
|
MorphoBlueWstEthEth = "morphobluewstetheth",
|
|
4
|
-
MorphoBlueWstEthUSDC = "morphobluewstethusdc"
|
|
4
|
+
MorphoBlueWstEthUSDC = "morphobluewstethusdc",
|
|
5
|
+
MorphoBlueSDAIUSDC = "morphobluesdaiusdc",
|
|
6
|
+
MorphoBlueWBTCUSDC = "morphobluewbtcusdc",
|
|
7
|
+
MorphoBlueEthUSDC = "morphoblueethusdc",
|
|
8
|
+
MorphoBlueWBTCUSDT = "morphobluewbtcusdt",
|
|
9
|
+
MorphoBlueWstEthUSDT = "morphobluewstethusdt"
|
|
5
10
|
}
|
|
6
11
|
export interface MorphoBlueMarketData {
|
|
7
12
|
chainIds: NetworkNumber[];
|
|
@@ -14,6 +19,7 @@ export interface MorphoBlueMarketData {
|
|
|
14
19
|
oracle: string;
|
|
15
20
|
irm: string;
|
|
16
21
|
lltv: number | string;
|
|
22
|
+
marketId: string;
|
|
17
23
|
protocolName: string;
|
|
18
24
|
}
|
|
19
25
|
export interface MorphoBlueAssetData {
|
package/cjs/types/morphoBlue.js
CHANGED
|
@@ -5,4 +5,9 @@ var MorphoBlueVersions;
|
|
|
5
5
|
(function (MorphoBlueVersions) {
|
|
6
6
|
MorphoBlueVersions["MorphoBlueWstEthEth"] = "morphobluewstetheth";
|
|
7
7
|
MorphoBlueVersions["MorphoBlueWstEthUSDC"] = "morphobluewstethusdc";
|
|
8
|
+
MorphoBlueVersions["MorphoBlueSDAIUSDC"] = "morphobluesdaiusdc";
|
|
9
|
+
MorphoBlueVersions["MorphoBlueWBTCUSDC"] = "morphobluewbtcusdc";
|
|
10
|
+
MorphoBlueVersions["MorphoBlueEthUSDC"] = "morphoblueethusdc";
|
|
11
|
+
MorphoBlueVersions["MorphoBlueWBTCUSDT"] = "morphobluewbtcusdt";
|
|
12
|
+
MorphoBlueVersions["MorphoBlueWstEthUSDT"] = "morphobluewstethusdt";
|
|
8
13
|
})(MorphoBlueVersions || (exports.MorphoBlueVersions = MorphoBlueVersions = {}));
|
|
@@ -4077,6 +4077,24 @@ export namespace McdView {
|
|
|
4077
4077
|
address: string;
|
|
4078
4078
|
createdBlock: number;
|
|
4079
4079
|
oldVersions: {
|
|
4080
|
+
"11183987": {
|
|
4081
|
+
abi: {
|
|
4082
|
+
inputs: {
|
|
4083
|
+
internalType: string;
|
|
4084
|
+
name: string;
|
|
4085
|
+
type: string;
|
|
4086
|
+
}[];
|
|
4087
|
+
name: string;
|
|
4088
|
+
outputs: {
|
|
4089
|
+
internalType: string;
|
|
4090
|
+
name: string;
|
|
4091
|
+
type: string;
|
|
4092
|
+
}[];
|
|
4093
|
+
stateMutability: string;
|
|
4094
|
+
type: string;
|
|
4095
|
+
}[];
|
|
4096
|
+
address: string;
|
|
4097
|
+
};
|
|
4080
4098
|
"14384301": {
|
|
4081
4099
|
abi: {
|
|
4082
4100
|
inputs: {
|
package/esm/config/contracts.js
CHANGED
|
@@ -727,8 +727,12 @@ module.exports = {
|
|
|
727
727
|
"address": "0x922C795aE0be55Aaeb3FF51813B76AFc78e97C7c",
|
|
728
728
|
"createdBlock": 14410792,
|
|
729
729
|
"oldVersions": {
|
|
730
|
+
"11183987": {
|
|
731
|
+
"abi": [{ "inputs": [], "name": "MCD_MANAGER", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "VAT_ADDRESS", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "_getProxyOwner", "outputs": [{ "internalType": "address", "name": "userAddr", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_cdpId", "type": "uint256" }], "name": "getCdpInfo", "outputs": [{ "internalType": "address", "name": "urn", "type": "address" }, { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "userAddr", "type": "address" }, { "internalType": "bytes32", "name": "ilk", "type": "bytes32" }, { "internalType": "uint256", "name": "collateral", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "contract IManager", "name": "_manager", "type": "address" }, { "internalType": "uint256", "name": "_cdpId", "type": "uint256" }, { "internalType": "bytes32", "name": "_ilk", "type": "bytes32" }], "name": "getCdpInfo", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32[]", "name": "_ilks", "type": "bytes32[]" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getCropJoinCdps", "outputs": [{ "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }, { "internalType": "address[]", "name": "urns", "type": "address[]" }, { "internalType": "bytes32[]", "name": "ilks", "type": "bytes32[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "contract IManager", "name": "_manager", "type": "address" }, { "internalType": "uint256", "name": "_cdpId", "type": "uint256" }], "name": "getOwner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_ilk", "type": "bytes32" }], "name": "getPrice", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_managerAddr", "type": "address" }, { "internalType": "uint256", "name": "_vaultId", "type": "uint256" }], "name": "getRatio", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_mcdManager", "type": "address" }, { "internalType": "uint256", "name": "_vaultId", "type": "uint256" }], "name": "getUrnAndIlk", "outputs": [{ "internalType": "address", "name": "urn", "type": "address" }, { "internalType": "bytes32", "name": "ilk", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_managerAddr", "type": "address" }, { "internalType": "uint256", "name": "_vaultId", "type": "uint256" }, { "internalType": "bytes32", "name": "_ilk", "type": "bytes32" }], "name": "getVaultInfo", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "spotter", "outputs": [{ "internalType": "contract ISpotter", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "vat", "outputs": [{ "internalType": "contract IVat", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }],
|
|
732
|
+
"address": "0x68C61AF097b834c68eA6EA5e46aF6c04E8945B2d"
|
|
733
|
+
},
|
|
730
734
|
"14384301": {
|
|
731
|
-
"abi": [{ "inputs": [{ "internalType": "contract IManager", "name": "_manager", "type": "address" }, { "internalType": "uint256", "name": "_cdpId", "type": "uint256" }, { "internalType": "bytes32", "name": "_ilk", "type": "bytes32" }], "name": "getCdpInfo", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
|
|
735
|
+
"abi": [{ "inputs": [{ "internalType": "address", "name": "_mcdManager", "type": "address" }, { "internalType": "uint256", "name": "_vaultId", "type": "uint256" }], "name": "getUrnAndIlk", "outputs": [{ "internalType": "address", "name": "urn", "type": "address" }, { "internalType": "bytes32", "name": "ilk", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "contract IManager", "name": "_manager", "type": "address" }, { "internalType": "uint256", "name": "_cdpId", "type": "uint256" }, { "internalType": "bytes32", "name": "_ilk", "type": "bytes32" }], "name": "getCdpInfo", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
|
|
732
736
|
"address": "0x119a9B532FEe9Ce4a07F86f7053e635dD4E166F9"
|
|
733
737
|
}
|
|
734
738
|
}
|
package/esm/curveUsd/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
|
-
import { CrvUSDGlobalMarketData, CrvUSDMarketData, CrvUSDUserData
|
|
2
|
+
import { CrvUSDGlobalMarketData, CrvUSDMarketData, CrvUSDUserData } from '../types';
|
|
3
3
|
import { Blockish, EthAddress, NetworkNumber, PositionBalances } from '../types/common';
|
|
4
4
|
export declare const getCurveUsdGlobalData: (web3: Web3, network: NetworkNumber, selectedMarket: CrvUSDMarketData) => Promise<CrvUSDGlobalMarketData>;
|
|
5
|
-
export declare const getCrvUsdAccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress,
|
|
5
|
+
export declare const getCrvUsdAccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress, controllerAddress: EthAddress) => Promise<PositionBalances>;
|
|
6
6
|
export declare const getCurveUsdUserData: (web3: Web3, network: NetworkNumber, address: string, selectedMarket: CrvUSDMarketData, activeBand: string) => Promise<CrvUSDUserData>;
|
|
7
7
|
export declare const getCurveUsdFullPositionData: (web3: Web3, network: NetworkNumber, address: string, selectedMarket: CrvUSDMarketData) => Promise<CrvUSDUserData>;
|
package/esm/curveUsd/index.js
CHANGED
|
@@ -111,7 +111,7 @@ const getStatusForUser = (bandRange, activeBand, crvUSDSupplied, collSupplied) =
|
|
|
111
111
|
return CrvUSDStatus.SoftLiquidated; // or is fully soft liquidated
|
|
112
112
|
return CrvUSDStatus.Nonexistant;
|
|
113
113
|
};
|
|
114
|
-
export const getCrvUsdAccountBalances = (web3, network, block, addressMapping, address,
|
|
114
|
+
export const getCrvUsdAccountBalances = (web3, network, block, addressMapping, address, controllerAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
115
115
|
let balances = {
|
|
116
116
|
collateral: {},
|
|
117
117
|
debt: {},
|
|
@@ -120,7 +120,7 @@ export const getCrvUsdAccountBalances = (web3, network, block, addressMapping, a
|
|
|
120
120
|
return balances;
|
|
121
121
|
}
|
|
122
122
|
const contract = CrvUSDViewContract(web3, network, block);
|
|
123
|
-
const selectedMarket = CrvUsdMarkets(network)
|
|
123
|
+
const selectedMarket = Object.values(CrvUsdMarkets(network)).find(i => i.controllerAddress.toLowerCase() === controllerAddress.toLowerCase());
|
|
124
124
|
const data = yield contract.methods.userData(selectedMarket.controllerAddress, address).call({}, block);
|
|
125
125
|
balances = {
|
|
126
126
|
collateral: {
|
package/esm/maker/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
|
-
import { Blockish, NetworkNumber, PositionBalances } from '../types/common';
|
|
2
|
+
import { Blockish, EthAddress, NetworkNumber, PositionBalances } from '../types/common';
|
|
3
3
|
import { CdpData } from '../types';
|
|
4
|
-
export declare const getMakerAccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, cdpId: string) => Promise<PositionBalances>;
|
|
4
|
+
export declare const getMakerAccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, cdpId: string, _managerAddress?: EthAddress) => Promise<PositionBalances>;
|
|
5
5
|
export declare const getMakerCdpData: (web3: Web3, network: NetworkNumber, cdpId: string) => Promise<CdpData>;
|
package/esm/maker/index.js
CHANGED
|
@@ -12,25 +12,33 @@ import { assetAmountInEth, getAssetInfo, ilkToAsset } from '@defisaver/tokens';
|
|
|
12
12
|
import { McdViewContract } from '../contracts';
|
|
13
13
|
import { makerHelpers } from '../helpers';
|
|
14
14
|
import { wethToEth } from '../services/utils';
|
|
15
|
-
export const getMakerAccountBalances = (web3, network, block, addressMapping, cdpId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
export const getMakerAccountBalances = (web3, network, block, addressMapping, cdpId, _managerAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
let balances = {
|
|
17
17
|
collateral: {},
|
|
18
18
|
debt: {},
|
|
19
19
|
};
|
|
20
|
+
const managerAddress = _managerAddress || '0x5ef30b9986345249bc32d8928B7ee64DE9435E39'; // Default CDP Manager (This is used only to differentiate BProtocol CDPs)
|
|
20
21
|
if (!cdpId) {
|
|
21
22
|
return balances;
|
|
22
23
|
}
|
|
23
24
|
const viewContract = McdViewContract(web3, network, block);
|
|
25
|
+
let ilk;
|
|
26
|
+
const needsIlk = new Dec(block).lt(14410792) && new Dec(block).gte(14384301);
|
|
27
|
+
if (needsIlk) {
|
|
28
|
+
ilk = (yield viewContract.methods.getUrnAndIlk(managerAddress, cdpId).call({}, block)).ilk;
|
|
29
|
+
}
|
|
24
30
|
// @ts-ignore
|
|
25
|
-
const cdpInfo = yield viewContract.methods.getCdpInfo(cdpId).call({}, block);
|
|
26
|
-
const ilkInfo = yield makerHelpers.getCollateralInfo(cdpInfo.ilk, web3, network, block);
|
|
27
|
-
const
|
|
31
|
+
const cdpInfo = yield viewContract.methods.getCdpInfo(...(needsIlk ? [managerAddress, cdpId, ilk] : [cdpId])).call({}, block);
|
|
32
|
+
const ilkInfo = yield makerHelpers.getCollateralInfo(needsIlk ? ilk : cdpInfo.ilk, web3, network, block);
|
|
33
|
+
const collateral = needsIlk ? cdpInfo[1] : cdpInfo.collateral;
|
|
34
|
+
const debt = needsIlk ? cdpInfo[0] : cdpInfo.debt;
|
|
35
|
+
const asset = wethToEth(ilkToAsset(needsIlk ? ilk : cdpInfo.ilk));
|
|
28
36
|
balances = {
|
|
29
37
|
collateral: {
|
|
30
|
-
[addressMapping ? getAssetInfo(asset, network).address.toLowerCase() : asset]: asset === 'WBTC' ? new Dec(
|
|
38
|
+
[addressMapping ? getAssetInfo(asset, network).address.toLowerCase() : asset]: asset === 'WBTC' ? new Dec(collateral).div(1e10).floor().toString() : collateral,
|
|
31
39
|
},
|
|
32
40
|
debt: {
|
|
33
|
-
[addressMapping ? getAssetInfo('DAI', network).address.toLowerCase() : 'DAI']: new Dec(
|
|
41
|
+
[addressMapping ? getAssetInfo('DAI', network).address.toLowerCase() : 'DAI']: new Dec(debt).times(ilkInfo.currentRate).div(1e27).floor()
|
|
34
42
|
.toString(),
|
|
35
43
|
},
|
|
36
44
|
};
|
|
@@ -2,7 +2,17 @@ import { MorphoBlueMarketData } from '../../types';
|
|
|
2
2
|
import { NetworkNumber } from '../../types/common';
|
|
3
3
|
export declare const MORPHO_BLUE_WSTETH_ETH: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
4
4
|
export declare const MORPHO_BLUE_WSTETH_USDC: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
5
|
+
export declare const MORPHO_BLUE_SDAI_USDC: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
6
|
+
export declare const MORPHO_BLUE_WBTC_USDC: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
7
|
+
export declare const MORPHO_BLUE_ETH_USDC: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
8
|
+
export declare const MORPHO_BLUE_WBTC_USDT: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
9
|
+
export declare const MORPHO_BLUE_WSTETH_USDT: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
5
10
|
export declare const MorphoBlueMarkets: (networkId: NetworkNumber) => {
|
|
6
11
|
readonly morphobluewstetheth: MorphoBlueMarketData;
|
|
7
12
|
readonly morphobluewstethusdc: MorphoBlueMarketData;
|
|
13
|
+
readonly morphobluesdaiusdc: MorphoBlueMarketData;
|
|
14
|
+
readonly morphobluewbtcusdc: MorphoBlueMarketData;
|
|
15
|
+
readonly morphoblueethusdc: MorphoBlueMarketData;
|
|
16
|
+
readonly morphobluewbtcusdt: MorphoBlueMarketData;
|
|
17
|
+
readonly morphobluewstethusdt: MorphoBlueMarketData;
|
|
8
18
|
};
|
|
@@ -11,6 +11,7 @@ export const MORPHO_BLUE_WSTETH_ETH = (networkId = NetworkNumber.Eth) => ({
|
|
|
11
11
|
oracle: '0x2a01eb9496094da03c4e364def50f5ad1280ad72',
|
|
12
12
|
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
13
13
|
lltv: 0.945,
|
|
14
|
+
marketId: '0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec41',
|
|
14
15
|
// icon: SvgAdapter(protocolIcons.spark),
|
|
15
16
|
protocolName: 'morpho-blue',
|
|
16
17
|
});
|
|
@@ -25,10 +26,91 @@ export const MORPHO_BLUE_WSTETH_USDC = (networkId = NetworkNumber.Eth) => ({
|
|
|
25
26
|
oracle: '0x48F7E36EB6B826B2dF4B2E630B62Cd25e89E40e2',
|
|
26
27
|
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
27
28
|
lltv: 0.86,
|
|
29
|
+
marketId: '0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc',
|
|
30
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
31
|
+
protocolName: 'morpho-blue',
|
|
32
|
+
});
|
|
33
|
+
export const MORPHO_BLUE_SDAI_USDC = (networkId = NetworkNumber.Eth) => ({
|
|
34
|
+
chainIds: [1],
|
|
35
|
+
label: 'Morpho Blue',
|
|
36
|
+
shortLabel: 'sDAI/USDC',
|
|
37
|
+
value: MorphoBlueVersions.MorphoBlueSDAIUSDC,
|
|
38
|
+
url: 'sdaiusdc',
|
|
39
|
+
loanToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
40
|
+
collateralToken: '0x83F20F44975D03b1b09e64809B757c47f942BEeA',
|
|
41
|
+
oracle: '0x6CAFE228eC0B0bC2D076577d56D35Fe704318f6d',
|
|
42
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
43
|
+
lltv: 0.965,
|
|
44
|
+
marketId: '0x06f2842602373d247c4934f7656e513955ccc4c377f0febc0d9ca2c3bcc191b1',
|
|
45
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
46
|
+
protocolName: 'morpho-blue',
|
|
47
|
+
});
|
|
48
|
+
export const MORPHO_BLUE_WBTC_USDC = (networkId = NetworkNumber.Eth) => ({
|
|
49
|
+
chainIds: [1],
|
|
50
|
+
label: 'Morpho Blue',
|
|
51
|
+
shortLabel: 'WBTC/USDC',
|
|
52
|
+
value: MorphoBlueVersions.MorphoBlueWBTCUSDC,
|
|
53
|
+
url: 'wbtcusdc',
|
|
54
|
+
loanToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
55
|
+
collateralToken: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
56
|
+
oracle: '0xDddd770BADd886dF3864029e4B377B5F6a2B6b83',
|
|
57
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
58
|
+
lltv: 0.86,
|
|
59
|
+
marketId: '0x3a85e619751152991742810df6ec69ce473daef99e28a64ab2340d7b7ccfee49',
|
|
60
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
61
|
+
protocolName: 'morpho-blue',
|
|
62
|
+
});
|
|
63
|
+
export const MORPHO_BLUE_ETH_USDC = (networkId = NetworkNumber.Eth) => ({
|
|
64
|
+
chainIds: [1],
|
|
65
|
+
label: 'Morpho Blue',
|
|
66
|
+
shortLabel: 'ETH/USDC',
|
|
67
|
+
value: MorphoBlueVersions.MorphoBlueEthUSDC,
|
|
68
|
+
url: 'ethusdc',
|
|
69
|
+
loanToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
70
|
+
collateralToken: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
71
|
+
oracle: '0xdC6fd5831277c693b1054e19E94047cB37c77615',
|
|
72
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
73
|
+
lltv: 0.915,
|
|
74
|
+
marketId: '0xf9acc677910cc17f650416a22e2a14d5da7ccb9626db18f1bf94efe64f92b372',
|
|
75
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
76
|
+
protocolName: 'morpho-blue',
|
|
77
|
+
});
|
|
78
|
+
export const MORPHO_BLUE_WBTC_USDT = (networkId = NetworkNumber.Eth) => ({
|
|
79
|
+
chainIds: [1],
|
|
80
|
+
label: 'Morpho Blue',
|
|
81
|
+
shortLabel: 'WBTC/USDT',
|
|
82
|
+
value: MorphoBlueVersions.MorphoBlueWBTCUSDT,
|
|
83
|
+
url: 'wbtcusdt',
|
|
84
|
+
loanToken: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
85
|
+
collateralToken: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
86
|
+
oracle: '0x008bF4B1cDA0cc9f0e882E0697f036667652E1ef',
|
|
87
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
88
|
+
lltv: 0.86,
|
|
89
|
+
marketId: '0xa921ef34e2fc7a27ccc50ae7e4b154e16c9799d3387076c421423ef52ac4df99',
|
|
90
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
91
|
+
protocolName: 'morpho-blue',
|
|
92
|
+
});
|
|
93
|
+
export const MORPHO_BLUE_WSTETH_USDT = (networkId = NetworkNumber.Eth) => ({
|
|
94
|
+
chainIds: [1],
|
|
95
|
+
label: 'Morpho Blue',
|
|
96
|
+
shortLabel: 'wstETH/USDT',
|
|
97
|
+
value: MorphoBlueVersions.MorphoBlueWstEthUSDT,
|
|
98
|
+
url: 'wstethusdt',
|
|
99
|
+
loanToken: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
100
|
+
collateralToken: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
|
|
101
|
+
oracle: '0x95DB30fAb9A3754e42423000DF27732CB2396992',
|
|
102
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
103
|
+
lltv: 0.86,
|
|
104
|
+
marketId: '0xe7e9694b754c4d4f7e21faf7223f6fa71abaeb10296a4c43a54a7977149687d2',
|
|
28
105
|
// icon: SvgAdapter(protocolIcons.spark),
|
|
29
106
|
protocolName: 'morpho-blue',
|
|
30
107
|
});
|
|
31
108
|
export const MorphoBlueMarkets = (networkId) => ({
|
|
32
109
|
[MorphoBlueVersions.MorphoBlueWstEthEth]: MORPHO_BLUE_WSTETH_ETH(networkId),
|
|
33
110
|
[MorphoBlueVersions.MorphoBlueWstEthUSDC]: MORPHO_BLUE_WSTETH_USDC(networkId),
|
|
111
|
+
[MorphoBlueVersions.MorphoBlueSDAIUSDC]: MORPHO_BLUE_SDAI_USDC(networkId),
|
|
112
|
+
[MorphoBlueVersions.MorphoBlueWBTCUSDC]: MORPHO_BLUE_WBTC_USDC(networkId),
|
|
113
|
+
[MorphoBlueVersions.MorphoBlueEthUSDC]: MORPHO_BLUE_ETH_USDC(networkId),
|
|
114
|
+
[MorphoBlueVersions.MorphoBlueWBTCUSDT]: MORPHO_BLUE_WBTC_USDT(networkId),
|
|
115
|
+
[MorphoBlueVersions.MorphoBlueWstEthUSDT]: MORPHO_BLUE_WSTETH_USDT(networkId),
|
|
34
116
|
});
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { MMUsedAssets, NetworkNumber } from './common';
|
|
2
2
|
export declare enum MorphoBlueVersions {
|
|
3
3
|
MorphoBlueWstEthEth = "morphobluewstetheth",
|
|
4
|
-
MorphoBlueWstEthUSDC = "morphobluewstethusdc"
|
|
4
|
+
MorphoBlueWstEthUSDC = "morphobluewstethusdc",
|
|
5
|
+
MorphoBlueSDAIUSDC = "morphobluesdaiusdc",
|
|
6
|
+
MorphoBlueWBTCUSDC = "morphobluewbtcusdc",
|
|
7
|
+
MorphoBlueEthUSDC = "morphoblueethusdc",
|
|
8
|
+
MorphoBlueWBTCUSDT = "morphobluewbtcusdt",
|
|
9
|
+
MorphoBlueWstEthUSDT = "morphobluewstethusdt"
|
|
5
10
|
}
|
|
6
11
|
export interface MorphoBlueMarketData {
|
|
7
12
|
chainIds: NetworkNumber[];
|
|
@@ -14,6 +19,7 @@ export interface MorphoBlueMarketData {
|
|
|
14
19
|
oracle: string;
|
|
15
20
|
irm: string;
|
|
16
21
|
lltv: number | string;
|
|
22
|
+
marketId: string;
|
|
17
23
|
protocolName: string;
|
|
18
24
|
}
|
|
19
25
|
export interface MorphoBlueAssetData {
|
package/esm/types/morphoBlue.js
CHANGED
|
@@ -2,4 +2,9 @@ export var MorphoBlueVersions;
|
|
|
2
2
|
(function (MorphoBlueVersions) {
|
|
3
3
|
MorphoBlueVersions["MorphoBlueWstEthEth"] = "morphobluewstetheth";
|
|
4
4
|
MorphoBlueVersions["MorphoBlueWstEthUSDC"] = "morphobluewstethusdc";
|
|
5
|
+
MorphoBlueVersions["MorphoBlueSDAIUSDC"] = "morphobluesdaiusdc";
|
|
6
|
+
MorphoBlueVersions["MorphoBlueWBTCUSDC"] = "morphobluewbtcusdc";
|
|
7
|
+
MorphoBlueVersions["MorphoBlueEthUSDC"] = "morphoblueethusdc";
|
|
8
|
+
MorphoBlueVersions["MorphoBlueWBTCUSDT"] = "morphobluewbtcusdt";
|
|
9
|
+
MorphoBlueVersions["MorphoBlueWstEthUSDT"] = "morphobluewstethusdt";
|
|
5
10
|
})(MorphoBlueVersions || (MorphoBlueVersions = {}));
|
package/package.json
CHANGED
package/src/config/contracts.js
CHANGED
|
@@ -727,8 +727,12 @@ module.exports = {
|
|
|
727
727
|
"address": "0x922C795aE0be55Aaeb3FF51813B76AFc78e97C7c",
|
|
728
728
|
"createdBlock": 14410792,
|
|
729
729
|
"oldVersions": {
|
|
730
|
+
"11183987": {
|
|
731
|
+
"abi": [{"inputs":[],"name":"MCD_MANAGER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAT_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"_getProxyOwner","outputs":[{"internalType":"address","name":"userAddr","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cdpId","type":"uint256"}],"name":"getCdpInfo","outputs":[{"internalType":"address","name":"urn","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"userAddr","type":"address"},{"internalType":"bytes32","name":"ilk","type":"bytes32"},{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"uint256","name":"debt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IManager","name":"_manager","type":"address"},{"internalType":"uint256","name":"_cdpId","type":"uint256"},{"internalType":"bytes32","name":"_ilk","type":"bytes32"}],"name":"getCdpInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_ilks","type":"bytes32[]"},{"internalType":"address","name":"_user","type":"address"}],"name":"getCropJoinCdps","outputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address[]","name":"urns","type":"address[]"},{"internalType":"bytes32[]","name":"ilks","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IManager","name":"_manager","type":"address"},{"internalType":"uint256","name":"_cdpId","type":"uint256"}],"name":"getOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_ilk","type":"bytes32"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_managerAddr","type":"address"},{"internalType":"uint256","name":"_vaultId","type":"uint256"}],"name":"getRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_mcdManager","type":"address"},{"internalType":"uint256","name":"_vaultId","type":"uint256"}],"name":"getUrnAndIlk","outputs":[{"internalType":"address","name":"urn","type":"address"},{"internalType":"bytes32","name":"ilk","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_managerAddr","type":"address"},{"internalType":"uint256","name":"_vaultId","type":"uint256"},{"internalType":"bytes32","name":"_ilk","type":"bytes32"}],"name":"getVaultInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"spotter","outputs":[{"internalType":"contract ISpotter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vat","outputs":[{"internalType":"contract IVat","name":"","type":"address"}],"stateMutability":"view","type":"function"}],
|
|
732
|
+
"address": "0x68C61AF097b834c68eA6EA5e46aF6c04E8945B2d"
|
|
733
|
+
},
|
|
730
734
|
"14384301": {
|
|
731
|
-
"abi": [{"inputs":[{"internalType":"contract IManager","name":"_manager","type":"address"},{"internalType":"uint256","name":"_cdpId","type":"uint256"},{"internalType":"bytes32","name":"_ilk","type":"bytes32"}],"name":"getCdpInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}],
|
|
735
|
+
"abi": [{"inputs":[{"internalType":"address","name":"_mcdManager","type":"address"},{"internalType":"uint256","name":"_vaultId","type":"uint256"}],"name":"getUrnAndIlk","outputs":[{"internalType":"address","name":"urn","type":"address"},{"internalType":"bytes32","name":"ilk","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IManager","name":"_manager","type":"address"},{"internalType":"uint256","name":"_cdpId","type":"uint256"},{"internalType":"bytes32","name":"_ilk","type":"bytes32"}],"name":"getCdpInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}],
|
|
732
736
|
"address": "0x119a9B532FEe9Ce4a07F86f7053e635dD4E166F9"
|
|
733
737
|
}
|
|
734
738
|
}
|
package/src/curveUsd/index.ts
CHANGED
|
@@ -124,7 +124,7 @@ const getStatusForUser = (bandRange: string[], activeBand: string, crvUSDSupplie
|
|
|
124
124
|
return CrvUSDStatus.Nonexistant;
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
export const getCrvUsdAccountBalances = async (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress,
|
|
127
|
+
export const getCrvUsdAccountBalances = async (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress, controllerAddress: EthAddress): Promise<PositionBalances> => {
|
|
128
128
|
let balances: PositionBalances = {
|
|
129
129
|
collateral: {},
|
|
130
130
|
debt: {},
|
|
@@ -135,7 +135,7 @@ export const getCrvUsdAccountBalances = async (web3: Web3, network: NetworkNumbe
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
const contract = CrvUSDViewContract(web3, network, block);
|
|
138
|
-
const selectedMarket = CrvUsdMarkets(network)
|
|
138
|
+
const selectedMarket = Object.values(CrvUsdMarkets(network)).find(i => i.controllerAddress.toLowerCase() === controllerAddress.toLowerCase()) as CrvUSDMarketData;
|
|
139
139
|
|
|
140
140
|
const data = await contract.methods.userData(selectedMarket.controllerAddress, address).call({}, block);
|
|
141
141
|
|
package/src/maker/index.ts
CHANGED
|
@@ -1,35 +1,51 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
2
|
import Dec from 'decimal.js';
|
|
3
3
|
import { assetAmountInEth, getAssetInfo, ilkToAsset } from '@defisaver/tokens';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Blockish, EthAddress, NetworkNumber, PositionBalances,
|
|
6
|
+
} from '../types/common';
|
|
5
7
|
import { McdViewContract } from '../contracts';
|
|
6
8
|
import { makerHelpers } from '../helpers';
|
|
7
9
|
import { CdpData } from '../types';
|
|
8
10
|
import { wethToEth } from '../services/utils';
|
|
9
11
|
|
|
10
|
-
export const getMakerAccountBalances = async (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, cdpId: string): Promise<PositionBalances> => {
|
|
12
|
+
export const getMakerAccountBalances = async (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, cdpId: string, _managerAddress?: EthAddress): Promise<PositionBalances> => {
|
|
11
13
|
let balances: PositionBalances = {
|
|
12
14
|
collateral: {},
|
|
13
15
|
debt: {},
|
|
14
16
|
};
|
|
17
|
+
const managerAddress = _managerAddress || '0x5ef30b9986345249bc32d8928B7ee64DE9435E39'; // Default CDP Manager (This is used only to differentiate BProtocol CDPs)
|
|
15
18
|
|
|
16
19
|
if (!cdpId) {
|
|
17
20
|
return balances;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
const viewContract = McdViewContract(web3, network, block);
|
|
24
|
+
|
|
25
|
+
let ilk;
|
|
26
|
+
|
|
27
|
+
const needsIlk = new Dec(block).lt(14410792) && new Dec(block).gte(14384301);
|
|
28
|
+
|
|
29
|
+
if (needsIlk) {
|
|
30
|
+
ilk = (await viewContract.methods.getUrnAndIlk(managerAddress, cdpId).call({}, block)).ilk;
|
|
31
|
+
}
|
|
32
|
+
|
|
21
33
|
// @ts-ignore
|
|
22
|
-
const cdpInfo = await viewContract.methods.getCdpInfo(cdpId).call({}, block);
|
|
23
|
-
const ilkInfo = await makerHelpers.getCollateralInfo(cdpInfo.ilk, web3, network, block);
|
|
34
|
+
const cdpInfo = await viewContract.methods.getCdpInfo(...(needsIlk ? [managerAddress, cdpId, ilk] : [cdpId])).call({}, block);
|
|
35
|
+
const ilkInfo = await makerHelpers.getCollateralInfo(needsIlk ? ilk : cdpInfo.ilk, web3, network, block);
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const collateral = needsIlk ? cdpInfo[1] : cdpInfo.collateral;
|
|
39
|
+
const debt = needsIlk ? cdpInfo[0] : cdpInfo.debt;
|
|
24
40
|
|
|
25
|
-
const asset = wethToEth(ilkToAsset(cdpInfo.ilk));
|
|
41
|
+
const asset = wethToEth(ilkToAsset(needsIlk ? ilk : cdpInfo.ilk));
|
|
26
42
|
|
|
27
43
|
balances = {
|
|
28
44
|
collateral: {
|
|
29
|
-
[addressMapping ? getAssetInfo(asset, network).address.toLowerCase() : asset]: asset === 'WBTC' ? new Dec(
|
|
45
|
+
[addressMapping ? getAssetInfo(asset, network).address.toLowerCase() : asset]: asset === 'WBTC' ? new Dec(collateral).div(1e10).floor().toString() : collateral,
|
|
30
46
|
},
|
|
31
47
|
debt: {
|
|
32
|
-
[addressMapping ? getAssetInfo('DAI', network).address.toLowerCase() : 'DAI']: new Dec(
|
|
48
|
+
[addressMapping ? getAssetInfo('DAI', network).address.toLowerCase() : 'DAI']: new Dec(debt).times(ilkInfo.currentRate).div(1e27).floor()
|
|
33
49
|
.toString(),
|
|
34
50
|
},
|
|
35
51
|
};
|
|
@@ -12,6 +12,7 @@ export const MORPHO_BLUE_WSTETH_ETH = (networkId: NetworkNumber = NetworkNumber.
|
|
|
12
12
|
oracle: '0x2a01eb9496094da03c4e364def50f5ad1280ad72',
|
|
13
13
|
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
14
14
|
lltv: 0.945,
|
|
15
|
+
marketId: '0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec41',
|
|
15
16
|
// icon: SvgAdapter(protocolIcons.spark),
|
|
16
17
|
protocolName: 'morpho-blue',
|
|
17
18
|
});
|
|
@@ -27,6 +28,85 @@ export const MORPHO_BLUE_WSTETH_USDC = (networkId: NetworkNumber = NetworkNumber
|
|
|
27
28
|
oracle: '0x48F7E36EB6B826B2dF4B2E630B62Cd25e89E40e2',
|
|
28
29
|
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
29
30
|
lltv: 0.86,
|
|
31
|
+
marketId: '0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc',
|
|
32
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
33
|
+
protocolName: 'morpho-blue',
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const MORPHO_BLUE_SDAI_USDC = (networkId: NetworkNumber = NetworkNumber.Eth): MorphoBlueMarketData => ({
|
|
37
|
+
chainIds: [1],
|
|
38
|
+
label: 'Morpho Blue',
|
|
39
|
+
shortLabel: 'sDAI/USDC',
|
|
40
|
+
value: MorphoBlueVersions.MorphoBlueSDAIUSDC,
|
|
41
|
+
url: 'sdaiusdc',
|
|
42
|
+
loanToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
43
|
+
collateralToken: '0x83F20F44975D03b1b09e64809B757c47f942BEeA',
|
|
44
|
+
oracle: '0x6CAFE228eC0B0bC2D076577d56D35Fe704318f6d',
|
|
45
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
46
|
+
lltv: 0.965,
|
|
47
|
+
marketId: '0x06f2842602373d247c4934f7656e513955ccc4c377f0febc0d9ca2c3bcc191b1',
|
|
48
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
49
|
+
protocolName: 'morpho-blue',
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const MORPHO_BLUE_WBTC_USDC = (networkId: NetworkNumber = NetworkNumber.Eth): MorphoBlueMarketData => ({
|
|
53
|
+
chainIds: [1],
|
|
54
|
+
label: 'Morpho Blue',
|
|
55
|
+
shortLabel: 'WBTC/USDC',
|
|
56
|
+
value: MorphoBlueVersions.MorphoBlueWBTCUSDC,
|
|
57
|
+
url: 'wbtcusdc',
|
|
58
|
+
loanToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
59
|
+
collateralToken: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
60
|
+
oracle: '0xDddd770BADd886dF3864029e4B377B5F6a2B6b83',
|
|
61
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
62
|
+
lltv: 0.86,
|
|
63
|
+
marketId: '0x3a85e619751152991742810df6ec69ce473daef99e28a64ab2340d7b7ccfee49',
|
|
64
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
65
|
+
protocolName: 'morpho-blue',
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const MORPHO_BLUE_ETH_USDC = (networkId: NetworkNumber = NetworkNumber.Eth): MorphoBlueMarketData => ({
|
|
69
|
+
chainIds: [1],
|
|
70
|
+
label: 'Morpho Blue',
|
|
71
|
+
shortLabel: 'ETH/USDC',
|
|
72
|
+
value: MorphoBlueVersions.MorphoBlueEthUSDC,
|
|
73
|
+
url: 'ethusdc',
|
|
74
|
+
loanToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
75
|
+
collateralToken: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
76
|
+
oracle: '0xdC6fd5831277c693b1054e19E94047cB37c77615',
|
|
77
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
78
|
+
lltv: 0.915,
|
|
79
|
+
marketId: '0xf9acc677910cc17f650416a22e2a14d5da7ccb9626db18f1bf94efe64f92b372',
|
|
80
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
81
|
+
protocolName: 'morpho-blue',
|
|
82
|
+
});
|
|
83
|
+
export const MORPHO_BLUE_WBTC_USDT = (networkId: NetworkNumber = NetworkNumber.Eth): MorphoBlueMarketData => ({
|
|
84
|
+
chainIds: [1],
|
|
85
|
+
label: 'Morpho Blue',
|
|
86
|
+
shortLabel: 'WBTC/USDT',
|
|
87
|
+
value: MorphoBlueVersions.MorphoBlueWBTCUSDT,
|
|
88
|
+
url: 'wbtcusdt',
|
|
89
|
+
loanToken: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
90
|
+
collateralToken: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
91
|
+
oracle: '0x008bF4B1cDA0cc9f0e882E0697f036667652E1ef',
|
|
92
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
93
|
+
lltv: 0.86,
|
|
94
|
+
marketId: '0xa921ef34e2fc7a27ccc50ae7e4b154e16c9799d3387076c421423ef52ac4df99',
|
|
95
|
+
// icon: SvgAdapter(protocolIcons.spark),
|
|
96
|
+
protocolName: 'morpho-blue',
|
|
97
|
+
});
|
|
98
|
+
export const MORPHO_BLUE_WSTETH_USDT = (networkId: NetworkNumber = NetworkNumber.Eth): MorphoBlueMarketData => ({
|
|
99
|
+
chainIds: [1],
|
|
100
|
+
label: 'Morpho Blue',
|
|
101
|
+
shortLabel: 'wstETH/USDT',
|
|
102
|
+
value: MorphoBlueVersions.MorphoBlueWstEthUSDT,
|
|
103
|
+
url: 'wstethusdt',
|
|
104
|
+
loanToken: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
105
|
+
collateralToken: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
|
|
106
|
+
oracle: '0x95DB30fAb9A3754e42423000DF27732CB2396992',
|
|
107
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
108
|
+
lltv: 0.86,
|
|
109
|
+
marketId: '0xe7e9694b754c4d4f7e21faf7223f6fa71abaeb10296a4c43a54a7977149687d2',
|
|
30
110
|
// icon: SvgAdapter(protocolIcons.spark),
|
|
31
111
|
protocolName: 'morpho-blue',
|
|
32
112
|
});
|
|
@@ -34,4 +114,9 @@ export const MORPHO_BLUE_WSTETH_USDC = (networkId: NetworkNumber = NetworkNumber
|
|
|
34
114
|
export const MorphoBlueMarkets = (networkId: NetworkNumber) => ({
|
|
35
115
|
[MorphoBlueVersions.MorphoBlueWstEthEth]: MORPHO_BLUE_WSTETH_ETH(networkId),
|
|
36
116
|
[MorphoBlueVersions.MorphoBlueWstEthUSDC]: MORPHO_BLUE_WSTETH_USDC(networkId),
|
|
117
|
+
[MorphoBlueVersions.MorphoBlueSDAIUSDC]: MORPHO_BLUE_SDAI_USDC(networkId),
|
|
118
|
+
[MorphoBlueVersions.MorphoBlueWBTCUSDC]: MORPHO_BLUE_WBTC_USDC(networkId),
|
|
119
|
+
[MorphoBlueVersions.MorphoBlueEthUSDC]: MORPHO_BLUE_ETH_USDC(networkId),
|
|
120
|
+
[MorphoBlueVersions.MorphoBlueWBTCUSDT]: MORPHO_BLUE_WBTC_USDT(networkId),
|
|
121
|
+
[MorphoBlueVersions.MorphoBlueWstEthUSDT]: MORPHO_BLUE_WSTETH_USDT(networkId),
|
|
37
122
|
}) as const;
|
package/src/types/morphoBlue.ts
CHANGED
|
@@ -3,6 +3,11 @@ import { MMUsedAssets, NetworkNumber } from './common';
|
|
|
3
3
|
export enum MorphoBlueVersions {
|
|
4
4
|
MorphoBlueWstEthEth = 'morphobluewstetheth',
|
|
5
5
|
MorphoBlueWstEthUSDC = 'morphobluewstethusdc',
|
|
6
|
+
MorphoBlueSDAIUSDC = 'morphobluesdaiusdc',
|
|
7
|
+
MorphoBlueWBTCUSDC = 'morphobluewbtcusdc',
|
|
8
|
+
MorphoBlueEthUSDC = 'morphoblueethusdc',
|
|
9
|
+
MorphoBlueWBTCUSDT = 'morphobluewbtcusdt',
|
|
10
|
+
MorphoBlueWstEthUSDT = 'morphobluewstethusdt',
|
|
6
11
|
}
|
|
7
12
|
|
|
8
13
|
export interface MorphoBlueMarketData {
|
|
@@ -16,6 +21,7 @@ export interface MorphoBlueMarketData {
|
|
|
16
21
|
oracle: string,
|
|
17
22
|
irm: string,
|
|
18
23
|
lltv: number | string,
|
|
24
|
+
marketId: string,
|
|
19
25
|
// icon: Function,
|
|
20
26
|
protocolName: string,
|
|
21
27
|
}
|