You will learn how to invoke each function with the required parameters necessary in returning the calldata.
Because any liquidity related action relies on setting up pool and position instances.
the following is what you will learn in this guide:
- Set up the pool instance. This follows the same structure as the previous guide. Refer to Creating a Pool Instance for more detail.
- Create a position.
- Construct the calldata for minting a position.
- Construct the calldata for adding to a position.
- Construct the calldata for removing from a position.
we will write a smart contract that calls flash on a V3 pool and swaps the full amount withdrawn of token0 and token1 in the corresponding pools with the same token pair - but different fee tiers. After the swap, the contract will pay back the first pool and transfer profits to the original calling address.
Uniswap V3 introduces a new function, flash, within the Pool contract.
注意下面三项:
- Plugins must be loaded with import instead of require.
- You need to explicitly import the Hardhat config functions, like task.
- If you are defining tasks, they need to access the Hardhat Runtime Environment explicitly, as a parameter.
npx hardhat run scripts/pool-simple.ts --network mainnet
npx hardhat run scripts/pool.ts --network mainnet
https://docs.uniswap.org/sdk/introduction https://hardhat.org/guides/typescript.html hardhat use ts https://arxiv.org/pdf/2010.12252.pdf flashloadn paper