I am studying uniswapV2 contract code. And I deployed contracts on ropsten network. then I created a pool by createPool method. I wonder how to deposit tokens in the created pool contract. The created pool is a pair of DAI tokens and UNISWAP tokens. Below is the way I made a pool.
const pool = await FACTORY.methods.createPair(DAI_ADDR, UNI_ADDR).send({from: "0x53D18059f51eB2D1B73b7DA41f971fcF0c45f122"});
return pool address is 0xd6Ca8d671E7e96ED28F67cb196b1056EbDb550d9
here is code repository link. https://github.com/Uniswap/v2-core
How to deposit a token-pair by contract method? Thanks.
The phrase you're looking for is "add liquidity" (and the opposite action is "remove liquidity"). You deposit the underlying tokens and mint the LP (liquidity provider) tokens representing your stake in the pair contract.
You can provide liquidity through the router's function addLiquidity()
(docs).