maximebrugel / liquidity-provider-v2

UniswapV2 liquidity provider tasks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

liquidity-provider-V2

This is an intermediate contract with any UniswapV2 (fork).

schema

The contract allows 3 actions :

  • function addLiquidityOnlyETH(address router, address tokenB)
    To add liquidity with your ETH, just give the router address and the second token of the pair (ETH-ERC20).

  • function addLiquidityERC20(address router, address tokenA, address tokenB, uint256 amount)
    To add liquidity to a ERC20-ERC20 pair. You need to give the router address, the tokens addresses, and only the amount of the first token.
    The contract will manage if you already have (or not) the second token in your wallet.

  • function removeLiquidity(address router, address pair, uint256 amount)
    Allows to remove liquidity by giving the pair address, the router address and the amount of liquidity you want to remove.

Adapters

If you have any errors with routers that change the nomenclature, please check => adapters

Development and Testing

$ yarn
$ yarn test

Gas report

gas-report

About

UniswapV2 liquidity provider tasks

License:GNU General Public License v3.0


Languages

Language:Solidity 67.9%Language:TypeScript 32.1%