-
Notifications
You must be signed in to change notification settings - Fork 200
/
Copy pathindex.js
51 lines (46 loc) · 1.04 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
const { getAmmTokensPrices, getAmmLpPrices, getLpBreakdown } = require('../stats/getAmmPrices');
const { getMooTokenPrices } = require('../stats/getMooTokenPrices');
async function lpsPrices(ctx) {
try {
const lpTokenPrices = await getAmmLpPrices();
ctx.status = 200;
ctx.body = { ...lpTokenPrices };
} catch (err) {
console.error(err);
ctx.status = 500;
}
}
async function tokenPrices(ctx) {
try {
const prices = await getAmmTokensPrices();
ctx.status = 200;
ctx.body = prices;
} catch (err) {
ctx.throw(500, err);
}
}
async function mooTokenPrices(ctx) {
try {
const prices = await getMooTokenPrices();
ctx.status = 200;
ctx.body = prices;
} catch (err) {
ctx.throw(500, err);
}
}
async function lpsBreakdown(ctx) {
try {
const lpTokenBreakdown = await getLpBreakdown();
ctx.status = 200;
ctx.body = { ...lpTokenBreakdown };
} catch (err) {
console.error(err);
ctx.status = 500;
}
}
module.exports = {
lpsPrices,
tokenPrices,
mooTokenPrices,
lpsBreakdown,
};