-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.js
67 lines (50 loc) · 1.15 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const {
getSolFarmPoolInfo
} = require('./leveragePools');
const POOLS = {
RAYDIUM: 0,
ORCA: 1
};
const main = async () => {
/**
* Fill this with proper values and uncomment.
*/
// ORCA WHETH-USDC Example
// await getVaultData(
// POOLS.ORCA,
// "WHETH-USDC",
// "BN2vN85Q4HiWJL6JejX2ke82fKY7nxnFUBjAWFMC8Wcb"
// );
//RAYDIUM RAY-SOL EXAMPLE
await getVaultData(
POOLS.RAYDIUM,
"RAY-SOL",
"FX7DL4WUQATRtU5oEjxX5hsrqrnteeXXySqo9JZaTzN9"
);
};
const getVaultData = async (
_pool,
_pair,
_userPubKey
) => {
try {
let { borrowed, virtualValue, value, debtValue, borrowedAsset } = await getSolFarmPoolInfo(
_pool,
_pair,
_userPubKey,
);
console.log("User Key", _userPubKey);
console.log("Pair", _pair);
console.log(`Borrowed: ${borrowed} ${borrowedAsset}`);
console.log(`Position Value: ${virtualValue} USD`);
console.log(`Debt Value: ${debtValue} USD`);
console.log(`Equity Value: ${value} USD`);
console.log("");
return {
borrowed, virtualValue, value, debtValue, borrowedAsset
};
} catch (error) {
console.log(error);
};
};
main();