Variables
feeTo
Accumulate liquidity token for protocol fee.
feeToSetter
Address that can change the feeTo .
getPair
To get the address of exchange pairs. Ex: getPair[<tokenA address>][<tokenB address>] .
allPairs
Array of exchange pairs created by this factory.
Functions
createPair
-
Get consistent order of token addresses.
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); -
Check if address of pair is zero. It means that there is not existing pool for
token0&token1.
require(getPair[token0][token1] == address(0), 'UniswapV2: PAIR_EXISTS'); // single check is sufficient -
Initialize the pair of
token0andtoken. Add pair to theallPairsarray.
IUniswapV2Pair(pair).initialize(token0, token1); getPair[token0][token1] = pair; getPair[token1][token0] = pair; // populate mapping in the reverse direction allPairs.push(pair); emit PairCreated(token0, token1, pair, allPairs.length);
setFeeTo & setFeeToSetter
If msg.sender is feeToSetter , we can change and control the feeTo .
Top comments (0)