@gearbox-protocol/sdk 1.25.2 → 1.26.1
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/lib/contracts/contractsRegister.d.ts +6 -6
- package/lib/contracts/contractsRegister.js +11 -11
- package/lib/contracts/utilsContracts.d.ts +7 -0
- package/lib/contracts/utilsContracts.js +28 -0
- package/lib/core/creditAccount.d.ts +1 -1
- package/lib/core/creditAccount.js +3 -7
- package/lib/core/creditAccount.spec.js +3 -3
- package/lib/core/creditSession.d.ts +2 -0
- package/lib/core/creditSession.js +15 -6
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/oracles/priceFeeds.js +56 -28
- package/lib/tokens/decimals.js +4 -0
- package/lib/tokens/normal.d.ts +1 -1
- package/lib/tokens/normal.js +80 -0
- package/lib/tokens/token.js +37 -29
- package/package.json +1 -1
|
@@ -6,11 +6,11 @@ export declare const CREDIT_MANAGER_WETH_V2_MAINNET: string;
|
|
|
6
6
|
export declare const CREDIT_MANAGER_WSTETH_V2_MAINNET: string;
|
|
7
7
|
export declare const CREDIT_MANAGER_WBTC_V2_MAINNET: string;
|
|
8
8
|
export declare const CREDIT_MANAGER_FRAX_V2_MAINNET: string;
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export type CreditManagersV2 = typeof CREDIT_MANAGER_DAI_V2_MAINNET | typeof CREDIT_MANAGER_USDC_V2_MAINNET | typeof CREDIT_MANAGER_WETH_V2_MAINNET | typeof CREDIT_MANAGER_WSTETH_V2_MAINNET | typeof CREDIT_MANAGER_WBTC_V2_MAINNET | typeof
|
|
9
|
+
export declare const CREDIT_MANAGER_DAI_V2_ARBITRUM: string;
|
|
10
|
+
export declare const CREDIT_MANAGER_USDC_V2_ARBITRUM: string;
|
|
11
|
+
export declare const CREDIT_MANAGER_WETH_V2_ARBITRUM: string;
|
|
12
|
+
export declare const CREDIT_MANAGER_WSTETH_V2_ARBITRUM: string;
|
|
13
|
+
export declare const CREDIT_MANAGER_WBTC_V2_ARBITRUM: string;
|
|
14
|
+
export type CreditManagersV2 = typeof CREDIT_MANAGER_DAI_V2_MAINNET | typeof CREDIT_MANAGER_USDC_V2_MAINNET | typeof CREDIT_MANAGER_WETH_V2_MAINNET | typeof CREDIT_MANAGER_WSTETH_V2_MAINNET | typeof CREDIT_MANAGER_WBTC_V2_MAINNET | typeof CREDIT_MANAGER_DAI_V2_ARBITRUM | typeof CREDIT_MANAGER_USDC_V2_ARBITRUM | typeof CREDIT_MANAGER_WETH_V2_ARBITRUM | typeof CREDIT_MANAGER_WSTETH_V2_ARBITRUM | typeof CREDIT_MANAGER_WBTC_V2_ARBITRUM | typeof CREDIT_MANAGER_FRAX_V2_MAINNET;
|
|
15
15
|
export declare const deployedContracts: Record<string, string>;
|
|
16
16
|
export declare function getContractName(address: string): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getContractName = exports.deployedContracts = exports.
|
|
3
|
+
exports.getContractName = exports.deployedContracts = exports.CREDIT_MANAGER_WBTC_V2_ARBITRUM = exports.CREDIT_MANAGER_WSTETH_V2_ARBITRUM = exports.CREDIT_MANAGER_WETH_V2_ARBITRUM = exports.CREDIT_MANAGER_USDC_V2_ARBITRUM = exports.CREDIT_MANAGER_DAI_V2_ARBITRUM = exports.CREDIT_MANAGER_FRAX_V2_MAINNET = exports.CREDIT_MANAGER_WBTC_V2_MAINNET = exports.CREDIT_MANAGER_WSTETH_V2_MAINNET = exports.CREDIT_MANAGER_WETH_V2_MAINNET = exports.CREDIT_MANAGER_USDC_V2_MAINNET = exports.CREDIT_MANAGER_DAI_V2_MAINNET = exports.stEthPoolWrapper = void 0;
|
|
4
4
|
const mappers_1 = require("../utils/mappers");
|
|
5
5
|
const contracts_1 = require("./contracts");
|
|
6
6
|
exports.stEthPoolWrapper = {
|
|
@@ -14,11 +14,11 @@ exports.CREDIT_MANAGER_WSTETH_V2_MAINNET = "0xe0bce4460795281d39c91da9b0275bca96
|
|
|
14
14
|
exports.CREDIT_MANAGER_WBTC_V2_MAINNET = "0xc62bf8a7889adf1c5dc4665486c7683ae6e74e0f".toLowerCase();
|
|
15
15
|
exports.CREDIT_MANAGER_FRAX_V2_MAINNET = "0xa3e1e0d58fe8dd8c9dd48204699a1178f1b274d8".toLowerCase();
|
|
16
16
|
// Arbitrum
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
17
|
+
exports.CREDIT_MANAGER_DAI_V2_ARBITRUM = "0xf7ba434952acaa2e12035a2c3643ca327914a470".toLowerCase();
|
|
18
|
+
exports.CREDIT_MANAGER_USDC_V2_ARBITRUM = "0x2144a7785baecbab32295188285717cad6c1a11c".toLowerCase();
|
|
19
|
+
exports.CREDIT_MANAGER_WETH_V2_ARBITRUM = "0x2ad4a2f1bdd815e285a22cdcc072fbb43818b09b".toLowerCase();
|
|
20
|
+
exports.CREDIT_MANAGER_WSTETH_V2_ARBITRUM = "0x40d542a5c15b2c0c65af047984c285c2c30847af".toLowerCase();
|
|
21
|
+
exports.CREDIT_MANAGER_WBTC_V2_ARBITRUM = "0x6546dd4e8d507e3e45bb924818c0bad2a3aa2c5f".toLowerCase();
|
|
22
22
|
exports.deployedContracts = {
|
|
23
23
|
// MAINNET
|
|
24
24
|
"0x777E23A2AcB2fCbB35f6ccF98272d03C722Ba6EB": "DAI",
|
|
@@ -40,11 +40,11 @@ exports.deployedContracts = {
|
|
|
40
40
|
[exports.CREDIT_MANAGER_WBTC_V2_MAINNET]: "WBTC",
|
|
41
41
|
[exports.CREDIT_MANAGER_FRAX_V2_MAINNET]: "FRAX",
|
|
42
42
|
// Arbitrum CM
|
|
43
|
-
[exports.
|
|
44
|
-
[exports.
|
|
45
|
-
[exports.
|
|
46
|
-
[exports.
|
|
47
|
-
[exports.
|
|
43
|
+
[exports.CREDIT_MANAGER_DAI_V2_ARBITRUM]: "DAI",
|
|
44
|
+
[exports.CREDIT_MANAGER_USDC_V2_ARBITRUM]: "USDC",
|
|
45
|
+
[exports.CREDIT_MANAGER_WETH_V2_ARBITRUM]: "WETH",
|
|
46
|
+
[exports.CREDIT_MANAGER_WSTETH_V2_ARBITRUM]: "wstETH",
|
|
47
|
+
[exports.CREDIT_MANAGER_WBTC_V2_ARBITRUM]: "WBTC",
|
|
48
48
|
// Arbitrum pools
|
|
49
49
|
"0xfb422e503f8b768184aba5e73587543d1c871a23": "DAI",
|
|
50
50
|
"0x7c14c88f672d5513c8fa640fa48815f40c781a60": "USDC",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NetworkType } from "../core/chains";
|
|
2
|
+
export declare const ADDRESS_PROVIDER: Record<NetworkType, string>;
|
|
3
|
+
export declare const TIMELOCK: Record<NetworkType, string>;
|
|
4
|
+
export declare const BLACKLIST_HELPER: Record<NetworkType, string>;
|
|
5
|
+
export declare const DEGEN_NFT: Record<NetworkType, string>;
|
|
6
|
+
export declare const CREATE2FACTORY: Record<NetworkType, string>;
|
|
7
|
+
export declare const MULTISIG: Record<NetworkType, string>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MULTISIG = exports.CREATE2FACTORY = exports.DEGEN_NFT = exports.BLACKLIST_HELPER = exports.TIMELOCK = exports.ADDRESS_PROVIDER = void 0;
|
|
4
|
+
const constants_1 = require("../core/constants");
|
|
5
|
+
exports.ADDRESS_PROVIDER = {
|
|
6
|
+
Mainnet: "0xcF64698AFF7E5f27A11dff868AF228653ba53be0",
|
|
7
|
+
Arbitrum: constants_1.NOT_DEPLOYED,
|
|
8
|
+
};
|
|
9
|
+
exports.TIMELOCK = {
|
|
10
|
+
Mainnet: "0xa133C9A92Fb8dDB962Af1cbae58b2723A0bdf23b",
|
|
11
|
+
Arbitrum: constants_1.NOT_DEPLOYED,
|
|
12
|
+
};
|
|
13
|
+
exports.BLACKLIST_HELPER = {
|
|
14
|
+
Mainnet: "0xFfbF344741654a1B9Ab1286Cf05A42f275F67839",
|
|
15
|
+
Arbitrum: constants_1.NOT_DEPLOYED,
|
|
16
|
+
};
|
|
17
|
+
exports.DEGEN_NFT = {
|
|
18
|
+
Mainnet: "0xB829a5b349b01fc71aFE46E50dD6Ec0222A6E599",
|
|
19
|
+
Arbitrum: constants_1.NOT_DEPLOYED,
|
|
20
|
+
};
|
|
21
|
+
exports.CREATE2FACTORY = {
|
|
22
|
+
Mainnet: "0x59b7B8Dd9E6e1F934C9c3Def4a1Eb69Bc17Ec9cc",
|
|
23
|
+
Arbitrum: constants_1.NOT_DEPLOYED,
|
|
24
|
+
};
|
|
25
|
+
exports.MULTISIG = {
|
|
26
|
+
Mainnet: "0xA7D5DDc1b8557914F158076b228AA91eF613f1D5",
|
|
27
|
+
Arbitrum: constants_1.NOT_DEPLOYED,
|
|
28
|
+
};
|
|
@@ -54,7 +54,7 @@ export declare class CreditAccountData {
|
|
|
54
54
|
isForbidden(token: string): boolean;
|
|
55
55
|
updateHealthFactor(creditManager: CreditManagerData, currentCumulativeIndex: bigint, priceOracle: PriceOracleData): void;
|
|
56
56
|
static isTokenEnabled(index: number, enabledTokenMask: bigint): boolean;
|
|
57
|
-
static
|
|
57
|
+
static calcMaxDebtIncrease(healthFactor: number, borrowAmountPlusInterest: bigint, underlyingLT: number, minHf?: number): bigint;
|
|
58
58
|
static calcOverallAPY({ caAssets, lpAPY, prices, totalValue, debt, borrowRate, underlyingToken, }: CalcOverallAPYProps): number | undefined;
|
|
59
59
|
hash(): string;
|
|
60
60
|
static hash(creditManager: string, borrower: string): string;
|
|
@@ -117,13 +117,9 @@ class CreditAccountData {
|
|
|
117
117
|
static isTokenEnabled(index, enabledTokenMask) {
|
|
118
118
|
return ((2n ** BigInt(index)) & enabledTokenMask) !== 0n;
|
|
119
119
|
}
|
|
120
|
-
static
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
maxLeverageFactor)
|
|
124
|
-
: Number(minHf);
|
|
125
|
-
const result = (borrowAmountPlusInterest * BigInt(healthFactor - minHealthFactor)) /
|
|
126
|
-
BigInt(minHealthFactor - underlyingLT);
|
|
120
|
+
static calcMaxDebtIncrease(healthFactor, borrowAmountPlusInterest, underlyingLT, minHf = Number(constants_1.PERCENTAGE_FACTOR)) {
|
|
121
|
+
const result = (borrowAmountPlusInterest * BigInt(healthFactor - minHf)) /
|
|
122
|
+
BigInt(minHf - underlyingLT);
|
|
127
123
|
return result < 0 ? 0n : result;
|
|
128
124
|
}
|
|
129
125
|
static calcOverallAPY({ caAssets, lpAPY, prices, totalValue, debt, borrowRate, underlyingToken, }) {
|
|
@@ -122,16 +122,16 @@ describe("CreditAccount CreditAccountData.calcOverallAPY test", () => {
|
|
|
122
122
|
});
|
|
123
123
|
describe("CreditAccount calcMaxIncreaseBorrow test", () => {
|
|
124
124
|
it("health max increase borrow is zero if hf < 1", () => {
|
|
125
|
-
const result = creditAccount_1.CreditAccountData.
|
|
125
|
+
const result = creditAccount_1.CreditAccountData.calcMaxDebtIncrease(9999, BigInt("156522834253690396032546"), 9300);
|
|
126
126
|
(0, chai_1.expect)(result.toString()).to.be.eq("0");
|
|
127
127
|
});
|
|
128
128
|
it("health max increase borrow is calculated correctly", () => {
|
|
129
|
-
const result = creditAccount_1.CreditAccountData.
|
|
129
|
+
const result = creditAccount_1.CreditAccountData.calcMaxDebtIncrease(10244, BigInt("156522834253690396032546"), 9300);
|
|
130
130
|
(0, chai_1.expect)(result.toString()).to.be.eq("54559387939857795188487");
|
|
131
131
|
});
|
|
132
132
|
it("health max increase borrow is calculated correctly (low hf, high debt)", () => {
|
|
133
133
|
const loweHf = 10244;
|
|
134
|
-
const result = creditAccount_1.CreditAccountData.
|
|
134
|
+
const result = creditAccount_1.CreditAccountData.calcMaxDebtIncrease(loweHf, BigInt("54782991988791638611392"), 9300);
|
|
135
135
|
(0, chai_1.expect)(result.toString()).to.be.eq("19095785778950228315970");
|
|
136
136
|
});
|
|
137
137
|
});
|
|
@@ -43,6 +43,8 @@ export declare class CreditSession {
|
|
|
43
43
|
readonly spotUserFunds: bigint;
|
|
44
44
|
readonly cvxUnclaimedRewards: Array<AssetWithView>;
|
|
45
45
|
readonly balances: Array<AssetWithView>;
|
|
46
|
+
readonly forbiddenTokens: Record<string, true>;
|
|
47
|
+
readonly disabledTokens: Record<string, true>;
|
|
46
48
|
constructor(payload: CreditSessionPayload);
|
|
47
49
|
}
|
|
48
50
|
export declare class CreditSessionFiltered {
|
|
@@ -58,7 +58,9 @@ class CreditSession {
|
|
|
58
58
|
spotTotalValue;
|
|
59
59
|
spotUserFunds;
|
|
60
60
|
cvxUnclaimedRewards;
|
|
61
|
-
balances;
|
|
61
|
+
balances = [];
|
|
62
|
+
forbiddenTokens = {};
|
|
63
|
+
disabledTokens = {};
|
|
62
64
|
constructor(payload) {
|
|
63
65
|
this.id = (payload.id || "").toLowerCase();
|
|
64
66
|
this.status = exports.CREDIT_SESSION_STATUS_BY_ID[payload.status || 0];
|
|
@@ -105,12 +107,19 @@ class CreditSession {
|
|
|
105
107
|
balanceView: balance.f.toString(),
|
|
106
108
|
};
|
|
107
109
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
Object.entries(payload.balances || {}).forEach(([t, b]) => {
|
|
111
|
+
const token = t.toLowerCase();
|
|
112
|
+
if (!b.isEnabled) {
|
|
113
|
+
this.disabledTokens[token] = true;
|
|
114
|
+
}
|
|
115
|
+
if (!b.isAllowed) {
|
|
116
|
+
this.forbiddenTokens[token] = true;
|
|
117
|
+
}
|
|
118
|
+
this.balances.push({
|
|
110
119
|
token: token.toLowerCase(),
|
|
111
|
-
balance: (0, formatter_1.toBigInt)(
|
|
112
|
-
balanceView:
|
|
113
|
-
};
|
|
120
|
+
balance: (0, formatter_1.toBigInt)(b.BI || 0),
|
|
121
|
+
balanceView: b.F.toString(),
|
|
122
|
+
});
|
|
114
123
|
});
|
|
115
124
|
}
|
|
116
125
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export * from "./utils/validate";
|
|
|
33
33
|
export * from "./apy";
|
|
34
34
|
export { AdapterInterface } from "./contracts/adapters";
|
|
35
35
|
export * from "./contracts/contractsRegister";
|
|
36
|
+
export * from "./contracts/utilsContracts";
|
|
36
37
|
export * from "./parsers/txParser";
|
|
37
38
|
export * from "./pathfinder/core";
|
|
38
39
|
export * from "./pathfinder/pathfinder";
|
package/lib/index.js
CHANGED
|
@@ -52,6 +52,7 @@ __exportStar(require("./apy"), exports);
|
|
|
52
52
|
var adapters_1 = require("./contracts/adapters");
|
|
53
53
|
Object.defineProperty(exports, "AdapterInterface", { enumerable: true, get: function () { return adapters_1.AdapterInterface; } });
|
|
54
54
|
__exportStar(require("./contracts/contractsRegister"), exports);
|
|
55
|
+
__exportStar(require("./contracts/utilsContracts"), exports);
|
|
55
56
|
__exportStar(require("./parsers/txParser"), exports);
|
|
56
57
|
__exportStar(require("./pathfinder/core"), exports);
|
|
57
58
|
__exportStar(require("./pathfinder/pathfinder"), exports);
|
|
@@ -9,116 +9,116 @@ exports.priceFeedsByNetwork = {
|
|
|
9
9
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
10
10
|
address: {
|
|
11
11
|
Mainnet: "0xc929ad75B72593967DE83E7F7Cda0493458261D9",
|
|
12
|
-
Arbitrum: "
|
|
12
|
+
Arbitrum: "0x4bc735ef24bf286983024cad5d03f0738865aaef",
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
AAVE: {
|
|
16
16
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
17
17
|
address: {
|
|
18
18
|
Mainnet: "0x547a514d5e3769680Ce22B2361c10Ea13619e8a9",
|
|
19
|
-
Arbitrum: "
|
|
19
|
+
Arbitrum: "0xad1d5344aade45f43e596773bcc4c423eabdd034",
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
COMP: {
|
|
23
23
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
24
24
|
address: {
|
|
25
25
|
Mainnet: "0xdbd020CAeF83eFd542f4De03e3cF0C28A4428bd5",
|
|
26
|
-
Arbitrum: "
|
|
26
|
+
Arbitrum: "0xe7c53ffd03eb6cef7d208bc4c13446c76d1e5884",
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
CRV: {
|
|
30
30
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
31
31
|
address: {
|
|
32
32
|
Mainnet: "0xCd627aA160A6fA45Eb793D19Ef54f5062F20f33f",
|
|
33
|
-
Arbitrum: "
|
|
33
|
+
Arbitrum: "0xaebda2c976cfd1ee1977eac079b4382acb849325",
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
DAI: {
|
|
37
37
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
38
38
|
address: {
|
|
39
39
|
Mainnet: "0xAed0c38402a5d19df6E4c03F4E2DceD6e29c1ee9",
|
|
40
|
-
Arbitrum: "
|
|
40
|
+
Arbitrum: "0xc5c8e77b397e531b8ec06bfb0048328b30e9ecfb",
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
DPI: {
|
|
44
44
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
45
45
|
address: {
|
|
46
46
|
Mainnet: "0xD2A593BF7594aCE1faD597adb697b5645d5edDB2",
|
|
47
|
-
Arbitrum:
|
|
47
|
+
Arbitrum: constants_1.NOT_DEPLOYED,
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
FEI: {
|
|
51
51
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
52
52
|
address: {
|
|
53
53
|
Mainnet: "0x31e0a88fecB6eC0a411DBe0e9E76391498296EE9",
|
|
54
|
-
Arbitrum:
|
|
54
|
+
Arbitrum: constants_1.NOT_DEPLOYED,
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
GUSD: {
|
|
58
58
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
59
59
|
address: {
|
|
60
60
|
Mainnet: "0xa89f5d2365ce98B3cD68012b6f503ab1416245Fc",
|
|
61
|
-
Arbitrum:
|
|
61
|
+
Arbitrum: constants_1.NOT_DEPLOYED,
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
LINK: {
|
|
65
65
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
66
66
|
address: {
|
|
67
67
|
Mainnet: "0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c",
|
|
68
|
-
Arbitrum: "
|
|
68
|
+
Arbitrum: "0x86e53cf1b870786351da77a57575e79cb55812cb",
|
|
69
69
|
},
|
|
70
70
|
},
|
|
71
71
|
SNX: {
|
|
72
72
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
73
73
|
address: {
|
|
74
74
|
Mainnet: "0xDC3EA94CD0AC27d9A86C180091e7f78C683d3699",
|
|
75
|
-
Arbitrum: "
|
|
75
|
+
Arbitrum: "0x054296f0d036b95531b4e14afb578b80cfb41252",
|
|
76
76
|
},
|
|
77
77
|
},
|
|
78
78
|
UNI: {
|
|
79
79
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
80
80
|
address: {
|
|
81
81
|
Mainnet: "0x553303d460EE0afB37EdFf9bE42922D8FF63220e",
|
|
82
|
-
Arbitrum: "
|
|
82
|
+
Arbitrum: "0x9c917083fdb403ab5adbec26ee294f6ecada2720",
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
USDC: {
|
|
86
86
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
87
87
|
address: {
|
|
88
88
|
Mainnet: "0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6",
|
|
89
|
-
Arbitrum: "
|
|
89
|
+
Arbitrum: "0x50834f3163758fcc1df9973b6e91f0f0f0434ad3",
|
|
90
90
|
},
|
|
91
91
|
},
|
|
92
92
|
USDT: {
|
|
93
93
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
94
94
|
address: {
|
|
95
95
|
Mainnet: "0x3E7d1eAB13ad0104d2750B8863b489D65364e32D",
|
|
96
|
-
Arbitrum: "
|
|
96
|
+
Arbitrum: "0x3f3f5df88dc9f13eac63df89ec16ef6e7e25dde7",
|
|
97
97
|
},
|
|
98
98
|
},
|
|
99
99
|
WBTC: {
|
|
100
100
|
type: oracles_1.OracleType.COMPOSITE_ORACLE,
|
|
101
101
|
targetToBasePriceFeed: {
|
|
102
102
|
Mainnet: "0xfdFD9C85aD200c506Cf9e21F1FD8dd01932FBB23",
|
|
103
|
-
Arbitrum: "",
|
|
103
|
+
Arbitrum: "0x0017abac5b6f291f9164e35b1234ca1d697f9cf4",
|
|
104
104
|
},
|
|
105
105
|
baseToUsdPriceFeed: {
|
|
106
106
|
Mainnet: "0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c",
|
|
107
|
-
Arbitrum: "
|
|
107
|
+
Arbitrum: "0x6ce185860a4963106506c203335a2910413708e9",
|
|
108
108
|
},
|
|
109
109
|
},
|
|
110
110
|
WETH: {
|
|
111
111
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
112
112
|
address: {
|
|
113
113
|
Mainnet: "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419",
|
|
114
|
-
Arbitrum: "
|
|
114
|
+
Arbitrum: "0x639fe6ab55c921f74e7fac1ee960c0b6293ba612",
|
|
115
115
|
},
|
|
116
116
|
},
|
|
117
117
|
YFI: {
|
|
118
118
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
119
119
|
address: {
|
|
120
120
|
Mainnet: "0xA027702dbb89fbd58938e4324ac03B58d812b0E1",
|
|
121
|
-
Arbitrum: "
|
|
121
|
+
Arbitrum: "0x745ab5b69e01e2be1104ca84937bb71f96f5fb21",
|
|
122
122
|
},
|
|
123
123
|
},
|
|
124
124
|
/// UPDATE
|
|
@@ -126,11 +126,11 @@ exports.priceFeedsByNetwork = {
|
|
|
126
126
|
type: oracles_1.OracleType.COMPOSITE_ORACLE,
|
|
127
127
|
targetToBasePriceFeed: {
|
|
128
128
|
Mainnet: "0x86392dC19c0b719886221c78AB11eb8Cf5c52812",
|
|
129
|
-
Arbitrum: "
|
|
129
|
+
Arbitrum: "0xded2c52b75b24732e9107377b7ba93ec1ffa4baf",
|
|
130
130
|
},
|
|
131
131
|
baseToUsdPriceFeed: {
|
|
132
132
|
Mainnet: "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419",
|
|
133
|
-
Arbitrum: "
|
|
133
|
+
Arbitrum: "0x639fe6ab55c921f74e7fac1ee960c0b6293ba612",
|
|
134
134
|
},
|
|
135
135
|
},
|
|
136
136
|
wstETH: {
|
|
@@ -141,21 +141,21 @@ exports.priceFeedsByNetwork = {
|
|
|
141
141
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
142
142
|
address: {
|
|
143
143
|
Mainnet: "0xd962fC30A72A84cE50161031391756Bf2876Af5D",
|
|
144
|
-
Arbitrum: "
|
|
144
|
+
Arbitrum: "0x851175a919f36c8e30197c09a9a49da932c2cc00",
|
|
145
145
|
},
|
|
146
146
|
},
|
|
147
147
|
FRAX: {
|
|
148
148
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
149
149
|
address: {
|
|
150
150
|
Mainnet: "0xB9E1E3A9feFf48998E45Fa90847ed4D467E8BcfD",
|
|
151
|
-
Arbitrum: "
|
|
151
|
+
Arbitrum: "0x0809e3d38d1b4214958faf06d8b1b1a2b73f2ab8",
|
|
152
152
|
},
|
|
153
153
|
},
|
|
154
154
|
LUSD: {
|
|
155
155
|
type: oracles_1.OracleType.BOUNDED_ORACLE,
|
|
156
156
|
targetPriceFeed: {
|
|
157
157
|
Mainnet: "0x3D7aE7E594f2f2091Ad8798313450130d0Aba3a0",
|
|
158
|
-
Arbitrum: "
|
|
158
|
+
Arbitrum: "0x0411d28c94d85a36bc72cb0f875dfa8371d8ffff",
|
|
159
159
|
},
|
|
160
160
|
upperBound: (BigInt(1e8) * 11n) / 10n,
|
|
161
161
|
},
|
|
@@ -163,25 +163,25 @@ exports.priceFeedsByNetwork = {
|
|
|
163
163
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
164
164
|
address: {
|
|
165
165
|
Mainnet: "0xad35Bd71b9aFE6e4bDc266B345c198eaDEf9Ad94",
|
|
166
|
-
Arbitrum:
|
|
166
|
+
Arbitrum: constants_1.NOT_DEPLOYED,
|
|
167
167
|
},
|
|
168
168
|
},
|
|
169
169
|
FXS: {
|
|
170
170
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
171
171
|
address: {
|
|
172
172
|
Mainnet: "0x6Ebc52C8C1089be9eB3945C4350B68B8E4C2233f",
|
|
173
|
-
Arbitrum: "
|
|
173
|
+
Arbitrum: "0x36a121448d74fa81450c992a1a44b9b7377cd3a5",
|
|
174
174
|
},
|
|
175
175
|
},
|
|
176
176
|
LDO: {
|
|
177
177
|
type: oracles_1.OracleType.COMPOSITE_ORACLE,
|
|
178
178
|
targetToBasePriceFeed: {
|
|
179
179
|
Mainnet: "0x4e844125952D32AcdF339BE976c98E22F6F318dB",
|
|
180
|
-
Arbitrum:
|
|
180
|
+
Arbitrum: constants_1.NOT_DEPLOYED,
|
|
181
181
|
},
|
|
182
182
|
baseToUsdPriceFeed: {
|
|
183
183
|
Mainnet: "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419",
|
|
184
|
-
Arbitrum: "
|
|
184
|
+
Arbitrum: "0x639fe6ab55c921f74e7fac1ee960c0b6293ba612",
|
|
185
185
|
},
|
|
186
186
|
// ADD ETH-> DAI Oracle!
|
|
187
187
|
},
|
|
@@ -196,7 +196,7 @@ exports.priceFeedsByNetwork = {
|
|
|
196
196
|
},
|
|
197
197
|
baseToUsdPriceFeed: {
|
|
198
198
|
Mainnet: "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419",
|
|
199
|
-
Arbitrum: "
|
|
199
|
+
Arbitrum: "0x639fe6ab55c921f74e7fac1ee960c0b6293ba612",
|
|
200
200
|
},
|
|
201
201
|
},
|
|
202
202
|
MIM: {
|
|
@@ -210,7 +210,35 @@ exports.priceFeedsByNetwork = {
|
|
|
210
210
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
211
211
|
address: {
|
|
212
212
|
Mainnet: "0x8c110B94C5f1d347fAcF5E1E938AB2db60E3c9a8",
|
|
213
|
-
Arbitrum:
|
|
213
|
+
Arbitrum: "0x383b3624478124697bef675f07ca37570b73992f",
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
GMX: {
|
|
217
|
+
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
218
|
+
address: {
|
|
219
|
+
Mainnet: constants_1.NOT_DEPLOYED,
|
|
220
|
+
Arbitrum: "0xdb98056fecfff59d032ab628337a4887110df3db",
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
ARB: {
|
|
224
|
+
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
225
|
+
address: {
|
|
226
|
+
Mainnet: constants_1.NOT_DEPLOYED,
|
|
227
|
+
Arbitrum: "0xb2a824043730fe05f3da2efafa1cbbe83fa548d6",
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
RDNT: {
|
|
231
|
+
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
232
|
+
address: {
|
|
233
|
+
Mainnet: constants_1.NOT_DEPLOYED,
|
|
234
|
+
Arbitrum: "0x20d0fcab0ecfd078b036b6caf1fac69a6453b352",
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
BAL: {
|
|
238
|
+
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
239
|
+
address: {
|
|
240
|
+
Mainnet: "0xdf2917806e30300537aeb49a7663062f4d1f2b5f",
|
|
241
|
+
Arbitrum: "0xbe5ea816870d11239c543f84b71439511d70b94f",
|
|
214
242
|
},
|
|
215
243
|
},
|
|
216
244
|
yvDAI: {
|
package/lib/tokens/decimals.js
CHANGED
package/lib/tokens/normal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TradeAction } from "../pathfinder/tradeTypes";
|
|
2
2
|
import type { TokenBase } from "./token";
|
|
3
3
|
import { TokenType } from "./tokenType";
|
|
4
|
-
export type NormalToken = "1INCH" | "AAVE" | "COMP" | "CRV" | "DPI" | "FEI" | "LINK" | "SNX" | "UNI" | "USDT" | "USDC" | "DAI" | "WETH" | "WBTC" | "YFI" | "STETH" | "wstETH" | "CVX" | "FRAX" | "FXS" | "LDO" | "LUSD" | "sUSD" | "GUSD" | "LQTY" | "OHM" | "MIM" | "SPELL";
|
|
4
|
+
export type NormalToken = "1INCH" | "AAVE" | "COMP" | "CRV" | "DPI" | "FEI" | "LINK" | "SNX" | "UNI" | "USDT" | "USDC" | "DAI" | "WETH" | "WBTC" | "YFI" | "STETH" | "wstETH" | "CVX" | "FRAX" | "FXS" | "LDO" | "LUSD" | "sUSD" | "GUSD" | "LQTY" | "OHM" | "MIM" | "SPELL" | "GMX" | "ARB" | "RDNT" | "BAL";
|
|
5
5
|
export type NormalTokenData = {
|
|
6
6
|
symbol: NormalToken;
|
|
7
7
|
type: TokenType.NORMAL_TOKEN;
|
package/lib/tokens/normal.js
CHANGED
|
@@ -727,6 +727,86 @@ exports.normalTokens = {
|
|
|
727
727
|
],
|
|
728
728
|
lpActions: [],
|
|
729
729
|
},
|
|
730
|
+
GMX: {
|
|
731
|
+
name: "GMX",
|
|
732
|
+
symbol: "GMX",
|
|
733
|
+
type: tokenType_1.TokenType.NORMAL_TOKEN,
|
|
734
|
+
swapActions: [
|
|
735
|
+
{
|
|
736
|
+
type: tradeTypes_1.TradeType.UniswapV3Swap,
|
|
737
|
+
contract: "UNISWAP_V3_ROUTER",
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
type: tradeTypes_1.TradeType.UniswapV2Swap,
|
|
741
|
+
contract: "UNISWAP_V2_ROUTER",
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
type: tradeTypes_1.TradeType.UniswapV2Swap,
|
|
745
|
+
contract: "SUSHISWAP_ROUTER",
|
|
746
|
+
},
|
|
747
|
+
],
|
|
748
|
+
lpActions: [],
|
|
749
|
+
},
|
|
750
|
+
ARB: {
|
|
751
|
+
name: "ARB",
|
|
752
|
+
symbol: "ARB",
|
|
753
|
+
type: tokenType_1.TokenType.NORMAL_TOKEN,
|
|
754
|
+
swapActions: [
|
|
755
|
+
{
|
|
756
|
+
type: tradeTypes_1.TradeType.UniswapV3Swap,
|
|
757
|
+
contract: "UNISWAP_V3_ROUTER",
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
type: tradeTypes_1.TradeType.UniswapV2Swap,
|
|
761
|
+
contract: "UNISWAP_V2_ROUTER",
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
type: tradeTypes_1.TradeType.UniswapV2Swap,
|
|
765
|
+
contract: "SUSHISWAP_ROUTER",
|
|
766
|
+
},
|
|
767
|
+
],
|
|
768
|
+
lpActions: [],
|
|
769
|
+
},
|
|
770
|
+
RDNT: {
|
|
771
|
+
name: "RDNT",
|
|
772
|
+
symbol: "RDNT",
|
|
773
|
+
type: tokenType_1.TokenType.NORMAL_TOKEN,
|
|
774
|
+
swapActions: [
|
|
775
|
+
{
|
|
776
|
+
type: tradeTypes_1.TradeType.UniswapV3Swap,
|
|
777
|
+
contract: "UNISWAP_V3_ROUTER",
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
type: tradeTypes_1.TradeType.UniswapV2Swap,
|
|
781
|
+
contract: "UNISWAP_V2_ROUTER",
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
type: tradeTypes_1.TradeType.UniswapV2Swap,
|
|
785
|
+
contract: "SUSHISWAP_ROUTER",
|
|
786
|
+
},
|
|
787
|
+
],
|
|
788
|
+
lpActions: [],
|
|
789
|
+
},
|
|
790
|
+
BAL: {
|
|
791
|
+
name: "BAL",
|
|
792
|
+
symbol: "BAL",
|
|
793
|
+
type: tokenType_1.TokenType.NORMAL_TOKEN,
|
|
794
|
+
swapActions: [
|
|
795
|
+
{
|
|
796
|
+
type: tradeTypes_1.TradeType.UniswapV3Swap,
|
|
797
|
+
contract: "UNISWAP_V3_ROUTER",
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
type: tradeTypes_1.TradeType.UniswapV2Swap,
|
|
801
|
+
contract: "UNISWAP_V2_ROUTER",
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
type: tradeTypes_1.TradeType.UniswapV2Swap,
|
|
805
|
+
contract: "SUSHISWAP_ROUTER",
|
|
806
|
+
},
|
|
807
|
+
],
|
|
808
|
+
lpActions: [],
|
|
809
|
+
},
|
|
730
810
|
};
|
|
731
811
|
const isNormalToken = (t) => typeof t === "string" && !!exports.normalTokens[t];
|
|
732
812
|
exports.isNormalToken = isNormalToken;
|
package/lib/tokens/token.js
CHANGED
|
@@ -43,6 +43,10 @@ exports.tokenDataByNetwork = {
|
|
|
43
43
|
OHM: "0x64aa3364F17a4D01c6f1751Fd97C2BD3D7e7f1D5",
|
|
44
44
|
MIM: "0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3",
|
|
45
45
|
SPELL: "0x090185f2135308BaD17527004364eBcC2D37e5F6",
|
|
46
|
+
GMX: constants_1.NOT_DEPLOYED,
|
|
47
|
+
ARB: constants_1.NOT_DEPLOYED,
|
|
48
|
+
RDNT: constants_1.NOT_DEPLOYED,
|
|
49
|
+
BAL: "0xba100000625a3754423978a60c9317c58a424e3D",
|
|
46
50
|
/// UPDATE
|
|
47
51
|
STETH: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
|
|
48
52
|
wstETH: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
|
|
@@ -123,34 +127,38 @@ exports.tokenDataByNetwork = {
|
|
|
123
127
|
///
|
|
124
128
|
Arbitrum: {
|
|
125
129
|
"1INCH": constants_1.NOT_DEPLOYED,
|
|
126
|
-
AAVE:
|
|
127
|
-
COMP:
|
|
128
|
-
CRV:
|
|
129
|
-
DAI:
|
|
130
|
+
AAVE: "0xba5DdD1f9d7F570dc94a51479a000E3BCE967196",
|
|
131
|
+
COMP: "0x354A6dA3fcde098F8389cad84b0182725c6C91dE",
|
|
132
|
+
CRV: "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978",
|
|
133
|
+
DAI: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
|
|
130
134
|
DPI: constants_1.NOT_DEPLOYED,
|
|
131
135
|
FEI: constants_1.NOT_DEPLOYED,
|
|
132
|
-
LINK:
|
|
133
|
-
SNX:
|
|
134
|
-
UNI:
|
|
135
|
-
USDT:
|
|
136
|
-
USDC:
|
|
137
|
-
WBTC:
|
|
138
|
-
WETH:
|
|
139
|
-
YFI:
|
|
140
|
-
OHM:
|
|
141
|
-
MIM:
|
|
142
|
-
SPELL:
|
|
136
|
+
LINK: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4",
|
|
137
|
+
SNX: "0xcBA56Cd8216FCBBF3fA6DF6137F3147cBcA37D60",
|
|
138
|
+
UNI: "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0",
|
|
139
|
+
USDT: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
|
|
140
|
+
USDC: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
141
|
+
WBTC: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
142
|
+
WETH: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
143
|
+
YFI: "0x82e3A8F066a6989666b031d916c43672085b1582",
|
|
144
|
+
OHM: "0x6E6a3D8F1AfFAc703B1aEF1F43B8D2321bE40043",
|
|
145
|
+
MIM: "0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A",
|
|
146
|
+
SPELL: "0x3E6648C5a70A150A88bCE65F4aD4d506Fe15d2AF",
|
|
147
|
+
GMX: "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a",
|
|
148
|
+
ARB: "0x912CE59144191C1204E64559FE8253a0e49E6548",
|
|
149
|
+
RDNT: "0x3082CC23568eA640225c2467653dB90e9250AaA0",
|
|
150
|
+
BAL: "0x040d1EdC9569d4Bab2D15287Dc5A4F10F56a56B8",
|
|
143
151
|
/// UPDATE
|
|
144
152
|
STETH: constants_1.NOT_DEPLOYED,
|
|
145
|
-
wstETH:
|
|
146
|
-
CVX:
|
|
147
|
-
FRAX:
|
|
148
|
-
FXS:
|
|
149
|
-
LDO:
|
|
150
|
-
LUSD:
|
|
151
|
-
sUSD:
|
|
153
|
+
wstETH: "0x5979D7b546E38E414F7E9822514be443A4800529",
|
|
154
|
+
CVX: "0xb952A807345991BD529FDded05009F5e80Fe8F45",
|
|
155
|
+
FRAX: "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F",
|
|
156
|
+
FXS: "0x9d2F299715D94d8A7E6F5eaa8E654E8c74a988A7s",
|
|
157
|
+
LDO: "0x13Ad51ed4F1B7e9Dc168d8a00cB3f4dDD85EfA60",
|
|
158
|
+
LUSD: "0x93b346b6BC2548dA6A1E7d98E9a421B42541425b",
|
|
159
|
+
sUSD: "0xA970AF1a584579B618be4d69aD6F73459D112F95",
|
|
152
160
|
GUSD: constants_1.NOT_DEPLOYED,
|
|
153
|
-
LQTY:
|
|
161
|
+
LQTY: "0xfb9E5D956D889D91a82737B9bFCDaC1DCE3e1449",
|
|
154
162
|
// YEARN TOKENS
|
|
155
163
|
yvDAI: constants_1.NOT_DEPLOYED,
|
|
156
164
|
yvUSDC: constants_1.NOT_DEPLOYED,
|
|
@@ -160,17 +168,17 @@ exports.tokenDataByNetwork = {
|
|
|
160
168
|
yvCurve_FRAX: constants_1.NOT_DEPLOYED,
|
|
161
169
|
// CURVE LP TOKENS
|
|
162
170
|
"3Crv": constants_1.NOT_DEPLOYED,
|
|
163
|
-
crvFRAX:
|
|
164
|
-
steCRV:
|
|
165
|
-
crvPlain3andSUSD: constants_1.NOT_DEPLOYED,
|
|
166
|
-
gusd3CRV: constants_1.NOT_DEPLOYED,
|
|
171
|
+
crvFRAX: "0xc9b8a3fdecb9d5b218d02555a8baf332e5b740d5",
|
|
172
|
+
steCRV: "0x06325440d014e39736583c165c2963ba99faf14e",
|
|
167
173
|
FRAX3CRV: constants_1.NOT_DEPLOYED,
|
|
168
174
|
LUSD3CRV: constants_1.NOT_DEPLOYED,
|
|
175
|
+
crvPlain3andSUSD: constants_1.NOT_DEPLOYED,
|
|
176
|
+
gusd3CRV: constants_1.NOT_DEPLOYED,
|
|
169
177
|
OHMFRAXBP: constants_1.NOT_DEPLOYED,
|
|
170
178
|
MIM_3LP3CRV: constants_1.NOT_DEPLOYED,
|
|
171
179
|
crvCRVETH: constants_1.NOT_DEPLOYED,
|
|
172
180
|
crvCVXETH: constants_1.NOT_DEPLOYED,
|
|
173
|
-
crvUSDTWBTCWETH:
|
|
181
|
+
crvUSDTWBTCWETH: "0x8e0b8c8bb9db49a46697f3a5bb8a308e744821d2",
|
|
174
182
|
LDOETH: constants_1.NOT_DEPLOYED,
|
|
175
183
|
// CONVEX LP TOKENS
|
|
176
184
|
cvx3Crv: constants_1.NOT_DEPLOYED,
|
|
@@ -202,7 +210,7 @@ exports.tokenDataByNetwork = {
|
|
|
202
210
|
stkcvxLDOETH: constants_1.NOT_DEPLOYED,
|
|
203
211
|
// BALANCER TOKENS
|
|
204
212
|
"50OHM_50DAI": constants_1.NOT_DEPLOYED,
|
|
205
|
-
"50OHM_50WETH":
|
|
213
|
+
"50OHM_50WETH": "0x89dc7e71e362faf88d92288fe2311d25c6a1b5e0",
|
|
206
214
|
OHM_wstETH: constants_1.NOT_DEPLOYED,
|
|
207
215
|
// GEARBOX
|
|
208
216
|
dDAI: constants_1.NOT_DEPLOYED,
|