Discover more of SonicScan Block Explorer's tools and services in one place.
Contract Source Code:
File 1 of 3 : AggregatorConnector.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { ILiquidityConnector, AddLiquidityParams, RemoveLiquidityParams, SwapParams, GetAmountOutParams } from "contracts/interfaces/ILiquidityConnector.sol"; struct AggregatorExtraData { bytes data; } contract AggregatorConnector is ILiquidityConnector { error AggregatorSwapFailed(bytes error); error NotImplemented(); address public immutable router; constructor( address router_ ) { router = router_; } function addLiquidity( AddLiquidityParams memory ) external payable override { revert NotImplemented(); } function removeLiquidity( RemoveLiquidityParams memory ) external pure override { revert NotImplemented(); } function swapExactTokensForTokens( SwapParams memory swap ) external payable override { AggregatorExtraData memory extraData = abi.decode(swap.extraData, (AggregatorExtraData)); (bool success, bytes memory error) = router.call(extraData.data); if (!success) { revert AggregatorSwapFailed(error); } } function getAmountOut( GetAmountOutParams memory ) external pure override returns (uint256) { revert NotImplemented(); } }
File 2 of 3 : ILiquidityConnector.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { AddLiquidityParams, RemoveLiquidityParams, SwapParams, GetAmountOutParams } from "contracts/structs/LiquidityStructs.sol"; interface ILiquidityConnector { function addLiquidity( AddLiquidityParams memory addLiquidityParams ) external payable; function removeLiquidity( RemoveLiquidityParams memory removeLiquidityParams ) external; function swapExactTokensForTokens( SwapParams memory swap ) external payable; function getAmountOut( GetAmountOutParams memory getAmountOutParams ) external view returns (uint256); }
File 3 of 3 : LiquidityStructs.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; struct AddLiquidityParams { address router; address lpToken; address[] tokens; uint256[] desiredAmounts; uint256[] minAmounts; bytes extraData; } struct RemoveLiquidityParams { address router; address lpToken; address[] tokens; uint256 lpAmountIn; uint256[] minAmountsOut; bytes extraData; } struct SwapParams { address router; uint256 amountIn; uint256 minAmountOut; address tokenIn; bytes extraData; } struct GetAmountOutParams { address router; address lpToken; address tokenIn; address tokenOut; uint256 amountIn; }
Please enter a contract address above to load the contract details and source code.
Please DO NOT store any passwords or private keys here. A private note (up to 100 characters) can be saved and is useful for transaction tracking.
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.