I want to set up a Foundry test where I create a UniswapV3Factory and deploy a pool with two tokens. Here is what I have so far:
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
import '../src/libraries/BitMath.sol';
import {TestERC20} from './TestERC20.sol';
import "forge-std/console.sol";
import "../src/UniswapV3Factory.sol";
import "../src/UniswapV3Pool.sol";
import '../src/interfaces/IUniswapV3Pool.sol';
import '../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import '../lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol';
contract UniswapV3Test {
address internal user1;
IERC20 token0;
IERC20 token1;
function setUp() public {
user1 = address(1);
token0 = new ERC20("Token1", "T1");
token1 = new ERC20("Token2", "T2");
}
function testDeployPool() external {
UniswapV3Factory factory = new UniswapV3Factory();
IUniswapV3Pool pool = IUniswapV3Pool(factory.createPool(address(token0), address(token1), 0));
console.log('tick spacing', pool.tickSpacing());
}
}
When I run forge test -vvvv
a revert happens on UniswapV3Factory::createPool
Anybody know why?