code_learner93
code_learner93

Reputation: 621

How can I use uniswap to build my own LP token?

I'm new to DeFi and liquidity farming. I'm just trying to build a simple LP farming application for testing and I'm trying to generate some LP tokens to be used as my reward tokens.

I'd like to know if there is any example that people have worked on - using Uniswap smart contracts like UniswapV2Factory and UniswapV2Router, to create their own LP tokens?

Any help is appreciated, thank you!

Upvotes: 0

Views: 432

Answers (1)

Petr Hejda
Petr Hejda

Reputation: 43561

Each Uniswap V2 Pair contract instance extends on their own ERC20 implementation. This ERC20 is the Liquidity Provider token that you get in exchange for the provided underlying tokens.

Amount of the LP token is calculated and minted within the Pair mint() function. Which is a low-level function not used directly from their UI. The Uniswap UI calls the Router's addLiquidity(), which is a wrapper function handling both underlying token transfers and mint of the LP token.

Upvotes: 1

Related Questions