small tweaks

This commit is contained in:
Noah Zinsmeister
2019-12-09 16:24:59 -05:00
parent 26f8f69618
commit 12b269d686
4 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,5 @@
# Uniswap v2 Smart Contracts
[![CircleCI](https://circleci.com/gh/Uniswap/uniswap-v2.svg?style=svg)](https://circleci.com/gh/Uniswap/uniswap-v2)
[![CircleCI](https://circleci.com/gh/Uniswap/uniswap-v2-core.svg?style=svg)](https://circleci.com/gh/Uniswap/uniswap-v2-core)
## Local Development

View File

@ -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);
}
// almost certainly never needs to be called, it's for weird tokens
// almost never _needs_ to be called, it's for weird tokens and can also be helpful for oracles
function sync() external lock {
update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)));
}

View File

@ -47,4 +47,5 @@ interface IUniswapV2 {
function burnLiquidity(address recipient) external returns (uint amount0, uint amount1);
function swap0(address recipient) external returns (uint amount1);
function swap1(address recipient) external returns (uint amount0);
function sync() external;
}

View File

@ -19,9 +19,9 @@ describe('UniswapV2', () => {
let token1: Contract
let exchange: Contract
beforeEach(async () => {
const { token0: _token0, token1: _token1, exchange: _exchange } = (await loadFixture(
const { token0: _token0, token1: _token1, exchange: _exchange }: ExchangeFixture = await loadFixture(
exchangeFixture as any
)) as ExchangeFixture
)
token0 = _token0
token1 = _token1
exchange = _exchange