Skip to content

Commit

Permalink
chore: 0
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsley-einstein committed Feb 13, 2025
1 parent 385e952 commit 3f0b317
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/app/swap/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Button } from "@/components/ui/button";
import {
__AGGREGATOR_ROUTERS__,
__ETHER__,
__MONI__,
__HONEY__,
__WRAPPED_ETHER__,
} from "@/config/constants";
import { useGetTokenLists } from "@/hooks/api/tokens";
Expand Down Expand Up @@ -62,7 +62,7 @@ export default function Page() {

const router = useMemo(() => __AGGREGATOR_ROUTERS__[chainId], [chainId]);
const wrappedEther = useMemo(() => __WRAPPED_ETHER__[chainId], [chainId]);
const moni = useMemo(() => __MONI__[chainId], [chainId]);
const honey = useMemo(() => __HONEY__[chainId], [chainId]);
const { balance: etherBalance } = useNativeBalance();
const { balance: token0Balance } = useERC20Balance(
selectedTokens[0]?.address as any,
Expand Down Expand Up @@ -114,13 +114,21 @@ export default function Page() {
);
const amountOutFormatted = useMemo(
() =>
Number(
formatUnits(
bestQueryData?.amountOut ?? BigInt(0),
selectedTokens[1]?.decimals ?? 18,
),
),
[bestQueryData?.amountOut, selectedTokens],
address0 === wrappedEther && address1 === wrappedEther
? 1
: Number(
formatUnits(
bestQueryData?.amountOut ?? BigInt(0),
selectedTokens[1]?.decimals ?? 18,
),
),
[
address0,
address1,
bestQueryData?.amountOut,
selectedTokens,
wrappedEther,
],
);
const { data: bestPathData, refetch: refetchBestPath } = useFindBestPath(
Number(parseUnits(amount.toString(), selectedTokens[0]?.decimals ?? 18)),
Expand Down Expand Up @@ -214,7 +222,7 @@ export default function Page() {
if (!hasLoadedDefaultTokens) {
if (tokenLists.length) {
const token0 = tokenLists.find(
(token) => token.address.toLowerCase() === moni.toLowerCase(),
(token) => token.address.toLowerCase() === honey.toLowerCase(),
);
const token1 = tokenLists.find(
(token) => token.address.toLowerCase() === __ETHER__.toLowerCase(),
Expand All @@ -226,7 +234,7 @@ export default function Page() {
setHasLoadedDefaultTokens(true);
}
}
}, [hasLoadedDefaultTokens, tokenLists, moni, selectedTokens]);
}, [hasLoadedDefaultTokens, tokenLists, honey, selectedTokens]);

useWatchBlocks({
onBlock: async () => {
Expand Down
4 changes: 4 additions & 0 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ export const __MONI__ = {
[__CHAIN_IDS__.bera_testnet]: "0x5A3740947AdEdADDE6B3034222B779549F0aC42F",
[__CHAIN_IDS__.bera]: "0x64FAF984Bf60dE19e24238521814cA98574E3b00",
};
export const __HONEY__ = {
[__CHAIN_IDS__.bera_testnet]: "0x0E4aaF1351de4c0264C5c7056Ef3777b41BD8e03",
[__CHAIN_IDS__.bera]: "0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce",
};
export const __BERA_PACK__ = {
[__CHAIN_IDS__.arbi_mainnet]: "0x95a07C40eB0441ef0AD69443fA0766A6392c2861",
};
Expand Down

0 comments on commit 3f0b317

Please sign in to comment.