diff --git a/.forge-snapshots/allowanceHolder_balancerV3VIP_USDC-USDT.snap b/.forge-snapshots/allowanceHolder_balancerV3VIP_USDC-USDT.snap index c69c98050..cb1efd585 100644 --- a/.forge-snapshots/allowanceHolder_balancerV3VIP_USDC-USDT.snap +++ b/.forge-snapshots/allowanceHolder_balancerV3VIP_USDC-USDT.snap @@ -1 +1 @@ -279569 \ No newline at end of file +279578 \ No newline at end of file diff --git a/.forge-snapshots/allowanceHolder_pancakeInfinityVIP_Orvex-WETH-NVDA.snap b/.forge-snapshots/allowanceHolder_pancakeInfinityVIP_Orvex-WETH-NVDA.snap index edf48a534..852f8843f 100644 --- a/.forge-snapshots/allowanceHolder_pancakeInfinityVIP_Orvex-WETH-NVDA.snap +++ b/.forge-snapshots/allowanceHolder_pancakeInfinityVIP_Orvex-WETH-NVDA.snap @@ -1 +1 @@ -240827 \ No newline at end of file +240788 \ No newline at end of file diff --git a/.forge-snapshots/allowanceHolder_pancakeInfinityVIP_USDT-CAKE.snap b/.forge-snapshots/allowanceHolder_pancakeInfinityVIP_USDT-CAKE.snap index d46eb40f3..619e621ba 100644 --- a/.forge-snapshots/allowanceHolder_pancakeInfinityVIP_USDT-CAKE.snap +++ b/.forge-snapshots/allowanceHolder_pancakeInfinityVIP_USDT-CAKE.snap @@ -1 +1 @@ -585058 \ No newline at end of file +585030 \ No newline at end of file diff --git a/.forge-snapshots/allowanceHolder_pancakeInfinityVIP_USDT-WBNB.snap b/.forge-snapshots/allowanceHolder_pancakeInfinityVIP_USDT-WBNB.snap index 0f44a5354..214edc36f 100644 --- a/.forge-snapshots/allowanceHolder_pancakeInfinityVIP_USDT-WBNB.snap +++ b/.forge-snapshots/allowanceHolder_pancakeInfinityVIP_USDT-WBNB.snap @@ -1 +1 @@ -171614 \ No newline at end of file +171654 \ No newline at end of file diff --git a/.forge-snapshots/settler_balancerV3VIP_USDC-USDT.snap b/.forge-snapshots/settler_balancerV3VIP_USDC-USDT.snap index b0a789cc5..322ebbbd9 100644 --- a/.forge-snapshots/settler_balancerV3VIP_USDC-USDT.snap +++ b/.forge-snapshots/settler_balancerV3VIP_USDC-USDT.snap @@ -1 +1 @@ -288054 \ No newline at end of file +288063 \ No newline at end of file diff --git a/.forge-snapshots/settler_balancerV3_USDC-USDT.snap b/.forge-snapshots/settler_balancerV3_USDC-USDT.snap index e41262be1..f934d8677 100644 --- a/.forge-snapshots/settler_balancerV3_USDC-USDT.snap +++ b/.forge-snapshots/settler_balancerV3_USDC-USDT.snap @@ -1 +1 @@ -318463 \ No newline at end of file +318469 \ No newline at end of file diff --git a/.forge-snapshots/settler_curveV2_fee_USDT-WETH.snap b/.forge-snapshots/settler_curveV2_fee_USDT-WETH.snap index 6b6f34cfb..558095e2a 100644 --- a/.forge-snapshots/settler_curveV2_fee_USDT-WETH.snap +++ b/.forge-snapshots/settler_curveV2_fee_USDT-WETH.snap @@ -1 +1 @@ -378164 \ No newline at end of file +378163 \ No newline at end of file diff --git a/.forge-snapshots/settler_ekuboExtension_USDT-WETH.snap b/.forge-snapshots/settler_ekuboExtension_USDT-WETH.snap index 4f9b14282..9d85dc9b5 100644 --- a/.forge-snapshots/settler_ekuboExtension_USDT-WETH.snap +++ b/.forge-snapshots/settler_ekuboExtension_USDT-WETH.snap @@ -1 +1 @@ -220121 \ No newline at end of file +220073 \ No newline at end of file diff --git a/.forge-snapshots/settler_ekuboV2Extension_USDC-WETH.snap b/.forge-snapshots/settler_ekuboV2Extension_USDC-WETH.snap index 65b9d82b6..f024a8b78 100644 --- a/.forge-snapshots/settler_ekuboV2Extension_USDC-WETH.snap +++ b/.forge-snapshots/settler_ekuboV2Extension_USDC-WETH.snap @@ -1 +1 @@ -252125 \ No newline at end of file +252122 \ No newline at end of file diff --git a/.forge-snapshots/settler_ekuboV2_USDC-USDT.snap b/.forge-snapshots/settler_ekuboV2_USDC-USDT.snap index db78c6cad..46f84c9dc 100644 --- a/.forge-snapshots/settler_ekuboV2_USDC-USDT.snap +++ b/.forge-snapshots/settler_ekuboV2_USDC-USDT.snap @@ -1 +1 @@ -159697 \ No newline at end of file +159694 \ No newline at end of file diff --git a/.forge-snapshots/settler_ekuboV2_USDC-WETH.snap b/.forge-snapshots/settler_ekuboV2_USDC-WETH.snap index 323b4ec30..8699719dd 100644 --- a/.forge-snapshots/settler_ekuboV2_USDC-WETH.snap +++ b/.forge-snapshots/settler_ekuboV2_USDC-WETH.snap @@ -1 +1 @@ -196889 \ No newline at end of file +196886 \ No newline at end of file diff --git a/.forge-snapshots/settler_ekubo_USDC-USDT.snap b/.forge-snapshots/settler_ekubo_USDC-USDT.snap index 87e1c6b20..6dcfdda06 100644 --- a/.forge-snapshots/settler_ekubo_USDC-USDT.snap +++ b/.forge-snapshots/settler_ekubo_USDC-USDT.snap @@ -1 +1 @@ -152863 \ No newline at end of file +152860 \ No newline at end of file diff --git a/.forge-snapshots/settler_ekubo_USDC-WETH.snap b/.forge-snapshots/settler_ekubo_USDC-WETH.snap index 8c0d16cd5..991751580 100644 --- a/.forge-snapshots/settler_ekubo_USDC-WETH.snap +++ b/.forge-snapshots/settler_ekubo_USDC-WETH.snap @@ -1 +1 @@ -1873682 \ No newline at end of file +1873679 \ No newline at end of file diff --git a/.forge-snapshots/settler_externalMoveExecute_uniswapV3_DAI-WETH.snap b/.forge-snapshots/settler_externalMoveExecute_uniswapV3_DAI-WETH.snap index 7c55cd537..f1c56f5ae 100644 --- a/.forge-snapshots/settler_externalMoveExecute_uniswapV3_DAI-WETH.snap +++ b/.forge-snapshots/settler_externalMoveExecute_uniswapV3_DAI-WETH.snap @@ -1 +1 @@ -129239 \ No newline at end of file +129238 \ No newline at end of file diff --git a/.forge-snapshots/settler_externalMoveExecute_uniswapV3_USDC-USDT.snap b/.forge-snapshots/settler_externalMoveExecute_uniswapV3_USDC-USDT.snap index 8e767d9a0..c11081512 100644 --- a/.forge-snapshots/settler_externalMoveExecute_uniswapV3_USDC-USDT.snap +++ b/.forge-snapshots/settler_externalMoveExecute_uniswapV3_USDC-USDT.snap @@ -1 +1 @@ -133968 \ No newline at end of file +133967 \ No newline at end of file diff --git a/.forge-snapshots/settler_externalMoveExecute_uniswapV3_USDC-WETH.snap b/.forge-snapshots/settler_externalMoveExecute_uniswapV3_USDC-WETH.snap index a5cfe9b25..f9e1f0e8e 100644 --- a/.forge-snapshots/settler_externalMoveExecute_uniswapV3_USDC-WETH.snap +++ b/.forge-snapshots/settler_externalMoveExecute_uniswapV3_USDC-WETH.snap @@ -1 +1 @@ -135730 \ No newline at end of file +135729 \ No newline at end of file diff --git a/.forge-snapshots/settler_externalMoveExecute_uniswapV3_USDT-WETH.snap b/.forge-snapshots/settler_externalMoveExecute_uniswapV3_USDT-WETH.snap index c8c85841b..208ea0da6 100644 --- a/.forge-snapshots/settler_externalMoveExecute_uniswapV3_USDT-WETH.snap +++ b/.forge-snapshots/settler_externalMoveExecute_uniswapV3_USDT-WETH.snap @@ -1 +1 @@ -144935 \ No newline at end of file +144934 \ No newline at end of file diff --git a/.forge-snapshots/settler_externalMoveExecute_uniswapV3_WETH-USDC.snap b/.forge-snapshots/settler_externalMoveExecute_uniswapV3_WETH-USDC.snap index f7e1eab95..8c5753037 100644 --- a/.forge-snapshots/settler_externalMoveExecute_uniswapV3_WETH-USDC.snap +++ b/.forge-snapshots/settler_externalMoveExecute_uniswapV3_WETH-USDC.snap @@ -1 +1 @@ -138894 \ No newline at end of file +138893 \ No newline at end of file diff --git a/.forge-snapshots/settler_metaTxn_balancerV3_USDC-USDT.snap b/.forge-snapshots/settler_metaTxn_balancerV3_USDC-USDT.snap index 746eb37e5..53603791e 100644 --- a/.forge-snapshots/settler_metaTxn_balancerV3_USDC-USDT.snap +++ b/.forge-snapshots/settler_metaTxn_balancerV3_USDC-USDT.snap @@ -1 +1 @@ -292951 \ No newline at end of file +292960 \ No newline at end of file diff --git a/.forge-snapshots/settler_metaTxn_pancakeInfinity_Orvex-WETH-NVDA.snap b/.forge-snapshots/settler_metaTxn_pancakeInfinity_Orvex-WETH-NVDA.snap index eb7571785..c3d8cd6ac 100644 --- a/.forge-snapshots/settler_metaTxn_pancakeInfinity_Orvex-WETH-NVDA.snap +++ b/.forge-snapshots/settler_metaTxn_pancakeInfinity_Orvex-WETH-NVDA.snap @@ -1 +1 @@ -254319 \ No newline at end of file +254306 \ No newline at end of file diff --git a/.forge-snapshots/settler_metaTxn_pancakeInfinity_USDT-CAKE.snap b/.forge-snapshots/settler_metaTxn_pancakeInfinity_USDT-CAKE.snap index d92a12be6..ef23caa9c 100644 --- a/.forge-snapshots/settler_metaTxn_pancakeInfinity_USDT-CAKE.snap +++ b/.forge-snapshots/settler_metaTxn_pancakeInfinity_USDT-CAKE.snap @@ -1 +1 @@ -598545 \ No newline at end of file +598543 \ No newline at end of file diff --git a/.forge-snapshots/settler_metaTxn_pancakeInfinity_USDT-WBNB.snap b/.forge-snapshots/settler_metaTxn_pancakeInfinity_USDT-WBNB.snap index 7bb941c3f..64b4b9c0c 100644 --- a/.forge-snapshots/settler_metaTxn_pancakeInfinity_USDT-WBNB.snap +++ b/.forge-snapshots/settler_metaTxn_pancakeInfinity_USDT-WBNB.snap @@ -1 +1 @@ -185762 \ No newline at end of file +185828 \ No newline at end of file diff --git a/.forge-snapshots/settler_metaTxn_uniswapV3VIP_DAI-WETH.snap b/.forge-snapshots/settler_metaTxn_uniswapV3VIP_DAI-WETH.snap index 83e7e9902..a4e3d21f4 100644 --- a/.forge-snapshots/settler_metaTxn_uniswapV3VIP_DAI-WETH.snap +++ b/.forge-snapshots/settler_metaTxn_uniswapV3VIP_DAI-WETH.snap @@ -1 +1 @@ -125773 \ No newline at end of file +125772 \ No newline at end of file diff --git a/.forge-snapshots/settler_metaTxn_uniswapV3VIP_USDC-USDT.snap b/.forge-snapshots/settler_metaTxn_uniswapV3VIP_USDC-USDT.snap index 7e1ba4aa3..159e0710a 100644 --- a/.forge-snapshots/settler_metaTxn_uniswapV3VIP_USDC-USDT.snap +++ b/.forge-snapshots/settler_metaTxn_uniswapV3VIP_USDC-USDT.snap @@ -1 +1 @@ -132076 \ No newline at end of file +132075 \ No newline at end of file diff --git a/.forge-snapshots/settler_metaTxn_uniswapV3VIP_USDC-WETH.snap b/.forge-snapshots/settler_metaTxn_uniswapV3VIP_USDC-WETH.snap index 11024edb8..3ec6fa53a 100644 --- a/.forge-snapshots/settler_metaTxn_uniswapV3VIP_USDC-WETH.snap +++ b/.forge-snapshots/settler_metaTxn_uniswapV3VIP_USDC-WETH.snap @@ -1 +1 @@ -135102 \ No newline at end of file +135101 \ No newline at end of file diff --git a/.forge-snapshots/settler_metaTxn_uniswapV3VIP_USDT-WETH.snap b/.forge-snapshots/settler_metaTxn_uniswapV3VIP_USDT-WETH.snap index cc843fdcf..aaeb442ef 100644 --- a/.forge-snapshots/settler_metaTxn_uniswapV3VIP_USDT-WETH.snap +++ b/.forge-snapshots/settler_metaTxn_uniswapV3VIP_USDT-WETH.snap @@ -1 +1 @@ -137298 \ No newline at end of file +137297 \ No newline at end of file diff --git a/.forge-snapshots/settler_metaTxn_uniswapV3_DAI-WETH.snap b/.forge-snapshots/settler_metaTxn_uniswapV3_DAI-WETH.snap index 93ff8116f..523d23443 100644 --- a/.forge-snapshots/settler_metaTxn_uniswapV3_DAI-WETH.snap +++ b/.forge-snapshots/settler_metaTxn_uniswapV3_DAI-WETH.snap @@ -1 +1 @@ -151930 \ No newline at end of file +151929 \ No newline at end of file diff --git a/.forge-snapshots/settler_metaTxn_uniswapV3_USDC-USDT.snap b/.forge-snapshots/settler_metaTxn_uniswapV3_USDC-USDT.snap index 968491e26..86d87ba48 100644 --- a/.forge-snapshots/settler_metaTxn_uniswapV3_USDC-USDT.snap +++ b/.forge-snapshots/settler_metaTxn_uniswapV3_USDC-USDT.snap @@ -1 +1 @@ -162290 \ No newline at end of file +162289 \ No newline at end of file diff --git a/.forge-snapshots/settler_metaTxn_uniswapV3_USDC-WETH.snap b/.forge-snapshots/settler_metaTxn_uniswapV3_USDC-WETH.snap index 779824f09..40c8c2e09 100644 --- a/.forge-snapshots/settler_metaTxn_uniswapV3_USDC-WETH.snap +++ b/.forge-snapshots/settler_metaTxn_uniswapV3_USDC-WETH.snap @@ -1 +1 @@ -163974 \ No newline at end of file +163973 \ No newline at end of file diff --git a/.forge-snapshots/settler_metaTxn_uniswapV3_USDT-WETH.snap b/.forge-snapshots/settler_metaTxn_uniswapV3_USDT-WETH.snap index f6cbbde8b..197976a2c 100644 --- a/.forge-snapshots/settler_metaTxn_uniswapV3_USDT-WETH.snap +++ b/.forge-snapshots/settler_metaTxn_uniswapV3_USDT-WETH.snap @@ -1 +1 @@ -167311 \ No newline at end of file +167310 \ No newline at end of file diff --git a/.forge-snapshots/settler_pancakeInfinityVIP_Orvex-WETH-NVDA.snap b/.forge-snapshots/settler_pancakeInfinityVIP_Orvex-WETH-NVDA.snap index 5ab125787..2329e9f72 100644 --- a/.forge-snapshots/settler_pancakeInfinityVIP_Orvex-WETH-NVDA.snap +++ b/.forge-snapshots/settler_pancakeInfinityVIP_Orvex-WETH-NVDA.snap @@ -1 +1 @@ -249334 \ No newline at end of file +249295 \ No newline at end of file diff --git a/.forge-snapshots/settler_pancakeInfinityVIP_USDT-CAKE.snap b/.forge-snapshots/settler_pancakeInfinityVIP_USDT-CAKE.snap index 64c0e3090..8249207a9 100644 --- a/.forge-snapshots/settler_pancakeInfinityVIP_USDT-CAKE.snap +++ b/.forge-snapshots/settler_pancakeInfinityVIP_USDT-CAKE.snap @@ -1 +1 @@ -593565 \ No newline at end of file +593537 \ No newline at end of file diff --git a/.forge-snapshots/settler_pancakeInfinityVIP_USDT-WBNB.snap b/.forge-snapshots/settler_pancakeInfinityVIP_USDT-WBNB.snap index 032716eb4..dcb9e6d6e 100644 --- a/.forge-snapshots/settler_pancakeInfinityVIP_USDT-WBNB.snap +++ b/.forge-snapshots/settler_pancakeInfinityVIP_USDT-WBNB.snap @@ -1 +1 @@ -180458 \ No newline at end of file +180498 \ No newline at end of file diff --git a/.forge-snapshots/settler_pancakeInfinity_Orvex-WETH-NVDA.snap b/.forge-snapshots/settler_pancakeInfinity_Orvex-WETH-NVDA.snap index c1e1b6b97..a211bb622 100644 --- a/.forge-snapshots/settler_pancakeInfinity_Orvex-WETH-NVDA.snap +++ b/.forge-snapshots/settler_pancakeInfinity_Orvex-WETH-NVDA.snap @@ -1 +1 @@ -276980 \ No newline at end of file +276938 \ No newline at end of file diff --git a/.forge-snapshots/settler_pancakeInfinity_USDT-CAKE.snap b/.forge-snapshots/settler_pancakeInfinity_USDT-CAKE.snap index 1a81854d1..b196f267f 100644 --- a/.forge-snapshots/settler_pancakeInfinity_USDT-CAKE.snap +++ b/.forge-snapshots/settler_pancakeInfinity_USDT-CAKE.snap @@ -1 +1 @@ -619909 \ No newline at end of file +619878 \ No newline at end of file diff --git a/.forge-snapshots/settler_pancakeInfinity_USDT-WBNB.snap b/.forge-snapshots/settler_pancakeInfinity_USDT-WBNB.snap index cd29fcfc9..04b42e1eb 100644 --- a/.forge-snapshots/settler_pancakeInfinity_USDT-WBNB.snap +++ b/.forge-snapshots/settler_pancakeInfinity_USDT-WBNB.snap @@ -1 +1 @@ -206801 \ No newline at end of file +206838 \ No newline at end of file diff --git a/.forge-snapshots/settler_rfq_fee_full_custody_DAI-WETH.snap b/.forge-snapshots/settler_rfq_fee_full_custody_DAI-WETH.snap index 7ac7d5a63..83715b98b 100644 --- a/.forge-snapshots/settler_rfq_fee_full_custody_DAI-WETH.snap +++ b/.forge-snapshots/settler_rfq_fee_full_custody_DAI-WETH.snap @@ -1 +1 @@ -156475 \ No newline at end of file +156474 \ No newline at end of file diff --git a/.forge-snapshots/settler_rfq_fee_full_custody_USDC-USDT.snap b/.forge-snapshots/settler_rfq_fee_full_custody_USDC-USDT.snap index dc43a88aa..c49d88ffa 100644 --- a/.forge-snapshots/settler_rfq_fee_full_custody_USDC-USDT.snap +++ b/.forge-snapshots/settler_rfq_fee_full_custody_USDC-USDT.snap @@ -1 +1 @@ -180611 \ No newline at end of file +180610 \ No newline at end of file diff --git a/.forge-snapshots/settler_rfq_fee_full_custody_USDC-WETH.snap b/.forge-snapshots/settler_rfq_fee_full_custody_USDC-WETH.snap index 360b16efe..0c7dfe6a2 100644 --- a/.forge-snapshots/settler_rfq_fee_full_custody_USDC-WETH.snap +++ b/.forge-snapshots/settler_rfq_fee_full_custody_USDC-WETH.snap @@ -1 +1 @@ -175250 \ No newline at end of file +175249 \ No newline at end of file diff --git a/.forge-snapshots/settler_rfq_fee_full_custody_USDT-WETH.snap b/.forge-snapshots/settler_rfq_fee_full_custody_USDT-WETH.snap index 8fde3a6f0..bd8965c69 100644 --- a/.forge-snapshots/settler_rfq_fee_full_custody_USDT-WETH.snap +++ b/.forge-snapshots/settler_rfq_fee_full_custody_USDT-WETH.snap @@ -1 +1 @@ -171472 \ No newline at end of file +171471 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV2_DAI-WETH.snap b/.forge-snapshots/settler_uniswapV2_DAI-WETH.snap index 3a91d1b7d..42b1e7579 100644 --- a/.forge-snapshots/settler_uniswapV2_DAI-WETH.snap +++ b/.forge-snapshots/settler_uniswapV2_DAI-WETH.snap @@ -1 +1 @@ -136732 \ No newline at end of file +136731 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV2_USDC-WETH.snap b/.forge-snapshots/settler_uniswapV2_USDC-WETH.snap index c57ab2a2a..97721af08 100644 --- a/.forge-snapshots/settler_uniswapV2_USDC-WETH.snap +++ b/.forge-snapshots/settler_uniswapV2_USDC-WETH.snap @@ -1 +1 @@ -156215 \ No newline at end of file +156214 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV2_USDT-WETH.snap b/.forge-snapshots/settler_uniswapV2_USDT-WETH.snap index 5a695e104..1bedc0dde 100644 --- a/.forge-snapshots/settler_uniswapV2_USDT-WETH.snap +++ b/.forge-snapshots/settler_uniswapV2_USDT-WETH.snap @@ -1 +1 @@ -152129 \ No newline at end of file +152128 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV2_WETH-USDC.snap b/.forge-snapshots/settler_uniswapV2_WETH-USDC.snap index 1bfb01ca1..632a51f24 100644 --- a/.forge-snapshots/settler_uniswapV2_WETH-USDC.snap +++ b/.forge-snapshots/settler_uniswapV2_WETH-USDC.snap @@ -1 +1 @@ -147500 \ No newline at end of file +147499 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV2_fromNative_WETH-USDC.snap b/.forge-snapshots/settler_uniswapV2_fromNative_WETH-USDC.snap index 2c270ba2b..de95fbe1f 100644 --- a/.forge-snapshots/settler_uniswapV2_fromNative_WETH-USDC.snap +++ b/.forge-snapshots/settler_uniswapV2_fromNative_WETH-USDC.snap @@ -1 +1 @@ -139063 \ No newline at end of file +139062 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV2_single_chain_DAI-WETH.snap b/.forge-snapshots/settler_uniswapV2_single_chain_DAI-WETH.snap index 0d73c8afc..710d4c634 100644 --- a/.forge-snapshots/settler_uniswapV2_single_chain_DAI-WETH.snap +++ b/.forge-snapshots/settler_uniswapV2_single_chain_DAI-WETH.snap @@ -1 +1 @@ -111135 \ No newline at end of file +111134 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV2_single_chain_USDC-WETH.snap b/.forge-snapshots/settler_uniswapV2_single_chain_USDC-WETH.snap index 36623562d..730c94746 100644 --- a/.forge-snapshots/settler_uniswapV2_single_chain_USDC-WETH.snap +++ b/.forge-snapshots/settler_uniswapV2_single_chain_USDC-WETH.snap @@ -1 +1 @@ -128640 \ No newline at end of file +128639 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV2_single_chain_USDT-WETH.snap b/.forge-snapshots/settler_uniswapV2_single_chain_USDT-WETH.snap index aec543b60..0fd4af714 100644 --- a/.forge-snapshots/settler_uniswapV2_single_chain_USDT-WETH.snap +++ b/.forge-snapshots/settler_uniswapV2_single_chain_USDT-WETH.snap @@ -1 +1 @@ -123105 \ No newline at end of file +123104 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV2_single_chain_WETH-USDC.snap b/.forge-snapshots/settler_uniswapV2_single_chain_WETH-USDC.snap index bd44127dc..fb6001415 100644 --- a/.forge-snapshots/settler_uniswapV2_single_chain_WETH-USDC.snap +++ b/.forge-snapshots/settler_uniswapV2_single_chain_WETH-USDC.snap @@ -1 +1 @@ -122115 \ No newline at end of file +122114 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV2_toNative_DAI-WETH.snap b/.forge-snapshots/settler_uniswapV2_toNative_DAI-WETH.snap index d899a6e4b..1731ee58c 100644 --- a/.forge-snapshots/settler_uniswapV2_toNative_DAI-WETH.snap +++ b/.forge-snapshots/settler_uniswapV2_toNative_DAI-WETH.snap @@ -1 +1 @@ -155139 \ No newline at end of file +155138 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV2_toNative_USDC-WETH.snap b/.forge-snapshots/settler_uniswapV2_toNative_USDC-WETH.snap index df8624bb9..c8b69db42 100644 --- a/.forge-snapshots/settler_uniswapV2_toNative_USDC-WETH.snap +++ b/.forge-snapshots/settler_uniswapV2_toNative_USDC-WETH.snap @@ -1 +1 @@ -172644 \ No newline at end of file +172643 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV2_toNative_USDT-WETH.snap b/.forge-snapshots/settler_uniswapV2_toNative_USDT-WETH.snap index 9ba5032aa..8f51d73d5 100644 --- a/.forge-snapshots/settler_uniswapV2_toNative_USDT-WETH.snap +++ b/.forge-snapshots/settler_uniswapV2_toNative_USDT-WETH.snap @@ -1 +1 @@ -167109 \ No newline at end of file +167108 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3VIP_DAI-WETH.snap b/.forge-snapshots/settler_uniswapV3VIP_DAI-WETH.snap index 9463b024c..52197108f 100644 --- a/.forge-snapshots/settler_uniswapV3VIP_DAI-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3VIP_DAI-WETH.snap @@ -1 +1 @@ -120646 \ No newline at end of file +120645 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3VIP_USDC-USDT.snap b/.forge-snapshots/settler_uniswapV3VIP_USDC-USDT.snap index 31d438748..5e5b334f4 100644 --- a/.forge-snapshots/settler_uniswapV3VIP_USDC-USDT.snap +++ b/.forge-snapshots/settler_uniswapV3VIP_USDC-USDT.snap @@ -1 +1 @@ -126949 \ No newline at end of file +126948 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3VIP_USDC-WETH.snap b/.forge-snapshots/settler_uniswapV3VIP_USDC-WETH.snap index 9e8d7143d..93620a3e9 100644 --- a/.forge-snapshots/settler_uniswapV3VIP_USDC-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3VIP_USDC-WETH.snap @@ -1 +1 @@ -129975 \ No newline at end of file +129974 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3VIP_USDT-WETH.snap b/.forge-snapshots/settler_uniswapV3VIP_USDT-WETH.snap index 71b7f01de..8641a3e28 100644 --- a/.forge-snapshots/settler_uniswapV3VIP_USDT-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3VIP_USDT-WETH.snap @@ -1 +1 @@ -132171 \ No newline at end of file +132170 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3VIP_WETH-USDC.snap b/.forge-snapshots/settler_uniswapV3VIP_WETH-USDC.snap index c35fbfe1b..1f07be929 100644 --- a/.forge-snapshots/settler_uniswapV3VIP_WETH-USDC.snap +++ b/.forge-snapshots/settler_uniswapV3VIP_WETH-USDC.snap @@ -1 +1 @@ -130406 \ No newline at end of file +130405 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3VIP_toNative_DAI-WETH.snap b/.forge-snapshots/settler_uniswapV3VIP_toNative_DAI-WETH.snap index bc1f47080..97e8a93d9 100644 --- a/.forge-snapshots/settler_uniswapV3VIP_toNative_DAI-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3VIP_toNative_DAI-WETH.snap @@ -1 +1 @@ -164789 \ No newline at end of file +164788 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3VIP_toNative_USDC-WETH.snap b/.forge-snapshots/settler_uniswapV3VIP_toNative_USDC-WETH.snap index 1e6574557..549cf4094 100644 --- a/.forge-snapshots/settler_uniswapV3VIP_toNative_USDC-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3VIP_toNative_USDC-WETH.snap @@ -1 +1 @@ -174118 \ No newline at end of file +174117 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3VIP_toNative_USDT-WETH.snap b/.forge-snapshots/settler_uniswapV3VIP_toNative_USDT-WETH.snap index 48cb03099..676aad2b9 100644 --- a/.forge-snapshots/settler_uniswapV3VIP_toNative_USDT-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3VIP_toNative_USDT-WETH.snap @@ -1 +1 @@ -176314 \ No newline at end of file +176313 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_DAI-WETH.snap b/.forge-snapshots/settler_uniswapV3_DAI-WETH.snap index ecc6dc509..b2f807b87 100644 --- a/.forge-snapshots/settler_uniswapV3_DAI-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_DAI-WETH.snap @@ -1 +1 @@ -146864 \ No newline at end of file +146863 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_USDC-USDT.snap b/.forge-snapshots/settler_uniswapV3_USDC-USDT.snap index 26da52a51..895d2029f 100644 --- a/.forge-snapshots/settler_uniswapV3_USDC-USDT.snap +++ b/.forge-snapshots/settler_uniswapV3_USDC-USDT.snap @@ -1 +1 @@ -157224 \ No newline at end of file +157223 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_USDC-WETH.snap b/.forge-snapshots/settler_uniswapV3_USDC-WETH.snap index 4675e7356..974c68192 100644 --- a/.forge-snapshots/settler_uniswapV3_USDC-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_USDC-WETH.snap @@ -1 +1 @@ -158908 \ No newline at end of file +158907 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_USDT-WETH.snap b/.forge-snapshots/settler_uniswapV3_USDT-WETH.snap index d4e1b2df4..564e32a5a 100644 --- a/.forge-snapshots/settler_uniswapV3_USDT-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_USDT-WETH.snap @@ -1 +1 @@ -162245 \ No newline at end of file +162244 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_WETH-USDC.snap b/.forge-snapshots/settler_uniswapV3_WETH-USDC.snap index 022ddd705..0517d4bce 100644 --- a/.forge-snapshots/settler_uniswapV3_WETH-USDC.snap +++ b/.forge-snapshots/settler_uniswapV3_WETH-USDC.snap @@ -1 +1 @@ -156338 \ No newline at end of file +156337 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_DAI-WETH.snap b/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_DAI-WETH.snap index d40b0138c..6b0c9aaae 100644 --- a/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_DAI-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_DAI-WETH.snap @@ -1 +1 @@ -184380 \ No newline at end of file +184379 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_USDC-USDT.snap b/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_USDC-USDT.snap index 7e0e3d24f..d45386930 100644 --- a/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_USDC-USDT.snap +++ b/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_USDC-USDT.snap @@ -1 +1 @@ -200932 \ No newline at end of file +200931 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_USDC-WETH.snap b/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_USDC-WETH.snap index d3e27078d..3cb1259a1 100644 --- a/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_USDC-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_USDC-WETH.snap @@ -1 +1 @@ -196453 \ No newline at end of file +196452 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_USDT-WETH.snap b/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_USDT-WETH.snap index bf8070b52..5a46229b1 100644 --- a/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_USDT-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_USDT-WETH.snap @@ -1 +1 @@ -199790 \ No newline at end of file +199789 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_WETH-USDC.snap b/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_WETH-USDC.snap index 3d14283f8..9143472ba 100644 --- a/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_WETH-USDC.snap +++ b/.forge-snapshots/settler_uniswapV3_buyToken_fee_full_custody_WETH-USDC.snap @@ -1 +1 @@ -199844 \ No newline at end of file +199843 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_DAI-WETH.snap b/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_DAI-WETH.snap index 08ac50bdb..ff6bf1756 100644 --- a/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_DAI-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_DAI-WETH.snap @@ -1 +1 @@ -158303 \ No newline at end of file +158302 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_USDC-USDT.snap b/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_USDC-USDT.snap index f38e70759..e6d59c2a2 100644 --- a/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_USDC-USDT.snap +++ b/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_USDC-USDT.snap @@ -1 +1 @@ -170798 \ No newline at end of file +170797 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_USDC-WETH.snap b/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_USDC-WETH.snap index 51be611fe..cdc1b1085 100644 --- a/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_USDC-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_USDC-WETH.snap @@ -1 +1 @@ -167661 \ No newline at end of file +167660 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_USDT-WETH.snap b/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_USDT-WETH.snap index bd62605ed..e171c0610 100644 --- a/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_USDT-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_USDT-WETH.snap @@ -1 +1 @@ -169857 \ No newline at end of file +169856 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_WETH-USDC.snap b/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_WETH-USDC.snap index 1bbedff29..ead6415a6 100644 --- a/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_WETH-USDC.snap +++ b/.forge-snapshots/settler_uniswapV3_buyToken_fee_single_custody_WETH-USDC.snap @@ -1 +1 @@ -174047 \ No newline at end of file +174046 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_fromNative_WETH-USDC.snap b/.forge-snapshots/settler_uniswapV3_fromNative_WETH-USDC.snap index b065664d6..d9de07732 100644 --- a/.forge-snapshots/settler_uniswapV3_fromNative_WETH-USDC.snap +++ b/.forge-snapshots/settler_uniswapV3_fromNative_WETH-USDC.snap @@ -1 +1 @@ -147938 \ No newline at end of file +147937 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_multiplex2_DAI-WETH.snap b/.forge-snapshots/settler_uniswapV3_multiplex2_DAI-WETH.snap index a56fd9a5d..a87ec0fab 100644 --- a/.forge-snapshots/settler_uniswapV3_multiplex2_DAI-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_multiplex2_DAI-WETH.snap @@ -1 +1 @@ -179262 \ No newline at end of file +179261 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_multiplex2_USDC-USDT.snap b/.forge-snapshots/settler_uniswapV3_multiplex2_USDC-USDT.snap index a6712db0f..f5052a95f 100644 --- a/.forge-snapshots/settler_uniswapV3_multiplex2_USDC-USDT.snap +++ b/.forge-snapshots/settler_uniswapV3_multiplex2_USDC-USDT.snap @@ -1 +1 @@ -194271 \ No newline at end of file +194270 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_multiplex2_USDC-WETH.snap b/.forge-snapshots/settler_uniswapV3_multiplex2_USDC-WETH.snap index 3b79c8b2a..48ecb9510 100644 --- a/.forge-snapshots/settler_uniswapV3_multiplex2_USDC-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_multiplex2_USDC-WETH.snap @@ -1 +1 @@ -195991 \ No newline at end of file +195990 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_multiplex2_USDT-WETH.snap b/.forge-snapshots/settler_uniswapV3_multiplex2_USDT-WETH.snap index c68a4ca6d..ec32f8694 100644 --- a/.forge-snapshots/settler_uniswapV3_multiplex2_USDT-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_multiplex2_USDT-WETH.snap @@ -1 +1 @@ -196922 \ No newline at end of file +196921 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_multiplex2_WETH-USDC.snap b/.forge-snapshots/settler_uniswapV3_multiplex2_WETH-USDC.snap index 6fdb7637e..6c68ccb71 100644 --- a/.forge-snapshots/settler_uniswapV3_multiplex2_WETH-USDC.snap +++ b/.forge-snapshots/settler_uniswapV3_multiplex2_WETH-USDC.snap @@ -1 +1 @@ -190099 \ No newline at end of file +190098 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_DAI-WETH.snap b/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_DAI-WETH.snap index 1f0ee5431..8df1e2410 100644 --- a/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_DAI-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_DAI-WETH.snap @@ -1 +1 @@ -158273 \ No newline at end of file +158272 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_USDC-USDT.snap b/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_USDC-USDT.snap index 61c14fec2..2c5a492aa 100644 --- a/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_USDC-USDT.snap +++ b/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_USDC-USDT.snap @@ -1 +1 @@ -172689 \ No newline at end of file +172688 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_USDC-WETH.snap b/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_USDC-WETH.snap index dab9f4e5a..575da796c 100644 --- a/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_USDC-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_USDC-WETH.snap @@ -1 +1 @@ -173032 \ No newline at end of file +173031 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_USDT-WETH.snap b/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_USDT-WETH.snap index b01d458c7..aedf1c446 100644 --- a/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_USDT-WETH.snap +++ b/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_USDT-WETH.snap @@ -1 +1 @@ -175430 \ No newline at end of file +175429 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_WETH-USDC.snap b/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_WETH-USDC.snap index d22e0c02f..f25f83cb7 100644 --- a/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_WETH-USDC.snap +++ b/.forge-snapshots/settler_uniswapV3_sellToken_fee_full_custody_WETH-USDC.snap @@ -1 +1 @@ -167467 \ No newline at end of file +167466 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_DAI-WETH.snap b/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_DAI-WETH.snap new file mode 100644 index 000000000..239b8b91b --- /dev/null +++ b/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_DAI-WETH.snap @@ -0,0 +1 @@ +153774 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_USDC-USDT.snap b/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_USDC-USDT.snap new file mode 100644 index 000000000..671032cf0 --- /dev/null +++ b/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_USDC-USDT.snap @@ -0,0 +1 @@ +161690 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_USDC-WETH.snap b/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_USDC-WETH.snap new file mode 100644 index 000000000..6756afa35 --- /dev/null +++ b/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_USDC-WETH.snap @@ -0,0 +1 @@ +162033 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_USDT-WETH.snap b/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_USDT-WETH.snap new file mode 100644 index 000000000..6c7324492 --- /dev/null +++ b/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_USDT-WETH.snap @@ -0,0 +1 @@ +168931 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_WETH-USDC.snap b/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_WETH-USDC.snap new file mode 100644 index 000000000..4bf1255df --- /dev/null +++ b/.forge-snapshots/settler_uniswapV3_sellToken_fee_sub_bp_WETH-USDC.snap @@ -0,0 +1 @@ +162968 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV4VIP_toNative_DAI-WETH.snap b/.forge-snapshots/settler_uniswapV4VIP_toNative_DAI-WETH.snap index 112d4a20e..afc690c28 100644 --- a/.forge-snapshots/settler_uniswapV4VIP_toNative_DAI-WETH.snap +++ b/.forge-snapshots/settler_uniswapV4VIP_toNative_DAI-WETH.snap @@ -1 +1 @@ -118029 \ No newline at end of file +118028 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV4VIP_toNative_USDC-WETH.snap b/.forge-snapshots/settler_uniswapV4VIP_toNative_USDC-WETH.snap index 193b1f2c6..9926192b0 100644 --- a/.forge-snapshots/settler_uniswapV4VIP_toNative_USDC-WETH.snap +++ b/.forge-snapshots/settler_uniswapV4VIP_toNative_USDC-WETH.snap @@ -1 +1 @@ -135362 \ No newline at end of file +135361 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV4VIP_toNative_USDT-WETH.snap b/.forge-snapshots/settler_uniswapV4VIP_toNative_USDT-WETH.snap index 75b82d5a5..2fa67f53e 100644 --- a/.forge-snapshots/settler_uniswapV4VIP_toNative_USDT-WETH.snap +++ b/.forge-snapshots/settler_uniswapV4VIP_toNative_USDT-WETH.snap @@ -1 +1 @@ -129759 \ No newline at end of file +129758 \ No newline at end of file diff --git a/.forge-snapshots/settler_uniswapV4_fromNative_WETH-USDC.snap b/.forge-snapshots/settler_uniswapV4_fromNative_WETH-USDC.snap index c9e1326f9..d47f2cfa1 100644 --- a/.forge-snapshots/settler_uniswapV4_fromNative_WETH-USDC.snap +++ b/.forge-snapshots/settler_uniswapV4_fromNative_WETH-USDC.snap @@ -1 +1 @@ -107136 \ No newline at end of file +107135 \ No newline at end of file diff --git a/.forge-snapshots/settler_zeroExOtc_DAI-WETH.snap b/.forge-snapshots/settler_zeroExOtc_DAI-WETH.snap index 3f4ff669b..8c54408f5 100644 --- a/.forge-snapshots/settler_zeroExOtc_DAI-WETH.snap +++ b/.forge-snapshots/settler_zeroExOtc_DAI-WETH.snap @@ -1 +1 @@ -173162 \ No newline at end of file +173161 \ No newline at end of file diff --git a/.forge-snapshots/settler_zeroExOtc_USDC-USDT.snap b/.forge-snapshots/settler_zeroExOtc_USDC-USDT.snap index 6e9bcbd48..e2d6dfa12 100644 --- a/.forge-snapshots/settler_zeroExOtc_USDC-USDT.snap +++ b/.forge-snapshots/settler_zeroExOtc_USDC-USDT.snap @@ -1 +1 @@ -201622 \ No newline at end of file +201621 \ No newline at end of file diff --git a/.forge-snapshots/settler_zeroExOtc_USDC-WETH.snap b/.forge-snapshots/settler_zeroExOtc_USDC-WETH.snap index e17a29ad2..0a1c6c1f4 100644 --- a/.forge-snapshots/settler_zeroExOtc_USDC-WETH.snap +++ b/.forge-snapshots/settler_zeroExOtc_USDC-WETH.snap @@ -1 +1 @@ -198232 \ No newline at end of file +198231 \ No newline at end of file diff --git a/.forge-snapshots/settler_zeroExOtc_USDT-WETH.snap b/.forge-snapshots/settler_zeroExOtc_USDT-WETH.snap index 3b389fc87..4b1517ec5 100644 --- a/.forge-snapshots/settler_zeroExOtc_USDT-WETH.snap +++ b/.forge-snapshots/settler_zeroExOtc_USDT-WETH.snap @@ -1 +1 @@ -188494 \ No newline at end of file +188493 \ No newline at end of file diff --git a/.forge-snapshots/settler_zeroExOtc_WETH-USDC.snap b/.forge-snapshots/settler_zeroExOtc_WETH-USDC.snap index 647298c76..3d4a25358 100644 --- a/.forge-snapshots/settler_zeroExOtc_WETH-USDC.snap +++ b/.forge-snapshots/settler_zeroExOtc_WETH-USDC.snap @@ -1 +1 @@ -191787 \ No newline at end of file +191786 \ No newline at end of file diff --git a/.forge-snapshots/settler_zeroExOtc_partialFill_DAI-WETH.snap b/.forge-snapshots/settler_zeroExOtc_partialFill_DAI-WETH.snap index ed9ba46b4..c16b8096d 100644 --- a/.forge-snapshots/settler_zeroExOtc_partialFill_DAI-WETH.snap +++ b/.forge-snapshots/settler_zeroExOtc_partialFill_DAI-WETH.snap @@ -1 +1 @@ -180145 \ No newline at end of file +180144 \ No newline at end of file diff --git a/.forge-snapshots/settler_zeroExOtc_partialFill_USDC-USDT.snap b/.forge-snapshots/settler_zeroExOtc_partialFill_USDC-USDT.snap index 8daeafc98..10b29facf 100644 --- a/.forge-snapshots/settler_zeroExOtc_partialFill_USDC-USDT.snap +++ b/.forge-snapshots/settler_zeroExOtc_partialFill_USDC-USDT.snap @@ -1 +1 @@ -210661 \ No newline at end of file +210660 \ No newline at end of file diff --git a/.forge-snapshots/settler_zeroExOtc_partialFill_USDC-WETH.snap b/.forge-snapshots/settler_zeroExOtc_partialFill_USDC-WETH.snap index 54af1e4e3..01ee92704 100644 --- a/.forge-snapshots/settler_zeroExOtc_partialFill_USDC-WETH.snap +++ b/.forge-snapshots/settler_zeroExOtc_partialFill_USDC-WETH.snap @@ -1 +1 @@ -207930 \ No newline at end of file +207929 \ No newline at end of file diff --git a/.forge-snapshots/settler_zeroExOtc_partialFill_USDT-WETH.snap b/.forge-snapshots/settler_zeroExOtc_partialFill_USDT-WETH.snap index 613df9708..a8f8d7a8e 100644 --- a/.forge-snapshots/settler_zeroExOtc_partialFill_USDT-WETH.snap +++ b/.forge-snapshots/settler_zeroExOtc_partialFill_USDT-WETH.snap @@ -1 +1 @@ -197253 \ No newline at end of file +197252 \ No newline at end of file diff --git a/.forge-snapshots/settler_zeroExOtc_partialFill_WETH-USDC.snap b/.forge-snapshots/settler_zeroExOtc_partialFill_WETH-USDC.snap index 404c1dcaf..531d72a09 100644 --- a/.forge-snapshots/settler_zeroExOtc_partialFill_WETH-USDC.snap +++ b/.forge-snapshots/settler_zeroExOtc_partialFill_WETH-USDC.snap @@ -1 +1 @@ -198490 \ No newline at end of file +198489 \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md index 27644fbbd..ba50b62f7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -408,7 +408,7 @@ See `.github/workflows/test.yml` and `.github/workflows/integration.yml` for the ## Key Constants ```solidity -uint256 internal constant BASIS = 10_000; // BPS denominator +uint256 internal constant BASIS = 1_000_000; // ppm (parts-per-million) proportion denominator IERC20 internal constant ETH_ADDRESS = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); ``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 122482e37..0f5a918c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ `recipient`, `buyToken`, `maxSellAmount`, `refundNativeEth`, and `maxRefundAmount` * SolidlyV3 UniV3 fork removed from Sonic +* All proportional-amount action arguments are now denominated in parts-per-million (`ppm`; denominator 1_000_000) instead of basis points (`bps`; denominator 10_000) + * Affects the `bps` (now `ppm`) argument of `UNISWAPV3`, `UNISWAPV2`, `BASIC`, `VELODROME`, `MAKERPSM`, `DODOV1`, `DODOV2`, `MAVERICKV2`, `EULERSWAP`, `HANJI`, `UNISWAPV4`, `BALANCERV3`, `PANCAKE_INFINITY`, `EKUBO`, and `EKUBOV3` actions. + * Affects the `maxBps` (now `maxPpm`) argument of `POSITIVE_SLIPPAGE` + * Action selectors are unchanged (the arguments are `uint256` at the ABI level); only the interpretation of the value changes + * In the packed `fills` encoding of `UNISWAPV4`, `BALANCERV3`, `PANCAKE_INFINITY`, `EKUBO`, and `EKUBOV3`, the leading proportion field of each fill (and the corresponding field of the non-VIP header) widens from 2 bytes to 3 bytes + * `BALANCERV3` wrap/unwrap flags move from bits 15/14 to bits 23/22 of the fill's proportion field + * The Ekubo forwarding-extension flag moves from bit 15 to bit 23 + * The Permit2 balance-proportional sell amount sentinel widens: `permit.permitted.amount > type(uint256).max - 1_000_000` now encodes a proportion in `ppm` as `type(uint256).max - (1_000_000 - ppm)` ### Non-breaking changes diff --git a/sh/initial_description_crosschain_intent.md b/sh/initial_description_crosschain_intent.md index 17df0489d..025da8cb5 100644 --- a/sh/initial_description_crosschain_intent.md +++ b/sh/initial_description_crosschain_intent.md @@ -45,7 +45,7 @@ This provides enhanced security at the cost of some gas and inconvenience. encoded in calldata. Actions are ABIEncoded with a selector. See `ICrossChainIntentSettlerActions` for the available options. Typically, actions are parametrized by the `recipient` where tokens are sent after the trade and -the `bps` specifying a proportion of the `Settler` contract's token balance to +the `ppm` specifying a proportion of the `Settler` contract's token balance to be liquidated in the action. ## Action encoding diff --git a/sh/initial_description_intent.md b/sh/initial_description_intent.md index 8438d9044..bb464eb10 100644 --- a/sh/initial_description_intent.md +++ b/sh/initial_description_intent.md @@ -42,7 +42,7 @@ This provides enhanced security at the cost of some gas and inconvenience. 0x Settler settles swaps by performing a sequence of actions encoded in calldata. Actions are ABIEncoded with a selector. See `ISettlerActions` for the available options. Typically, actions are parametrized by the `recipient` where -tokens are sent after the trade and the `bps` specifying a proportion of the +tokens are sent after the trade and the `ppm` specifying a proportion of the `Settler` contract's token balance to be liquidated in the action. ## Action encoding diff --git a/sh/initial_description_metatx.md b/sh/initial_description_metatx.md index bbc06421e..71ae4df90 100644 --- a/sh/initial_description_metatx.md +++ b/sh/initial_description_metatx.md @@ -42,7 +42,7 @@ This provides enhanced security at the cost of some gas and inconvenience. 0x Settler settles swaps by performing a sequence of actions encoded in calldata. Actions are ABIEncoded with a selector. See `ISettlerActions` for the available options. Typically, actions are parametrized by the `recipient` where -tokens are sent after the trade and the `bps` specifying a proportion of the +tokens are sent after the trade and the `ppm` specifying a proportion of the `Settler` contract's token balance to be liquidated in the action. ## Action encoding diff --git a/sh/initial_description_taker.md b/sh/initial_description_taker.md index 9b952596b..4d1367e7c 100644 --- a/sh/initial_description_taker.md +++ b/sh/initial_description_taker.md @@ -46,7 +46,7 @@ allowance target, `AllowanceHolder` is provided (see above). 0x Settler settles swaps by performing a sequence of actions encoded in calldata. Actions are ABIEncoded with a selector. See `ISettlerActions` for the available options. Typically, actions are parametrized by the `recipient` where -tokens are sent after the trade and the `bps` specifying a proportion of the +tokens are sent after the trade and the `ppm` specifying a proportion of the `Settler` contract's token balance to be liquidated in the action. ## Action encoding diff --git a/src/ISettlerActions.sol b/src/ISettlerActions.sol index e9e218594..a25e7f744 100644 --- a/src/ISettlerActions.sol +++ b/src/ISettlerActions.sol @@ -54,7 +54,7 @@ interface ISettlerActions { function UNISWAPV4( address recipient, address sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -84,7 +84,7 @@ interface ISettlerActions { function BALANCERV3( address recipient, address sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -114,7 +114,7 @@ interface ISettlerActions { function PANCAKE_INFINITY( address recipient, address sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -144,7 +144,7 @@ interface ISettlerActions { /// @dev Trades against UniswapV3 using the contracts balance for funding // Pre-req: Funded // Post-req: Payout - function UNISWAPV3(address recipient, uint256 bps, bytes memory path, uint256 amountOutMin) external; + function UNISWAPV3(address recipient, uint256 ppm, bytes memory path, uint256 amountOutMin) external; /// @dev Trades against UniswapV3 using user funds via Permit2 for funding function UNISWAPV3_VIP( address recipient, @@ -161,7 +161,7 @@ interface ISettlerActions { uint256 amountOutMin ) external; - function MAKERPSM(address recipient, uint256 bps, bool buyGem, uint256 amountOutMin, address psm, address dai) + function MAKERPSM(address recipient, uint256 ppm, bool buyGem, uint256 amountOutMin, address psm, address dai) external; function CURVE_TRICRYPTO_VIP( @@ -178,17 +178,17 @@ interface ISettlerActions { uint256 minBuyAmount ) external; - function DODOV1(address sellToken, uint256 bps, address pool, bool quoteForBase, uint256 minBuyAmount) external; + function DODOV1(address sellToken, uint256 ppm, address pool, bool quoteForBase, uint256 minBuyAmount) external; function DODOV2( address recipient, address sellToken, - uint256 bps, + uint256 ppm, address pool, bool quoteForBase, uint256 minBuyAmount ) external; - function VELODROME(address recipient, uint256 bps, address pool, uint24 swapInfo, uint256 minBuyAmount) external; + function VELODROME(address recipient, uint256 ppm, address pool, uint24 swapInfo, uint256 minBuyAmount) external; /// @dev Trades against MaverickV2 using the contracts balance for funding /// This action does not use the MaverickV2 callback, so it takes an arbitrary pool address to make calls against. @@ -196,7 +196,7 @@ interface ISettlerActions { function MAVERICKV2( address recipient, address sellToken, - uint256 bps, + uint256 ppm, address pool, bool tokenAIn, int32 tickLimit, @@ -210,24 +210,24 @@ interface ISettlerActions { function UNISWAPV2( address recipient, address sellToken, - uint256 bps, + uint256 ppm, address pool, uint24 swapInfo, uint256 amountOutMin ) external; - function POSITIVE_SLIPPAGE(address payable recipient, address token, uint256 expectedAmount, uint256 maxBps) + function POSITIVE_SLIPPAGE(address payable recipient, address token, uint256 expectedAmount, uint256 maxPpm) external; /// @dev Trades against a basic AMM which follows the approval, transferFrom(msg.sender) interaction // Pre-req: Funded // Post-req: Payout - function BASIC(address sellToken, uint256 bps, address pool, uint256 offset, bytes calldata data) external; + function BASIC(address sellToken, uint256 ppm, address pool, uint256 offset, bytes calldata data) external; function EKUBO( address recipient, address sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -238,7 +238,7 @@ interface ISettlerActions { function EKUBOV3( address recipient, address sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -270,7 +270,7 @@ interface ISettlerActions { function EULERSWAP( address recipient, address sellToken, - uint256 bps, + uint256 ppm, address pool, bool zeroForOne, uint256 amountOutMin @@ -319,7 +319,7 @@ interface ISettlerActions { function HANJI( address sellToken, - uint256 bps, + uint256 ppm, address pool, uint256 sellScalingFactor, uint256 buyScalingFactor, diff --git a/src/SettlerAbstract.sol b/src/SettlerAbstract.sol index 99147928d..8c5b6630f 100644 --- a/src/SettlerAbstract.sol +++ b/src/SettlerAbstract.sol @@ -5,6 +5,7 @@ import {IERC20} from "@forge-std/interfaces/IERC20.sol"; import {ISettlerBase} from "./interfaces/ISettlerBase.sol"; import {Permit2PaymentAbstract} from "./core/Permit2PaymentAbstract.sol"; import {uint512} from "./utils/512Math.sol"; +import "./core/Constants.sol" as Constants; abstract contract SettlerAbstract is Permit2PaymentAbstract { // Permit2 Witness for meta transactions @@ -16,8 +17,8 @@ abstract contract SettlerAbstract is Permit2PaymentAbstract { string internal constant SLIPPAGE_TYPE = "Slippage(address recipient,address buyToken,uint256 minAmountOut)"; bytes32 internal constant SLIPPAGE_TYPEHASH = 0xdc83993a2ffc65b01b71ed08790b6e39c5c55d76937b62a3b5085b02071f1259; - uint256 internal constant BASIS = 10_000; - IERC20 internal constant ETH_ADDRESS = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); + uint256 internal constant BASIS = Constants.BASIS; + IERC20 internal constant ETH_ADDRESS = IERC20(Constants.ETH_ADDRESS); constructor() { assert(SLIPPAGE_AND_ACTIONS_TYPEHASH == keccak256(bytes(SLIPPAGE_AND_ACTIONS_TYPE))); diff --git a/src/SettlerBase.sol b/src/SettlerBase.sol index d8eca63eb..7a23d246d 100644 --- a/src/SettlerBase.sol +++ b/src/SettlerBase.sol @@ -136,34 +136,34 @@ abstract contract SettlerBase is ISettlerBase, Basic, RfqOrderSettlement, Uniswa fillRfqOrderSelfFunded(recipient, permit, maker, makerSig, takerToken, maxTakerAmount); } else if (action == uint32(ISettlerActions.UNISWAPV3.selector)) { - (address recipient, uint256 bps, bytes memory path, uint256 amountOutMin) = + (address recipient, uint256 ppm, bytes memory path, uint256 amountOutMin) = abi.decode(data, (address, uint256, bytes, uint256)); - sellToUniswapV3(recipient, bps, path, amountOutMin); + sellToUniswapV3(recipient, ppm, path, amountOutMin); } else if (action == uint32(ISettlerActions.UNISWAPV2.selector)) { - (address recipient, address sellToken, uint256 bps, address pool, uint24 swapInfo, uint256 amountOutMin) = + (address recipient, address sellToken, uint256 ppm, address pool, uint24 swapInfo, uint256 amountOutMin) = abi.decode(data, (address, address, uint256, address, uint24, uint256)); - sellToUniswapV2(recipient, sellToken, bps, pool, swapInfo, amountOutMin); + sellToUniswapV2(recipient, sellToken, ppm, pool, swapInfo, amountOutMin); } else if (action == uint32(ISettlerActions.BASIC.selector)) { - (IERC20 sellToken, uint256 bps, address pool, uint256 offset, bytes memory _data) = + (IERC20 sellToken, uint256 ppm, address pool, uint256 offset, bytes memory _data) = abi.decode(data, (IERC20, uint256, address, uint256, bytes)); - basicSellToPool(sellToken, bps, pool, offset, _data); + basicSellToPool(sellToken, ppm, pool, offset, _data); } else if (action == uint32(ISettlerActions.VELODROME.selector)) { - (address recipient, uint256 bps, IVelodromePair pool, uint24 swapInfo, uint256 minAmountOut) = + (address recipient, uint256 ppm, IVelodromePair pool, uint24 swapInfo, uint256 minAmountOut) = abi.decode(data, (address, uint256, IVelodromePair, uint24, uint256)); - sellToVelodrome(recipient, bps, pool, swapInfo, minAmountOut); + sellToVelodrome(recipient, ppm, pool, swapInfo, minAmountOut); } else if (action == uint32(ISettlerActions.POSITIVE_SLIPPAGE.selector)) { - (address payable recipient, IERC20 token, uint256 expectedAmount, uint256 maxBps) = + (address payable recipient, IERC20 token, uint256 expectedAmount, uint256 maxPpm) = abi.decode(data, (address, IERC20, uint256, uint256)); bool isETH = (token == ETH_ADDRESS); uint256 balance = isETH ? address(this).balance : token.fastBalanceOf(address(this)); if (balance > expectedAmount) { uint256 cap; unchecked { - cap = balance * maxBps / BASIS; + cap = balance * maxPpm / BASIS; balance -= expectedAmount; } balance = (balance > cap).ternary(cap, balance); diff --git a/src/bridge/BridgeSettlerBase.sol b/src/bridge/BridgeSettlerBase.sol index 0c2a3b909..4d54c1e79 100644 --- a/src/bridge/BridgeSettlerBase.sol +++ b/src/bridge/BridgeSettlerBase.sol @@ -80,10 +80,10 @@ abstract contract BridgeSettlerBase is SettlerBridgeAbstract, Basic, Relay, Laye ALLOWANCE_HOLDER.exec(settler, token, amount, payable(settler), settlerData); } } else if (action == uint32(IBridgeSettlerActions.BASIC.selector)) { - (address bridgeToken, uint256 bps, address pool, uint256 offset, bytes memory bridgeData) = + (address bridgeToken, uint256 ppm, address pool, uint256 offset, bytes memory bridgeData) = abi.decode(data, (address, uint256, address, uint256, bytes)); - basicSellToPool(IERC20(bridgeToken), bps, pool, offset, bridgeData); + basicSellToPool(IERC20(bridgeToken), ppm, pool, offset, bridgeData); } else if (action == uint32(IBridgeSettlerActions.BRIDGE_ERC20_TO_RELAY.selector)) { (address token, address to, bytes32 requestId) = abi.decode(data, (address, address, bytes32)); bridgeERC20ToRelay(IERC20(token), to, requestId); diff --git a/src/bridge/IBridgeSettlerActions.sol b/src/bridge/IBridgeSettlerActions.sol index a2a7bc715..bf4eaa605 100644 --- a/src/bridge/IBridgeSettlerActions.sol +++ b/src/bridge/IBridgeSettlerActions.sol @@ -16,7 +16,7 @@ interface IBridgeSettlerActions { /// @dev Bridge through a Bridge that follows the approval, transferFrom(msg.sender) interaction /// Pre-req: Funded - function BASIC(address bridgeToken, uint256 bps, address pool, uint256 offset, bytes calldata data) external; + function BASIC(address bridgeToken, uint256 ppm, address pool, uint256 offset, bytes calldata data) external; /// @dev Bridge ERC20 tokens through Relay function BRIDGE_ERC20_TO_RELAY(address token, address to, bytes32 requestId) external; diff --git a/src/chains/Arbitrum/Common.sol b/src/chains/Arbitrum/Common.sol index 18c89038a..7be95ec73 100644 --- a/src/chains/Arbitrum/Common.sol +++ b/src/chains/Arbitrum/Common.sol @@ -81,7 +81,7 @@ abstract contract ArbitrumMixin is ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -89,12 +89,12 @@ abstract contract ArbitrumMixin is uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.BALANCERV3.selector)) { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -102,19 +102,19 @@ abstract contract ArbitrumMixin is uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToBalancerV3(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToBalancerV3(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.MAVERICKV2.selector)) { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, IMaverickV2Pool pool, bool tokenAIn, int32 tickLimit, uint256 minBuyAmount ) = abi.decode(data, (address, IERC20, uint256, IMaverickV2Pool, bool, int32, uint256)); - sellToMaverickV2(recipient, sellToken, bps, pool, tokenAIn, tickLimit, minBuyAmount); + sellToMaverickV2(recipient, sellToken, ppm, pool, tokenAIn, tickLimit, minBuyAmount); } else if (action == uint32(ISettlerActions.BEBOP.selector)) { ( address recipient, @@ -128,15 +128,15 @@ abstract contract ArbitrumMixin is sellToBebop(payable(recipient), sellToken, order, makerSignature, amountOutMin); } else if (action == uint32(ISettlerActions.DODOV2.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = + (address recipient, IERC20 sellToken, uint256 ppm, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (address, IERC20, uint256, IDodoV2, bool, uint256)); - sellToDodoV2(recipient, sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV2(recipient, sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else if (action == uint32(ISettlerActions.DODOV1.selector)) { - (IERC20 sellToken, uint256 bps, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = + (IERC20 sellToken, uint256 ppm, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (IERC20, uint256, IDodoV1, bool, uint256)); - sellToDodoV1(sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV1(sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else if (action == uint32(ISettlerActions.RENEGADE.selector)) { ( address recipient, diff --git a/src/chains/Avalanche/Common.sol b/src/chains/Avalanche/Common.sol index 4c73bea68..3a1901127 100644 --- a/src/chains/Avalanche/Common.sol +++ b/src/chains/Avalanche/Common.sol @@ -47,7 +47,7 @@ abstract contract AvalancheMixin is FreeMemory, SettlerBase, DodoV2, UniswapV4, ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -55,17 +55,17 @@ abstract contract AvalancheMixin is FreeMemory, SettlerBase, DodoV2, UniswapV4, uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.EULERSWAP.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = + (address recipient, IERC20 sellToken, uint256 ppm, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = abi.decode(data, (address, IERC20, uint256, IEulerSwap, bool, uint256)); - sellToEulerSwap(recipient, sellToken, bps, pool, zeroForOne, amountOutMin); + sellToEulerSwap(recipient, sellToken, ppm, pool, zeroForOne, amountOutMin); } else if (action == uint32(ISettlerActions.BALANCERV3.selector)) { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -73,7 +73,7 @@ abstract contract AvalancheMixin is FreeMemory, SettlerBase, DodoV2, UniswapV4, uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToBalancerV3(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToBalancerV3(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.BEBOP.selector)) { ( address recipient, @@ -87,10 +87,10 @@ abstract contract AvalancheMixin is FreeMemory, SettlerBase, DodoV2, UniswapV4, sellToBebop(payable(recipient), sellToken, order, makerSignature, amountOutMin); } else if (action == uint32(ISettlerActions.DODOV2.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = + (address recipient, IERC20 sellToken, uint256 ppm, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (address, IERC20, uint256, IDodoV2, bool, uint256)); - sellToDodoV2(recipient, sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV2(recipient, sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else { return false; } diff --git a/src/chains/Base/Common.sol b/src/chains/Base/Common.sol index cea079828..840662a92 100644 --- a/src/chains/Base/Common.sol +++ b/src/chains/Base/Common.sol @@ -102,7 +102,7 @@ abstract contract BaseMixin is ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -111,31 +111,31 @@ abstract contract BaseMixin is ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); if (action == uint32(ISettlerActions.UNISWAPV4.selector)) { - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.BALANCERV3.selector)) { - sellToBalancerV3(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToBalancerV3(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else { // if (action == uint32(ISettlerActions.PANCAKE_INFINITY.selector)) - sellToPancakeInfinity(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToPancakeInfinity(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } /* } else if (action == uint32(ISettlerActions.EULERSWAP.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = + (address recipient, IERC20 sellToken, uint256 ppm, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = abi.decode(data, (address, IERC20, uint256, IEulerSwap, bool, uint256)); - sellToEulerSwap(recipient, sellToken, bps, pool, zeroForOne, amountOutMin); + sellToEulerSwap(recipient, sellToken, ppm, pool, zeroForOne, amountOutMin); */ } else if (action == uint32(ISettlerActions.MAVERICKV2.selector)) { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, IMaverickV2Pool pool, bool tokenAIn, int32 tickLimit, uint256 minBuyAmount ) = abi.decode(data, (address, IERC20, uint256, IMaverickV2Pool, bool, int32, uint256)); - sellToMaverickV2(recipient, sellToken, bps, pool, tokenAIn, tickLimit, minBuyAmount); + sellToMaverickV2(recipient, sellToken, ppm, pool, tokenAIn, tickLimit, minBuyAmount); } else if (action == uint32(ISettlerActions.BEBOP.selector)) { ( address recipient, @@ -149,10 +149,10 @@ abstract contract BaseMixin is sellToBebop(payable(recipient), sellToken, order, makerSignature, amountOutMin); } else if (action == uint32(ISettlerActions.DODOV2.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = + (address recipient, IERC20 sellToken, uint256 ppm, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (address, IERC20, uint256, IDodoV2, bool, uint256)); - sellToDodoV2(recipient, sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV2(recipient, sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else if (action == uint32(ISettlerActions.RENEGADE.selector)) { ( address recipient, @@ -178,7 +178,7 @@ abstract contract BaseMixin is } else if (action == uint32(ISettlerActions.HANJI.selector)) { ( IERC20 sellToken, - uint256 bps, + uint256 ppm, address pool, uint256 sellScalingFactor, uint256 buyScalingFactor, @@ -187,7 +187,7 @@ abstract contract BaseMixin is uint256 minBuyAmount ) = abi.decode(data, (IERC20, uint256, address, uint256, uint256, bool, uint256, uint256)); - sellToHanji(sellToken, bps, pool, sellScalingFactor, buyScalingFactor, isAsk, priceLimit, minBuyAmount); + sellToHanji(sellToken, ppm, pool, sellScalingFactor, buyScalingFactor, isAsk, priceLimit, minBuyAmount); } else { return false; } diff --git a/src/chains/Berachain/Common.sol b/src/chains/Berachain/Common.sol index 849bd5993..07d47016e 100644 --- a/src/chains/Berachain/Common.sol +++ b/src/chains/Berachain/Common.sol @@ -34,10 +34,10 @@ abstract contract BerachainMixin is FreeMemory, SettlerBase, EulerSwap { if (super._dispatch(i, action, data, slippage)) { return true; } else if (action == uint32(ISettlerActions.EULERSWAP.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = + (address recipient, IERC20 sellToken, uint256 ppm, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = abi.decode(data, (address, IERC20, uint256, IEulerSwap, bool, uint256)); - sellToEulerSwap(recipient, sellToken, bps, pool, zeroForOne, amountOutMin); + sellToEulerSwap(recipient, sellToken, ppm, pool, zeroForOne, amountOutMin); } else { return false; } diff --git a/src/chains/Bnb/Common.sol b/src/chains/Bnb/Common.sol index 0ef99d975..613ca279b 100644 --- a/src/chains/Bnb/Common.sol +++ b/src/chains/Bnb/Common.sol @@ -80,7 +80,7 @@ abstract contract BnbMixin is ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -88,24 +88,24 @@ abstract contract BnbMixin is uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.EULERSWAP.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = + (address recipient, IERC20 sellToken, uint256 ppm, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = abi.decode(data, (address, IERC20, uint256, IEulerSwap, bool, uint256)); - sellToEulerSwap(recipient, sellToken, bps, pool, zeroForOne, amountOutMin); + sellToEulerSwap(recipient, sellToken, ppm, pool, zeroForOne, amountOutMin); } else if (action == uint32(ISettlerActions.MAVERICKV2.selector)) { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, IMaverickV2Pool pool, bool tokenAIn, int32 tickLimit, uint256 minBuyAmount ) = abi.decode(data, (address, IERC20, uint256, IMaverickV2Pool, bool, int32, uint256)); - sellToMaverickV2(recipient, sellToken, bps, pool, tokenAIn, tickLimit, minBuyAmount); + sellToMaverickV2(recipient, sellToken, ppm, pool, tokenAIn, tickLimit, minBuyAmount); } else if (action == uint32(ISettlerActions.BEBOP.selector)) { ( address recipient, @@ -122,7 +122,7 @@ abstract contract BnbMixin is ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -130,17 +130,17 @@ abstract contract BnbMixin is uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToPancakeInfinity(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToPancakeInfinity(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.DODOV2.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = + (address recipient, IERC20 sellToken, uint256 ppm, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (address, IERC20, uint256, IDodoV2, bool, uint256)); - sellToDodoV2(recipient, sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV2(recipient, sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else if (action == uint32(ISettlerActions.DODOV1.selector)) { - (IERC20 sellToken, uint256 bps, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = + (IERC20 sellToken, uint256 ppm, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (IERC20, uint256, IDodoV1, bool, uint256)); - sellToDodoV1(sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV1(sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else { return false; } diff --git a/src/chains/Ink/Common.sol b/src/chains/Ink/Common.sol index 02727d4c1..21cc3de5a 100644 --- a/src/chains/Ink/Common.sol +++ b/src/chains/Ink/Common.sol @@ -43,7 +43,7 @@ abstract contract InkMixin is FreeMemory, SettlerBase, UniswapV4 { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -51,7 +51,7 @@ abstract contract InkMixin is FreeMemory, SettlerBase, UniswapV4 { uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else { return false; } diff --git a/src/chains/Linea/Common.sol b/src/chains/Linea/Common.sol index ccd5b367a..6da8e27a9 100644 --- a/src/chains/Linea/Common.sol +++ b/src/chains/Linea/Common.sol @@ -46,10 +46,10 @@ abstract contract LineaMixin is FreeMemory, SettlerBase, DodoV1 { if (super._dispatch(i, action, data, slippage)) { return true; } else if (action == uint32(ISettlerActions.DODOV1.selector)) { - (IERC20 sellToken, uint256 bps, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = + (IERC20 sellToken, uint256 ppm, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (IERC20, uint256, IDodoV1, bool, uint256)); - sellToDodoV1(sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV1(sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else { return false; } diff --git a/src/chains/Mainnet/Common.sol b/src/chains/Mainnet/Common.sol index 64fc87522..5efd06f5b 100644 --- a/src/chains/Mainnet/Common.sol +++ b/src/chains/Mainnet/Common.sol @@ -93,30 +93,30 @@ abstract contract MainnetMixin is fillRfqOrderSelfFunded(recipient, permit, maker, makerSig, takerToken, maxTakerAmount); } else if (action == uint32(ISettlerActions.UNISWAPV3.selector)) { - (address recipient, uint256 bps, bytes memory path, uint256 amountOutMin) = + (address recipient, uint256 ppm, bytes memory path, uint256 amountOutMin) = abi.decode(data, (address, uint256, bytes, uint256)); - sellToUniswapV3(recipient, bps, path, amountOutMin); + sellToUniswapV3(recipient, ppm, path, amountOutMin); } else if (action == uint32(ISettlerActions.UNISWAPV2.selector)) { - (address recipient, address sellToken, uint256 bps, address pool, uint24 swapInfo, uint256 amountOutMin) = + (address recipient, address sellToken, uint256 ppm, address pool, uint24 swapInfo, uint256 amountOutMin) = abi.decode(data, (address, address, uint256, address, uint24, uint256)); - sellToUniswapV2(recipient, sellToken, bps, pool, swapInfo, amountOutMin); + sellToUniswapV2(recipient, sellToken, ppm, pool, swapInfo, amountOutMin); } else if (action == uint32(ISettlerActions.BASIC.selector)) { - (IERC20 sellToken, uint256 bps, address pool, uint256 offset, bytes memory _data) = + (IERC20 sellToken, uint256 ppm, address pool, uint256 offset, bytes memory _data) = abi.decode(data, (IERC20, uint256, address, uint256, bytes)); - basicSellToPool(sellToken, bps, pool, offset, _data); + basicSellToPool(sellToken, ppm, pool, offset, _data); } /* `VELODROME` is removed */ else if (action == uint32(ISettlerActions.POSITIVE_SLIPPAGE.selector)) { - (address payable recipient, IERC20 token, uint256 expectedAmount, uint256 maxBps) = + (address payable recipient, IERC20 token, uint256 expectedAmount, uint256 maxPpm) = abi.decode(data, (address, IERC20, uint256, uint256)); bool isETH = (token == ETH_ADDRESS); uint256 balance = isETH ? address(this).balance : token.fastBalanceOf(address(this)); if (balance > expectedAmount) { uint256 cap; unchecked { - cap = balance * maxBps / BASIS; + cap = balance * maxPpm / BASIS; balance -= expectedAmount; } balance = (balance > cap).ternary(cap, balance); @@ -133,7 +133,7 @@ abstract contract MainnetMixin is ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -142,36 +142,36 @@ abstract contract MainnetMixin is ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); if (action == uint32(ISettlerActions.UNISWAPV4.selector)) { - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.BALANCERV3.selector)) { - sellToBalancerV3(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToBalancerV3(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.EKUBO.selector)) { - sellToEkuboV2(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToEkuboV2(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else { // if (action == uint32(ISettlerActions.EKUBOV3.selector)) - sellToEkuboV3(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToEkuboV3(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } } else if (action == uint32(ISettlerActions.MAKERPSM.selector)) { - (address recipient, uint256 bps, bool buyGem, uint256 amountOutMin, IPSM psm, IERC20 dai) = + (address recipient, uint256 ppm, bool buyGem, uint256 amountOutMin, IPSM psm, IERC20 dai) = abi.decode(data, (address, uint256, bool, uint256, IPSM, IERC20)); - sellToMakerPsm(recipient, bps, buyGem, amountOutMin, psm, dai); + sellToMakerPsm(recipient, ppm, buyGem, amountOutMin, psm, dai); } else if (action == uint32(ISettlerActions.EULERSWAP.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = + (address recipient, IERC20 sellToken, uint256 ppm, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = abi.decode(data, (address, IERC20, uint256, IEulerSwap, bool, uint256)); - sellToEulerSwap(recipient, sellToken, bps, pool, zeroForOne, amountOutMin); + sellToEulerSwap(recipient, sellToken, ppm, pool, zeroForOne, amountOutMin); } else if (action == uint32(ISettlerActions.MAVERICKV2.selector)) { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, IMaverickV2Pool pool, bool tokenAIn, int32 tickLimit, uint256 minBuyAmount ) = abi.decode(data, (address, IERC20, uint256, IMaverickV2Pool, bool, int32, uint256)); - sellToMaverickV2(recipient, sellToken, bps, pool, tokenAIn, tickLimit, minBuyAmount); + sellToMaverickV2(recipient, sellToken, ppm, pool, tokenAIn, tickLimit, minBuyAmount); } else if (action == uint32(ISettlerActions.BEBOP.selector)) { ( address recipient, @@ -185,15 +185,15 @@ abstract contract MainnetMixin is sellToBebop(payable(recipient), sellToken, order, makerSignature, amountOutMin); } else if (action == uint32(ISettlerActions.DODOV2.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = + (address recipient, IERC20 sellToken, uint256 ppm, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (address, IERC20, uint256, IDodoV2, bool, uint256)); - sellToDodoV2(recipient, sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV2(recipient, sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else if (action == uint32(ISettlerActions.DODOV1.selector)) { - (IERC20 sellToken, uint256 bps, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = + (IERC20 sellToken, uint256 ppm, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (IERC20, uint256, IDodoV1, bool, uint256)); - sellToDodoV1(sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV1(sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else { return false; } diff --git a/src/chains/Mantle/Common.sol b/src/chains/Mantle/Common.sol index 6a442c151..5471bcc09 100644 --- a/src/chains/Mantle/Common.sol +++ b/src/chains/Mantle/Common.sol @@ -36,15 +36,15 @@ abstract contract MantleMixin is FreeMemory, SettlerBase, DodoV1, DodoV2 { if (super._dispatch(i, action, data, slippage)) { return true; } else if (action == uint32(ISettlerActions.DODOV2.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = + (address recipient, IERC20 sellToken, uint256 ppm, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (address, IERC20, uint256, IDodoV2, bool, uint256)); - sellToDodoV2(recipient, sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV2(recipient, sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else if (action == uint32(ISettlerActions.DODOV1.selector)) { - (IERC20 sellToken, uint256 bps, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = + (IERC20 sellToken, uint256 ppm, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (IERC20, uint256, IDodoV1, bool, uint256)); - sellToDodoV1(sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV1(sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else { return false; } diff --git a/src/chains/Monad/Common.sol b/src/chains/Monad/Common.sol index 174b787cc..845c7124f 100644 --- a/src/chains/Monad/Common.sol +++ b/src/chains/Monad/Common.sol @@ -51,7 +51,7 @@ abstract contract MonadMixin is FreeMemory, SettlerBase, BalancerV3, UniswapV4, ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -59,12 +59,12 @@ abstract contract MonadMixin is FreeMemory, SettlerBase, BalancerV3, UniswapV4, uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.BALANCERV3.selector)) { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -72,11 +72,11 @@ abstract contract MonadMixin is FreeMemory, SettlerBase, BalancerV3, UniswapV4, uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToBalancerV3(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToBalancerV3(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.HANJI.selector)) { ( IERC20 sellToken, - uint256 bps, + uint256 ppm, address pool, uint256 sellScalingFactor, uint256 buyScalingFactor, @@ -85,7 +85,7 @@ abstract contract MonadMixin is FreeMemory, SettlerBase, BalancerV3, UniswapV4, uint256 minBuyAmount ) = abi.decode(data, (IERC20, uint256, address, uint256, uint256, bool, uint256, uint256)); - sellToHanji(sellToken, bps, pool, sellScalingFactor, buyScalingFactor, isAsk, priceLimit, minBuyAmount); + sellToHanji(sellToken, ppm, pool, sellScalingFactor, buyScalingFactor, isAsk, priceLimit, minBuyAmount); } else { return false; } diff --git a/src/chains/Optimism/Common.sol b/src/chains/Optimism/Common.sol index b43708179..2e9d9e852 100644 --- a/src/chains/Optimism/Common.sol +++ b/src/chains/Optimism/Common.sol @@ -54,7 +54,7 @@ abstract contract OptimismMixin is FreeMemory, SettlerBase, UniswapV4, BalancerV ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -62,12 +62,12 @@ abstract contract OptimismMixin is FreeMemory, SettlerBase, UniswapV4, BalancerV uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.BALANCERV3.selector)) { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -75,7 +75,7 @@ abstract contract OptimismMixin is FreeMemory, SettlerBase, UniswapV4, BalancerV uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToBalancerV3(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToBalancerV3(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.BEBOP.selector)) { ( address recipient, diff --git a/src/chains/Plasma/Common.sol b/src/chains/Plasma/Common.sol index 458fc3dd6..654a30bc7 100644 --- a/src/chains/Plasma/Common.sol +++ b/src/chains/Plasma/Common.sol @@ -37,15 +37,15 @@ abstract contract PlasmaMixin is FreeMemory, SettlerBase, BalancerV3, EulerSwap if (super._dispatch(i, action, data, slippage)) { return true; } else if (action == uint32(ISettlerActions.EULERSWAP.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = + (address recipient, IERC20 sellToken, uint256 ppm, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = abi.decode(data, (address, IERC20, uint256, IEulerSwap, bool, uint256)); - sellToEulerSwap(recipient, sellToken, bps, pool, zeroForOne, amountOutMin); + sellToEulerSwap(recipient, sellToken, ppm, pool, zeroForOne, amountOutMin); } else if (action == uint32(ISettlerActions.BALANCERV3.selector)) { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -53,7 +53,7 @@ abstract contract PlasmaMixin is FreeMemory, SettlerBase, BalancerV3, EulerSwap uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToBalancerV3(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToBalancerV3(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else { return false; } diff --git a/src/chains/Polygon/Common.sol b/src/chains/Polygon/Common.sol index 3de912939..c4bc620c4 100644 --- a/src/chains/Polygon/Common.sol +++ b/src/chains/Polygon/Common.sol @@ -49,7 +49,7 @@ abstract contract PolygonMixin is FreeMemory, SettlerBase, DodoV1, DodoV2, Unisw ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -57,12 +57,12 @@ abstract contract PolygonMixin is FreeMemory, SettlerBase, DodoV1, DodoV2, Unisw uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.DODOV2.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = + (address recipient, IERC20 sellToken, uint256 ppm, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (address, IERC20, uint256, IDodoV2, bool, uint256)); - sellToDodoV2(recipient, sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV2(recipient, sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else if (action == uint32(ISettlerActions.BEBOP.selector)) { ( address recipient, @@ -76,10 +76,10 @@ abstract contract PolygonMixin is FreeMemory, SettlerBase, DodoV1, DodoV2, Unisw sellToBebop(payable(recipient), sellToken, order, makerSignature, amountOutMin); } else if (action == uint32(ISettlerActions.DODOV1.selector)) { - (IERC20 sellToken, uint256 bps, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = + (IERC20 sellToken, uint256 ppm, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (IERC20, uint256, IDodoV1, bool, uint256)); - sellToDodoV1(sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV1(sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else { return false; } diff --git a/src/chains/RobinHood/Common.sol b/src/chains/RobinHood/Common.sol index 856d02584..f405235ad 100644 --- a/src/chains/RobinHood/Common.sol +++ b/src/chains/RobinHood/Common.sol @@ -66,7 +66,7 @@ abstract contract RobinHoodMixin is FreeMemory, SettlerBase, UniswapV4, EkuboV3, ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -75,16 +75,16 @@ abstract contract RobinHoodMixin is FreeMemory, SettlerBase, UniswapV4, EkuboV3, ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); if (action == uint32(ISettlerActions.UNISWAPV4.selector)) { - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.EKUBOV3.selector)) { - sellToEkuboV3(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToEkuboV3(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else { // if (action == uint32(ISettlerActions.PANCAKE_INFINITY.selector)) - sellToPancakeInfinity(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToPancakeInfinity(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } } else if (action == uint32(ISettlerActions.HANJI.selector)) { ( IERC20 sellToken, - uint256 bps, + uint256 ppm, address pool, uint256 sellScalingFactor, uint256 buyScalingFactor, @@ -93,7 +93,7 @@ abstract contract RobinHoodMixin is FreeMemory, SettlerBase, UniswapV4, EkuboV3, uint256 minBuyAmount ) = abi.decode(data, (IERC20, uint256, address, uint256, uint256, bool, uint256, uint256)); - sellToHanji(sellToken, bps, pool, sellScalingFactor, buyScalingFactor, isAsk, priceLimit, minBuyAmount); + sellToHanji(sellToken, ppm, pool, sellScalingFactor, buyScalingFactor, isAsk, priceLimit, minBuyAmount); } else { return false; } diff --git a/src/chains/Scroll/Common.sol b/src/chains/Scroll/Common.sol index 6b65ff154..e6e6c169c 100644 --- a/src/chains/Scroll/Common.sol +++ b/src/chains/Scroll/Common.sol @@ -46,24 +46,24 @@ abstract contract ScrollMixin is FreeMemory, SettlerBase, MaverickV2, DodoV1, Do ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, IMaverickV2Pool pool, bool tokenAIn, int32 tickLimit, uint256 minBuyAmount ) = abi.decode(data, (address, IERC20, uint256, IMaverickV2Pool, bool, int32, uint256)); - sellToMaverickV2(recipient, sellToken, bps, pool, tokenAIn, tickLimit, minBuyAmount); + sellToMaverickV2(recipient, sellToken, ppm, pool, tokenAIn, tickLimit, minBuyAmount); } else if (action == uint32(ISettlerActions.DODOV2.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = + (address recipient, IERC20 sellToken, uint256 ppm, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (address, IERC20, uint256, IDodoV2, bool, uint256)); - sellToDodoV2(recipient, sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV2(recipient, sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else if (action == uint32(ISettlerActions.DODOV1.selector)) { - (IERC20 sellToken, uint256 bps, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = + (IERC20 sellToken, uint256 ppm, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) = abi.decode(data, (IERC20, uint256, IDodoV1, bool, uint256)); - sellToDodoV1(sellToken, bps, dodo, quoteForBase, minBuyAmount); + sellToDodoV1(sellToken, ppm, dodo, quoteForBase, minBuyAmount); } else { return false; } diff --git a/src/chains/Sepolia/Common.sol b/src/chains/Sepolia/Common.sol index 7d56de407..339be994d 100644 --- a/src/chains/Sepolia/Common.sol +++ b/src/chains/Sepolia/Common.sol @@ -44,7 +44,7 @@ abstract contract SepoliaMixin is FreeMemory, SettlerBase, MaverickV2, UniswapV4 ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -52,19 +52,19 @@ abstract contract SepoliaMixin is FreeMemory, SettlerBase, MaverickV2, UniswapV4 uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.MAVERICKV2.selector)) { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, IMaverickV2Pool pool, bool tokenAIn, int32 tickLimit, uint256 minBuyAmount ) = abi.decode(data, (address, IERC20, uint256, IMaverickV2Pool, bool, int32, uint256)); - sellToMaverickV2(recipient, sellToken, bps, pool, tokenAIn, tickLimit, minBuyAmount); + sellToMaverickV2(recipient, sellToken, ppm, pool, tokenAIn, tickLimit, minBuyAmount); } else { return false; } diff --git a/src/chains/Sonic/Common.sol b/src/chains/Sonic/Common.sol index 63cf8b1aa..1140d7fef 100644 --- a/src/chains/Sonic/Common.sol +++ b/src/chains/Sonic/Common.sol @@ -41,15 +41,15 @@ abstract contract SonicMixin is FreeMemory, SettlerBase, EulerSwap, BalancerV3 { if (super._dispatch(i, action, data, slippage)) { return true; } else if (action == uint32(ISettlerActions.EULERSWAP.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = + (address recipient, IERC20 sellToken, uint256 ppm, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = abi.decode(data, (address, IERC20, uint256, IEulerSwap, bool, uint256)); - sellToEulerSwap(recipient, sellToken, bps, pool, zeroForOne, amountOutMin); + sellToEulerSwap(recipient, sellToken, ppm, pool, zeroForOne, amountOutMin); } else if (action == uint32(ISettlerActions.BALANCERV3.selector)) { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -57,7 +57,7 @@ abstract contract SonicMixin is FreeMemory, SettlerBase, EulerSwap, BalancerV3 { uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToBalancerV3(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToBalancerV3(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else { return false; } diff --git a/src/chains/Tempo/Common.sol b/src/chains/Tempo/Common.sol index 216b0a2b3..79d9395c0 100644 --- a/src/chains/Tempo/Common.sol +++ b/src/chains/Tempo/Common.sol @@ -44,7 +44,7 @@ abstract contract TempoMixin is FreeMemory, SettlerBase, UniswapV4 { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -52,7 +52,7 @@ abstract contract TempoMixin is FreeMemory, SettlerBase, UniswapV4 { uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else { return false; } diff --git a/src/chains/Unichain/Common.sol b/src/chains/Unichain/Common.sol index 36deef9aa..eef45b810 100644 --- a/src/chains/Unichain/Common.sol +++ b/src/chains/Unichain/Common.sol @@ -44,7 +44,7 @@ abstract contract UnichainMixin is FreeMemory, SettlerBase, UniswapV4, EulerSwap ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -52,12 +52,12 @@ abstract contract UnichainMixin is FreeMemory, SettlerBase, UniswapV4, EulerSwap uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else if (action == uint32(ISettlerActions.EULERSWAP.selector)) { - (address recipient, IERC20 sellToken, uint256 bps, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = + (address recipient, IERC20 sellToken, uint256 ppm, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin) = abi.decode(data, (address, IERC20, uint256, IEulerSwap, bool, uint256)); - sellToEulerSwap(recipient, sellToken, bps, pool, zeroForOne, amountOutMin); + sellToEulerSwap(recipient, sellToken, ppm, pool, zeroForOne, amountOutMin); } else { return false; } diff --git a/src/chains/WorldChain/Common.sol b/src/chains/WorldChain/Common.sol index 4a76aa113..4b8f0d307 100644 --- a/src/chains/WorldChain/Common.sol +++ b/src/chains/WorldChain/Common.sol @@ -45,7 +45,7 @@ abstract contract WorldChainMixin is FreeMemory, SettlerBase, UniswapV4 { ( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -53,7 +53,7 @@ abstract contract WorldChainMixin is FreeMemory, SettlerBase, UniswapV4 { uint256 amountOutMin ) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256)); - sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + sellToUniswapV4(recipient, sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } else { return false; } diff --git a/src/core/BalancerV3.sol b/src/core/BalancerV3.sol index 884cbab38..39242bea9 100644 --- a/src/core/BalancerV3.sol +++ b/src/core/BalancerV3.sol @@ -251,12 +251,6 @@ abstract contract BalancerV3 is SettlerSwapAbstract, FreeMemory { using UnsafeVault for IBalancerV3Vault; - constructor() { - assert(BASIS == Encoder.BASIS); - assert(BASIS == Decoder.BASIS); - assert(address(ETH_ADDRESS) == NotesLib.ETH_ADDRESS); - } - //// How to generate `fills` for BalancerV3: //// //// Linearize your DAG of fills by doing a topological sort on the tokens involved. Swapping @@ -273,10 +267,10 @@ abstract contract BalancerV3 is SettlerSwapAbstract, FreeMemory { //// //// Now that you have a list of fills, encode each fill as follows. //// First, decide if the fill is a swap or an ERC4626 wrap/unwrap. - //// Second, encode the `bps` for the fill as 2 bytes. Remember that this `bps` is relative to + //// Second, encode the `ppm` for the fill as 3 bytes. Remember that this `ppm` is relative to //// the running balance at the moment that the fill is settled. If the fill is a wrap, set the - //// most significant bit of `bps`. If the fill is an unwrap, set the second most significant - //// bit of `bps` + //// most significant bit of `ppm`. If the fill is an unwrap, set the second most significant + //// bit of `ppm` //// Third, encode the packing key for that fill as 1 byte. The packing key byte depends on the //// tokens involved in the previous fill. If the fill is a wrap, the buy token must be the //// ERC4626 vault. If the fill is an unwrap, the sell token must be the ERC4626 vault. If the @@ -301,7 +295,7 @@ abstract contract BalancerV3 is SettlerSwapAbstract, FreeMemory { function sellToBalancerV3( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -312,7 +306,7 @@ abstract contract BalancerV3 is SettlerSwapAbstract, FreeMemory { uint32(IBalancerV3Vault.unlock.selector), recipient, sellToken, - bps, + ppm, feeOnTransfer, hashMul, hashMod, @@ -458,9 +452,9 @@ abstract contract BalancerV3 is SettlerSwapAbstract, FreeMemory { } // the mandatory fields are - // 2 - sell bps + // 3 - sell ppm // 1 - pool key tokens case - uint256 private constant _HOP_DATA_LENGTH = 3; + uint256 private constant _HOP_DATA_LENGTH = 4; function balV3UnlockCallback(bytes calldata data) private returns (bytes memory) { address recipient; @@ -511,36 +505,36 @@ abstract contract BalancerV3 is SettlerSwapAbstract, FreeMemory { */ while (data.length >= _HOP_DATA_LENGTH) { - uint256 bps; + uint256 ppm; assembly ("memory-safe") { - bps := shr(0xf0, calldataload(data.offset)) + ppm := shr(0xe8, calldataload(data.offset)) - data.offset := add(0x02, data.offset) - data.length := sub(data.length, 0x02) + data.offset := add(0x03, data.offset) + data.length := sub(data.length, 0x03) // we don't check for array out-of-bounds here; we will check it later in `Decoder.overflowCheck` } data = Decoder.updateState(state, notes, data); - if (bps & 0xc000 == 0) { + if (ppm & 0xc00000 == 0) { data = _setSwapParams(swapParams, state, data); unchecked { - swapParams.amountGiven = (state.sell().amount() * bps).unsafeDiv(BASIS); + swapParams.amountGiven = (state.sell().amount() * ppm).unsafeDiv(BASIS); } data = _decodeUserdataAndSwap(swapParams, state, data); } else { Decoder.overflowCheck(data); - if (bps & 0x4000 == 0) { + if (ppm & 0x400000 == 0) { wrapParams.direction = IBalancerV3Vault.WrappingDirection.WRAP; wrapParams.wrappedToken = IERC4626(address(state.buy().token())); } else { wrapParams.direction = IBalancerV3Vault.WrappingDirection.UNWRAP; wrapParams.wrappedToken = IERC4626(address(state.sell().token())); } - bps &= 0x3fff; + ppm &= 0x3fffff; unchecked { - wrapParams.amountGiven = (state.sell().amount() * bps).unsafeDiv(BASIS); + wrapParams.amountGiven = (state.sell().amount() * ppm).unsafeDiv(BASIS); } _erc4626WrapUnwrap(wrapParams, state); diff --git a/src/core/Basic.sol b/src/core/Basic.sol index 9e9d254bc..7582edac6 100644 --- a/src/core/Basic.sol +++ b/src/core/Basic.sol @@ -18,7 +18,7 @@ abstract contract Basic is SettlerAbstract { /// @dev Sell to a pool with a generic approval, transferFrom interaction. /// offset in the calldata is used to update the sellAmount given a proportion of the sellToken balance - function basicSellToPool(IERC20 sellToken, uint256 bps, address pool, uint256 offset, bytes memory data) internal { + function basicSellToPool(IERC20 sellToken, uint256 ppm, address pool, uint256 offset, bytes memory data) internal { if (_isRestrictedTarget(pool)) { revertConfusedDeputy(); } @@ -28,7 +28,7 @@ abstract contract Basic is SettlerAbstract { uint256 value; if (sellToken == ETH_ADDRESS) { unchecked { - value = (address(this).balance * bps).unsafeDiv(BASIS); + value = (address(this).balance * ppm).unsafeDiv(BASIS); } if (data.length == 0) { if (offset != 0) revert InvalidOffset(); @@ -44,11 +44,11 @@ abstract contract Basic is SettlerAbstract { } } } else if (address(sellToken) == address(0)) { - // TODO: check for zero `bps` + // TODO: check for zero `ppm` if (offset != 0) revert InvalidOffset(); } else { - // We treat `bps > BASIS` as a GIGO error - uint256 amount = tmp().omul(sellToken.fastBalanceOf(address(this)), bps).unsafeDiv(BASIS); + // We treat `ppm > BASIS` as a GIGO error + uint256 amount = tmp().omul(sellToken.fastBalanceOf(address(this)), ppm).unsafeDiv(BASIS); if ((offset += 32) > data.length) { Panic.panic(Panic.ARRAY_OUT_OF_BOUNDS); diff --git a/src/core/Constants.sol b/src/core/Constants.sol new file mode 100644 index 000000000..50a1c27ab --- /dev/null +++ b/src/core/Constants.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +// The denominator for all balance-proportional action arguments (parts-per-million). +uint256 constant BASIS = 1_000_000; + +// ERC-7528 native asset designator. +address constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; diff --git a/src/core/DodoV1.sol b/src/core/DodoV1.sol index 130b4a4c6..07a6dee4c 100644 --- a/src/core/DodoV1.sol +++ b/src/core/DodoV1.sol @@ -350,12 +350,12 @@ abstract contract DodoV1 is SettlerSwapAbstract, DodoSellHelper { using SafeTransferLib for IERC20; using FastDodoV1 for IDodoV1; - function sellToDodoV1(IERC20 sellToken, uint256 bps, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) + function sellToDodoV1(IERC20 sellToken, uint256 ppm, IDodoV1 dodo, bool quoteForBase, uint256 minBuyAmount) internal { uint256 sellAmount; unchecked { - sellAmount = (sellToken.fastBalanceOf(address(this)) * bps).unsafeDiv(BASIS); + sellAmount = (sellToken.fastBalanceOf(address(this)) * ppm).unsafeDiv(BASIS); } sellToken.safeApproveIfBelow(address(dodo), sellAmount); if (quoteForBase) { diff --git a/src/core/DodoV2.sol b/src/core/DodoV2.sol index 737197f54..565dd2f6b 100644 --- a/src/core/DodoV2.sol +++ b/src/core/DodoV2.sol @@ -71,15 +71,15 @@ abstract contract DodoV2 is SettlerSwapAbstract { function sellToDodoV2( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, IDodoV2 dodo, bool quoteForBase, uint256 minBuyAmount ) internal returns (uint256 buyAmount) { - if (bps != 0) { + if (ppm != 0) { uint256 sellAmount; unchecked { - sellAmount = (sellToken.fastBalanceOf(address(this)) * bps).unsafeDiv(BASIS); + sellAmount = (sellToken.fastBalanceOf(address(this)) * ppm).unsafeDiv(BASIS); } sellToken.safeTransfer(address(dodo), sellAmount); } diff --git a/src/core/EkuboV2.sol b/src/core/EkuboV2.sol index 8fa51460c..28c7fb15f 100644 --- a/src/core/EkuboV2.sol +++ b/src/core/EkuboV2.sol @@ -139,12 +139,6 @@ abstract contract EkuboV2 is SettlerSwapAbstract { using NotesLib for NotesLib.Note[]; using UnsafeEkuboCore for IEkuboCore; - constructor() { - assert(BASIS == Encoder.BASIS); - assert(BASIS == Decoder.BASIS); - assert(address(ETH_ADDRESS) == NotesLib.ETH_ADDRESS); - } - //// How to generate `fills` for Ekubo //// //// Linearize your DAG of fills by doing a topological sort on the tokens involved. In the @@ -162,10 +156,10 @@ abstract contract EkuboV2 is SettlerSwapAbstract { //// Settler's representation. The conversion is performed by Settler before making calls to Ekubo //// //// Now that you have a list of fills, encode each fill as follows. - //// First encode the `bps` for the fill as 2 bytes. Remember that this `bps` is relative to the - //// running balance at the moment that the fill is settled. If the uppermost bit of `bps` is + //// First encode the `ppm` for the fill as 3 bytes. Remember that this `ppm` is relative to the + //// running balance at the moment that the fill is settled. If the uppermost bit of `ppm` is //// set, then the swap is treated as a swap through an extension that requires forwarding. Only - //// the lower 15 bits of `bps` are used for the amount calculation. + //// the lower 23 bits of `ppm` are used for the amount calculation. //// Second, encode the price caps sqrtRatio as 12 bytes. //// Third, encode the packing key for that fill as 1 byte. The packing key byte depends on the //// tokens involved in the previous fill. The packing key for the first fill must be 1; @@ -185,7 +179,7 @@ abstract contract EkuboV2 is SettlerSwapAbstract { function sellToEkuboV2( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -196,7 +190,7 @@ abstract contract EkuboV2 is SettlerSwapAbstract { uint32(IEkuboCore.lock.selector), recipient, sellToken, - bps, + ppm, feeOnTransfer, hashMul, hashMod, @@ -255,11 +249,11 @@ abstract contract EkuboV2 is SettlerSwapAbstract { } // the mandatory fields are - // 2 - sell bps + // 3 - sell ppm // 12 - sqrtRatio // 1 - pool key tokens case // 32 - config (20 extension, 8 fee, 4 tickSpacing) - uint256 private constant _HOP_DATA_LENGTH = 47; + uint256 private constant _HOP_DATA_LENGTH = 48; function locked(bytes calldata data) private returns (bytes memory) { address recipient; @@ -297,16 +291,16 @@ abstract contract EkuboV2 is SettlerSwapAbstract { PoolKey memory poolKey; while (data.length >= _HOP_DATA_LENGTH) { - uint256 bps; + uint256 ppm; SqrtRatio sqrtRatio; assembly ("memory-safe") { - bps := shr(0xf0, calldataload(data.offset)) - data.offset := add(0x02, data.offset) + ppm := shr(0xe8, calldataload(data.offset)) + data.offset := add(0x03, data.offset) sqrtRatio := shr(0xa0, calldataload(data.offset)) data.offset := add(0x0c, data.offset) - data.length := sub(data.length, 0x0e) + data.length := sub(data.length, 0x0f) // we don't check for array out-of-bounds here; we will check it later in `Decoder.overflowCheck` } @@ -316,7 +310,7 @@ abstract contract EkuboV2 is SettlerSwapAbstract { // `CORE` will throw. int256 amountSpecified; unchecked { - amountSpecified = int256((state.sell().amount() * (bps & 0x7fff)).unsafeDiv(BASIS)); + amountSpecified = int256((state.sell().amount() * (ppm & 0x7fffff)).unsafeDiv(BASIS)); } bool isToken1; // opposite of regular zeroForOne @@ -361,7 +355,7 @@ abstract contract EkuboV2 is SettlerSwapAbstract { { int256 delta0; int256 delta1; - if (bps & 0x8000 == 0) { + if (ppm & 0x800000 == 0) { (delta0, delta1) = IEkuboCore(msg.sender).unsafeSwap(poolKey, amountSpecified, isToken1, sqrtRatio); } else { (delta0, delta1) = diff --git a/src/core/EkuboV3.sol b/src/core/EkuboV3.sol index 6abd06721..ca4d911aa 100644 --- a/src/core/EkuboV3.sol +++ b/src/core/EkuboV3.sol @@ -168,12 +168,6 @@ abstract contract EkuboV3 is SettlerSwapAbstract { using NotesLib for NotesLib.Note[]; using UnsafeEkuboCore for IEkuboCore; - constructor() { - assert(BASIS == Encoder.BASIS); - assert(BASIS == Decoder.BASIS); - assert(address(ETH_ADDRESS) == NotesLib.ETH_ADDRESS); - } - //// How to generate `fills` for Ekubo //// //// Linearize your DAG of fills by doing a topological sort on the tokens involved. In the @@ -191,10 +185,10 @@ abstract contract EkuboV3 is SettlerSwapAbstract { //// Settler's representation. The conversion is performed by Settler before making calls to Ekubo //// //// Now that you have a list of fills, encode each fill as follows. - //// First encode the `bps` for the fill as 2 bytes. Remember that this `bps` is relative to the - //// running balance at the moment that the fill is settled. If the uppermost bit of `bps` is + //// First encode the `ppm` for the fill as 3 bytes. Remember that this `ppm` is relative to the + //// running balance at the moment that the fill is settled. If the uppermost bit of `ppm` is //// set, then the swap is treated as a swap through an extension that requires forwarding. Only - //// the lower 15 bits of `bps` are used for the amount calculation. + //// the lower 23 bits of `ppm` are used for the amount calculation. //// Second, encode the price caps sqrtRatio as 12 bytes. //// Third, encode the packing key for that fill as 1 byte. The packing key byte depends on the //// tokens involved in the previous fill. The packing key for the first fill must be 1; @@ -214,7 +208,7 @@ abstract contract EkuboV3 is SettlerSwapAbstract { function sellToEkuboV3( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -225,7 +219,7 @@ abstract contract EkuboV3 is SettlerSwapAbstract { uint32(IEkuboCore.lock.selector), recipient, sellToken, - bps, + ppm, feeOnTransfer, hashMul, hashMod, @@ -316,11 +310,11 @@ abstract contract EkuboV3 is SettlerSwapAbstract { } // the mandatory fields are - // 2 - sell bps + // 3 - sell ppm // 12 - sqrtRatio // 1 - pool key tokens case // 32 - config (20 extension, 8 fee, 4 tickSpacing) - uint256 private constant _HOP_DATA_LENGTH = 47; + uint256 private constant _HOP_DATA_LENGTH = 48; function locked_6416899205(bytes calldata data) private returns (bytes memory) { address recipient; @@ -362,16 +356,16 @@ abstract contract EkuboV3 is SettlerSwapAbstract { PoolKey memory poolKey; while (data.length >= _HOP_DATA_LENGTH) { - uint256 bps; + uint256 ppm; SqrtRatio sqrtRatio; assembly ("memory-safe") { - bps := shr(0xf0, calldataload(data.offset)) - data.offset := add(0x02, data.offset) + ppm := shr(0xe8, calldataload(data.offset)) + data.offset := add(0x03, data.offset) sqrtRatio := shr(0xa0, calldataload(data.offset)) data.offset := add(0x0c, data.offset) - data.length := sub(data.length, 0x0e) + data.length := sub(data.length, 0x0f) // we don't check for array out-of-bounds here; we will check it later in `Decoder.overflowCheck` } @@ -380,7 +374,7 @@ abstract contract EkuboV3 is SettlerSwapAbstract { // given that deltas are `int128`. If it overflows an `int128`, `unsafeSwap` will throw. int256 amountSpecified; unchecked { - amountSpecified = int256((state.sell().amount() * (bps & 0x7fff)).unsafeDiv(BASIS)); + amountSpecified = int256((state.sell().amount() * (ppm & 0x7fffff)).unsafeDiv(BASIS)); } bool isToken1; // opposite of regular zeroForOne @@ -424,7 +418,7 @@ abstract contract EkuboV3 is SettlerSwapAbstract { { int256 delta0; int256 delta1; - if (bps & 0x8000 == 0) { + if (ppm & 0x800000 == 0) { (delta0, delta1) = IEkuboCore(msg.sender).unsafeSwap(poolKey, amountSpecified, isToken1, sqrtRatio); } else { (delta0, delta1) = diff --git a/src/core/EulerSwap.sol b/src/core/EulerSwap.sol index b3abe4929..9120872be 100644 --- a/src/core/EulerSwap.sol +++ b/src/core/EulerSwap.sol @@ -895,7 +895,7 @@ abstract contract EulerSwap is SettlerSwapAbstract { function sellToEulerSwap( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, IEulerSwap pool, bool zeroForOne, uint256 amountOutMin @@ -909,9 +909,9 @@ abstract contract EulerSwap is SettlerSwapAbstract { (uint256 inLimit,) = EulerSwapLib.calcLimits(_EVC(), pool, zeroForOne, p, reserve0, reserve1); uint256 sellAmount; - if (bps != 0) { + if (ppm != 0) { unchecked { - sellAmount = sellToken.fastBalanceOf(address(this)) * bps / BASIS; + sellAmount = sellToken.fastBalanceOf(address(this)) * ppm / BASIS; } // If the sell amount is over the limit, any excess will be retained by Settler and sold // to subsequent liquidities in the actions list. If `pool` is the last liquidity, this diff --git a/src/core/FlashAccountingCommon.sol b/src/core/FlashAccountingCommon.sol index c32236d21..34d5d0f6a 100644 --- a/src/core/FlashAccountingCommon.sol +++ b/src/core/FlashAccountingCommon.sol @@ -8,6 +8,7 @@ import {SafeTransferLib} from "../vendor/SafeTransferLib.sol"; import {Panic} from "../utils/Panic.sol"; import {UnsafeMath} from "../utils/UnsafeMath.sol"; import {FastLogic} from "../utils/FastLogic.sol"; +import {BASIS, ETH_ADDRESS} from "./Constants.sol"; import {revertTooMuchSlippage, BoughtSellToken, DeltaNotPositive, DeltaNotNegative} from "./SettlerErrors.sol"; @@ -51,7 +52,6 @@ type NotePtr is uint256; /// signature `TokenHashCollision(address,address)`. library NotesLib { uint256 private constant _ADDRESS_MASK = 0x00ffffffffffffffffffffffffffffffffffffffff; - address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; /// This is the maximum number of tokens that may be involved in an action. Increasing or /// decreasing this value requires no other changes elsewhere in this file. @@ -372,13 +372,11 @@ using StateLib for State global; library Encoder { using FastLogic for bool; - uint256 internal constant BASIS = 10_000; - function encode( uint256 unlockSelector, address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -387,16 +385,16 @@ library Encoder { ) internal view returns (bytes memory data) { hashMul *= 96; hashMod *= 96; - if ((bps > BASIS).or(amountOutMin >> 128 != 0).or(hashMul >> 128 != 0).or(hashMod >> 128 != 0)) { + if ((ppm > BASIS).or(amountOutMin >> 128 != 0).or(hashMul >> 128 != 0).or(hashMod >> 128 != 0)) { Panic.panic(Panic.ARITHMETIC_OVERFLOW); } assembly ("memory-safe") { data := mload(0x40) let pathLen := mload(fills) - mcopy(add(0xd3, data), add(0x20, fills), pathLen) + mcopy(add(0xd4, data), add(0x20, fills), pathLen) - mstore(add(0xb3, data), bps) + mstore(add(0xb4, data), ppm) mstore(add(0xb1, data), sellToken) mstore(add(0x9d, data), address()) // payer // feeOnTransfer (1 byte) @@ -405,13 +403,13 @@ library Encoder { mstore(add(0x78, data), hashMul) mstore(add(0x68, data), amountOutMin) mstore(add(0x58, data), recipient) - mstore(add(0x44, data), add(0x6f, pathLen)) + mstore(add(0x44, data), add(0x70, pathLen)) mstore(add(0x24, data), 0x20) mstore(add(0x04, data), unlockSelector) - mstore(data, add(0xb3, pathLen)) + mstore(data, add(0xb4, pathLen)) mstore8(add(0xa8, data), lt(0x00, feeOnTransfer)) - mstore(0x40, add(data, add(0xd3, pathLen))) + mstore(0x40, add(data, add(0xd4, pathLen))) } } @@ -481,8 +479,6 @@ library Decoder { using NotesLib for NotesLib.Note; using NotesLib for NotesLib.Note[]; - uint256 internal constant BASIS = 10_000; - /// Update `state` for the next fill packed in `data`. This also may allocate/append `Note`s /// into `notes`. Returns the suffix of the bytes that are not consumed in the decoding /// process. The first byte of `data` describes which of the compact representations for the hop @@ -565,7 +561,7 @@ library Decoder { /// Decode an ABI-ish encoded `bytes` from `data`. It is "-ish" in the sense that the encoding /// of the length doesn't take up an entire word. The length is encoded as only 3 bytes (2^24 /// bytes of calldata consumes ~67M gas, much more than the block limit). The payload is also - /// unpadded. The next fill's `bps` is encoded immediately after the `hookData` payload. + /// unpadded. The next fill's `ppm` is encoded immediately after the `hookData` payload. function decodeBytes(bytes calldata data) internal pure returns (bytes calldata retData, bytes calldata hookData) { assembly ("memory-safe") { hookData.length := shr(0xe8, calldataload(data.offset)) @@ -653,38 +649,40 @@ library Decoder { if (state.globalSell().tokenIsEth()) { assert(payer == address(this)); - uint16 bps; + uint256 ppm; assembly ("memory-safe") { // `data` hasn't been advanced from decoding `sellToken` above. so we have to - // implicitly advance it by 20 bytes to decode `bps` then advance by 22 bytes + // advance it by 20 bytes to decode `ppm` then advance by 3 bytes - bps := shr(0x50, calldataload(data.offset)) + data.offset := add(0x14, data.offset) + ppm := shr(0xe8, calldataload(data.offset)) - data.offset := add(0x16, data.offset) - data.length := sub(data.length, 0x16) + data.offset := add(0x3, data.offset) + data.length := sub(data.length, 0x17) // We check for array out-of-bounds below } unchecked { - state.globalSell().setAmount((address(this).balance * bps).unsafeDiv(BASIS)); + state.globalSell().setAmount((address(this).balance * ppm).unsafeDiv(BASIS)); } } else { if (payer == address(this)) { - uint16 bps; + uint256 ppm; assembly ("memory-safe") { // `data` hasn't been advanced from decoding `sellToken` above. so we have to - // implicitly advance it by 20 bytes to decode `bps` then advance by 22 bytes + // advance it by 20 bytes to decode `ppm` then advance by 3 bytes - bps := shr(0x50, calldataload(data.offset)) + data.offset := add(0x14, data.offset) + ppm := shr(0xe8, calldataload(data.offset)) - data.offset := add(0x16, data.offset) - data.length := sub(data.length, 0x16) + data.offset := add(0x3, data.offset) + data.length := sub(data.length, 0x17) // We check for array out-of-bounds below } unchecked { NotePtr globalSell = state.globalSell(); - globalSell.setAmount((globalSell.token().fastBalanceOf(address(this)) * bps).unsafeDiv(BASIS)); + globalSell.setAmount((globalSell.token().fastBalanceOf(address(this)) * ppm).unsafeDiv(BASIS)); } } else { assert(payer == address(0)); diff --git a/src/core/Hanji.sol b/src/core/Hanji.sol index 89f85d23c..d942d3259 100644 --- a/src/core/Hanji.sol +++ b/src/core/Hanji.sol @@ -116,7 +116,7 @@ abstract contract Hanji is SettlerSwapAbstract { function sellToHanji( IERC20 sellToken, - uint256 bps, + uint256 ppm, address pool, uint256 sellScalingFactor, uint256 buyScalingFactor, @@ -128,9 +128,9 @@ abstract contract Hanji is SettlerSwapAbstract { uint256 sellAmount; unchecked { if (sendNative) { - sellAmount = address(this).balance * bps / BASIS; + sellAmount = address(this).balance * ppm / BASIS; } else { - sellAmount = sellToken.fastBalanceOf(address(this)) * bps / BASIS; + sellAmount = sellToken.fastBalanceOf(address(this)) * ppm / BASIS; sellToken.safeApproveIfBelow(pool, sellAmount); } } diff --git a/src/core/LayerZeroOFT.sol b/src/core/LayerZeroOFT.sol index 7339bbe25..599b31725 100644 --- a/src/core/LayerZeroOFT.sol +++ b/src/core/LayerZeroOFT.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.25; import {IERC20} from "@forge-std/interfaces/IERC20.sol"; import {SafeTransferLib} from "../vendor/SafeTransferLib.sol"; +import {ETH_ADDRESS} from "./Constants.sol"; interface IOFT { event OFTSent( @@ -64,8 +65,6 @@ library FastLayerZeroOFT { } } -IERC20 constant ETH = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); - contract LayerZeroOFT { using SafeTransferLib for IERC20; using FastLayerZeroOFT for address; @@ -88,7 +87,7 @@ contract LayerZeroOFT { nativeFee := mload(add(0x40, sendData)) } - if (token == ETH) { + if (address(token) == ETH_ADDRESS) { uint256 value = address(this).balance; updatedInputAmount = value - nativeFee; diff --git a/src/core/MakerPSM.sol b/src/core/MakerPSM.sol index 57ac97b3f..658d52080 100644 --- a/src/core/MakerPSM.sol +++ b/src/core/MakerPSM.sol @@ -136,7 +136,7 @@ abstract contract MakerPSM is SettlerSwapAbstract { USDT.safeApprove(UsddGemJoin, type(uint256).max); } - function sellToMakerPsm(address recipient, uint256 bps, bool buyGem, uint256 amountOutMin, IPSM psm, IERC20 dai) + function sellToMakerPsm(address recipient, uint256 ppm, bool buyGem, uint256 amountOutMin, IPSM psm, IERC20 dai) internal returns (uint256 buyAmount) { @@ -148,7 +148,7 @@ abstract contract MakerPSM is SettlerSwapAbstract { // phantom overflow can't happen here because: // 1. sellToken has decimals = 18 (sellToken is DAI, USDS, or USDD) // 2. PSM prohibits gemToken with decimals > 18 (sellToken is USDC or USDT) - sellAmount = (sellToken.fastBalanceOf(address(this)) * bps).unsafeDiv(BASIS); + sellAmount = (sellToken.fastBalanceOf(address(this)) * ppm).unsafeDiv(BASIS); } if (buyGem) { unchecked { diff --git a/src/core/MaverickV2.sol b/src/core/MaverickV2.sol index 24c00f0ce..41835f038 100644 --- a/src/core/MaverickV2.sol +++ b/src/core/MaverickV2.sol @@ -221,19 +221,19 @@ abstract contract MaverickV2 is SettlerSwapAbstract { function sellToMaverickV2( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, IMaverickV2Pool pool, bool tokenAIn, int32 tickLimit, uint256 minBuyAmount ) internal returns (uint256 buyAmount) { uint256 sellAmount; - if (bps != 0) { + if (ppm != 0) { unchecked { // We don't care about phantom overflow here because reserves // are limited to 128 bits. Any token balance that would // overflow here would also break MaverickV2. - sellAmount = (sellToken.fastBalanceOf(address(this)) * bps).unsafeDiv(BASIS); + sellAmount = (sellToken.fastBalanceOf(address(this)) * ppm).unsafeDiv(BASIS); } sellToken.safeTransfer(address(pool), sellAmount); } else { diff --git a/src/core/PancakeInfinity.sol b/src/core/PancakeInfinity.sol index 42175885c..64f8ef6d3 100644 --- a/src/core/PancakeInfinity.sol +++ b/src/core/PancakeInfinity.sol @@ -200,12 +200,6 @@ abstract contract PancakeInfinity is SettlerSwapAbstract { using UnsafePancakeInfinityPoolManager for IPancakeInfinityCLPoolManager; using UnsafePancakeInfinityBinPoolManager for IPancakeInfinityBinPoolManager; - constructor() { - assert(BASIS == Encoder.BASIS); - assert(BASIS == Decoder.BASIS); - assert(address(ETH_ADDRESS) == NotesLib.ETH_ADDRESS); - } - function _PANCAKE_INFINITY_VAULT() internal pure virtual returns (address); // A chain hosting a fork that lacks CL_MANAGER must unconditionally call `revertUnknownPoolManagerId(0)` @@ -232,7 +226,7 @@ abstract contract PancakeInfinity is SettlerSwapAbstract { //// Pancake Infinity. //// //// Now that you have a list of fills, encode each fill as follows. - //// First encode the `bps` for the fill as 2 bytes. Remember that this `bps` is relative to the + //// First encode the `ppm` for the fill as 3 bytes. Remember that this `ppm` is relative to the //// running balance at the moment that the fill is settled. //// Second, encode the price caps sqrtPriceLimitX96 as 20 bytes. //// Third, encode the packing key for that fill as 1 byte. The packing key byte depends on the @@ -260,7 +254,7 @@ abstract contract PancakeInfinity is SettlerSwapAbstract { function sellToPancakeInfinity( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -271,7 +265,7 @@ abstract contract PancakeInfinity is SettlerSwapAbstract { uint32(IPancakeInfinityVault.lock.selector), recipient, sellToken, - bps, + ppm, feeOnTransfer, hashMul, hashMod, @@ -377,7 +371,7 @@ abstract contract PancakeInfinity is SettlerSwapAbstract { } // the mandatory fields are - // 2 - sell bps + // 3 - sell ppm // 20 - sqrtPriceLimitX96 // 1 - pool key tokens case // 20 - hook @@ -385,7 +379,7 @@ abstract contract PancakeInfinity is SettlerSwapAbstract { // 3 - pool fee // 32 - parameters // 3 - hook data length - uint256 private constant _HOP_DATA_LENGTH = 82; + uint256 private constant _HOP_DATA_LENGTH = 83; uint256 private constant _ADDRESS_MASK = 0x00ffffffffffffffffffffffffffffffffffffffff; @@ -429,20 +423,20 @@ abstract contract PancakeInfinity is SettlerSwapAbstract { int256 amountSpecified; uint160 sqrtPriceLimitX96; { - uint16 bps; + uint24 ppm; assembly ("memory-safe") { - bps := shr(0xf0, calldataload(data.offset)) - data.offset := add(0x02, data.offset) + ppm := shr(0xe8, calldataload(data.offset)) + data.offset := add(0x03, data.offset) sqrtPriceLimitX96 := shr(0x60, calldataload(data.offset)) data.offset := add(0x14, data.offset) - data.length := sub(data.length, 0x16) + data.length := sub(data.length, 0x17) // we don't check for array out-of-bounds here; we will check it later in `Decoder.overflowCheck` } data = Decoder.updateState(state, notes, data); - amountSpecified = int256((state.sell().amount() * bps).unsafeDiv(BASIS)).unsafeNeg(); + amountSpecified = int256((state.sell().amount() * ppm).unsafeDiv(BASIS)).unsafeNeg(); } bool zeroForOne; { diff --git a/src/core/StargateV2.sol b/src/core/StargateV2.sol index c25e7547d..7e6514a14 100644 --- a/src/core/StargateV2.sol +++ b/src/core/StargateV2.sol @@ -4,7 +4,8 @@ pragma solidity ^0.8.25; import {IERC20} from "@forge-std/interfaces/IERC20.sol"; import {SafeTransferLib} from "../vendor/SafeTransferLib.sol"; -import {IOFT, ETH} from "src/core/LayerZeroOFT.sol"; +import {IOFT} from "src/core/LayerZeroOFT.sol"; +import {ETH_ADDRESS} from "./Constants.sol"; interface IStargateV2 is IOFT { function sendToken(SendParam memory SendParam, MessagingFee memory messagingFee, address refundAddress) external; @@ -31,7 +32,7 @@ contract StargateV2 { nativeFee := mload(add(0x40, sendData)) } - if (token == ETH) { + if (address(token) == ETH_ADDRESS) { // Any excess on top of fee + amount is returned to // the refund address specified in `sendData` uint256 value = address(this).balance; diff --git a/src/core/UniswapV2.sol b/src/core/UniswapV2.sol index bf1817d4a..e80ff15e5 100644 --- a/src/core/UniswapV2.sol +++ b/src/core/UniswapV2.sol @@ -89,7 +89,7 @@ abstract contract UniswapV2 is SettlerSwapAbstract { function sellToUniswapV2( address recipient, address sellToken, - uint256 bps, + uint256 ppm, address pool, uint24 swapInfo, uint256 minBuyAmount @@ -104,18 +104,18 @@ abstract contract UniswapV2 is SettlerSwapAbstract { uint256 sellAmount; uint256 buyAmount; - // If bps is zero we assume there are no funds within this contract, skip the updating sellAmount. + // If ppm is zero we assume there are no funds within this contract, skip the updating sellAmount. // This case occurs if the pool is being chained, in which the funds have been sent directly to the pool - if (bps != 0) { + if (ppm != 0) { // We don't care about phantom overflow here because reserves are // limited to 112 bits. Any token balance that would overflow here would // also break UniV2. - // It is *possible* to set `bps` above the basis and therefore - // cause an overflow on this multiplication. However, `bps` is + // It is *possible* to set `ppm` above the basis and therefore + // cause an overflow on this multiplication. However, `ppm` is // passed as authenticated calldata, so this is a GIGO error that we // do not attempt to fix. unchecked { - sellAmount = IERC20(sellToken).fastBalanceOf(address(this)) * bps / BASIS; + sellAmount = IERC20(sellToken).fastBalanceOf(address(this)) * ppm / BASIS; } IERC20(sellToken).safeTransfer(address(pool), sellAmount); } diff --git a/src/core/UniswapV3Fork.sol b/src/core/UniswapV3Fork.sol index d9f6cc845..07291fd8e 100644 --- a/src/core/UniswapV3Fork.sol +++ b/src/core/UniswapV3Fork.sol @@ -89,11 +89,11 @@ abstract contract UniswapV3Fork is SettlerSwapAbstract { /// @dev Sell a token for another token directly against uniswap v3. /// @param encodedPath Uniswap-encoded path. - /// @param bps proportion of current balance of the first token in the path to sell. + /// @param ppm proportion of current balance of the first token in the path to sell. /// @param minBuyAmount Minimum amount of the last token in the path to buy. /// @param recipient The recipient of the bought tokens. /// @return buyAmount Amount of the last token in the path bought. - function sellToUniswapV3(address recipient, uint256 bps, bytes memory encodedPath, uint256 minBuyAmount) + function sellToUniswapV3(address recipient, uint256 ppm, bytes memory encodedPath, uint256 minBuyAmount) internal returns (uint256 buyAmount) { @@ -103,7 +103,7 @@ abstract contract UniswapV3Fork is SettlerSwapAbstract { // We don't care about phantom overflow here because reserves are // limited to 128 bits. Any token balance that would overflow here // would also break UniV3. - (IERC20(address(bytes20(encodedPath))).fastBalanceOf(address(this)) * bps).unsafeDiv(BASIS), + (IERC20(address(bytes20(encodedPath))).fastBalanceOf(address(this)) * ppm).unsafeDiv(BASIS), minBuyAmount, address(this), // payer new bytes(SWAP_CALLBACK_PREFIX_DATA_SIZE) diff --git a/src/core/UniswapV4.sol b/src/core/UniswapV4.sol index bf248a027..61ea1f5e2 100644 --- a/src/core/UniswapV4.sol +++ b/src/core/UniswapV4.sol @@ -29,12 +29,6 @@ abstract contract UniswapV4 is SettlerSwapAbstract { using UnsafePoolManager for IPoolManager; using NotesLib for NotesLib.Note[]; - constructor() { - assert(BASIS == Encoder.BASIS); - assert(BASIS == Decoder.BASIS); - assert(address(ETH_ADDRESS) == NotesLib.ETH_ADDRESS); - } - function _POOL_MANAGER() internal view virtual returns (IPoolManager); //// These two functions are the entrypoints to this set of actions. Because UniV4 has a @@ -58,7 +52,7 @@ abstract contract UniswapV4 is SettlerSwapAbstract { //// that at least one of the global buy token's fills is positioned appropriately. //// //// Now that you have a list of fills, encode each fill as follows. - //// First encode the `bps` for the fill as 2 bytes. Remember that this `bps` is relative to the + //// First encode the `ppm` for the fill as 3 bytes. Remember that this `ppm` is relative to the //// running balance at the moment that the fill is settled. //// Second, encode the price caps sqrtPriceLimitX96 as 20 bytes. //// Third, encode the packing key for that fill as 1 byte. The packing key byte depends on the @@ -81,7 +75,7 @@ abstract contract UniswapV4 is SettlerSwapAbstract { function sellToUniswapV4( address recipient, IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -92,7 +86,7 @@ abstract contract UniswapV4 is SettlerSwapAbstract { uint32(IPoolManager.unlock.selector), recipient, sellToken, - bps, + ppm, feeOnTransfer, hashMul, hashMod, @@ -177,14 +171,14 @@ abstract contract UniswapV4 is SettlerSwapAbstract { //// multiple times in the calldata. // the mandatory fields are - // 2 - sell bps + // 3 - sell ppm // 20 - sqrtPriceLimitX96 // 1 - pool key tokens case // 3 - pool fee // 3 - pool tick spacing // 20 - pool hooks // 3 - hook data length - uint256 private constant _HOP_DATA_LENGTH = 52; + uint256 private constant _HOP_DATA_LENGTH = 53; /// Decode a `PoolKey` from its packed representation in `bytes` and the token information in /// `state`. Returns the `zeroForOne` flag and the suffix of the bytes that are not consumed in @@ -282,17 +276,17 @@ abstract contract UniswapV4 is SettlerSwapAbstract { IPoolManager.PoolKey memory key; IPoolManager.SwapParams memory params; while (data.length >= _HOP_DATA_LENGTH) { - uint256 bps; + uint256 ppm; { uint160 sqrtPriceLimitX96; assembly ("memory-safe") { - bps := shr(0xf0, calldataload(data.offset)) - data.offset := add(0x02, data.offset) + ppm := shr(0xe8, calldataload(data.offset)) + data.offset := add(0x03, data.offset) sqrtPriceLimitX96 := shr(0x60, calldataload(data.offset)) data.offset := add(0x14, data.offset) - data.length := sub(data.length, 0x16) + data.length := sub(data.length, 0x17) // we don't check for array out-of-bounds here; we will check it later in `Decoder.overflowCheck` } params.sqrtPriceLimitX96 = sqrtPriceLimitX96; @@ -307,7 +301,7 @@ abstract contract UniswapV4 is SettlerSwapAbstract { params.zeroForOne = zeroForOne; unchecked { - params.amountSpecified = int256((state.sell().amount() * bps).unsafeDiv(BASIS)).unsafeNeg(); + params.amountSpecified = int256((state.sell().amount() * ppm).unsafeDiv(BASIS)).unsafeNeg(); } BalanceDelta delta = IPoolManager(msg.sender).unsafeSwap(key, params, hookData); diff --git a/src/core/Velodrome.sol b/src/core/Velodrome.sol index 85ba4d32c..b7d3e8c37 100644 --- a/src/core/Velodrome.sol +++ b/src/core/Velodrome.sol @@ -225,7 +225,7 @@ abstract contract Velodrome is SettlerSwapAbstract { } } - function sellToVelodrome(address recipient, uint256 bps, IVelodromePair pair, uint24 swapInfo, uint256 minAmountOut) + function sellToVelodrome(address recipient, uint256 ppm, IVelodromePair pair, uint24 swapInfo, uint256 minAmountOut) internal { // Preventing calls to Permit2 or AH is not explicitly required as neither of these contracts implement the `swap` nor `transfer` selector @@ -255,12 +255,12 @@ abstract contract Velodrome is SettlerSwapAbstract { unchecked { // Compute sell amount in native units uint256 sellAmount; - if (bps != 0) { + if (ppm != 0) { // It must be possible to square the sell token balance of the pool, otherwise it // will revert with an overflow. Therefore, it can't be so large that multiplying by - // a "reasonable" `bps` value could overflow. We don't care to protect against - // unreasonable `bps` values because that just means the taker is griefing themself. - sellAmount = (sellToken.fastBalanceOf(address(this)) * bps).unsafeDiv(BASIS); + // a "reasonable" `ppm` value could overflow. We don't care to protect against + // unreasonable `ppm` values because that just means the taker is griefing themself. + sellAmount = (sellToken.fastBalanceOf(address(this)) * ppm).unsafeDiv(BASIS); } if (sellAmount != 0) { sellToken.safeTransfer(address(pair), sellAmount); diff --git a/src/core/VelodromeAlt.sol b/src/core/VelodromeAlt.sol index 667c02088..8682c0514 100644 --- a/src/core/VelodromeAlt.sol +++ b/src/core/VelodromeAlt.sol @@ -177,7 +177,7 @@ abstract contract Velodrome is SettlerSwapAbstract { } } - function sellToVelodrome(address recipient, uint256 bps, IVelodromePair pair, uint24 swapInfo, uint256 minAmountOut) + function sellToVelodrome(address recipient, uint256 ppm, IVelodromePair pair, uint24 swapInfo, uint256 minAmountOut) internal { // Preventing calls to Permit2 or AH is not explicitly required as neither of these contracts implement the `swap` nor `transfer` selector @@ -207,12 +207,12 @@ abstract contract Velodrome is SettlerSwapAbstract { unchecked { // Compute sell amount in native units uint256 sellAmount; - if (bps != 0) { + if (ppm != 0) { // It must be possible to square the sell token balance of the pool, otherwise it // will revert with an overflow. Therefore, it can't be so large that multiplying by - // a "reasonable" `bps` value could overflow. We don't care to protect against - // unreasonable `bps` values because that just means the taker is griefing themself. - sellAmount = (sellToken.fastBalanceOf(address(this)) * bps).unsafeDiv(BASIS); + // a "reasonable" `ppm` value could overflow. We don't care to protect against + // unreasonable `ppm` values because that just means the taker is griefing themself. + sellAmount = (sellToken.fastBalanceOf(address(this)) * ppm).unsafeDiv(BASIS); } if (sellAmount != 0) { sellToken.safeTransfer(address(pair), sellAmount); diff --git a/test/integration/AllowanceHolderPairTest.t.sol b/test/integration/AllowanceHolderPairTest.t.sol index 6bb2bb9a2..47cc33941 100644 --- a/test/integration/AllowanceHolderPairTest.t.sol +++ b/test/integration/AllowanceHolderPairTest.t.sol @@ -50,7 +50,7 @@ abstract contract AllowanceHolderPairTest is SettlerBasePairTest { ) ), // Execute UniswapV3 from the Settler balance - abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 10_000, uniswapV3Path(), 0)) + abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 1_000_000, uniswapV3Path(), 0)) ); IAllowanceHolder _allowanceHolder = allowanceHolder; @@ -251,7 +251,7 @@ abstract contract AllowanceHolderPairTest is SettlerBasePairTest { ISettlerActions.BASIC, ( address(fromToken()), - 1_000, + 100_000, address(fromToken()), 0x24, abi.encodeCall(fromToken().transfer, (BURN_ADDRESS, 0)) diff --git a/test/integration/BalancerV3.t.sol b/test/integration/BalancerV3.t.sol index c570fb9a5..d74ba3cb3 100644 --- a/test/integration/BalancerV3.t.sol +++ b/test/integration/BalancerV3.t.sol @@ -116,17 +116,17 @@ abstract contract BalancerV3Test is SettlerMetaTxnPairTest, AllowanceHolderPairT function fills() internal virtual returns (bytes memory) { return bytes.concat( // wrap `fromToken()` to `fromTokenWrapped()` - bytes2(uint16(2 ** 15 | 10000)), + bytes3(uint24(2 ** 23 | 1_000_000)), bytes1(uint8(1)), bytes20(uint160(address(fromTokenWrapped()))), // swap `fromTokenWrapped()` to `toTokenWrapped()` - bytes2(uint16(10000)), + bytes3(uint24(1_000_000)), bytes1(uint8(2)), bytes20(uint160(address(toTokenWrapped()))), bytes20(uint160(balancerV3Pool())), bytes3(uint24(0)), // unwrap `toTokenWrapped()` to `toToken()` - bytes2(uint16(2 ** 14 | 10000)), + bytes3(uint24(2 ** 22 | 1_000_000)), bytes1(uint8(2)), bytes20(uint160(address(toToken()))) ); @@ -139,7 +139,7 @@ abstract contract BalancerV3Test is SettlerMetaTxnPairTest, AllowanceHolderPairT bytes[] memory actions = ActionDataBuilder.build( abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, sig)), abi.encodeCall( - ISettlerActions.BALANCERV3, (FROM, address(fromToken()), 10_000, false, hashMul, hashMod, fills(), 0) + ISettlerActions.BALANCERV3, (FROM, address(fromToken()), 1_000_000, false, hashMul, hashMod, fills(), 0) ) ); ISettlerBase.AllowedSlippage memory allowedSlippage = ISettlerBase.AllowedSlippage({ diff --git a/test/integration/DodoV1PairTest.t.sol b/test/integration/DodoV1PairTest.t.sol index 310a25165..79206a7bc 100644 --- a/test/integration/DodoV1PairTest.t.sol +++ b/test/integration/DodoV1PairTest.t.sol @@ -20,7 +20,9 @@ abstract contract DodoV1PairTest is SettlerBasePairTest { function testSettler_dodoV1() public skipIf(dodoV1Pool() == address(0)) { bytes[] memory actions = ActionDataBuilder.build( _getDefaultFromPermit2Action(), - abi.encodeCall(ISettlerActions.DODOV1, (address(fromToken()), 10_000, dodoV1Pool(), dodoV1Direction(), 0)) + abi.encodeCall( + ISettlerActions.DODOV1, (address(fromToken()), 1_000_000, dodoV1Pool(), dodoV1Direction(), 0) + ) ); Settler _settler = settler; uint256 beforeBalance = balanceOf(toToken(), FROM); diff --git a/test/integration/DodoV2PairTest.t.sol b/test/integration/DodoV2PairTest.t.sol index 35eed4953..9b099f21d 100644 --- a/test/integration/DodoV2PairTest.t.sol +++ b/test/integration/DodoV2PairTest.t.sol @@ -78,7 +78,7 @@ contract DodoV2PairTest is BasePairTest { bytes memory sig = getPermitTransferSignature(permit, address(settler), FROM_PRIVATE_KEY, permit2Domain); bytes[] memory actions = ActionDataBuilder.build( abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, sig)), - abi.encodeCall(ISettlerActions.DODOV2, (FROM, address(fromToken()), 10_000, dodoV2Pool(), true, 0)) + abi.encodeCall(ISettlerActions.DODOV2, (FROM, address(fromToken()), 1_000_000, dodoV2Pool(), true, 0)) ); Settler _settler = settler; diff --git a/test/integration/EkuboV2.t.sol b/test/integration/EkuboV2.t.sol index a19deb7b2..9f67c9b09 100644 --- a/test/integration/EkuboV2.t.sol +++ b/test/integration/EkuboV2.t.sol @@ -70,14 +70,14 @@ abstract contract EkuboV2Test is SettlerMetaTxnPairTest { function ekuboV2Fills() internal view returns (bytes memory) { (IERC20 fromToken, IERC20 toToken) = ekuboV2Tokens(); return abi.encodePacked( - uint16(10_000), ekuboV2SqrtRatio(fromToken, toToken), bytes1(0x01), address(toToken), ekuboV2PoolConfig() + uint24(1_000_000), ekuboV2SqrtRatio(fromToken, toToken), bytes1(0x01), address(toToken), ekuboV2PoolConfig() ); } function ekuboV2ExtensionFills() internal view returns (bytes memory) { (IERC20 fromToken, IERC20 toToken) = ekuboV2Tokens(); return abi.encodePacked( - uint16(42768), + uint24(2 ** 23 | 1_000_000), ekuboV2SqrtRatio(fromToken, toToken), bytes1(0x01), address(toToken), @@ -116,7 +116,7 @@ abstract contract EkuboV2Test is SettlerMetaTxnPairTest { abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, sig)), abi.encodeCall( ISettlerActions.EKUBO, - (ekuboV2Recipient(), address(fromToken()), 10_000, false, hashMul, hashMod, ekuboV2Fills(), 0) + (ekuboV2Recipient(), address(fromToken()), 1_000_000, false, hashMul, hashMod, ekuboV2Fills(), 0) ) ) ); @@ -152,7 +152,7 @@ abstract contract EkuboV2Test is SettlerMetaTxnPairTest { ( ekuboV2Recipient(), address(fromToken()), - 10_000, + 1_000_000, false, hashMul, hashMod, diff --git a/test/integration/EkuboV3.t.sol b/test/integration/EkuboV3.t.sol index 4ba36f58b..f1920e345 100644 --- a/test/integration/EkuboV3.t.sol +++ b/test/integration/EkuboV3.t.sol @@ -72,14 +72,18 @@ abstract contract EkuboV3Test is SettlerMetaTxnPairTest { function ekuboFills() internal view returns (bytes memory) { (IERC20 fromToken, IERC20 toToken) = ekuboTokens(); return abi.encodePacked( - uint16(10_000), ekuboSqrtRatio(fromToken, toToken), bytes1(0x01), address(toToken), ekuboPoolConfig() + uint24(1_000_000), ekuboSqrtRatio(fromToken, toToken), bytes1(0x01), address(toToken), ekuboPoolConfig() ); } function ekuboExtensionFills() internal view returns (bytes memory) { (IERC20 fromToken, IERC20 toToken) = ekuboTokens(); return abi.encodePacked( - uint16(42768), ekuboSqrtRatio(fromToken, toToken), bytes1(0x01), address(toToken), ekuboExtensionConfig() + uint24(2 ** 23 | 1_000_000), + ekuboSqrtRatio(fromToken, toToken), + bytes1(0x01), + address(toToken), + ekuboExtensionConfig() ); } @@ -118,7 +122,7 @@ abstract contract EkuboV3Test is SettlerMetaTxnPairTest { abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, sig)), abi.encodeCall( ISettlerActions.EKUBOV3, - (recipient(), address(fromToken()), 10_000, false, hashMul, hashMod, ekuboFills(), 0) + (recipient(), address(fromToken()), 1_000_000, false, hashMul, hashMod, ekuboFills(), 0) ) ) ); @@ -151,7 +155,7 @@ abstract contract EkuboV3Test is SettlerMetaTxnPairTest { abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, sig)), abi.encodeCall( ISettlerActions.EKUBOV3, - (recipient(), address(fromToken()), 10_000, false, hashMul, hashMod, ekuboExtensionFills(), 0) + (recipient(), address(fromToken()), 1_000_000, false, hashMul, hashMod, ekuboExtensionFills(), 0) ) ) ); diff --git a/test/integration/EulerSwap.t.sol b/test/integration/EulerSwap.t.sol index 918abf81c..efdc628e0 100644 --- a/test/integration/EulerSwap.t.sol +++ b/test/integration/EulerSwap.t.sol @@ -95,7 +95,7 @@ abstract contract EulerSwapTest is AllowanceHolderPairTest { bytes[] memory actions = ActionDataBuilder.build( abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, sig)), - abi.encodeCall(ISettlerActions.EULERSWAP, (FROM, address(fromToken()), 10_000, eulerSwapPool(), true, 0)) + abi.encodeCall(ISettlerActions.EULERSWAP, (FROM, address(fromToken()), 1_000_000, eulerSwapPool(), true, 0)) ); ISettlerBase.AllowedSlippage memory allowedSlippage = ISettlerBase.AllowedSlippage({ @@ -123,7 +123,7 @@ abstract contract EulerSwapTest is AllowanceHolderPairTest { bytes[] memory actions = ActionDataBuilder.build( abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, sig)), - abi.encodeCall(ISettlerActions.EULERSWAP, (FROM, address(toToken()), 10_000, eulerSwapPool(), false, 0)) + abi.encodeCall(ISettlerActions.EULERSWAP, (FROM, address(toToken()), 1_000_000, eulerSwapPool(), false, 0)) ); ISettlerBase.AllowedSlippage memory allowedSlippage = ISettlerBase.AllowedSlippage({ diff --git a/test/integration/Hanji.t.sol b/test/integration/Hanji.t.sol index 9b69b4535..6838d8eaf 100644 --- a/test/integration/Hanji.t.sol +++ b/test/integration/Hanji.t.sol @@ -102,12 +102,12 @@ abstract contract HanjiTestBase is AllowanceHolderPairTest { // ========== HELPER FUNCTIONS ========== /// @dev Builds a standard HANJI action with common parameters - function _buildHanjiAction(bool unwrap, uint256 bps, uint256 minBuyAmount) internal view returns (bytes memory) { + function _buildHanjiAction(bool unwrap, uint256 ppm, uint256 minBuyAmount) internal view returns (bytes memory) { return abi.encodeCall( ISettlerActions.HANJI, ( unwrap ? ETH_ADDRESS : address(fromToken()), - bps, + ppm, address(hanjiPool()), sellScalingFactor(), buyScalingFactor(), @@ -152,7 +152,7 @@ abstract contract HanjiTestBase is AllowanceHolderPairTest { defaultERC20PermitTransfer(address(fromToken()), amount(), 0); return ActionDataBuilder.build( abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, new bytes(0))), - _buildHanjiAction(false, 10_000, 0) + _buildHanjiAction(false, 1_000_000, 0) ); } } @@ -213,9 +213,9 @@ contract HanjiWmonToUsdcTest is HanjiTestBase { abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, new bytes(0))), abi.encodeCall( ISettlerActions.BASIC, - (address(fromToken()), 10_000, address(fromToken()), 4, abi.encodeCall(IWMON.withdraw, (0))) + (address(fromToken()), 1_000_000, address(fromToken()), 4, abi.encodeCall(IWMON.withdraw, (0))) ), - _buildHanjiAction(true, 10_000, 0) + _buildHanjiAction(true, 1_000_000, 0) ); (uint256 spent, uint256 received) = _executeHanji(actions, "hanji_sellNativeForUsdc"); @@ -233,7 +233,7 @@ contract HanjiWmonToUsdcTest is HanjiTestBase { bytes[] memory actions = ActionDataBuilder.build( abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, new bytes(0))), - _buildHanjiAction(false, 10_000, type(uint128).max) + _buildHanjiAction(false, 1_000_000, type(uint128).max) ); ISettlerBase.AllowedSlippage memory allowedSlippage = ISettlerBase.AllowedSlippage({ @@ -301,7 +301,7 @@ contract HanjiUsdcToWmonTest is HanjiTestBase { bytes[] memory actions = ActionDataBuilder.build( abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, new bytes(0))), - _buildHanjiAction(false, 10_000, type(uint128).max) + _buildHanjiAction(false, 1_000_000, type(uint128).max) ); ISettlerBase.AllowedSlippage memory allowedSlippage = ISettlerBase.AllowedSlippage({ diff --git a/test/integration/LayerZeroOFT.t.sol b/test/integration/LayerZeroOFT.t.sol index 295545b84..6f7cf14d4 100644 --- a/test/integration/LayerZeroOFT.t.sol +++ b/test/integration/LayerZeroOFT.t.sol @@ -8,7 +8,8 @@ import {ALLOWANCE_HOLDER} from "src/allowanceholder/IAllowanceHolder.sol"; import {IBridgeSettlerActions} from "src/bridge/IBridgeSettlerActions.sol"; import {PlasmaBridgeSettler} from "src/chains/Plasma/BridgeSettler.sol"; import {SafeTransferLib} from "src/vendor/SafeTransferLib.sol"; -import {IOFT, ETH} from "src/core/LayerZeroOFT.sol"; +import {IOFT} from "src/core/LayerZeroOFT.sol"; +import {ETH_ADDRESS} from "src/core/Constants.sol"; import {ActionDataBuilder} from "../utils/ActionDataBuilder.sol"; import {LibBytes} from "../utils/LibBytes.sol"; @@ -113,7 +114,7 @@ contract LayerZeroOFTPlasmaTest is BridgeSettlerIntegrationTest { bytes[] memory bridgeActions = ActionDataBuilder.build( abi.encodeCall( IBridgeSettlerActions.BRIDGE_TO_LAYER_ZERO_OFT, - (address(ETH), oft, abi.encodeCall(IOFT.send, (sendParam, messagingFee, address(this))).popSelector()) + (ETH_ADDRESS, oft, abi.encodeCall(IOFT.send, (sendParam, messagingFee, address(this))).popSelector()) ) ); sendParam.amountLD = amount; @@ -151,9 +152,9 @@ contract LayerZeroOFTPlasmaTest is BridgeSettlerIntegrationTest { bytes[] memory bridgeActions = ActionDataBuilder.build( abi.encodeCall( IBridgeSettlerActions.BRIDGE_TO_LAYER_ZERO_OFT, - (address(ETH), oft, abi.encodeCall(IOFT.send, (sendParam, messagingFee, address(this))).popSelector()) + (ETH_ADDRESS, oft, abi.encodeCall(IOFT.send, (sendParam, messagingFee, address(this))).popSelector()) ), - abi.encodeCall(IBridgeSettlerActions.BASIC, (address(ETH), 10000, address(this), 0, bytes(""))) + abi.encodeCall(IBridgeSettlerActions.BASIC, (ETH_ADDRESS, 1_000_000, address(this), 0, bytes(""))) ); sendParam.amountLD = amount - dust; diff --git a/test/integration/MakerPSMLite.t.sol b/test/integration/MakerPSMLite.t.sol index 7b7e37915..6ee5ce347 100644 --- a/test/integration/MakerPSMLite.t.sol +++ b/test/integration/MakerPSMLite.t.sol @@ -105,7 +105,7 @@ contract MakerPsmLiteTest is SettlerMetaTxnPairTest { abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, sig)), abi.encodeCall( ISettlerActions.MAKERPSM, - (FROM, 10_000, makerPsmBuyGem(), amountOut(), address(makerPsm()), address(dai())) + (FROM, 1_000_000, makerPsmBuyGem(), amountOut(), address(makerPsm()), address(dai())) ) ); ISettlerBase.AllowedSlippage memory allowedSlippage = ISettlerBase.AllowedSlippage({ @@ -139,7 +139,7 @@ contract MakerPsmLiteTest is SettlerMetaTxnPairTest { abi.encodeCall(ISettlerActions.METATXN_TRANSFER_FROM, (address(settlerMetaTxn), permit)), abi.encodeCall( ISettlerActions.MAKERPSM, - (FROM, 10_000, makerPsmBuyGem(), amountOut(), address(makerPsm()), address(dai())) + (FROM, 1_000_000, makerPsmBuyGem(), amountOut(), address(makerPsm()), address(dai())) ) ); ISettlerBase.AllowedSlippage memory allowedSlippage = ISettlerBase.AllowedSlippage({ diff --git a/test/integration/MaverickV2PairTest.t.sol b/test/integration/MaverickV2PairTest.t.sol index 7148c74bd..b6822691b 100644 --- a/test/integration/MaverickV2PairTest.t.sol +++ b/test/integration/MaverickV2PairTest.t.sol @@ -65,7 +65,15 @@ abstract contract MaverickV2PairTest is SettlerMetaTxnPairTest { abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, sig)), abi.encodeCall( ISettlerActions.MAVERICKV2, - (FROM, address(fromToken()), 10_000, maverickV2Pool(), maverickV2TokenAIn(), maverickV2TickLimit(), 0) + ( + FROM, + address(fromToken()), + 1_000_000, + maverickV2Pool(), + maverickV2TokenAIn(), + maverickV2TickLimit(), + 0 + ) ) ); ISettlerBase.AllowedSlippage memory allowedSlippage = ISettlerBase.AllowedSlippage({ diff --git a/test/integration/PancakeInfinity.t.sol b/test/integration/PancakeInfinity.t.sol index 02e11418f..3153e8789 100644 --- a/test/integration/PancakeInfinity.t.sol +++ b/test/integration/PancakeInfinity.t.sol @@ -151,7 +151,7 @@ abstract contract PancakeInfinityTest is AllowanceHolderPairTest, SettlerMetaTxn .poolIdToPoolKey(PoolId.wrap(poolId_)); return abi.encodePacked( - uint16(10_000), + uint24(1_000_000), sqrtPriceLimitX96(fromToken, toToken), bytes1(0x01), toToken, @@ -205,7 +205,7 @@ abstract contract PancakeInfinityTest is AllowanceHolderPairTest, SettlerMetaTxn abi.encodeCall(ISettlerActions.TRANSFER_FROM, (address(settler), permit, sig)), abi.encodeCall( ISettlerActions.PANCAKE_INFINITY, - (recipient(), address(fromToken()), 10_000, false, hashMul, hashMod, pancakeInfinityFills(), 0) + (recipient(), address(fromToken()), 1_000_000, false, hashMul, hashMod, pancakeInfinityFills(), 0) ) ) ); @@ -421,9 +421,9 @@ contract USDTWBNBTest is PancakeInfinityTest { for (uint256 i; i < actions.length; i++) { data[i] = actions[i]; } - data[actions.length] = abi.encodeCall(ISettlerActions.BASIC, (bnb, 10_000, wbnb, 0, "")); + data[actions.length] = abi.encodeCall(ISettlerActions.BASIC, (bnb, 1_000_000, wbnb, 0, "")); data[actions.length + 1] = abi.encodeCall( - ISettlerActions.BASIC, (wbnb, 10_000, wbnb, 36, abi.encodeCall(toToken().transfer, (FROM, uint256(0)))) + ISettlerActions.BASIC, (wbnb, 1_000_000, wbnb, 36, abi.encodeCall(toToken().transfer, (FROM, uint256(0)))) ); return data; } diff --git a/test/integration/SettlerMetaTxnPairTest.t.sol b/test/integration/SettlerMetaTxnPairTest.t.sol index dabf29304..b6710d7a7 100644 --- a/test/integration/SettlerMetaTxnPairTest.t.sol +++ b/test/integration/SettlerMetaTxnPairTest.t.sol @@ -139,7 +139,7 @@ abstract contract SettlerMetaTxnPairTest is SettlerBasePairTest { bytes[] memory actions = ActionDataBuilder.build( abi.encodeCall(ISettlerActions.METATXN_TRANSFER_FROM, (address(settlerMetaTxn), permit)), - abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 10_000, uniswapV3Path(), 0)) + abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 1_000_000, uniswapV3Path(), 0)) ); bytes32[] memory actionHashes = new bytes32[](actions.length); @@ -292,7 +292,7 @@ abstract contract SettlerMetaTxnPairTest is SettlerBasePairTest { ISettlerActions.BASIC, ( address(toToken()), - 1_000, + 100_000, address(toToken()), 0x24, abi.encodeCall(toToken().transfer, (BURN_ADDRESS, 0)) diff --git a/test/integration/SettlerPairTest.t.sol b/test/integration/SettlerPairTest.t.sol index 14c9fa355..c993dfcf4 100644 --- a/test/integration/SettlerPairTest.t.sol +++ b/test/integration/SettlerPairTest.t.sol @@ -73,7 +73,7 @@ abstract contract SettlerPairTest is SettlerBasePairTest { ISettlerActions.BASIC, ( address(fromToken()), - 10_000, + 1_000_000, address(ZERO_EX), 0x184, abi.encodeCall( @@ -102,7 +102,7 @@ abstract contract SettlerPairTest is SettlerBasePairTest { ISettlerActions.BASIC, ( address(fromToken()), - 5_000, + 500_000, address(ZERO_EX), 0x184, abi.encodeCall( @@ -114,7 +114,7 @@ abstract contract SettlerPairTest is SettlerBasePairTest { ISettlerActions.BASIC, ( address(fromToken()), - 10_000, + 1_000_000, address(fromToken()), 0x24, abi.encodeCall(fromToken().transfer, (FROM, 0)) @@ -151,8 +151,8 @@ abstract contract SettlerPairTest is SettlerBasePairTest { function testSettler_uniswapV3_multiplex2() public skipIf(uniswapV3Path().length == 0) { bytes[] memory actions = ActionDataBuilder.build( _getDefaultFromPermit2Action(), - abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 5_000, uniswapV3Path(), 0)), - abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 10_000, uniswapV3Path(), 0)) + abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 500_000, uniswapV3Path(), 0)), + abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 1_000_000, uniswapV3Path(), 0)) ); Settler _settler = settler; @@ -171,7 +171,7 @@ abstract contract SettlerPairTest is SettlerBasePairTest { function testSettler_uniswapV3() public skipIf(uniswapV3Path().length == 0) { bytes[] memory actions = ActionDataBuilder.build( _getDefaultFromPermit2Action(), - abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 10_000, uniswapV3Path(), 0)) + abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 1_000_000, uniswapV3Path(), 0)) ); Settler _settler = settler; @@ -190,12 +190,12 @@ abstract contract SettlerPairTest is SettlerBasePairTest { function testSettler_uniswapV3_buyToken_fee_full_custody() public skipIf(uniswapV3Path().length == 0) { bytes[] memory actions = ActionDataBuilder.build( _getDefaultFromPermit2Action(), - abi.encodeCall(ISettlerActions.UNISWAPV3, (address(settler), 10_000, uniswapV3Path(), 0)), + abi.encodeCall(ISettlerActions.UNISWAPV3, (address(settler), 1_000_000, uniswapV3Path(), 0)), abi.encodeCall( ISettlerActions.BASIC, ( address(toToken()), - 1_000, + 100_000, address(toToken()), 0x24, abi.encodeCall(toToken().transfer, (BURN_ADDRESS, 0)) @@ -222,7 +222,7 @@ abstract contract SettlerPairTest is SettlerBasePairTest { ISettlerActions.BASIC, ( address(toToken()), - 1_000, + 100_000, address(toToken()), 0x24, abi.encodeCall(toToken().transfer, (BURN_ADDRESS, 0)) @@ -248,13 +248,13 @@ abstract contract SettlerPairTest is SettlerBasePairTest { ISettlerActions.BASIC, ( address(fromToken()), - 1_000, + 100_000, address(fromToken()), 0x24, abi.encodeCall(fromToken().transfer, (BURN_ADDRESS, 0)) ) ), - abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 10_000, uniswapV3Path(), 0)) + abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 1_000_000, uniswapV3Path(), 0)) ); Settler _settler = settler; @@ -270,6 +270,41 @@ abstract contract SettlerPairTest is SettlerBasePairTest { snapEnd(); } + function testSettler_uniswapV3_sellToken_fee_sub_bp() public skipIf(uniswapV3Path().length == 0) { + uint256 feePpm = 30; + uint256 expectedFee = amount() * feePpm / 1_000_000; + uint256 burnBalanceBefore = fromToken().balanceOf(BURN_ADDRESS); + + bytes[] memory actions = ActionDataBuilder.build( + _getDefaultFromPermit2Action(), + abi.encodeCall( + ISettlerActions.BASIC, + ( + address(fromToken()), + feePpm, + address(fromToken()), + 0x24, + abi.encodeCall(fromToken().transfer, (BURN_ADDRESS, 0)) + ) + ), + abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 1_000_000, uniswapV3Path(), 0)) + ); + + Settler _settler = settler; + vm.startPrank(FROM); + snapStartName("settler_uniswapV3_sellToken_fee_sub_bp"); + _settler.execute( + ISettlerBase.AllowedSlippage({ + recipient: payable(address(0)), buyToken: IERC20(address(0)), minAmountOut: 0 ether + }), + actions, + bytes32(0) + ); + snapEnd(); + + assertEq(fromToken().balanceOf(BURN_ADDRESS), burnBalanceBefore + expectedFee); + } + function testSettler_uniswapV2() public skipIf(uniswapV2Pool() == address(0)) { // |7|6|5|4|3|2|1|0| - bit positions in swapInfo (uint8) // |0|0|0|0|0|0|F|Z| - Z: zeroForOne flag, F: sellTokenHasFee flag @@ -279,7 +314,7 @@ abstract contract SettlerPairTest is SettlerBasePairTest { bytes[] memory actions = ActionDataBuilder.build( _getDefaultFromPermit2Action(), abi.encodeCall( - ISettlerActions.UNISWAPV2, (FROM, address(fromToken()), 10_000, uniswapV2Pool(), swapInfo, 0) + ISettlerActions.UNISWAPV2, (FROM, address(fromToken()), 1_000_000, uniswapV2Pool(), swapInfo, 0) ) ); @@ -381,7 +416,7 @@ abstract contract SettlerPairTest is SettlerBasePairTest { bytes[] memory actions = ActionDataBuilder.build( _getDefaultFromPermit2Action(), abi.encodeCall( - ISettlerActions.UNISWAPV2, (nextPool, address(fromToken()), 10_000, uniswapV2Pool(), swapInfo, 0) + ISettlerActions.UNISWAPV2, (nextPool, address(fromToken()), 1_000_000, uniswapV2Pool(), swapInfo, 0) ), abi.encodeCall(ISettlerActions.UNISWAPV2, (FROM, address(toToken()), 0, nextPool, swapInfo2, 0)) ); @@ -412,7 +447,7 @@ abstract contract SettlerPairTest is SettlerBasePairTest { ISettlerActions.BASIC, ( address(fromToken()), - 10_000, + 1_000_000, poolData.pool, 0x44, abi.encodeCall(ICurveV2Pool.exchange, (poolData.fromTokenIndex, poolData.toTokenIndex, 0, 0)) @@ -422,7 +457,7 @@ abstract contract SettlerPairTest is SettlerBasePairTest { ISettlerActions.BASIC, ( address(toToken()), - 1_000, + 100_000, address(toToken()), 0x24, abi.encodeCall(toToken().transfer, (BURN_ADDRESS, 0)) @@ -450,7 +485,7 @@ abstract contract SettlerPairTest is SettlerBasePairTest { ISettlerActions.BASIC, ( address(fromToken()), - 10_000, // bps + 1_000_000, // ppm poolData.pool, 0x44, // offset abi.encodeCall(ICurveV2Pool.exchange, (poolData.fromTokenIndex, poolData.toTokenIndex, 0, 0)) @@ -473,7 +508,7 @@ abstract contract SettlerPairTest is SettlerBasePairTest { function testSettler_externalMoveExecute_uniswapV3() public skipIf(uniswapV3Path().length == 0) { bytes[] memory actions = - ActionDataBuilder.build(abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 10_000, uniswapV3Path(), 0))); + ActionDataBuilder.build(abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 1_000_000, uniswapV3Path(), 0))); Settler _settler = settler; diff --git a/test/integration/StargateV2.t.sol b/test/integration/StargateV2.t.sol index 60a7cb6a3..496812ebb 100644 --- a/test/integration/StargateV2.t.sol +++ b/test/integration/StargateV2.t.sol @@ -7,7 +7,8 @@ import {BridgeSettlerIntegrationTest} from "./BridgeSettler.t.sol"; import {ALLOWANCE_HOLDER} from "src/allowanceholder/IAllowanceHolder.sol"; import {IBridgeSettlerActions} from "src/bridge/IBridgeSettlerActions.sol"; import {ArbitrumBridgeSettler} from "src/chains/Arbitrum/BridgeSettler.sol"; -import {IStargateV2, IOFT, ETH} from "src/core/StargateV2.sol"; +import {IStargateV2, IOFT} from "src/core/StargateV2.sol"; +import {ETH_ADDRESS} from "src/core/Constants.sol"; import {ActionDataBuilder} from "../utils/ActionDataBuilder.sol"; import {LibBytes} from "../utils/LibBytes.sol"; @@ -55,7 +56,7 @@ contract StargateV2Test is BridgeSettlerIntegrationTest { bytes[] memory bridgeActions = ActionDataBuilder.build( abi.encodeCall( IBridgeSettlerActions.BRIDGE_TO_STARGATE_V2, - (address(ETH), pool, abi.encode(sendParam, messagingFee, address(this))) + (ETH_ADDRESS, pool, abi.encode(sendParam, messagingFee, address(this))) ) ); uint256 excess = 10; diff --git a/test/integration/USDC_WETH.t.sol b/test/integration/USDC_WETH.t.sol index de502ff4e..37b01722e 100644 --- a/test/integration/USDC_WETH.t.sol +++ b/test/integration/USDC_WETH.t.sol @@ -178,10 +178,10 @@ contract USDCWETHTest is for (uint256 i; i < actions.length; i++) { data[i] = actions[i]; } - data[actions.length] = abi.encodeCall(ISettlerActions.BASIC, (address(ETH), 10_000, address(_weth), 0, "")); + data[actions.length] = abi.encodeCall(ISettlerActions.BASIC, (address(ETH), 1_000_000, address(_weth), 0, "")); data[actions.length + 1] = abi.encodeCall( ISettlerActions.BASIC, - (_weth, 10_000, address(_weth), 36, abi.encodeCall(toToken().transfer, (FROM, uint256(0)))) + (_weth, 1_000_000, address(_weth), 36, abi.encodeCall(toToken().transfer, (FROM, uint256(0)))) ); return data; } @@ -214,10 +214,10 @@ contract USDCWETHTest is for (uint256 i; i < actions.length; i++) { data[i] = actions[i]; } - data[actions.length] = abi.encodeCall(ISettlerActions.BASIC, (address(ETH), 10_000, address(_weth), 0, "")); + data[actions.length] = abi.encodeCall(ISettlerActions.BASIC, (address(ETH), 1_000_000, address(_weth), 0, "")); data[actions.length + 1] = abi.encodeCall( ISettlerActions.BASIC, - (_weth, 10_000, address(_weth), 36, abi.encodeCall(toToken().transfer, (FROM, uint256(0)))) + (_weth, 1_000_000, address(_weth), 36, abi.encodeCall(toToken().transfer, (FROM, uint256(0)))) ); return data; } diff --git a/test/integration/USDT_WETH.t.sol b/test/integration/USDT_WETH.t.sol index 7ed713f7c..e01123d05 100644 --- a/test/integration/USDT_WETH.t.sol +++ b/test/integration/USDT_WETH.t.sol @@ -139,10 +139,10 @@ contract USDTWETHTest is for (uint256 i; i < actions.length; i++) { data[i] = actions[i]; } - data[actions.length] = abi.encodeCall(ISettlerActions.BASIC, (address(ETH), 10_000, address(_weth), 0, "")); + data[actions.length] = abi.encodeCall(ISettlerActions.BASIC, (address(ETH), 1_000_000, address(_weth), 0, "")); data[actions.length + 1] = abi.encodeCall( ISettlerActions.BASIC, - (_weth, 10_000, address(_weth), 36, abi.encodeCall(toToken().transfer, (FROM, uint256(0)))) + (_weth, 1_000_000, address(_weth), 36, abi.encodeCall(toToken().transfer, (FROM, uint256(0)))) ); return data; } diff --git a/test/integration/UniV3CallbackPoC.t.sol b/test/integration/UniV3CallbackPoC.t.sol index bebb764b2..5a6e0e3ee 100644 --- a/test/integration/UniV3CallbackPoC.t.sol +++ b/test/integration/UniV3CallbackPoC.t.sol @@ -241,7 +241,7 @@ contract UniV3CallbackPoC is Utils, Permit2Signature, MainnetDefaultFork { ISettlerActions.BASIC, ( address(0), // sellToken - 10_000, // proportion + 1_000_000, // proportion pool, // pool 0, // offset poolCalldata diff --git a/test/integration/UniswapV2PairTest.t.sol b/test/integration/UniswapV2PairTest.t.sol index d2b270dba..e59e52e6e 100644 --- a/test/integration/UniswapV2PairTest.t.sol +++ b/test/integration/UniswapV2PairTest.t.sol @@ -92,7 +92,7 @@ abstract contract UniswapV2PairTest is SettlerPairTest { ), abi.encodeCall( ISettlerActions.BASIC, - (address(WETH), 10_000, address(WETH), 4, abi.encodeWithSignature("withdraw(uint256)", 0 wei)) + (address(WETH), 1_000_000, address(WETH), 4, abi.encodeWithSignature("withdraw(uint256)", 0 wei)) ) ); ISettlerBase.AllowedSlippage memory slippage = @@ -116,14 +116,20 @@ abstract contract UniswapV2PairTest is SettlerPairTest { bytes[] memory actions = ActionDataBuilder.build( abi.encodeCall( ISettlerActions.BASIC, - (address(ETH), 10_000, address(WETH), 4, bytes.concat(abi.encodeWithSignature("deposit()"), bytes32(0))) + ( + address(ETH), + 1_000_000, + address(WETH), + 4, + bytes.concat(abi.encodeWithSignature("deposit()"), bytes32(0)) + ) ), abi.encodeCall( ISettlerActions.UNISWAPV2, ( FROM, address(fromToken()), - 10_000, + 1_000_000, uniswapV2Pool(), uint24((30 << 8) | (zeroForOne ? 1 : 0)), slippageLimit() diff --git a/test/integration/UniswapV3PairTest.t.sol b/test/integration/UniswapV3PairTest.t.sol index 352e64e94..41a47c0df 100644 --- a/test/integration/UniswapV3PairTest.t.sol +++ b/test/integration/UniswapV3PairTest.t.sol @@ -111,7 +111,7 @@ abstract contract UniswapV3PairTest is SettlerPairTest { abi.encodeCall(ISettlerActions.UNISWAPV3_VIP, (address(_settler), permit, uniswapV3Path(), sig, 0 wei)), abi.encodeCall( ISettlerActions.BASIC, - (address(WETH), 10_000, address(WETH), 4, abi.encodeWithSignature("withdraw(uint256)", 0 wei)) + (address(WETH), 1_000_000, address(WETH), 4, abi.encodeWithSignature("withdraw(uint256)", 0 wei)) ) ); ISettlerBase.AllowedSlippage memory slippage = @@ -132,9 +132,9 @@ abstract contract UniswapV3PairTest is SettlerPairTest { bytes[] memory actions = ActionDataBuilder.build( abi.encodeCall( ISettlerActions.BASIC, - (address(ETH), 10_000, address(WETH), 4, abi.encodeWithSignature("deposit()", 0 wei)) + (address(ETH), 1_000_000, address(WETH), 4, abi.encodeWithSignature("deposit()", 0 wei)) ), - abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 10_000, uniswapV3Path(), slippageLimit())) + abi.encodeCall(ISettlerActions.UNISWAPV3, (FROM, 1_000_000, uniswapV3Path(), slippageLimit())) ); ISettlerBase.AllowedSlippage memory slippage = ISettlerBase.AllowedSlippage({ recipient: payable(address(0)), buyToken: IERC20(address(0)), minAmountOut: 0 ether diff --git a/test/integration/UniswapV4PairTest.t.sol b/test/integration/UniswapV4PairTest.t.sol index 0dc338876..d5ce04124 100644 --- a/test/integration/UniswapV4PairTest.t.sol +++ b/test/integration/UniswapV4PairTest.t.sol @@ -131,7 +131,7 @@ abstract contract UniswapV4PairTest is SettlerBasePairTest { (uint256 hashMul, uint256 hashMod) = uniswapV4PerfectHash(fromTokenCompat, toTokenCompat); bytes memory fills = abi.encodePacked( - uint16(10_000), + uint24(1_000_000), uint160(1461446703485210103287273052203988822378723970341), bytes1(0x01), toTokenCompat, @@ -166,7 +166,7 @@ abstract contract UniswapV4PairTest is SettlerBasePairTest { (uint256 hashMul, uint256 hashMod) = uniswapV4PerfectHash(fromTokenCompat, toTokenCompat); bytes memory fills = abi.encodePacked( - uint16(10_000), + uint24(1_000_000), uint160(4295128740), bytes1(0x01), toTokenCompat, @@ -179,7 +179,7 @@ abstract contract UniswapV4PairTest is SettlerBasePairTest { bytes[] memory actions = ActionDataBuilder.build( abi.encodeCall( ISettlerActions.UNISWAPV4, - (FROM, address(fromTokenCompat), 10_000, false, hashMul, hashMod, fills, slippageLimit()) + (FROM, address(fromTokenCompat), 1_000_000, false, hashMul, hashMod, fills, slippageLimit()) ) ); ISettlerBase.AllowedSlippage memory slippage = ISettlerBase.AllowedSlippage({ diff --git a/test/integration/WethWrapTest.t.sol b/test/integration/WethWrapTest.t.sol index 4bb075d0f..5c5c25773 100644 --- a/test/integration/WethWrapTest.t.sol +++ b/test/integration/WethWrapTest.t.sol @@ -47,7 +47,7 @@ contract WethWrapTest is BasePairTest { function testWethDeposit() public { vm.deal(address(_settler), amount()); bytes[] memory actions = - ActionDataBuilder.build(abi.encodeCall(ISettlerActions.BASIC, (_eth, 10_000, address(_weth), 0, ""))); + ActionDataBuilder.build(abi.encodeCall(ISettlerActions.BASIC, (_eth, 1_000_000, address(_weth), 0, ""))); uint256 balanceBefore = balanceOf(toToken(), address(this)); Settler settler = _settler; @@ -68,7 +68,8 @@ contract WethWrapTest is BasePairTest { deal(address(_weth), address(_settler), amount()); bytes[] memory actions = ActionDataBuilder.build( abi.encodeCall( - ISettlerActions.BASIC, (address(_weth), 10_000, address(_weth), 4, abi.encodeCall(_weth.withdraw, (0))) + ISettlerActions.BASIC, + (address(_weth), 1_000_000, address(_weth), 4, abi.encodeCall(_weth.withdraw, (0))) ) ); diff --git a/test/unit/BridgeSettler.t.sol b/test/unit/BridgeSettler.t.sol index 0a3820b6f..5a401128d 100644 --- a/test/unit/BridgeSettler.t.sol +++ b/test/unit/BridgeSettler.t.sol @@ -98,7 +98,7 @@ contract BridgeSettlerTest is BridgeSettlerUnitTest, Utils { ISettlerActions.BASIC, ( address(token), - 10_000, + 1_000_000, address(token), 0x24, abi.encodeCall(IERC20.transfer, (address(bridgeSettler), 0)) @@ -133,7 +133,7 @@ contract BridgeSettlerTest is BridgeSettlerUnitTest, Utils { IBridgeSettlerActions.BASIC, ( address(token), - 10_000, + 1_000_000, address(bridgeDummy), 0x24, abi.encodeCall(BridgeDummy.take, (address(token), 0)) @@ -169,7 +169,7 @@ contract BridgeSettlerTest is BridgeSettlerUnitTest, Utils { // 1. Just send Native back to BridgeSettler bytes[] memory settlerActions = ActionDataBuilder.build( - abi.encodeCall(ISettlerActions.BASIC, (ETH_ADDRESS, 10_000, address(bridgeSettler), 0x00, bytes(""))) + abi.encodeCall(ISettlerActions.BASIC, (ETH_ADDRESS, 1_000_000, address(bridgeSettler), 0x00, bytes(""))) ); // 1. Do a swap (that just takes and returns the assets) @@ -193,7 +193,7 @@ contract BridgeSettlerTest is BridgeSettlerUnitTest, Utils { ) ) ), - abi.encodeCall(IBridgeSettlerActions.BASIC, (ETH_ADDRESS, 10_000, address(bridgeDummy), 0, bytes(""))) + abi.encodeCall(IBridgeSettlerActions.BASIC, (ETH_ADDRESS, 1_000_000, address(bridgeDummy), 0, bytes(""))) ); deal(user, amount); diff --git a/test/unit/core/BasicUnitTest.t.sol b/test/unit/core/BasicUnitTest.t.sol index b01bbdeba..4065e8fee 100644 --- a/test/unit/core/BasicUnitTest.t.sol +++ b/test/unit/core/BasicUnitTest.t.sol @@ -14,8 +14,8 @@ import {Utils} from "../Utils.sol"; import {Test} from "@forge-std/Test.sol"; contract BasicDummy is Permit2PaymentTakerSubmitted, Basic { - function sellToPool(IERC20 sellToken, uint256 bps, address pool, uint256 offset, bytes memory data) public { - super.basicSellToPool(sellToken, bps, pool, offset, data); + function sellToPool(IERC20 sellToken, uint256 ppm, address pool, uint256 offset, bytes memory data) public { + super.basicSellToPool(sellToken, ppm, pool, offset, data); } function _tokenId() internal pure override returns (uint256) { @@ -52,7 +52,7 @@ contract BasicUnitTest is Utils, Test { } function testBasicSell() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 offset = 4; uint256 amount = 99999; bytes4 selector = bytes4(hex"12345678"); @@ -69,12 +69,12 @@ contract BasicUnitTest is Utils, Test { _mockExpectCall(address(POOL), data, abi.encode(true)); - basic.sellToPool(TOKEN, bps, POOL, offset, data); + basic.sellToPool(TOKEN, ppm, POOL, offset, data); } /// @dev adjust the balange of the contract to be less than expected function testBasicSellLowerBalanceAmount() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 offset = 4; uint256 amount = 99999; bytes4 selector = bytes4(hex"12345678"); @@ -90,12 +90,12 @@ contract BasicUnitTest is Utils, Test { ); _mockExpectCall(address(POOL), abi.encodePacked(selector, amount / 2), abi.encode(true)); - basic.sellToPool(TOKEN, bps, POOL, offset, data); + basic.sellToPool(TOKEN, ppm, POOL, offset, data); } /// @dev adjust the balange of the contract to be greater than expected function testBasicSellGreaterBalanceAmount() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 offset = 4; uint256 amount = 99999; bytes4 selector = bytes4(hex"12345678"); @@ -111,12 +111,12 @@ contract BasicUnitTest is Utils, Test { ); _mockExpectCall(address(POOL), abi.encodePacked(selector, amount * 2), abi.encode(true)); - basic.sellToPool(TOKEN, bps, POOL, offset, data); + basic.sellToPool(TOKEN, ppm, POOL, offset, data); } /// @dev When 0xeeee (native asset) is used we expect it to transfer as value function testBasicSellEthValue() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 offset = 4; uint256 amount = 99999; uint256 value = amount; @@ -126,12 +126,12 @@ contract BasicUnitTest is Utils, Test { _mockExpectCall(address(POOL), value, abi.encodePacked(selector, amount), abi.encode(true)); vm.deal(address(basic), value); - basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), bps, POOL, offset, data); + basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), ppm, POOL, offset, data); } /// @dev When 0xeeee (native asset) is used we expect it to transfer as value and adjust for the current balance if lower function testBasicSellLowerEthValue() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 offset = 4; uint256 amount = 99999; uint256 value = amount / 2; @@ -141,12 +141,12 @@ contract BasicUnitTest is Utils, Test { _mockExpectCall(address(POOL), value, abi.encodePacked(selector, value), abi.encode(true)); vm.deal(address(basic), value); - basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), bps, POOL, offset, data); + basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), ppm, POOL, offset, data); } /// @dev When 0xeeee (native asset) is used we expect it to transfer as value and adjust for the current balance if greater function testBasicSellGreaterEthValue() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 offset = 4; uint256 amount = 99999; uint256 value = amount * 2; @@ -156,28 +156,44 @@ contract BasicUnitTest is Utils, Test { _mockExpectCall(address(POOL), value, abi.encodePacked(selector, value), abi.encode(true)); vm.deal(address(basic), value); - basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), bps, POOL, offset, data); + basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), ppm, POOL, offset, data); } /// @dev When 0xeeee (native asset) is used we expect it to transfer as value and adjust for the current balance function testBasicSellAdjustedEthValue() public { - uint256 bps = 5_000; // sell half + uint256 ppm = 500_000; // sell half uint256 offset = 4; uint256 amount = 99999; uint256 value = amount * 2; bytes4 selector = bytes4(hex"12345678"); bytes memory data = abi.encodePacked(selector, amount); - // 5_000 / 10_000 * value == amount + // 500_000 / 1_000_000 * value == amount _mockExpectCall(address(POOL), amount, abi.encodePacked(selector, amount), abi.encode(true)); vm.deal(address(basic), value); - basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), bps, POOL, offset, data); + basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), ppm, POOL, offset, data); + } + + /// @dev A proportion below one basis point (here 30 ppm) sells a nonzero amount + function testBasicSellSubBasisPointProportion() public { + uint256 ppm = 30; + uint256 offset = 4; + uint256 value = 1_000_000; + uint256 amount = 30; + bytes4 selector = bytes4(hex"12345678"); + bytes memory data = abi.encodePacked(selector, amount); + + // 30 / 1_000_000 * value == amount + _mockExpectCall(address(POOL), amount, abi.encodePacked(selector, amount), abi.encode(true)); + + vm.deal(address(basic), value); + basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), ppm, POOL, offset, data); } /// @dev When 0xeeee (native asset) is used we expect it to support a transfer with no data function testBasicSellTransferValue() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 offset = 0; uint256 amount = 99999; uint256 value = amount; @@ -186,27 +202,27 @@ contract BasicUnitTest is Utils, Test { _mockExpectCall(address(POOL), value, data, abi.encode(true)); vm.deal(address(basic), value); - basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), bps, POOL, offset, data); + basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), ppm, POOL, offset, data); } function testBasicRestrictedTarget() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 offset = 0; bytes memory data; vm.expectRevert(); - basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), bps, PERMIT2, offset, data); + basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), ppm, PERMIT2, offset, data); vm.expectRevert(); - basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), bps, ALLOWANCE_HOLDER, offset, data); + basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), ppm, ALLOWANCE_HOLDER, offset, data); } function testBasicBubblesUpRevert() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 offset = 0; bytes memory data; vm.expectRevert(); - basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), bps, POOL, offset, data); + basic.sellToPool(IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), ppm, POOL, offset, data); } } diff --git a/test/unit/core/MakerPSMUnitTest.t.sol b/test/unit/core/MakerPSMUnitTest.t.sol index dcf117d32..21e861b15 100644 --- a/test/unit/core/MakerPSMUnitTest.t.sol +++ b/test/unit/core/MakerPSMUnitTest.t.sol @@ -147,16 +147,16 @@ contract MakerPSMDummy is MakerPSM { revert("unimplemented"); } - function sellToPool(address recipient, uint256 bps) public { - super.sellToMakerPsm(recipient, bps, false, 0, psm, dai); + function sellToPool(address recipient, uint256 ppm) public { + super.sellToMakerPsm(recipient, ppm, false, 0, psm, dai); } - function buyFromPool(address recipient, uint256 bps) public { - super.sellToMakerPsm(recipient, bps, true, 0, psm, dai); + function buyFromPool(address recipient, uint256 ppm) public { + super.sellToMakerPsm(recipient, ppm, true, 0, psm, dai); } - function sellToPool(address recipient, uint256 bps, uint256 amountOutMin) public { - super.sellToMakerPsm(recipient, bps, false, amountOutMin, psm, dai); + function sellToPool(address recipient, uint256 ppm, uint256 amountOutMin) public { + super.sellToMakerPsm(recipient, ppm, false, amountOutMin, psm, dai); } } @@ -213,7 +213,7 @@ contract MakerPSMUnitTest is Utils, Test { } function testMakerPSMBuy() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 amount = 99999; _mockExpectCall( @@ -224,18 +224,18 @@ contract MakerPSMUnitTest is Utils, Test { _mockExpectCall(PSM, abi.encodeWithSelector(IPSM.tout.selector), abi.encode(100)); _mockExpectCall(PSM, abi.encodeWithSelector(IPSM.buyGem.selector, RECIPIENT, 99998), abi.encode(amount)); - psm.buyFromPool(RECIPIENT, bps); + psm.buyFromPool(RECIPIENT, ppm); } function testMakerPSMSell() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 amount = 99999; _mockExpectCall(PSM_GEM, abi.encodeWithSelector(IERC20.balanceOf.selector, address(psm)), abi.encode(amount)); _mockExpectCall(PSM, abi.encodeWithSelector(IPSM.tin.selector), abi.encode(0)); _mockExpectCall(PSM, abi.encodeWithSelector(IPSM.sellGem.selector, RECIPIENT, amount), abi.encode(0)); - psm.sellToPool(RECIPIENT, bps); + psm.sellToPool(RECIPIENT, ppm); } } @@ -263,7 +263,7 @@ contract MakerUsddPSMUnitTest is MakerPSMUnitTest { _mockExpectCall(PSM, abi.encodeWithSelector(IPSM.tin.selector), abi.encode(0)); _mockExpectCall(PSM, abi.encodeWithSelector(IPSM.sellGem.selector, RECIPIENT, amount), new bytes(0)); - psm.sellToPool(RECIPIENT, 10_000, amountOutMin); + psm.sellToPool(RECIPIENT, 1_000_000, amountOutMin); } function testSell_DssPsm_CalculatesFee() public { @@ -277,6 +277,6 @@ contract MakerUsddPSMUnitTest is MakerPSMUnitTest { _mockExpectCall(PSM, abi.encodeWithSelector(IPSM.tin.selector), abi.encode(tin)); _mockExpectCall(PSM, abi.encodeWithSelector(IPSM.sellGem.selector, RECIPIENT, amount), new bytes(0)); - psm.sellToPool(RECIPIENT, 10_000, expectedOut); + psm.sellToPool(RECIPIENT, 1_000_000, expectedOut); } } diff --git a/test/unit/core/MsgSenderUnitTest.t.sol b/test/unit/core/MsgSenderUnitTest.t.sol index 2a4c6499c..8bf8ca5e5 100644 --- a/test/unit/core/MsgSenderUnitTest.t.sol +++ b/test/unit/core/MsgSenderUnitTest.t.sol @@ -34,7 +34,7 @@ contract MsgSenderUnitTest is Test { ISettlerActions.BASIC, ( address(0), // sellToken (no token transfer needed) - 0, // bps + 0, // ppm address(callbackHelper), // pool 0, // offset abi.encodeCall(MsgSenderCallbackHelper.checkMsgSender, (address(settler))) @@ -64,7 +64,7 @@ contract MsgSenderUnitTest is Test { ISettlerActions.BASIC, ( address(0), // sellToken (no token transfer needed) - 0, // bps + 0, // ppm address(callbackHelper), // pool 0, // offset abi.encodeCall(MsgSenderCallbackHelper.checkMsgSender, (address(settler))) diff --git a/test/unit/core/RebateClaimerUnitTest.t.sol b/test/unit/core/RebateClaimerUnitTest.t.sol index f942d4222..31c29d025 100644 --- a/test/unit/core/RebateClaimerUnitTest.t.sol +++ b/test/unit/core/RebateClaimerUnitTest.t.sol @@ -53,7 +53,7 @@ contract RebateClaimerUnitTest is Test { ISettlerActions.BASIC, ( address(0), // sellToken (no transfer needed) - 0, // bps + 0, // ppm address(callbackHelper), // pool 0, // offset abi.encodeCall(RebateClaimerCallbackHelper.checkRebateClaimer, (address(settler))) diff --git a/test/unit/core/UniswapV2UnitTest.t.sol b/test/unit/core/UniswapV2UnitTest.t.sol index 97ecd5e6f..ffad1a982 100644 --- a/test/unit/core/UniswapV2UnitTest.t.sol +++ b/test/unit/core/UniswapV2UnitTest.t.sol @@ -17,12 +17,12 @@ contract UniswapV2Dummy is Permit2PaymentTakerSubmitted, UniswapV2 { function sell( address recipient, address sellToken, - uint256 bps, + uint256 ppm, address pool, uint24 swapInfo, uint256 minBuyAmount ) public { - super.sellToUniswapV2(recipient, sellToken, bps, pool, swapInfo, minBuyAmount); + super.sellToUniswapV2(recipient, sellToken, ppm, pool, swapInfo, minBuyAmount); } function _hasMetaTxn() internal pure override returns (bool) { @@ -65,7 +65,7 @@ contract UniswapV2UnitTest is Utils, Test { } function testUniswapV2Sell() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 amount = 99999; uint256 minBuyAmount = 9087; uint24 swapInfo = (TOKEN0 < TOKEN1 ? 1 : 0) | (30 << 8); @@ -80,11 +80,11 @@ contract UniswapV2UnitTest is Utils, Test { POOL, abi.encodeCall(IUniV2Pair.swap, (uint256(9087), 0, RECIPIENT, new bytes(0))), new bytes(0) ); - uni.sell(RECIPIENT, TOKEN0, bps, POOL, swapInfo, minBuyAmount); + uni.sell(RECIPIENT, TOKEN0, ppm, POOL, swapInfo, minBuyAmount); } function testUniswapV2SellSlippageCheck() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 amount = 99999; uint256 minBuyAmount = 1e18; uint24 swapInfo = (TOKEN0 < TOKEN1 ? 1 : 0) | (30 << 8); @@ -102,11 +102,11 @@ contract UniswapV2UnitTest is Utils, Test { // ); vm.expectRevert(); - uni.sell(RECIPIENT, TOKEN0, bps, POOL, swapInfo, minBuyAmount); + uni.sell(RECIPIENT, TOKEN0, ppm, POOL, swapInfo, minBuyAmount); } function testUniswapV2LowerAmount() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 amount = 99999; uint256 minBuyAmount = 1; uint24 swapInfo = (TOKEN0 < TOKEN1 ? 1 : 0) | (30 << 8); @@ -121,11 +121,11 @@ contract UniswapV2UnitTest is Utils, Test { POOL, abi.encodeCall(IUniV2Pair.swap, (uint256(8328), 0, RECIPIENT, new bytes(0))), new bytes(0) ); - uni.sell(RECIPIENT, TOKEN0, bps, POOL, swapInfo, minBuyAmount); + uni.sell(RECIPIENT, TOKEN0, ppm, POOL, swapInfo, minBuyAmount); } function testUniswapV2GreaterAmount() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 amount = 99999; uint256 minBuyAmount = 9521; uint24 swapInfo = (TOKEN0 < TOKEN1 ? 1 : 0) | (30 << 8); @@ -140,11 +140,11 @@ contract UniswapV2UnitTest is Utils, Test { POOL, abi.encodeCall(IUniV2Pair.swap, (uint256(9521), 0, RECIPIENT, new bytes(0))), new bytes(0) ); - uni.sell(RECIPIENT, TOKEN0, bps, POOL, swapInfo, minBuyAmount); + uni.sell(RECIPIENT, TOKEN0, ppm, POOL, swapInfo, minBuyAmount); } function testUniswapV2SellTokenFee() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 amount = 99999; uint256 minBuyAmount = 1; uint24 swapInfo = (TOKEN0 < TOKEN1 ? 3 : 2) | (30 << 8); @@ -163,11 +163,11 @@ contract UniswapV2UnitTest is Utils, Test { ); // the pool is responsible for transferring to receipient, since the pool is a dummy, this transfer is not mocked - uni.sell(RECIPIENT, TOKEN0, bps, POOL, swapInfo, minBuyAmount); + uni.sell(RECIPIENT, TOKEN0, ppm, POOL, swapInfo, minBuyAmount); } function testUniswapV2Multihop() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 amount = 99999; uint256 minBuyAmount = 9521; uint24 swapInfo0 = (TOKEN0 < TOKEN1 ? 1 : 0) | (30 << 8); @@ -189,7 +189,7 @@ contract UniswapV2UnitTest is Utils, Test { POOL2, abi.encodeCall(IUniV2Pair.swap, (uint256(0), uint256(9521), RECIPIENT, new bytes(0))), new bytes(0) ); - uni.sell(POOL2, TOKEN0, bps, POOL, swapInfo0, 0); + uni.sell(POOL2, TOKEN0, ppm, POOL, swapInfo0, 0); uni.sell(RECIPIENT, TOKEN1, 0, POOL2, swapInfo1, minBuyAmount); } } diff --git a/test/unit/core/UniswapV3UnitTest.t.sol b/test/unit/core/UniswapV3UnitTest.t.sol index 4a3bdb6d5..51d892ca0 100644 --- a/test/unit/core/UniswapV3UnitTest.t.sol +++ b/test/unit/core/UniswapV3UnitTest.t.sol @@ -43,12 +43,12 @@ contract UniswapV3Dummy is AllowanceHolderContext, UniswapV3Fork { return callback(data[4:]); } - function sellSelf(address recipient, uint256 bps, bytes memory encodedPath, uint256 minBuyAmount) + function sellSelf(address recipient, uint256 ppm, bytes memory encodedPath, uint256 minBuyAmount) external takerSubmitted returns (uint256) { - return super.sellToUniswapV3(recipient, bps, encodedPath, minBuyAmount); + return super.sellToUniswapV3(recipient, ppm, encodedPath, minBuyAmount); } function sell( @@ -299,7 +299,7 @@ contract UniswapV3UnitTest is Utils, Test { } function testUniswapV3SellSelfFunded() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 amount = 99999; uint256 minBuyAmount = amount; @@ -328,11 +328,11 @@ contract UniswapV3UnitTest is Utils, Test { vm.expectCall(POOL, data); _mockExpectCall(TOKEN0, abi.encodeCall(IERC20.transfer, (POOL, 1)), abi.encode(true)); - uni.sellSelf(RECIPIENT, bps, encodedPath, minBuyAmount); + uni.sellSelf(RECIPIENT, ppm, encodedPath, minBuyAmount); } function testUniswapV3SellSlippage() public { - uint256 bps = 10_000; + uint256 ppm = 1_000_000; uint256 amount = 99999; uint256 minBuyAmount = amount + 1; @@ -365,7 +365,7 @@ contract UniswapV3UnitTest is Utils, Test { vm.expectRevert( abi.encodeWithSignature("TooMuchSlippage(address,uint256,uint256)", TOKEN1, minBuyAmount, amount) ); - uni.sellSelf(RECIPIENT, bps, encodedPath, minBuyAmount); + uni.sellSelf(RECIPIENT, ppm, encodedPath, minBuyAmount); } function testUniswapV3SellPermit2() public { diff --git a/test/unit/core/UniswapV4UnitTest.t.sol b/test/unit/core/UniswapV4UnitTest.t.sol index 53aa42541..ca87ecada 100644 --- a/test/unit/core/UniswapV4UnitTest.t.sol +++ b/test/unit/core/UniswapV4UnitTest.t.sol @@ -120,7 +120,7 @@ contract UniswapV4Stub is UniswapV4 { function sellToUniswapV4( IERC20 sellToken, - uint256 bps, + uint256 ppm, bool feeOnTransfer, uint256 hashMul, uint256 hashMod, @@ -128,7 +128,7 @@ contract UniswapV4Stub is UniswapV4 { uint256 amountOutMin ) external payable returns (uint256) { require(_operator() == _msgSender()); - return super.sellToUniswapV4(_msgSender(), sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); + return super.sellToUniswapV4(_msgSender(), sellToken, ppm, feeOnTransfer, hashMul, hashMod, fills, amountOutMin); } function sellToUniswapV4VIP( @@ -857,7 +857,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback sellToken.safeTransfer(address(_stub), sellAmount); } vm.startPrank(address(this), address(this)); - _stub.sellToUniswapV4{value: value}(sellToken, 10_000, feeOnTransfer, hashMul, hashMod, fills, 0); + _stub.sellToUniswapV4{value: value}(sellToken, 1_000_000, feeOnTransfer, hashMul, hashMod, fills, 0); vm.stopPrank(); return _swapPost(sellToken, buyToken, sellTokenBalanceBefore, buyTokenBalanceBefore, address(_stub)); @@ -918,7 +918,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback ) = _swapPre(poolIndex, sellAmount, feeOnTransfer, zeroForOne); bytes memory fills = abi.encodePacked( - uint16(10_000), + uint24(1_000_000), sqrtPriceLimitX96(poolKey, sellToken, buyToken), bytes1(0x01), buyToken, @@ -958,7 +958,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback uint256 buyAmount; uint256 sellTokenBalanceBefore; uint256 buyTokenBalanceBefore; - uint256 bps; + uint256 ppm; uint256 hashMul; uint256 hashMod; } @@ -976,7 +976,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback buyAmount: 0, sellTokenBalanceBefore: 0, buyTokenBalanceBefore: 0, - bps: 0, + ppm: 0, hashMul: 0, hashMod: 0 }); @@ -1019,7 +1019,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback (state.hashMul, state.hashMod) = _getHash(swapTokens); bytes memory fills = abi.encodePacked( - uint16(10_000), + uint24(1_000_000), sqrtPriceLimitX96(state.poolKey0, state.sellToken, state.hopToken), bytes1(0x01), state.hopToken, @@ -1027,7 +1027,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback state.poolKey0.tickSpacing, state.poolKey0.hooks, uint24(0), - uint16(10_000), + uint24(1_000_000), sqrtPriceLimitX96(state.poolKey1, state.hopToken, state.buyToken), bytes1(0x02), state.buyToken, @@ -1082,9 +1082,9 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback /* hashMod */ ) = _swapPre(2, TOTAL_SUPPLY / 1_000, false, zeroForOne1); uint256 sellAmount = sellAmount0 + sellAmount1; - uint256 bps0 = sellAmount0 * 10_000 / sellAmount; - assertLt(bps0, 10_000); - assertGt(bps0, 0); + uint256 ppm0 = sellAmount0 * 1_000_000 / sellAmount; + assertLt(ppm0, 1_000_000); + assertGt(ppm0, 0); IERC20[] memory swapTokens = new IERC20[](3); swapTokens[0] = sellToken; @@ -1093,7 +1093,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback (uint256 hashMul, uint256 hashMod) = _getHash(swapTokens); bytes memory fills = abi.encodePacked( - uint16(bps0), + uint24(ppm0), sqrtPriceLimitX96(poolKey0, sellToken, buyToken0), bytes1(0x01), buyToken0, @@ -1102,7 +1102,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback poolKey0.hooks, uint24(0), new bytes(0), - uint16(10_000), + uint24(1_000_000), sqrtPriceLimitX96(poolKey1, sellToken, buyToken1), bytes1(0x01), buyToken1, @@ -1147,7 +1147,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback uint256 buyAmount1; uint256 sellTokenBalanceBefore; uint256 buyTokenBalanceBefore; - uint256 bps; + uint256 ppm; uint256 hashMul; uint256 hashMod; } @@ -1172,7 +1172,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback buyAmount1: 0, sellTokenBalanceBefore: 0, buyTokenBalanceBefore: 0, - bps: 0, + ppm: 0, hashMul: 0, hashMod: 0 }); @@ -1229,9 +1229,9 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback assertEq(state.allegedHopAmount, state.hopAmount); state.sellAmount = state.sellAmount0 + state.sellAmount1; state.buyAmount = state.buyAmount0 + state.buyAmount1; - state.bps = state.sellAmount0 * 10_000 / state.sellAmount; - assertLt(state.bps, 10_000); - assertGt(state.bps, 0); + state.ppm = state.sellAmount0 * 1_000_000 / state.sellAmount; + assertLt(state.ppm, 1_000_000); + assertGt(state.ppm, 0); { IERC20[] memory swapTokens = new IERC20[](3); @@ -1243,7 +1243,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback bytes[] memory fills = new bytes[](3); fills[0] = abi.encodePacked( - uint16(state.bps), + uint24(state.ppm), sqrtPriceLimitX96(state.poolKey0, state.sellToken, state.hopToken), bytes1(0x01), state.hopToken, @@ -1253,7 +1253,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback uint24(0) ); fills[1] = abi.encodePacked( - uint16(10_000), + uint24(1_000_000), sqrtPriceLimitX96(state.poolKey1, state.sellToken, state.buyToken), bytes1(0x01), state.buyToken, @@ -1263,7 +1263,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback uint24(0) ); fills[2] = abi.encodePacked( - uint16(10_000), + uint24(1_000_000), sqrtPriceLimitX96(state.poolKey2, state.hopToken, state.buyToken), bytes1(0x03), state.hopToken, @@ -1351,7 +1351,7 @@ contract UniswapV4BoundedInvariantTest is BaseUniswapV4UnitTest, IUnlockCallback }); bytes memory fills = abi.encodePacked( - uint16(10_000), + uint24(1_000_000), sqrtPriceLimitX96(poolKey, sellToken, buyToken), bytes1(0x01), buyToken,