From 6272d96b44b02f13a474db66d8e685a53a3192e6 Mon Sep 17 00:00:00 2001 From: haydenadams Date: Thu, 12 Sep 2019 15:20:25 -0400 Subject: [PATCH] rename --- contracts/UniswapERC20.sol | 0 ...wapFactory.sol => UniswapERC20Factory.sol} | 6 ++--- contracts/UniswapETH.sol | 4 +-- contracts/UniswapETHFactory.sol | 27 +++++++++++++++++++ contracts/interfaces/IERC20.sol | 4 --- contracts/interfaces/IUniswapERC20.sol | 0 contracts/interfaces/IUniswapERC20Factory.sol | 0 .../{IUniswapExchange.sol => IUniswapETH.sol} | 0 ...swapFactory.sol => IUniswapETHFactory.sol} | 0 9 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 contracts/UniswapERC20.sol rename contracts/{UniswapFactory.sol => UniswapERC20Factory.sol} (88%) create mode 100644 contracts/UniswapETHFactory.sol create mode 100644 contracts/interfaces/IUniswapERC20.sol create mode 100644 contracts/interfaces/IUniswapERC20Factory.sol rename contracts/interfaces/{IUniswapExchange.sol => IUniswapETH.sol} (100%) rename contracts/interfaces/{IUniswapFactory.sol => IUniswapETHFactory.sol} (100%) diff --git a/contracts/UniswapERC20.sol b/contracts/UniswapERC20.sol new file mode 100644 index 000000000..e69de29bb diff --git a/contracts/UniswapFactory.sol b/contracts/UniswapERC20Factory.sol similarity index 88% rename from contracts/UniswapFactory.sol rename to contracts/UniswapERC20Factory.sol index 968693ece..b49a384a4 100644 --- a/contracts/UniswapFactory.sol +++ b/contracts/UniswapERC20Factory.sol @@ -1,9 +1,9 @@ pragma solidity ^0.5.11; -import "./UniswapExchange.sol"; -import "./interfaces/IUniswapExchange.sol"; +import "./UniswapERC20.sol"; +import "./interfaces/IUniswapERC20.sol"; -contract UniswapFactory { +contract UniswapERC20Factory { event NewExchange(address indexed token, address indexed exchange); diff --git a/contracts/UniswapETH.sol b/contracts/UniswapETH.sol index e087007fe..8695931a3 100644 --- a/contracts/UniswapETH.sol +++ b/contracts/UniswapETH.sol @@ -1,8 +1,8 @@ pragma solidity ^0.5.11; import './ERC20.sol'; import './interfaces/IERC20.sol'; -import './interfaces/IUniswapFactory.sol'; -import './interfaces/IUniswapExchange.sol'; +import './interfaces/IUniswapETHFactory.sol'; +import './interfaces/IUniswapETH.sol'; contract UniswapETH is ERC20 { diff --git a/contracts/UniswapETHFactory.sol b/contracts/UniswapETHFactory.sol new file mode 100644 index 000000000..bc2372aa5 --- /dev/null +++ b/contracts/UniswapETHFactory.sol @@ -0,0 +1,27 @@ +pragma solidity ^0.5.11; +import "./UniswapETH.sol"; +import "./interfaces/IUniswapETH.sol"; + + +contract UniswapETHFactory { + + event NewExchange(address indexed token, address indexed exchange); + + uint256 public tokenCount; + mapping (address => address) public getExchange; + mapping (address => address) public getToken; + mapping (uint256 => address) public getTokenWithId; + + function createExchange(address token) public returns (address) { + require(token != address(0)); + require(getExchange[token] == address(0), 'EXCHANGE_EXISTS'); + UniswapExchange exchange = new UniswapExchange(token); + getExchange[token] = address(exchange); + getToken[address(exchange)] = token; + uint256 tokenId = tokenCount + 1; + tokenCount = tokenId; + getTokenWithId[tokenId] = token; + emit NewExchange(token, address(exchange)); + return address(exchange); + } +} diff --git a/contracts/interfaces/IERC20.sol b/contracts/interfaces/IERC20.sol index 0a71ade4c..82fe54f5b 100644 --- a/contracts/interfaces/IERC20.sol +++ b/contracts/interfaces/IERC20.sol @@ -1,9 +1,5 @@ pragma solidity ^0.5.11; -/** - * @title ERC20 interface - * @dev see https://eips.ethereum.org/EIPS/eip-20 - */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); diff --git a/contracts/interfaces/IUniswapERC20.sol b/contracts/interfaces/IUniswapERC20.sol new file mode 100644 index 000000000..e69de29bb diff --git a/contracts/interfaces/IUniswapERC20Factory.sol b/contracts/interfaces/IUniswapERC20Factory.sol new file mode 100644 index 000000000..e69de29bb diff --git a/contracts/interfaces/IUniswapExchange.sol b/contracts/interfaces/IUniswapETH.sol similarity index 100% rename from contracts/interfaces/IUniswapExchange.sol rename to contracts/interfaces/IUniswapETH.sol diff --git a/contracts/interfaces/IUniswapFactory.sol b/contracts/interfaces/IUniswapETHFactory.sol similarity index 100% rename from contracts/interfaces/IUniswapFactory.sol rename to contracts/interfaces/IUniswapETHFactory.sol