Uniswap was launch in 2021 and today is the Dex with more volume. In this video we will look at how it works concentrated liquidity through the NFTs and, we will launch a token that extracts percentual commissions on purchase and P2P.
Before we start
For this tutorial you will need Metamask or another compatible wallet with Goerli funds that you can get from a faucet.
Smart contract with token fees in Uniswap V3
You can launch the following token in Mainnet like in Goerlin because the Uniswap contracts share the same addresses. Nevertheless, you will need to adjust the address of the ‘Base Token’, the address of WETH in Mainnet 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
and in Goerli 0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6
.
Ypu can find this contract and more in Biblioteca y more info about the paramteris in the API Docs.
// SPDX-License-Identifier: MIT
pragma solidity 0.8.18;
import "biblioteca/contracts/ERC20/UniswapV3FeeToken.sol";
contract MyUniswapV3FeeToken is UniswapV3FeeToken
{
constructor() UniswapV3FeeToken(
"My Token", "MTKN", // Name and Symbol
1_000_000_000 ether, // 1 billion supply
100, 200, // Fees: 1% buy 2% P2P
msg.sender, // Vault Address
0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6, // Base token: WETH
1_000_000) // Initial rate: 1 WETH = 1,000,000 tokens
{
}
}
Thanks for watching this video!
Follows us on dev.to and in Youtube for everything related to Blockchain development.
Top comments (0)