-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: use decimal places with token values on the home page #74
Conversation
Deploying agoric-inter-dashboard with Cloudflare Pages
|
Cloudflare deployment logs are available here |
698ca68
to
bf27078
Compare
((Number(node_?.value) / tokenDivisor) * Number(oraclePrices[node_?.denom]?.typeOutAmount || tokenDivisor)) / | ||
tokenDivisor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
((Number(node_?.value) / tokenDivisor) * Number(oraclePrices[node_?.denom]?.typeOutAmount || tokenDivisor)) / | |
tokenDivisor; | |
((Number(node_?.value) / tokenDivisor) * Number(oraclePrices[node_?.denom]?.typeOutAmount || 0)) / | |
Number(oraclePrices[node_?.denom]?.typeInAmount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This results in incorrect value for Total Reserve Assets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably use Number(oraclePrices[node_?.denom]?.typeInAmount
instead of the deafault of 0 then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably use Number(oraclePrices[node_?.denom]?.typeInAmount
I reckon you are implying typeOutAmount
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no typeInAmount
the goal is to divide typeInAmount
by typeInAmount
to create a value of 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but i think if typeOutAmount
is not present, then typeInAmount
wont also be present. lets do this instead:
Number(oraclePrices[node_?.denom]?.typeOutAmount || 1)) /
Number(oraclePrices[node_?.denom]?.typeInAmount || 1);
dashboardResponse.reserveMetrics.nodes.reduce((agg, node) => agg + Number(node.shortfallBalance), 0) / 1_000_000; | ||
const totalLockedCollateral = dashboardResponse.vaultManagerMetrics.nodes.reduce((agg, node) => { | ||
dashboardResponse?.reserveMetrics?.nodes?.reduce((agg, node) => agg + Number(node?.shortfallBalance), 0) / | ||
istTokenDivisor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably shouldnt be divided by the istTokenDivisor but rather the token divisior of each node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? It results in different values compared to production
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not 100%. my logic is that this value represent reserve data. when we calculate totalReserve
above, which also represents reserve data, we also use token divisor rather than ist divisor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess then istdivisor is fine
7c7fbf1
to
37e1e57
Compare
src/pages/InterProtocol.tsx
Outdated
Number(oraclePrices[node.liquidatingCollateralBrand]?.typeOutAmount) || 0) / 1_000_000; | ||
((Number(node?.totalCollateral) / tokenDivisor) * | ||
Number(oraclePrices[node?.liquidatingCollateralBrand]?.typeOutAmount) || 0) / | ||
Number(oraclePrices[node?.liquidatingCollateralBrand]?.typeInAmount || 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont use default value here. 0 will result in a divide by zero error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't that be fine? 0/0
will be NaN
..........would be easier to point anomalies from the dashboard UI.
If we omit the 0
default, it will still be a NaN
(0/undefined and undefined/undefined)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the defaults. It's going to yield a NaN
regardless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true. i thought it might throw an Error.
37e1e57
to
f42d015
Compare
6380e0f
to
81b1a32
Compare
No description provided.