joshstevens19 / simple-uniswap-sdk

Uniswap SDK which handles the routes automatically for you, changes in trade quotes reactive subscriptions, exposure to formatted easy to understand information, bringing back the best trade quotes automatically, generating transactions for you and much more.
MIT License
188 stars 95 forks source link

Using this library to provide liquidity #38

Open GeorgeGkas opened 2 years ago

GeorgeGkas commented 2 years ago

Hello,

I have a question regarding the use of this library and would like to get some directions. I'm trying to create a liquidity pool for, lets say an artificail pair ETH > $TOKEN. How should I procceed? Is this supported from the library? I took a look in the source code and found that the required functionalities are implemented, but what classes should I use? uniswap-router-contract.factory.v2.ts already contains the method addLiquidity. From what I understand the following steps should be followed:

  1. Create a UniswapPair instance
  2. Create a UniswapRouterContractFactoryV2 instance
  3. Call addLiquidity method of UniswapRouterContractFactoryV2 instance and provide the token parameters from UniswapPair instance.
  4. Check for approval
  5. Send the transaction to network using a web3/ethers provider.

Is my assumptions correct? There might be the case that we also need to have a deployed contract for the desired liquidity pool, but I am not sure. I read the uniswap documentations but could not figure how to procceed. You take a very important step by creating this library, which is so much simpler to use than the official Uniswap SDK, so I took the initiate to ask for help here.

tongtongking commented 2 years ago

The question is so import for me. I was still thinking the same question.