removing limitPrice calucating from the swap execution
This commit is contained in:
@@ -360,9 +360,7 @@ export function useSwap() {
|
|||||||
await publicClient.waitForTransactionReceipt({ hash: approvalHash });
|
await publicClient.waitForTransactionReceipt({ hash: approvalHash });
|
||||||
console.log('✅ Approval confirmed');
|
console.log('✅ Approval confirmed');
|
||||||
|
|
||||||
// STEP 2: Calculate limit price and deadline
|
// STEP 2: Calculate deadline
|
||||||
const slippageBasisPoints = BigInt(Math.floor(slippagePercent * 100));
|
|
||||||
const limitPrice = (Q96 * (10000n + slippageBasisPoints)) / 10000n;
|
|
||||||
const deadline = BigInt(Math.floor(Date.now() / 1000) + 1200);
|
const deadline = BigInt(Math.floor(Date.now() / 1000) + 1200);
|
||||||
|
|
||||||
console.log('🚀 Executing swap with params:', {
|
console.log('🚀 Executing swap with params:', {
|
||||||
@@ -372,12 +370,12 @@ export function useSwap() {
|
|||||||
inputTokenIndex,
|
inputTokenIndex,
|
||||||
outputTokenIndex,
|
outputTokenIndex,
|
||||||
maxAmountIn: maxAmountIn.toString(),
|
maxAmountIn: maxAmountIn.toString(),
|
||||||
limitPrice: limitPrice.toString(),
|
limitPrice: '0 (no limit)',
|
||||||
deadline: deadline.toString(),
|
deadline: deadline.toString(),
|
||||||
unwrap: false,
|
unwrap: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// STEP 3: Execute the swap transaction
|
// STEP 3: Execute the swap transaction with no limit price
|
||||||
const hash = await walletClient.writeContract({
|
const hash = await walletClient.writeContract({
|
||||||
address: poolAddress,
|
address: poolAddress,
|
||||||
abi: IPartyPoolABI,
|
abi: IPartyPoolABI,
|
||||||
@@ -389,7 +387,7 @@ export function useSwap() {
|
|||||||
BigInt(inputTokenIndex),
|
BigInt(inputTokenIndex),
|
||||||
BigInt(outputTokenIndex),
|
BigInt(outputTokenIndex),
|
||||||
maxAmountIn,
|
maxAmountIn,
|
||||||
limitPrice,
|
0n, // no limit price
|
||||||
deadline,
|
deadline,
|
||||||
false, // unwrap
|
false, // unwrap
|
||||||
'0x', // cbData (empty bytes)
|
'0x', // cbData (empty bytes)
|
||||||
|
|||||||
Reference in New Issue
Block a user