Skip to content

Commit b0a2819

Browse files
committed
fix(UniswapV3SwapConnectors.cdc): update price impact from 500 bps to 600 bps to reflect new calculation requirements
refactor(UniswapV3SwapConnectors.cdc): remove safety margin in return value for maxAmount to simplify logic
1 parent 98b6cbf commit b0a2819

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

cadence/contracts/connectors/evm/UniswapV3SwapConnectors.cdc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,9 @@ access(all) contract UniswapV3SwapConnectors {
304304
)
305305
let L = wordToUIntN(words(liqRes!.data)[0], 128)
306306

307-
// Calculate price multiplier based on 5% price impact (500 bps)
307+
// Calculate price multiplier based on 5% price impact (600 bps)
308308
// Use UInt256 throughout to prevent overflow in multiplication operations
309-
let bps: UInt256 = 500
309+
let bps: UInt256 = 600
310310
let Q96: UInt256 = 0x1000000000000000000000000
311311
let sqrtPriceX96_256: UInt256 = UInt256(sqrtPriceX96)
312312
let L_256: UInt256 = UInt256(L)
@@ -340,8 +340,7 @@ access(all) contract UniswapV3SwapConnectors {
340340
maxAmount = (L_256 * deltaSqrt) / Q96
341341
}
342342

343-
// Return 80% of calculated max for additional safety margin
344-
return (maxAmount * 4) / 5
343+
return maxAmount
345344
}
346345

347346
/// Quote using the Uniswap V3 Quoter via dryCall

0 commit comments

Comments
 (0)