@@ -74,7 +74,8 @@ access(all) contract UniswapV3SwapConnectors {
7474 outVault : Type ,
7575 coaCapability : Capability <auth (EVM .Owner ) &EVM.CadenceOwnedAccount>,
7676 uniqueID: DeFiActions.UniqueIdentifier? ,
77- maxPriceImpactBps: UInt?
77+ maxPriceImpactBps: UInt? ,
78+ maxSlippageBps: UInt?
7879 ) {
7980 pre {
8081 tokenPath.length > = 2 : " tokenPath must contain at least two addresses"
@@ -87,6 +88,8 @@ access(all) contract UniswapV3SwapConnectors {
8788 " Provided COA Capability is invalid - need Capability<auth(EVM.Owner) &EVM.CadenceOwnedAccount>"
8889 maxPriceImpactBps == nil || (maxPriceImpactBps! > 0 && maxPriceImpactBps! < = 5000 ):
8990 " maxPriceImpactBps must be between 1 and 5000 (0.01% to 50%)"
91+ maxSlippageBps == nil || (maxSlippageBps! > 0 && maxSlippageBps! < = 1000 ):
92+ " maxPriceImpactBps must be between 1 and 5000 (0.01% to 10%)"
9093 }
9194 self .factoryAddress = factoryAddress
9295 self .routerAddress = routerAddress
@@ -98,6 +101,7 @@ access(all) contract UniswapV3SwapConnectors {
98101 self .coaCapability = coaCapability
99102 self .uniqueID = uniqueID
100103 self .maxPriceImpactBps = maxPriceImpactBps ?? 600 // Default to 6%
104+ self .maxSlippageBps = maxSlippageBps ?? 100 // Default to 1%
101105 }
102106
103107 /* --- DeFiActions.Swapper conformance --- */
@@ -413,7 +417,7 @@ access(all) contract UniswapV3SwapConnectors {
413417 }
414418
415419 // Slippage/min out on EVM units (adjust factor to your policy)
416- let slippage = UFix64 (self .maxPriceImpactBps ) / 10000 .0 // convert bps to percents
420+ let slippage = UFix64 (self .maxSlippageBps ) / 10000 .0 // convert bps to percents
417421 let minOutUint = FlowEVMBridgeUtils.convertCadenceAmountToERC20Amount (
418422 amountOutMin * (1 .0 - slippage),
419423 erc20Address: outToken
0 commit comments