Skip to content

Commit

Permalink
Fix price computation + display it
Browse files Browse the repository at this point in the history
  • Loading branch information
Wapaca committed Jul 1, 2023
1 parent 172aca6 commit 939a885
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion components/holders/Uniswapv3.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<div class="cell">{{ position.owner }}</div>
<div class="cell liquidity">
<div>In range: <fa-icon v-if="isPositionInRange(position)" :icon="['fas','check']" /><fa-icon v-else :icon="['fas','xmark']" /></div>
<div>Min: {{ null }} - Max: {{ null }}</div>
<div>Min: {{ position.priceLower }} {{ pool.tokenA.symbol }}</div>
<div>Max: {{ position.priceUpper }} {{ pool.tokenA.symbol }}</div>
</div>
<div class="cell liquidity">
<div>{{ position.liquidity }}</div>
Expand Down Expand Up @@ -49,6 +50,7 @@ export default {
},
computed: {
...mapState('LPdistrib', [
'pool',
'excludeWalletActive',
'displayedPositions',
'totalNeonReward',
Expand Down
5 changes: 3 additions & 2 deletions store/LPdistrib.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ export const actions = {
state.pool.tokenB.id
);

p.priceLower = isTicksAtLimit(state.pool.fee, p.tickLower, p.tickUpper).UPPER ? '∞' : tickToPrice(tokenA, tokenB, p.tickLower);
p.priceUpper = isTicksAtLimit(state.pool.fee, p.tickLower, p.tickUpper).LOWER ? '0' : tickToPrice(tokenA, tokenB, p.tickUpper);
// Order of tokens into tickToPrice reverse + tickUpper and tickLower too so it fits to NEON/WAX price
p.priceLower = isTicksAtLimit(state.pool.fee, p.tickLower, p.tickUpper).LOWER ? '0' : tickToPrice(tokenB, tokenA, p.tickUpper).toSignificant(5);
p.priceUpper = isTicksAtLimit(state.pool.fee, p.tickLower, p.tickUpper).UPPER ? '∞' : tickToPrice(tokenB, tokenA, p.tickLower).toSignificant(5);

return p;
});
Expand Down

0 comments on commit 939a885

Please sign in to comment.