11pragma solidity 0.5.15 ;
22
3+ import "./UniswapV2.sol " ;
34import "./interfaces/IUniswapV2Factory.sol " ;
45import "./interfaces/IUniswapV2.sol " ;
56
67contract UniswapV2Factory is IUniswapV2Factory {
7- bytes public exchangeBytecode;
88 address public feeToSetter;
99 address public feeTo;
1010
@@ -13,9 +13,7 @@ contract UniswapV2Factory is IUniswapV2Factory {
1313
1414 event ExchangeCreated (address indexed token0 , address indexed token1 , address exchange , uint );
1515
16- constructor (bytes memory _exchangeBytecode , address _feeToSetter ) public {
17- require (_exchangeBytecode.length >= 32 , "UniswapV2Factory: SHORT_BYTECODE " );
18- exchangeBytecode = _exchangeBytecode;
16+ constructor (address _feeToSetter ) public {
1917 feeToSetter = _feeToSetter;
2018 }
2119
@@ -37,7 +35,7 @@ contract UniswapV2Factory is IUniswapV2Factory {
3735 require (tokenA != address (0 ) && tokenB != address (0 ), "UniswapV2Factory: ZERO_ADDRESS " );
3836 (address token0 , address token1 ) = sortTokens (tokenA, tokenB);
3937 require (getExchange_[token0][token1] == address (0 ), "UniswapV2Factory: EXCHANGE_EXISTS " );
40- bytes memory exchangeBytecodeMemory = exchangeBytecode; // load bytecode into memory because create2 requires it
38+ bytes memory exchangeBytecodeMemory = type (UniswapV2).creationCode;
4139 bytes32 salt = keccak256 (abi.encodePacked (token0, token1));
4240 assembly { // solium-disable-line security/no-inline-assembly
4341 exchange := create2 (0 , add (exchangeBytecodeMemory, 32 ), mload (exchangeBytecodeMemory), salt)
0 commit comments