Skip to content

Commit 5d26773

Browse files
committed
bugfix xrpl
1 parent 8dc6f19 commit 5d26773

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

projects/helper/coreAssets.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,5 +1891,8 @@
18911891
"noble": {
18921892
"USDC": "uusdc",
18931893
"USDY": "ausdy"
1894+
},
1895+
"ripple": {
1896+
"XRP": "XRP"
18941897
}
18951898
}

projects/xrpl-dex/app.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ async function main() {
131131
const projectKey = 'xrpl-dex'
132132
const cacheKey = 'cache'
133133
let { allPools, lastPoolUpdate, lastDataUpdate, tvl } = await getCache(projectKey, cacheKey)
134-
lastPoolUpdate = false
135134
if (!lastPoolUpdate || timeNow - lastPoolUpdate > 3 * aDayInSeconds) {
136135
// try {
137136
console.time("xrpl-dex fetch pool list");

projects/xrpl-dex/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ function getTimeNow() {
1414
return Math.floor(Date.now() / 1000);
1515
}
1616

17-
async function tvl() {
17+
async function tvl(api) {
1818
const timeNow = getTimeNow()
1919
const aDayInSeconds = 60 * 60 * 24;
2020
const projectKey = 'xrpl-dex'
2121
const cacheKey = 'cache'
2222
let { lastDataUpdate, tvl } = await getCache(projectKey, cacheKey)
23-
if (!lastDataUpdate || timeNow - lastDataUpdate > aDayInSeconds || !Object.keys(tvl).length)
23+
const val = tvl?.XRP
24+
if (!lastDataUpdate || timeNow - lastDataUpdate > aDayInSeconds || !val)
2425
throw new Error("stale/missing tvl data");
25-
return tvl
26+
api.addCGToken('ripple', val/1e6)
2627
}

projects/xrpl-dex/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)