Skip to content

Commit

Permalink
Fix decimals on asset pricing
Browse files Browse the repository at this point in the history
  • Loading branch information
philipjames44 committed Mar 16, 2024
1 parent 9bda803 commit 657b662
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/liquidityPositions/currentStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,18 @@ const CurrentLPStatus = ({ nftId, position }: CurrentLPStatusProps) => {
const p: BigNumber = fromBaseUnit(
position!.phi!.component!.p!.lo,
position!.phi!.component!.p!.hi,
asset1Token.decimals
asset2Token.decimals
);
const q: BigNumber = fromBaseUnit(
position!.phi!.component!.q!.lo,
position!.phi!.component!.q!.hi,
asset2Token.decimals
asset1Token.decimals
);

return (
<>
<VStack width={"100%"}>
<HStack >
<HStack>
<Text fontFamily={"monospace"}>{nftId}</Text>

<div style={{ position: "relative", display: "inline-block" }}>
Expand Down
20 changes: 20 additions & 0 deletions src/constants/tokenConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ export const tokenConfigMapOnInner: { [key: string]: Token } = {
inner: "KeqcLzNx9qSH5+lcJHBB9KNW+YPrBk5dKzvPMiypahA=",
imagePath: "/assets/icons/penumbra.png",
},
"6KBVsPINa8gWSHhfH+kAFJC4afEJA3EtuB2HyCqJUws=": {
decimals: 0,
symbol: "cube",
inner: "6KBVsPINa8gWSHhfH+kAFJC4afEJA3EtuB2HyCqJUws=",
},
"reum7wQmk/owgvGMWMZn/6RFPV24zIKq3W6In/WwZgg=": {
decimals: 18,
symbol: "test_usd",
inner: "reum7wQmk/owgvGMWMZn/6RFPV24zIKq3W6In/WwZgg=",
},
"HW2Eq3UZVSBttoUwUi/MUtE7rr2UU7/UH500byp7OAc=": {
decimals: 6,
symbol: "gm",
inner: "HW2Eq3UZVSBttoUwUi/MUtE7rr2UU7/UH500byp7OAc=",
},
"nwPDkQq3OvLnBwGTD+nmv1Ifb2GEmFCgNHrU++9BsRE=": {
decimals: 6,
symbol: "gn",
inner: "nwPDkQq3OvLnBwGTD+nmv1Ifb2GEmFCgNHrU++9BsRE=",
},
};

// Recreate from tokenConfigMapOnInner to not have to redefine the same data
Expand Down
41 changes: 41 additions & 0 deletions src/pages/tradingPairs/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// pages/tradingPairs/index.tsx

import React, { useEffect, useRef, useState } from "react";
import { useRouter } from "next/router";
import Layout from "../../components/layout";
import {
VStack,
Text,
Spinner,
Center,
Box,
HStack,
Input,
Button,
} from "@chakra-ui/react";
import { useSearchParams } from "next/navigation";

export default function TradingPairs() {
const searchParams = useSearchParams();
const token1 = searchParams.get("token1")?.toLocaleLowerCase();
const token2 = searchParams.get("token2")?.toLocaleLowerCase();

if (!token1 || !token2) {
return (
<Layout pageTitle="Trading Pair View">
<Center height="100vh">
<Text>token1 or token2 url argument missing.</Text>
</Center>
</Layout>
);
}


return (
<Layout pageTitle={`${token1}/${token2}`}>
<Center height="100vh">
<Text>{`${token1} ${token2}`}</Text>
</Center>
</Layout>
);
}

0 comments on commit 657b662

Please sign in to comment.