Calculate 24h changes diff correctly

This commit is contained in:
Techno Freak
2024-02-03 18:31:44 +03:00
parent 036801fe90
commit a792c379a5
2 changed files with 34 additions and 16 deletions
+11 -4
View File
@@ -123,15 +123,22 @@ export const useFormatter = defineStore('formatter', {
}
return 0
},
tokenValueNumber(token?: Coin) {
tokenAmountNumber(token?: Coin) {
if(!token || !token.denom) return 0
// find the symbol,
// find the symbol
const symbol = this.dashboard.coingecko[token.denom]?.symbol || token.denom
// convert denomation to to symbol
// convert denomination to to symbol
const exponent =
this.dashboard.coingecko[symbol?.toLowerCase()]?.exponent || this.specialDenom(token.denom);
// cacualte amount of symbol
// caculate amount of symbol
const amount = Number(token.amount) / (10 ** exponent)
return amount
},
tokenValueNumber(token?: Coin) {
if(!token || !token.denom) return 0
const amount = this.tokenAmountNumber(token)
const value = amount * this.price(token.denom)
return value
},