Pool
Function Interface introduction
1. Create Pool
function createPool(
address tokenA,
address tokenB,
uint24 fee
) external override returns (address pool) {
require(tokenA != tokenB);
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0));
int24 tickSpacing = feeAmountTickSpacing[fee];
TickSpacingExtraInfo memory info = feeAmountTickSpacingExtraInfo[fee];
require(tickSpacing != 0 && info.enabled, 'fee is not available yet');
if (info.whitelistRequested) {
require(_whiteListAddresses[msg.sender], 'user should be in the white list for this fee tier');
}
require(getPool[token0][token1][fee] == address(0));
pool = IKuramaV3PoolDeployer(poolDeployer).deploy(address(this), token0, token1, fee, tickSpacing);
getPool[token0][token1][fee] = pool;
// populate mapping in the reverse direction, deliberate choice to avoid the cost of comparing addresses
getPool[token1][token0][fee] = pool;
emit PoolCreated(token0, token1, fee, tickSpacing, pool);
}Example code
Last updated