diff --git a/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseParameters/ReClammParams.tsx b/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseParameters/ReClammParams.tsx index 6cec508..75c0dce 100644 --- a/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseParameters/ReClammParams.tsx +++ b/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseParameters/ReClammParams.tsx @@ -1,25 +1,34 @@ import ReactECharts from "echarts-for-react"; -import { ArrowTopRightOnSquareIcon } from "@heroicons/react/20/solid"; -import { Alert, NumberInput, TextField } from "~~/components/common"; -import { useSortedTokenConfigs } from "~~/hooks/balancer"; +import { formatUnits } from "viem"; +import { ArrowTopRightOnSquareIcon, ArrowsRightLeftIcon } from "@heroicons/react/20/solid"; +import { InformationCircleIcon } from "@heroicons/react/24/outline"; +import { NumberInput, TextField } from "~~/components/common"; import { useReclAmmChart } from "~~/hooks/reclamm/useReclammChart"; -import { usePoolCreationStore } from "~~/hooks/v3"; +// import { useTokenUsdValue } from "~~/hooks/token"; +import { useFetchTokenRate, usePoolCreationStore, useUserDataStore } from "~~/hooks/v3"; export const ReClammParams = () => { - const { reClammParams, updateReClammParam } = usePoolCreationStore(); - const sortedTokenConfigs = useSortedTokenConfigs(); + const { reClammParams, updateReClammParam, tokenConfigs } = usePoolCreationStore(); + const { updateUserData } = useUserDataStore(); const { initialTargetPrice, initialMinPrice, initialMaxPrice, - priceShiftDailyRate, + dailyPriceShiftExponent, centerednessMargin, - initialBalanceA, + // initialBalanceA, usdPerTokenInputA, usdPerTokenInputB, + // tokenAPriceIncludesRate, + // tokenBPriceIncludesRate, } = reClammParams; + const { data: currentRateTokenA } = useFetchTokenRate(tokenConfigs[0].rateProvider); + const { data: currentRateTokenB } = useFetchTokenRate(tokenConfigs[1].rateProvider); + // const { tokenUsdValue: usdPerTokenA } = useTokenUsdValue(tokenConfigs[0].address, "1"); + // const { tokenUsdValue: usdPerTokenB } = useTokenUsdValue(tokenConfigs[1].address, "1"); + const sanitizeNumberInput = (input: string) => { // Remove non-numeric characters except decimal point const sanitized = input.replace(/[^0-9.]/g, ""); @@ -28,6 +37,15 @@ export const ReClammParams = () => { return parts.length > 2 ? parts[0] + "." + parts.slice(1).join("") : sanitized; }; + const humanRateA = currentRateTokenA && Number(formatUnits(currentRateTokenA, 18)); + const humanRateB = currentRateTokenB && Number(formatUnits(currentRateTokenB, 18)); + + const isBoostedA = !!currentRateTokenA; + const isBoostedB = !!currentRateTokenB; + + const boostedLabelA = isBoostedA ? `without rate` : ""; + const boostedLabelB = currentRateTokenB ? `without rate` : ""; + return (