This commit is contained in:
Noah Zinsmeister
2019-10-31 11:16:17 -04:00
parent 4779878e27
commit 0afb8d1323
3 changed files with 7 additions and 5 deletions

View File

@ -11,6 +11,7 @@ import "./libraries/SafeMath256.sol";
import "./token/ERC20.sol";
contract UniswapV2 is IUniswapV2, ERC20("Uniswap V2", "UNI-V2", 18, 0) {
using Math for uint256;
using SafeMath128 for uint128;
using SafeMath256 for uint256;
@ -35,7 +36,7 @@ contract UniswapV2 is IUniswapV2, ERC20("Uniswap V2", "UNI-V2", 18, 0) {
}
bool private locked; // reentrancy lock
address public factory;
address public token0;
address public token1;
@ -66,7 +67,7 @@ contract UniswapV2 is IUniswapV2, ERC20("Uniswap V2", "UNI-V2", 18, 0) {
function safeTransfer(address token, address to, uint128 value) private returns (bool result) {
IIncompatibleERC20(token).transfer(to, uint256(value));
assembly {
switch returndatasize()
switch returndatasize()
case 0 {
result := not(0) // for no-bool responses, treat as successful
}

View File

@ -56,7 +56,7 @@ contract Oracle {
token0: deltas.token0 / blocksElapsed,
token1: deltas.token1 / blocksElapsed
});
uint128 timeElapsed = blockTimestamp - lastUpdate.blockTimestamp;
_updateCurrentPrice(averages, timeElapsed);
}

View File

@ -35,7 +35,7 @@ contract ERC20 is IERC20 {
require(chainId == 0, "ERC20: ALREADY_INITIALIZED");
chainId = _chainId;
}
function mint(address to, uint256 value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
@ -110,7 +110,8 @@ contract ERC20 is IERC20 {
owner, spender, value, nonce, expiration, chainId
))
));
require(owner == ecrecover(digest, v, r, s), "ERC20: INVALID_SIGNATURE"); // TODO add ECDSA checks? https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/cryptography/ECDSA.sol
// TODO add ECDSA checks? https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/cryptography/ECDSA.sol
require(owner == ecrecover(digest, v, r, s), "ERC20: INVALID_SIGNATURE");
_approve(owner, spender, value);
}