From 26f8f69618913f6a0ec4878e8a6ed074e551275d Mon Sep 17 00:00:00 2001 From: Noah Zinsmeister Date: Mon, 9 Dec 2019 13:04:52 -0500 Subject: [PATCH] add skeleton LiquidityMinted event --- contracts/UniswapV2.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/UniswapV2.sol b/contracts/UniswapV2.sol index 5aee120..fe86662 100644 --- a/contracts/UniswapV2.sol +++ b/contracts/UniswapV2.sol @@ -60,7 +60,6 @@ contract UniswapV2 is IUniswapV2, ERC20("Uniswap V2", "UNI-V2", 18, 0), SafeTran address input ); - constructor() public { factory = msg.sender; } @@ -70,7 +69,6 @@ contract UniswapV2 is IUniswapV2, ERC20("Uniswap V2", "UNI-V2", 18, 0), SafeTran (token0, token1) = (_token0, _token1); } - // uniswap-v1 naming function getInputPrice(uint inputAmount, uint inputReserve, uint outputReserve) public pure returns (uint) { require(inputReserve > 0 && outputReserve > 0, "UniswapV2: INVALID_VALUE"); uint amountInputWithFee = inputAmount.mul(997); @@ -84,7 +82,9 @@ contract UniswapV2 is IUniswapV2, ERC20("Uniswap V2", "UNI-V2", 18, 0), SafeTran if (invariant > invariantLast) { uint numerator = invariant.mul(200); uint denominator = invariant - (invariant - invariantLast).mul(200); - mint(factory, numerator / denominator - 1); + uint liquidity = numerator / denominator - 1; + mint(factory, liquidity); + emit LiquidityMinted(msg.sender, factory, 0, 0, reserve0, reserve1, liquidity); } } @@ -161,7 +161,7 @@ contract UniswapV2 is IUniswapV2, ERC20("Uniswap V2", "UNI-V2", 18, 0), SafeTran emit Swap(msg.sender, recipient, amount0, amount1, reserve0, reserve1, token1); } - // this function almost certainly never needs to be called, it's for weird tokens + // almost certainly never needs to be called, it's for weird tokens function sync() external lock { update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this))); }