Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenadams committed Sep 20, 2019
1 parent 8e9ffb1 commit 5216582
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 3 deletions.
2 changes: 1 addition & 1 deletion contracts/UniswapERC20Factory.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pragma solidity ^0.5.11;
import "./UniswapERC20.sol";ss
import "./UniswapERC20.sol";

contract UniswapERC20Factory {

Expand Down
2 changes: 1 addition & 1 deletion contracts/UniswapETH.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ contract UniswapETH is ERC20 {


constructor(address tokenAddr) public {
require(address(tokenAddr != address(0), 'INVALID_ADDRESS');
require(address(tokenAddr) != address(0), 'INVALID_ADDRESS');
factory = IUniswapFactory(msg.sender);
token = IERC20(tokenAddr);
name = 'Uniswap V2';
Expand Down
2 changes: 1 addition & 1 deletion contracts/UniswapETHFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ contract UniswapETHFactory {
function createExchange(address token) public returns (address) {
require(token != address(0));
require(getExchange[token] == address(0), 'EXCHANGE_EXISTS');
UniswapExchange exchange = new UniswapExchange(token);
UniswapETH exchange = new UniswapETH(token);
getExchange[token] = address(exchange);
getToken[address(exchange)] = token;
uint256 tokenId = tokenCount + 1;
Expand Down
41 changes: 41 additions & 0 deletions contracts/interfaces/IUniswapERC20.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
pragma solidity ^0.5.11;

interface IUniswapERC20 {

event SwapAForB(address indexed buyer, uint256 amountSold, uint256 amountBought);
event SwapBForA(address indexed buyer, uint256 amountSold, uint256 amountBought);
event AddLiquidity(address indexed provider, uint256 amountTokenA, uint256 amountTokenB);
event RemoveLiquidity(address indexed provider, uint256 amountTokenA, uint256 amountTokenB);


function getInputPrice(uint256 inputAmount, uint256 inputReserve, uint256 outputReserve) external pure returns (uint256);


function getOutputPrice(uint256 outputAmount, uint256 inputReserve, uint256 outputReserve) external pure returns (uint256);


//TO: DO msg.sender is wrapper
function swapInput(address inputToken, uint256 amountSold, address recipient) external returns (uint256);


//TO: DO msg.sender is wrapper
function swapOutput(address outputToken, uint256 amountBought, address recipient) external returns (uint256);


function getInputPrice(address inputToken, uint256 amountSold) external view returns (uint256);


function getOutputPrice(address outputToken, uint256 amountBought) external view returns (uint256);


function tokenAAddress() external view returns (address);


function tokenBAddress() external view returns (address);


function addLiquidity(uint256 amountA, uint256 maxTokenB, uint256 minLiquidity) external returns (uint256);


function removeLiquidity(uint256 amount, uint256 minTokenA, uint256 minTokenB) external returns (uint256, uint256);
}
8 changes: 8 additions & 0 deletions contracts/interfaces/IUniswapERC20Factory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pragma solidity ^0.5.11;

interface IUniswapERC20Factory {

event NewERC20Exchange(address indexed tokenA, address indexed tokenB, address indexed exchange);

function createExchange(address token1, address token2) external returns (address);
}

0 comments on commit 5216582

Please sign in to comment.