Change the test to verify the actual gas used instead of the buggy estimated gas used
This commit is contained in:
@ -23,6 +23,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "yarn prettier ./test/*.ts --check",
|
||||
"lint:fix": "yarn prettier ./test/*.ts --write",
|
||||
"clean": "rimraf ./build/",
|
||||
"precompile": "yarn clean",
|
||||
"compile": "waffle .waffle.json",
|
||||
|
||||
@ -66,8 +66,9 @@ describe('UniswapV2Factory', () => {
|
||||
})
|
||||
|
||||
it('createPair:gas', async () => {
|
||||
const gasCost = await factory.estimate.createPair(...TEST_ADDRESSES)
|
||||
expect(gasCost).to.eq(2512920)
|
||||
const tx = await factory.createPair(...TEST_ADDRESSES)
|
||||
const receipt = await tx.wait()
|
||||
expect(receipt.gasUsed).to.eq(2512920)
|
||||
})
|
||||
|
||||
it('setFeeTo', async () => {
|
||||
|
||||
@ -176,8 +176,9 @@ describe('UniswapV2Pair', () => {
|
||||
const expectedOutputAmount = bigNumberify('453305446940074565')
|
||||
await token1.transfer(pair.address, swapAmount)
|
||||
await mineBlock(provider, (await provider.getBlock('latest')).timestamp + 1)
|
||||
const gasCost = await pair.estimate.swap(expectedOutputAmount, 0, wallet.address, '0x', overrides)
|
||||
expect(gasCost).to.eq(79136)
|
||||
const tx = await pair.swap(expectedOutputAmount, 0, wallet.address, '0x', overrides)
|
||||
const receipt = await tx.wait()
|
||||
expect(receipt.gasUsed).to.eq(73462)
|
||||
})
|
||||
|
||||
it('burn', async () => {
|
||||
|
||||
Reference in New Issue
Block a user