diff --git a/audit/auditLog.json b/audit/auditLog.json index 37337d342..139bcc5d0 100644 --- a/audit/auditLog.json +++ b/audit/auditLog.json @@ -48,6 +48,13 @@ "auditorGitHandle": "sujithsomraaj", "auditReportPath": "./audit/reports/2024.11.22_Permit2Proxy.pdf", "auditCommitHash": "0e3debb78abcdf9a9f934115338b611e16b039a0" + }, + "audit20241203": { + "auditCompletedOn": "03.12.2024", + "auditedBy": "Sujith Somraaj (individual security researcher)", + "auditorGitHandle": "sujithsomraaj", + "auditReportPath": "./audit/reports/2024.12.03_LiFiDexAggregator.pdf", + "auditCommitHash": "8a34562c912b5b19c919bb95338655c944428af5" } }, "auditedContracts": { @@ -70,6 +77,9 @@ "1.0.0": ["audit20240913"], "1.0.1": ["audit20241105"] }, + "LiFiDEXAggregator": { + "1.5.0": ["audit20241203"] + }, "Permit2Proxy": { "1.0.0": ["audit20241122"] }, diff --git a/audit/reports/2024.12.03_LiFiDexAggregator.pdf b/audit/reports/2024.12.03_LiFiDexAggregator.pdf new file mode 100644 index 000000000..eea33b846 Binary files /dev/null and b/audit/reports/2024.12.03_LiFiDexAggregator.pdf differ diff --git a/config/dexs.json b/config/dexs.json index 7e4cacf6d..291892b43 100644 --- a/config/dexs.json +++ b/config/dexs.json @@ -319,6 +319,7 @@ "0x70D6cFE9146D6B6ebEb88BcB22fa220E78058D6F", "0x11d40Dc8Ff0CE92F54A315aD8e674a55a866cBEe", "0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55", + "0xf88F6948C8AFf60c0B011f3175CDF459c66Ed035", "0x3a629404258dF01bef29Dd5d428508D92e207bD0", "0xf332761c673b59b21ff6dfa8ada44d78c12def09", "0x70cbb871e8f30fc8ce23609e9e0ea87b6b222f58" @@ -443,8 +444,8 @@ "fraxtal": [ "0x7956280Ec4B4d651C4083Ca737a1fa808b5319D8", "0x9870F0C91D722B3393383722968269496d919bD8", - "0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc", - "0xC82fd49be3F3D851b9E10589C50784cEAC7114a5" + "0xC82fd49be3F3D851b9E10589C50784cEAC7114a5", + "0xE38621607316cB43367c134C65dca3f41B61250f" ], "harmony": [ "0xdFC2983401614118E1F2D5A5FD93C17Fecf8BdC6", @@ -513,6 +514,7 @@ "0xf3552b98BB4234B47674700A99a0308D74B40F51", "0xF2ee649caB7a0edEdED7a27821B0aCDF77778aeD", "0x0263180888007D45340F86eC0b610d250BbDcB23", + "0xEcf953290D36fA96236356e171044DC802EeC598", "0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc", "0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3", "0x6131b5fae19ea4f9d964eac0408e4408b66337b5", @@ -541,7 +543,8 @@ "0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3", "0xbbbbbBB520d69a9775E85b458C58c648259FAD5F" "0xd0f95fafa06de1b21e79db03c649919501e99ea9", - "0xbd0ebe49779e154e5042b34d5bcfbc498e4b3249" + "0xbd0ebe49779e154e5042b34d5bcfbc498e4b3249", + "0x78bF01555bCF05e6B1d4dad017dBD0A105652DC9" ], "moonbeam": [ "0x5215E9fd223BC909083fbdB2860213873046e45d", @@ -759,7 +762,7 @@ "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64", "0x7956280Ec4B4d651C4083Ca737a1fa808b5319D8", "0x9870F0C91D722B3393383722968269496d919bD8", - "0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc", + "0xfdE9CE4e17B650efdcA13d524F132876700d806f", "0xC82fd49be3F3D851b9E10589C50784cEAC7114a5", "0xdb3af8df1cab8ae4159ed6a9b33df5f8c3ad1485", "0x801d8ed849039007a7170830623180396492c7ed" @@ -774,8 +777,9 @@ "0xbfe03c9e20a9fc0b37de01a172f207004935e0b1", "0x0000000000005e88410ccdfade4a5efae4b49562", "0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc", + "0x78bF01555bCF05e6B1d4dad017dBD0A105652DC9", "0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3", - "0xbbbbbBB520d69a9775E85b458C58c648259FAD5F" + "0xbbbbbBB520d69a9775E85b458C58c648259FAD5F", "0x6b2c0c7be2048daa9b5527982c29f48062b34d58", "0x57df6092665eb6058DE53939612413ff4B09114E" ], diff --git a/deployments/_deployments_log_file.json b/deployments/_deployments_log_file.json index 815e9cccc..8f284b456 100644 --- a/deployments/_deployments_log_file.json +++ b/deployments/_deployments_log_file.json @@ -23482,6 +23482,16 @@ "SALT": "", "VERIFIED": "false" } + ], + "1.2.0": [ + { + "ADDRESS": "0xfdE9CE4e17B650efdcA13d524F132876700d806f", + "OPTIMIZER_RUNS": "1000000", + "TIMESTAMP": "2024-10-17 07:16:41", + "CONSTRUCTOR_ARGS": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000003b6211981d47fb6375e0125a6a401830616f7906", + "SALT": "20241016", + "VERIFIED": "true" + } ] } }, @@ -23496,6 +23506,16 @@ "SALT": "", "VERIFIED": "true" } + ], + "1.3.0": [ + { + "ADDRESS": "0xEcf953290D36fA96236356e171044DC802EeC598", + "OPTIMIZER_RUNS": "1000000", + "TIMESTAMP": "2024-11-08 06:54:16", + "CONSTRUCTOR_ARGS": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000029dacdf7ccadf4ee67c923b4c22255a4b2494ed7", + "SALT": "", + "VERIFIED": "true" + } ] } }, @@ -23552,6 +23572,16 @@ "SALT": "", "VERIFIED": "true" } + ], + "1.1.0": [ + { + "ADDRESS": "0xE38621607316cB43367c134C65dca3f41B61250f", + "OPTIMIZER_RUNS": "1000000", + "TIMESTAMP": "2024-10-11 15:46:23", + "CONSTRUCTOR_ARGS": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d38743b48d26743c0ec6898d699394fbc94657ee", + "SALT": "", + "VERIFIED": "true" + } ] } }, @@ -23678,6 +23708,16 @@ "SALT": "", "VERIFIED": "true" } + ], + "1.5.0": [ + { + "ADDRESS": "0x78bF01555bCF05e6B1d4dad017dBD0A105652DC9", + "OPTIMIZER_RUNS": "1000000", + "TIMESTAMP": "2024-11-22 12:43:30", + "CONSTRUCTOR_ARGS": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d38743b48d26743c0ec6898d699394fbc94657ee", + "SALT": "", + "VERIFIED": "true" + } ] } }, @@ -23734,6 +23774,16 @@ "SALT": "", "VERIFIED": "true" } + ], + "1.5.0": [ + { + "ADDRESS": "0x78bF01555bCF05e6B1d4dad017dBD0A105652DC9", + "OPTIMIZER_RUNS": "1000000", + "TIMESTAMP": "2024-11-22 12:57:37", + "CONSTRUCTOR_ARGS": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d38743b48d26743c0ec6898d699394fbc94657ee", + "SALT": "", + "VERIFIED": "true" + } ] } }, @@ -23818,6 +23868,16 @@ "SALT": "", "VERIFIED": "true" } + ], + "1.4.0": [ + { + "ADDRESS": "0xf88F6948C8AFf60c0B011f3175CDF459c66Ed035", + "OPTIMIZER_RUNS": "1000000", + "TIMESTAMP": "2024-11-14 11:54:19", + "CONSTRUCTOR_ARGS": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d38743b48d26743c0ec6898d699394fbc94657ee", + "SALT": "", + "VERIFIED": "true" + } ] } }, diff --git a/deployments/cronos.json b/deployments/cronos.json index 2f542bf21..b98dde7ec 100644 --- a/deployments/cronos.json +++ b/deployments/cronos.json @@ -24,5 +24,5 @@ "SymbiosisFacet": "0x70a51Bbc58D6180709D99a759bd91A3feD212fD3", "EmergencyPauseFacet": "0x3CDDc79Da7c829643F5b2378110158Ea6ff349F9", "TokenWrapper": "0x693c18A628866BdD04956d9544Ce769C0e468149", - "LiFiDEXAggregator": "0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc" + "LiFiDEXAggregator": "0xf88F6948C8AFf60c0B011f3175CDF459c66Ed035" } \ No newline at end of file diff --git a/deployments/fraxtal.diamond.json b/deployments/fraxtal.diamond.json index 52231e61b..3db5dd05b 100644 --- a/deployments/fraxtal.diamond.json +++ b/deployments/fraxtal.diamond.json @@ -76,4 +76,4 @@ "TokenWrapper": "0xC82fd49be3F3D851b9E10589C50784cEAC7114a5" } } -} \ No newline at end of file +} diff --git a/deployments/fraxtal.json b/deployments/fraxtal.json index 2449415c1..105a4043f 100644 --- a/deployments/fraxtal.json +++ b/deployments/fraxtal.json @@ -21,6 +21,6 @@ "ServiceFeeCollector": "0x45d69A8a07F79DE2364F0B80F78af86e99015162", "TokenWrapper": "0xC82fd49be3F3D851b9E10589C50784cEAC7114a5", "SymbiosisFacet": "0x095857146B116802fBf4f75D96CC1b35c5F3ad1a", - "LiFiDEXAggregator": "0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc", + "LiFiDEXAggregator": "0xE38621607316cB43367c134C65dca3f41B61250f", "EmergencyPauseFacet": "0x6F2baA7cd5F156CA1B132F7FF11E0fa2aD775F61" -} \ No newline at end of file +} diff --git a/deployments/mantle.diamond.json b/deployments/mantle.diamond.json index 32defd7a8..a9dfac7f8 100644 --- a/deployments/mantle.diamond.json +++ b/deployments/mantle.diamond.json @@ -89,4 +89,4 @@ "TokenWrapper": "0x0263180888007D45340F86eC0b610d250BbDcB23" } } -} \ No newline at end of file +} diff --git a/deployments/mantle.json b/deployments/mantle.json index e2d6757b9..908d2bae4 100644 --- a/deployments/mantle.json +++ b/deployments/mantle.json @@ -24,8 +24,8 @@ "SquidFacet": "0xc23ae3A8d74C0a428FA59E4AD3EB6aa4b2330530", "StargateFacetV2": "0x6e378C84e657C57b2a8d183CFf30ee5CC8989b61", "ReceiverStargateV2": "0x1493e7B8d4DfADe0a178dAD9335470337A3a219A", - "LiFiDEXAggregator": "0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc", + "LiFiDEXAggregator": "0xEcf953290D36fA96236356e171044DC802EeC598", "EmergencyPauseFacet": "0x6F2baA7cd5F156CA1B132F7FF11E0fa2aD775F61", "GasZipFacet": "0xF5c923a087fb3c554579e2DD10AB6E37E0f6F849", "GasZipPeriphery": "0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3" -} \ No newline at end of file +} diff --git a/deployments/mode.json b/deployments/mode.json index ccd77f5bc..59a8bdc0f 100644 --- a/deployments/mode.json +++ b/deployments/mode.json @@ -24,7 +24,7 @@ "AcrossFacet": "0x4D67951397bc8162111BC45F973Ae7576Fd814F0", "AcrossFacetPacked": "0x54910b7b4723a775708aFd88f31b6572e168aF66", "GenericSwapFacetV3": "0x31a9b1835864706Af10103b31Ea2b79bdb995F5F", - "LiFiDEXAggregator": "0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc", + "LiFiDEXAggregator": "0x78bF01555bCF05e6B1d4dad017dBD0A105652DC9", "EmergencyPauseFacet": "0x6F2baA7cd5F156CA1B132F7FF11E0fa2aD775F61", "AcrossFacetV3": "0x6e00e0a7685Ca22c288d56D9E7924746B5043Ee7", "ReceiverAcrossV3": "0xB9CEc304899037E661F49DdFa7f64943b5920072", diff --git a/deployments/scroll.json b/deployments/scroll.json index aa461cf09..137126dab 100644 --- a/deployments/scroll.json +++ b/deployments/scroll.json @@ -28,7 +28,7 @@ "ReceiverStargateV2": "0x1493e7B8d4DfADe0a178dAD9335470337A3a219A", "AcrossFacet": "0x9535A1AFd986FA9a2D324657116F02C364edebFf", "AcrossFacetPacked": "0xFd796bf7Ff74d414b99CacF6F216eAC24bF3aC8E", - "LiFiDEXAggregator": "0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc", + "LiFiDEXAggregator": "0x78bF01555bCF05e6B1d4dad017dBD0A105652DC9", "EmergencyPauseFacet": "0x6F2baA7cd5F156CA1B132F7FF11E0fa2aD775F61", "AcrossFacetV3": "0x6e00e0a7685Ca22c288d56D9E7924746B5043Ee7", "ReceiverAcrossV3": "0xB9CEc304899037E661F49DdFa7f64943b5920072", diff --git a/deployments/sei.json b/deployments/sei.json index dff18b74c..0bc03616c 100644 --- a/deployments/sei.json +++ b/deployments/sei.json @@ -22,6 +22,6 @@ "GenericSwapFacetV3": "0x31a9b1835864706Af10103b31Ea2b79bdb995F5F", "ReceiverStargateV2": "0x1493e7B8d4DfADe0a178dAD9335470337A3a219A", "StargateFacetV2": "0x6e378C84e657C57b2a8d183CFf30ee5CC8989b61", - "LiFiDEXAggregator": "0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc", + "LiFiDEXAggregator": "0xfdE9CE4e17B650efdcA13d524F132876700d806f", "EmergencyPauseFacet": "0x6F2baA7cd5F156CA1B132F7FF11E0fa2aD775F61" -} \ No newline at end of file +} diff --git a/src/Periphery/LiFiDEXAggregator.sol b/src/Periphery/LiFiDEXAggregator.sol index a61f38245..da3dd3541 100644 --- a/src/Periphery/LiFiDEXAggregator.sol +++ b/src/Periphery/LiFiDEXAggregator.sol @@ -22,7 +22,7 @@ uint160 constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970 /// @title LiFi DEX Aggregator /// @author Ilya Lyalin (contract copied from: https://github.com/sushiswap/sushiswap/blob/c8c80dec821003eb72eb77c7e0446ddde8ca9e1e/protocols/route-processor/contracts/RouteProcessor4.sol) /// @notice Processes calldata to swap using various DEXs -/// @custom:version 1.0.0 +/// @custom:version 1.5.0 contract LiFiDEXAggregator is Ownable { using SafeERC20 for IERC20; using Approve for IERC20; @@ -575,6 +575,126 @@ contract LiFiDEXAggregator is Ownable { uniswapV3SwapCallback(amount0Delta, amount1Delta, data); } + /// @notice Called to `msg.sender` after executing a swap via RaExchangeV3#swap. + /// @dev In the implementation you must pay the pool tokens owed for the swap. + /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. + /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. + /// @param data Any data passed through by the caller via the RaExchangeV3#swap call + function ramsesV2SwapCallback( + int256 amount0Delta, + int256 amount1Delta, + bytes calldata data + ) external { + uniswapV3SwapCallback(amount0Delta, amount1Delta, data); + } + + /// @notice Called to `msg.sender` after executing a swap via XeiV3#swap. + /// @dev In the implementation you must pay the pool tokens owed for the swap. + /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. + /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. + /// @param data Any data passed through by the caller via the XeiV3#swap call + function xeiV3SwapCallback( + int256 amount0Delta, + int256 amount1Delta, + bytes calldata data + ) external { + uniswapV3SwapCallback(amount0Delta, amount1Delta, data); + } + + /// @notice Called to `msg.sender` after executing a swap via DragonSwapV2#swap. + /// @dev In the implementation you must pay the pool tokens owed for the swap. + /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. + /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. + /// @param data Any data passed through by the caller via the DragonSwapV2#swap call + function dragonswapV2SwapCallback( + int256 amount0Delta, + int256 amount1Delta, + bytes calldata data + ) external { + uniswapV3SwapCallback(amount0Delta, amount1Delta, data); + } + + /// @notice Called to `msg.sender` after executing a swap via AgniV3#swap. + /// @dev In the implementation you must pay the pool tokens owed for the swap. + /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. + /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. + /// @param data Any data passed through by the caller via the AgniV3#swap call + function agniSwapCallback( + int256 amount0Delta, + int256 amount1Delta, + bytes calldata data + ) external { + uniswapV3SwapCallback(amount0Delta, amount1Delta, data); + } + + /// @notice Called to `msg.sender` after executing a swap via FusionXV3#swap. + /// @dev In the implementation you must pay the pool tokens owed for the swap. + /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. + /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. + /// @param data Any data passed through by the caller via the FusionXV3#swap call + function fusionXV3SwapCallback( + int256 amount0Delta, + int256 amount1Delta, + bytes calldata data + ) external { + uniswapV3SwapCallback(amount0Delta, amount1Delta, data); + } + + /// @notice Called to `msg.sender` after executing a swap via VVS FinanceV3#swap. + /// @dev In the implementation you must pay the pool tokens owed for the swap. + /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. + /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. + /// @param data Any data passed through by the caller via the VVS Finance V3#swap call + function vvsV3SwapCallback( + int256 amount0Delta, + int256 amount1Delta, + bytes calldata data + ) external { + uniswapV3SwapCallback(amount0Delta, amount1Delta, data); + } + + /// @notice Called to `msg.sender` after executing a swap via SupSwapV3#swap. + /// @dev In the implementation you must pay the pool tokens owed for the swap. + /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. + /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. + /// @param data Any data passed through by the caller via the SupSwapV3#swap call + function supV3SwapCallback( + int256 amount0Delta, + int256 amount1Delta, + bytes calldata data + ) external { + uniswapV3SwapCallback(amount0Delta, amount1Delta, data); + } + + /// @notice Called to `msg.sender` after executing a swap via ZebraV3#swap. + /// @dev In the implementation you must pay the pool tokens owed for the swap. + /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. + /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by + /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. + /// @param data Any data passed through by the caller via the ZebraV3#swap call + function zebraV3SwapCallback( + int256 amount0Delta, + int256 amount1Delta, + bytes calldata data + ) external { + uniswapV3SwapCallback(amount0Delta, amount1Delta, data); + } + /// @notice Curve pool swap. Legacy pools that don't return amountOut and have native coins are not supported /// @param stream [pool, poolType, fromIndex, toIndex, recipient, output token] /// @param from Where to take liquidity for swap