@strkfarm/sdk 1.0.37 → 1.0.39
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/dist/cli.js +38 -588
- package/dist/cli.mjs +37 -587
- package/dist/index.browser.global.js +962 -329
- package/dist/index.browser.mjs +962 -325
- package/dist/index.d.ts +28 -54
- package/dist/index.js +985 -322
- package/dist/index.mjs +990 -323
- package/package.json +3 -3
- package/src/dataTypes/_bignumber.ts +49 -47
- package/src/global.ts +1 -33
- package/src/interfaces/common.ts +112 -98
- package/src/interfaces/lending.ts +1 -2
- package/src/modules/avnu.ts +1 -1
- package/src/modules/erc20.ts +6 -0
- package/src/modules/harvests.ts +1 -1
- package/src/modules/pragma.ts +1 -1
- package/src/modules/pricer-from-api.ts +3 -3
- package/src/modules/pricer.ts +2 -1
- package/src/modules/zkLend.ts +2 -1
- package/src/node/pricer-redis.ts +2 -1
- package/src/notifs/telegram.ts +1 -1
- package/src/strategies/ekubo-cl-vault.tsx +1503 -920
- package/src/strategies/vesu-rebalance.tsx +943 -611
- package/src/utils/index.ts +2 -0
- package/src/utils/logger.browser.ts +20 -0
- package/src/utils/logger.node.ts +35 -0
- package/src/utils/logger.ts +1 -0
- package/src/utils/store.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strkfarm/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"description": "STRKFarm TS SDK (Meant for our internal use, but feel free to use it)",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"typescript": "^5.5.3"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"react": "19.1.0"
|
|
54
|
+
"react": "19.1.0",
|
|
55
|
+
"starknet": "^6.11.0"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
57
58
|
"@avnu/avnu-sdk": "^3.0.2",
|
|
@@ -67,7 +68,6 @@
|
|
|
67
68
|
"proxy-from-env": "^1.1.0",
|
|
68
69
|
"redis": "^4.7.0",
|
|
69
70
|
"stacktrace-js": "^2.0.2",
|
|
70
|
-
"starknet": "^6.11.0",
|
|
71
71
|
"winston": "^3.13.0"
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -1,65 +1,67 @@
|
|
|
1
|
-
import { logger } from "@/
|
|
1
|
+
import { logger } from "@/utils/logger";
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
3
|
|
|
4
4
|
export class _Web3Number<T extends _Web3Number<T>> extends BigNumber {
|
|
5
|
-
|
|
5
|
+
decimals: number;
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
constructor(value: string | number, decimals: number) {
|
|
8
|
+
super(value);
|
|
9
|
+
this.decimals = decimals;
|
|
10
|
+
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
toWei() {
|
|
13
|
+
return this.mul(10 ** this.decimals).toFixed(0);
|
|
14
|
+
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
multipliedBy(value: string | number | T): T {
|
|
17
|
+
const _value = this.getStandardString(value);
|
|
18
|
+
return this.construct(this.mul(_value).toString(), this.decimals);
|
|
19
|
+
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
dividedBy(value: string | number | T): T {
|
|
22
|
+
const _value = this.getStandardString(value);
|
|
23
|
+
return this.construct(this.div(_value).toString(), this.decimals);
|
|
24
|
+
}
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
plus(value: string | number | T): T {
|
|
27
|
+
const _value = this.getStandardString(value);
|
|
28
|
+
return this.construct(this.add(_value).toString(), this.decimals);
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
minus(n: number | string | T, base?: number): T {
|
|
32
|
+
const _value = this.getStandardString(n);
|
|
33
|
+
return this.construct(super.minus(_value, base).toString(), this.decimals);
|
|
34
|
+
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
protected construct(value: string | number, decimals: number): T {
|
|
37
|
+
return new (this.constructor as {
|
|
38
|
+
new (value: string | number, decimals: number): T;
|
|
39
|
+
})(value, decimals);
|
|
40
|
+
}
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
toString(): string {
|
|
43
|
+
return super.toString();
|
|
44
|
+
}
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
toJSON() {
|
|
47
|
+
return this.toString();
|
|
48
|
+
}
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
valueOf() {
|
|
51
|
+
return this.toString();
|
|
52
|
+
}
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
private maxToFixedDecimals() {
|
|
55
|
+
return Math.min(this.decimals, 18);
|
|
56
|
+
}
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
return value.toFixed(this.maxToFixedDecimals())
|
|
58
|
+
private getStandardString(value: string | number | T): string {
|
|
59
|
+
if (typeof value == "string") {
|
|
60
|
+
return value;
|
|
61
61
|
}
|
|
62
|
+
return value.toFixed(this.maxToFixedDecimals());
|
|
63
|
+
}
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
BigNumber.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: BigNumber.ROUND_DOWN })
|
|
65
|
-
_Web3Number.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: BigNumber.ROUND_DOWN })
|
|
66
|
+
BigNumber.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: BigNumber.ROUND_DOWN });
|
|
67
|
+
_Web3Number.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: BigNumber.ROUND_DOWN });
|
package/src/global.ts
CHANGED
|
@@ -1,39 +1,7 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { TokenInfo } from './interfaces';
|
|
3
3
|
import { ContractAddr } from './dataTypes';
|
|
4
|
-
|
|
5
|
-
const colors = {
|
|
6
|
-
error: 'red',
|
|
7
|
-
warn: 'yellow',
|
|
8
|
-
info: 'blue',
|
|
9
|
-
verbose: 'white',
|
|
10
|
-
debug: 'white',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Add custom colors to Winston
|
|
14
|
-
// winston.addColors(colors);
|
|
15
|
-
|
|
16
|
-
// export const logger = createLogger({
|
|
17
|
-
// level: 'verbose', // Set the minimum logging level
|
|
18
|
-
// format: format.combine(
|
|
19
|
-
// format.colorize({ all: true }), // Apply custom colors
|
|
20
|
-
// format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), // Add timestamp to log messages
|
|
21
|
-
// format.printf(({ timestamp, level, message }) => {
|
|
22
|
-
// return `${timestamp} ${level}: ${message}`;
|
|
23
|
-
// })
|
|
24
|
-
// ),
|
|
25
|
-
// transports: [
|
|
26
|
-
// // new transports.Console() // Output logs to the console
|
|
27
|
-
// ]
|
|
28
|
-
// });
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export const logger = {
|
|
32
|
-
...console,
|
|
33
|
-
verbose(message: string) {
|
|
34
|
-
console.log(`[VERBOSE] ${message}`);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
4
|
+
import { logger } from '@/utils/logger';
|
|
37
5
|
|
|
38
6
|
|
|
39
7
|
export class FatalError extends Error {
|
package/src/interfaces/common.ts
CHANGED
|
@@ -1,60 +1,65 @@
|
|
|
1
|
-
import { ContractAddr, Web3Number } from "@/dataTypes"
|
|
2
|
-
import { BlockIdentifier, RpcProvider } from "starknet"
|
|
3
|
-
import React from
|
|
1
|
+
import { ContractAddr, Web3Number } from "@/dataTypes";
|
|
2
|
+
import { BlockIdentifier, RpcProvider } from "starknet";
|
|
3
|
+
import React from "react";
|
|
4
4
|
|
|
5
5
|
export enum RiskType {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
MARKET_RISK = "Market Risk",
|
|
7
|
+
// if non-correalted pairs, this is 3 (STRK/USDC)
|
|
8
|
+
// if highly correalted pairs, this is 1 (e.g. xSTRK/STRK)
|
|
9
|
+
// if correalted pairs, this is 2 (e.g. BTC/SOL)
|
|
10
|
+
// If there is added leverage on top, can go till 5
|
|
11
|
+
IMPERMANENT_LOSS = "Impermanent Loss Risk",
|
|
12
|
+
LIQUIDATION_RISK = "Liquidation Risk",
|
|
13
|
+
LOW_LIQUIDITY_RISK = "Low Liquidity Risk",
|
|
14
|
+
SMART_CONTRACT_RISK = "Smart Contract Risk",
|
|
15
|
+
ORACLE_RISK = "Oracle Risk",
|
|
16
|
+
TECHNICAL_RISK = "Technical Risk",
|
|
17
|
+
COUNTERPARTY_RISK = "Counterparty Risk" // e.g. bad debt
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface RiskFactor {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
type: RiskType;
|
|
22
|
+
value: number; // 0 to 5
|
|
23
|
+
weight: number; // 0 to 100
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface TokenInfo {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
name: string;
|
|
28
|
+
symbol: string;
|
|
29
|
+
address: ContractAddr;
|
|
30
|
+
decimals: number;
|
|
31
|
+
logo: string;
|
|
32
|
+
coingeckId?: string;
|
|
33
|
+
displayDecimals: number;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export enum Network {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
mainnet = "mainnet",
|
|
38
|
+
sepolia = "sepolia",
|
|
39
|
+
devnet = "devnet"
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export interface IConfig {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
provider: RpcProvider;
|
|
44
|
+
network: Network;
|
|
45
|
+
stage: "production" | "staging";
|
|
46
|
+
heartbeatUrl?: string;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export interface IProtocol {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
name: string;
|
|
51
|
+
logo: string;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export enum FlowChartColors {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
Green = "purple",
|
|
56
|
+
Blue = "#35484f",
|
|
57
|
+
Purple = "#6e53dc"
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface FAQ {
|
|
61
|
+
question: string | React.ReactNode;
|
|
62
|
+
answer: string | React.ReactNode;
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
/**
|
|
@@ -62,78 +67,87 @@ export enum FlowChartColors {
|
|
|
62
67
|
* @property risk.riskFactor.factor - The value of the risk factor from 0 to 10, 0 being the lowest and 10 being the highest.
|
|
63
68
|
*/
|
|
64
69
|
export interface IStrategyMetadata<T> {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
name: string;
|
|
71
|
+
description: string | React.ReactNode;
|
|
72
|
+
address: ContractAddr;
|
|
73
|
+
launchBlock: number;
|
|
74
|
+
type: "ERC4626" | "ERC721" | "Other";
|
|
75
|
+
depositTokens: TokenInfo[];
|
|
76
|
+
protocols: IProtocol[];
|
|
77
|
+
auditUrl?: string;
|
|
78
|
+
maxTVL: Web3Number;
|
|
79
|
+
risk: {
|
|
80
|
+
riskFactor: RiskFactor[];
|
|
81
|
+
netRisk: number;
|
|
82
|
+
notARisks: string[];
|
|
83
|
+
};
|
|
84
|
+
apyMethodology?: string;
|
|
85
|
+
additionalInfo: T;
|
|
86
|
+
faqs: FAQ[];
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
export interface IInvestmentFlow {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
id?: string; // used to link flows
|
|
91
|
+
title: string;
|
|
92
|
+
subItems: { key: string; value: string }[];
|
|
93
|
+
linkedFlows: IInvestmentFlow[];
|
|
94
|
+
style?: any;
|
|
88
95
|
}
|
|
89
96
|
|
|
90
|
-
export function getMainnetConfig(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
97
|
+
export function getMainnetConfig(
|
|
98
|
+
rpcUrl = "https://starknet-mainnet.public.blastapi.io",
|
|
99
|
+
blockIdentifier: BlockIdentifier = "pending"
|
|
100
|
+
): IConfig {
|
|
101
|
+
return {
|
|
102
|
+
provider: new RpcProvider({
|
|
103
|
+
nodeUrl: rpcUrl,
|
|
104
|
+
blockIdentifier: blockIdentifier
|
|
105
|
+
}),
|
|
106
|
+
stage: "production",
|
|
107
|
+
network: Network.mainnet
|
|
108
|
+
};
|
|
99
109
|
}
|
|
100
110
|
|
|
101
111
|
export const getRiskExplaination = (riskType: RiskType) => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
112
|
+
switch (riskType) {
|
|
113
|
+
case RiskType.MARKET_RISK:
|
|
114
|
+
return "The risk of the market moving against the position.";
|
|
115
|
+
case RiskType.IMPERMANENT_LOSS:
|
|
116
|
+
return "The temporary loss of value experienced by liquidity providers in AMMs when asset prices diverge compared to simply holding them.";
|
|
117
|
+
case RiskType.LIQUIDATION_RISK:
|
|
118
|
+
return "The risk of losing funds due to the position being liquidated.";
|
|
119
|
+
case RiskType.LOW_LIQUIDITY_RISK:
|
|
120
|
+
return "The risk of low liquidity in the pool, which can lead to high slippages or reduced in-abilities to quickly exit the position.";
|
|
121
|
+
case RiskType.ORACLE_RISK:
|
|
122
|
+
return "The risk of the oracle being manipulated or incorrect.";
|
|
123
|
+
case RiskType.SMART_CONTRACT_RISK:
|
|
124
|
+
return "The risk of the smart contract being vulnerable to attacks.";
|
|
125
|
+
case RiskType.TECHNICAL_RISK:
|
|
126
|
+
return "The risk of technical issues e.g. backend failure.";
|
|
127
|
+
case RiskType.COUNTERPARTY_RISK:
|
|
128
|
+
return "The risk of the counterparty defaulting e.g. bad debt on lending platforms.";
|
|
129
|
+
}
|
|
130
|
+
};
|
|
121
131
|
|
|
122
132
|
export const getRiskColor = (risk: RiskFactor) => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
133
|
+
const value = risk.value;
|
|
134
|
+
if (value === 0) return "green";
|
|
135
|
+
if (value < 2.5) return "yellow";
|
|
136
|
+
return "red";
|
|
137
|
+
};
|
|
128
138
|
|
|
129
139
|
export const getNoRiskTags = (risks: RiskFactor[]) => {
|
|
130
|
-
|
|
140
|
+
const noRisks1 = risks
|
|
141
|
+
.filter((risk) => risk.value === 0)
|
|
142
|
+
.map((risk) => risk.type);
|
|
143
|
+
|
|
144
|
+
// const risks not present
|
|
145
|
+
const noRisks2 = Object.values(RiskType).filter(
|
|
146
|
+
(risk) => !risks.map((risk) => risk.type).includes(risk)
|
|
147
|
+
);
|
|
131
148
|
|
|
132
|
-
|
|
133
|
-
const noRisks2 = Object.values(RiskType).filter(risk => !risks.map(risk => risk.type).includes(risk));
|
|
149
|
+
const mergedUnique = [...new Set([...noRisks1, ...noRisks2])];
|
|
134
150
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return mergedUnique.map(risk => `No ${risk}`);
|
|
139
|
-
}
|
|
151
|
+
// add `No` to the start of each risk
|
|
152
|
+
return mergedUnique.map((risk) => `No ${risk}`);
|
|
153
|
+
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { IConfig } from "@/interfaces/common";
|
|
2
2
|
import { TokenInfo } from "./common";
|
|
3
3
|
import { ContractAddr } from "@/dataTypes/address";
|
|
4
|
-
import { loggers } from "winston";
|
|
5
|
-
import { logger } from "@/global";
|
|
6
4
|
import { log } from "console";
|
|
7
5
|
import { Web3Number } from "@/dataTypes";
|
|
6
|
+
import { logger } from "@/utils/logger";
|
|
8
7
|
|
|
9
8
|
export interface ILendingMetadata {
|
|
10
9
|
name: string;
|
package/src/modules/avnu.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { uint256 } from "starknet";
|
|
|
3
3
|
import { Call, Uint256 } from "starknet";
|
|
4
4
|
import { fetchBuildExecuteTransaction, fetchQuotes, Quote } from "@avnu/avnu-sdk";
|
|
5
5
|
import { assert } from "../utils";
|
|
6
|
-
import { logger } from "@/
|
|
6
|
+
import { logger } from "@/utils/logger";
|
|
7
7
|
|
|
8
8
|
export interface Route {
|
|
9
9
|
token_from: string,
|
package/src/modules/erc20.ts
CHANGED
|
@@ -20,4 +20,10 @@ export class ERC20 {
|
|
|
20
20
|
const balance = await contract.call('balanceOf', [address.toString()]);
|
|
21
21
|
return Web3Number.fromWei(balance.toString(), tokenDecimals);
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
async allowance(token: string | ContractAddr, owner: string | ContractAddr, spender: string | ContractAddr, tokenDecimals: number) {
|
|
25
|
+
const contract = this.contract(token);
|
|
26
|
+
const allowance = await contract.call('allowance', [owner.toString(), spender.toString()]);
|
|
27
|
+
return Web3Number.fromWei(allowance.toString(), tokenDecimals);
|
|
28
|
+
}
|
|
23
29
|
}
|
package/src/modules/harvests.ts
CHANGED
package/src/modules/pragma.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Contract, RpcProvider } from "starknet";
|
|
2
2
|
import PragmaAbi from '@/data/pragma.abi.json';
|
|
3
|
-
import { logger } from "@/
|
|
3
|
+
import { logger } from "@/utils/logger";
|
|
4
4
|
|
|
5
5
|
export class Pragma {
|
|
6
6
|
contractAddr = '0x023fb3afbff2c0e3399f896dcf7400acf1a161941cfb386e34a123f228c62832';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PriceInfo } from "./pricer";
|
|
1
|
+
import { PriceInfo } from "./pricer";
|
|
3
2
|
import axios from "axios";
|
|
4
3
|
import { IConfig, TokenInfo } from "@/interfaces";
|
|
5
4
|
import { PricerBase } from "./pricerBase";
|
|
5
|
+
import { logger } from "@/utils/logger";
|
|
6
6
|
|
|
7
7
|
export class PricerFromApi extends PricerBase {
|
|
8
8
|
constructor(config: IConfig, tokens: TokenInfo[]) {
|
|
@@ -15,7 +15,7 @@ export class PricerFromApi extends PricerBase {
|
|
|
15
15
|
} catch (e: any) {
|
|
16
16
|
logger.warn('getPriceFromMyAPI error', JSON.stringify(e.message || e));
|
|
17
17
|
}
|
|
18
|
-
logger.
|
|
18
|
+
logger.info('getPrice coinbase', tokenSymbol);
|
|
19
19
|
let retry = 0;
|
|
20
20
|
const MAX_RETRIES = 5;
|
|
21
21
|
for (retry = 1; retry < MAX_RETRIES + 1; retry++) {
|
package/src/modules/pricer.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import { FatalError, Global
|
|
2
|
+
import { FatalError, Global } from "@/global";
|
|
3
3
|
import { TokenInfo } from "@/interfaces/common";
|
|
4
4
|
import { IConfig } from "@/interfaces/common";
|
|
5
5
|
import { Web3Number } from "@/dataTypes";
|
|
6
6
|
import { PricerBase } from "./pricerBase";
|
|
7
|
+
import { logger } from "@/utils/logger";
|
|
7
8
|
|
|
8
9
|
export interface PriceInfo {
|
|
9
10
|
price: number,
|
package/src/modules/zkLend.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
3
|
import { Web3Number } from "@/dataTypes/bignumber.browser";
|
|
4
|
-
import { FatalError, Global
|
|
4
|
+
import { FatalError, Global } from "@/global";
|
|
5
5
|
import { TokenInfo } from "@/interfaces";
|
|
6
6
|
import { ILending, ILendingPosition, LendingToken, MarginType } from "@/interfaces/lending";
|
|
7
7
|
import { ContractAddr } from "@/dataTypes/address";
|
|
8
8
|
import { IConfig } from "@/interfaces";
|
|
9
9
|
import { Pricer } from "./pricer";
|
|
10
|
+
import { logger } from "@/utils/logger";
|
|
10
11
|
|
|
11
12
|
export class ZkLend extends ILending implements ILending {
|
|
12
13
|
readonly pricer: Pricer;
|
package/src/node/pricer-redis.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { FatalError, Global
|
|
1
|
+
import { FatalError, Global } from '@/global';
|
|
2
2
|
import { IConfig, TokenInfo } from '@/interfaces';
|
|
3
3
|
import { PriceInfo, Pricer } from '@/modules/pricer';
|
|
4
4
|
import { createClient } from 'redis';
|
|
5
5
|
import type { RedisClientType } from 'redis'
|
|
6
|
+
import { logger } from "@/utils/logger";
|
|
6
7
|
|
|
7
8
|
export class PricerRedis extends Pricer {
|
|
8
9
|
private redisClient: RedisClientType | null = null;
|