From 5efec23ce6997538f1a2ed315049d1ccb25a1cf8 Mon Sep 17 00:00:00 2001 From: Pedro Yves Fracari <55461956+yvesfracari@users.noreply.github.com> Date: Wed, 20 Mar 2024 17:05:56 -0300 Subject: [PATCH] [CoW AMM Deployer] Calculate cow quote amount in based on minTradedToken0 amount (#635) --- apps/cow-amm-deployer/src/lib/schema.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/cow-amm-deployer/src/lib/schema.ts b/apps/cow-amm-deployer/src/lib/schema.ts index bf1723e81..2b0f7375c 100644 --- a/apps/cow-amm-deployer/src/lib/schema.ts +++ b/apps/cow-amm-deployer/src/lib/schema.ts @@ -119,11 +119,13 @@ export const ammFormSchema = z return !path.length; }) .superRefine((data, ctx) => { - // validate if route exists + // hardcoded value since we're just checking if the route exists or not + // we're using 100 times the minTradedToken0 to cover high gas price (mainly for mainnet) + const amountIn = data.minTradedToken0 * 100 ** data.token0.decimals; return fetchCowQuote({ tokenIn: data.token0, tokenOut: data.token1, - amountIn: 1e18, // hardcoded value since we're just checking if the route exists or not + amountIn, chainId: data.chainId as ChainId, priceQuality: "fast", }).then((res) => {