inline variable and tweak tests

This commit is contained in:
Noah Zinsmeister
2019-10-25 18:32:29 -04:00
parent 97c30f27c4
commit cb4d3f3bcb
2 changed files with 4 additions and 5 deletions

View File

@ -7,15 +7,14 @@ library Math {
}
// based on https://github.com/ethereum/dapp-bin/blob/11f05fc9e3f31a00d57982bc2f65ef2654f1b569/library/math.sol#L28 via https://github.com/ethereum/dapp-bin/pull/50
function sqrt(uint256 x) internal pure returns (uint256) {
function sqrt(uint256 x) internal pure returns (uint256 y) {
if (x == 0) return 0;
else if (x <= 3) return 1;
uint256 z = (x + 1) / 2;
uint256 y = x;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
return y;
}
}

View File

@ -39,10 +39,10 @@ describe('UniswapV2', () => {
})
it('mintLiquidity', async () => {
await token0.transfer(exchange.address, decimalize(1))
await token0.transfer(exchange.address, decimalize(4))
await token1.transfer(exchange.address, decimalize(1))
await expect(exchange.connect(wallet).mintLiquidity(wallet.address))
.to.emit(exchange, 'LiquidityMinted')
.withArgs(wallet.address, wallet.address, decimalize(1), decimalize(1), decimalize(1))
.withArgs(wallet.address, wallet.address, decimalize(2), decimalize(4), decimalize(1))
})
})