Skip to content

Commit

Permalink
add callback functions to LiFiDEXAggregator
Browse files Browse the repository at this point in the history
  • Loading branch information
0xDEnYO committed Nov 8, 2024
1 parent a1cf198 commit 0d463a2
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/Periphery/LiFiDEXAggregator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.2.0
/// @custom:version 1.3.0
contract LiFiDEXAggregator is Ownable {
using SafeERC20 for IERC20;
using Approve for IERC20;
Expand Down Expand Up @@ -620,6 +620,36 @@ contract LiFiDEXAggregator is Ownable {
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 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
Expand Down

0 comments on commit 0d463a2

Please sign in to comment.