From ff6c07d3aacc6649803f175eea4ec2e1d0f9d724 Mon Sep 17 00:00:00 2001 From: Matt Pereira Date: Mon, 26 May 2025 19:39:34 -0700 Subject: [PATCH 01/18] enable create reclamm preview --- .../app/v3/_components/PoolConfiguration/ChooseType/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseType/index.tsx b/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseType/index.tsx index c719e78..ee16f74 100644 --- a/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseType/index.tsx +++ b/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseType/index.tsx @@ -7,7 +7,7 @@ import { type SupportedPoolTypes, poolTypeMap } from "~~/utils/constants"; export function ChooseType() { // const { poolType } = usePoolCreationStore(); - const poolTypes = Object.keys(poolTypeMap).slice(0, 4) as SupportedPoolTypes[]; + const poolTypes = Object.keys(poolTypeMap) as SupportedPoolTypes[]; return ( <> From 6c793cf0b823b995d4f70ac09805e310e1399f26 Mon Sep 17 00:00:00 2001 From: Matt Pereira Date: Mon, 26 May 2025 19:42:27 -0700 Subject: [PATCH 02/18] clean up alerts --- .../ChooseParameters/ReClammParams.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseParameters/ReClammParams.tsx b/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseParameters/ReClammParams.tsx index 4716782..6cec508 100644 --- a/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseParameters/ReClammParams.tsx +++ b/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseParameters/ReClammParams.tsx @@ -42,12 +42,15 @@ export const ReClammParams = () => { -
+
- USD per token inputs are used to calculate the initial prices + + Initial prices represent the value of {sortedTokenConfigs[0].tokenInfo?.symbol} denominated in{" "} + {sortedTokenConfigs[1].tokenInfo?.symbol} +
{ }} />
- - Initial prices represent the value of {sortedTokenConfigs[0].tokenInfo?.symbol} denominated in{" "} - {sortedTokenConfigs[1].tokenInfo?.symbol} -
Date: Sat, 12 Jul 2025 18:12:58 -0700 Subject: [PATCH 03/18] update to new reclamm chart --- .../ChooseParameters/ReClammParams.tsx | 71 ++- .../ChooseType/PoolTypeButton.tsx | 2 +- .../PoolConfiguration/ChooseType/index.tsx | 11 +- .../_components/PoolConfiguration/index.tsx | 14 +- .../nextjs/app/v3/_components/PoolDetails.tsx | 4 +- packages/nextjs/hooks/balancer/index.ts | 1 - .../hooks/balancer/useSortedTokenConfigs.ts | 1 + packages/nextjs/hooks/reclamm/reClammMath.ts | 4 +- .../hooks/reclamm/useInitialPricingParams.ts | 8 +- .../nextjs/hooks/reclamm/useReclammChart.ts | 572 +++++++++--------- packages/nextjs/hooks/v3/useCreatePool.ts | 15 +- packages/nextjs/hooks/v3/useFetchTokenRate.ts | 4 + .../nextjs/hooks/v3/usePoolCreationStore.ts | 14 +- .../hooks/v3/useValidateCreationInputs.ts | 8 - packages/nextjs/utils/numbers.ts | 12 +- 15 files changed, 382 insertions(+), 359 deletions(-) diff --git a/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseParameters/ReClammParams.tsx b/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseParameters/ReClammParams.tsx index 6cec508..1830629 100644 --- a/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseParameters/ReClammParams.tsx +++ b/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseParameters/ReClammParams.tsx @@ -1,21 +1,19 @@ 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 { ArrowTopRightOnSquareIcon, ArrowsRightLeftIcon } from "@heroicons/react/20/solid"; +import { NumberInput, TextField } from "~~/components/common"; import { useReclAmmChart } from "~~/hooks/reclamm/useReclammChart"; import { usePoolCreationStore } from "~~/hooks/v3"; export const ReClammParams = () => { - const { reClammParams, updateReClammParam } = usePoolCreationStore(); - const sortedTokenConfigs = useSortedTokenConfigs(); + const { reClammParams, updateReClammParam, tokenConfigs } = usePoolCreationStore(); const { initialTargetPrice, initialMinPrice, initialMaxPrice, - priceShiftDailyRate, + dailyPriceShiftExponent, centerednessMargin, - initialBalanceA, + // initialBalanceA, usdPerTokenInputA, usdPerTokenInputB, } = reClammParams; @@ -42,19 +40,12 @@ export const ReClammParams = () => {
-
- -
+
- - Initial prices represent the value of {sortedTokenConfigs[0].tokenInfo?.symbol} denominated in{" "} - {sortedTokenConfigs[1].tokenInfo?.symbol} - -
{ @@ -62,7 +53,7 @@ export const ReClammParams = () => { }} /> { @@ -88,7 +79,7 @@ export const ReClammParams = () => { onChange={e => updateReClammParam({ initialMaxPrice: sanitizeNumberInput(e.target.value) })} />
-
+
{ onChange={e => updateReClammParam({ centerednessMargin: sanitizeNumberInput(e.target.value) })} /> updateReClammParam({ priceShiftDailyRate: sanitizeNumberInput(e.target.value) })} + onChange={e => updateReClammParam({ dailyPriceShiftExponent: sanitizeNumberInput(e.target.value) })} /> - updateReClammParam({ initialBalanceA: sanitizeNumberInput(e.target.value) })} - /> + /> */}
@@ -119,7 +110,35 @@ export const ReClammParams = () => { }; function ReClammChart() { - const { option } = useReclAmmChart(); + const { options } = useReclAmmChart(); + + const { tokenConfigs, updatePool, updateReClammParam, reClammParams } = usePoolCreationStore(); + + const handleInvertReClammParams = () => { + const { initialTargetPrice, initialMinPrice, initialMaxPrice, usdPerTokenInputA, usdPerTokenInputB } = + reClammParams; - return ; + updateReClammParam({ + initialTargetPrice: (1 / Number(initialTargetPrice)).toString(), + initialMinPrice: (1 / Number(initialMaxPrice)).toString(), + initialMaxPrice: (1 / Number(initialMinPrice)).toString(), + usdPerTokenInputA: usdPerTokenInputB, + usdPerTokenInputB: usdPerTokenInputA, + }); + updatePool({ tokenConfigs: [...tokenConfigs].reverse() }); + }; + + return ( +
+
+ +
+ +
+
+
+ ); } diff --git a/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseType/PoolTypeButton.tsx b/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseType/PoolTypeButton.tsx index cd9e072..b236043 100644 --- a/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseType/PoolTypeButton.tsx +++ b/packages/nextjs/app/v3/_components/PoolConfiguration/ChooseType/PoolTypeButton.tsx @@ -15,7 +15,7 @@ export function PoolTypeButton({ selectedPoolType }: { selectedPoolType: Support