📌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
Name | Type | Description |
---|---|---|
|
| The address of the input token. |
|
| The address of the output token. |
|
| The amount of input tokens to swap. |
|
| The minimum amount of output tokens to accept. |
|
| The address to send output tokens to. |
addLiquidity
addLiquidity
Adds liquidity to a Uniswap pool.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the first token. |
|
| The address of the second token. |
|
| The amount of the first token. |
|
| The amount of the second token. |
|
| The minimum amount of the first token to add. |
|
| The minimum amount of the second token to add. |
Last updated