Skip to content

Commit

Permalink
Removed duplicated contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvol committed Jul 24, 2023
1 parent 26af04c commit 81ac022
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 303 deletions.
292 changes: 0 additions & 292 deletions packages/protocol/contracts/common/FixidityLib0.8.sol

This file was deleted.

10 changes: 5 additions & 5 deletions packages/protocol/contracts/uniswap/test/MockUniswapV2Pair.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pragma solidity ^0.5.13;

import "../interfaces/IUniswapV2Pair.sol";
import "./UniswapV2ERC20.sol";
import "./libraries/Math.sol";
import "./libraries/MathUni.sol";
import "./libraries/UQ112x112.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";

Expand Down Expand Up @@ -102,8 +102,8 @@ contract MockUniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 {
uint256 _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint256 rootK = Math.sqrt(uint256(_reserve0).mul(_reserve1));
uint256 rootKLast = Math.sqrt(_kLast);
uint256 rootK = MathUni.sqrt(uint256(_reserve0).mul(_reserve1));
uint256 rootKLast = MathUni.sqrt(_kLast);
if (rootK > rootKLast) {
uint256 numerator = totalSupply.mul(rootK.sub(rootKLast));
uint256 denominator = rootK.mul(5).add(rootKLast);
Expand All @@ -127,10 +127,10 @@ contract MockUniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 {
bool feeOn = _mintFee(_reserve0, _reserve1);
uint256 _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
liquidity = MathUni.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(
liquidity = MathUni.min(
amount0.mul(_totalSupply) / _reserve0,
amount1.mul(_totalSupply) / _reserve1
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import ".//libraries/TransferHelper.sol";

import "../interfaces/IUniswapV2Router02.sol";
import "./libraries/UniswapV2Library.sol";
import "./libraries/SafeMath.sol";
import "./libraries/SafeMathUni.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IWETH.sol";

contract MockUniswapV2Router02 is IUniswapV2Router02 {
using SafeMath for uint256;
using SafeMathUni for uint256;

address public factory; // TODO changed by volpe
address public WETH; // TODO changed by volpe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pragma solidity ^0.5.13;

// a library for performing various math operations

library Math {
library MathUni {
function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x < y ? x : y;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pragma solidity ^0.5.13;

// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)

library SafeMath {
library SafeMathUni {
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ pragma solidity ^0.5.13;

import "../../interfaces/IUniswapV2Pair.sol";

import "./SafeMath.sol";
import "./SafeMathUni.sol";

library UniswapV2Library {
using SafeMath for uint256;
using SafeMathUni for uint256;

// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(address tokenA, address tokenB)
Expand Down

0 comments on commit 81ac022

Please sign in to comment.