📌Swap
Overview
The UniswapSwapAndLiquidity
contract is designed to interact with the Uniswap V2 decentralized exchange platform.
It facilitates two primary DeFi activities: swapping tokens and adding liquidity to Uniswap pools.
By integrating with the Uniswap V2 Router, this contract provides users with the ability to engage in token swaps and liquidity provision directly through the contract, simplifying and streamlining these processes.
Methods
swapTokens
swapTokens
Swaps tokens using the Uniswap V2 Router
Parameters
_tokenIn
address
The address of the input token.
_tokenOut
address
The address of the output token.
_amountIn
uint256
The amount of input tokens to swap.
_amountOutMin
uint256
The minimum amount of output tokens to accept.
_to
address
The address to send output tokens to.
addLiquidity
addLiquidity
Adds liquidity to a Uniswap pool.
Parameters
_tokenA
address
The address of the first token.
_tokenB
address
The address of the second token.
_amountA
uint256
The amount of the first token.
_amountB
uint256
The amount of the second token.
_amountAMin
uint256
The minimum amount of the first token to add.
_amountBMin
uint256
The minimum amount of the second token to add.
Last updated