Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions integration-tests/test/native-eth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ describe('Native ETH Integration Tests', async () => {
l2Bob = l1Bob.connect(env.l2Wallet.provider)
})

describe('estimateGas', () => {
it('Should estimate gas for ETH transfer', async () => {
const amount = utils.parseEther('0.5')
const addr = await l2Bob.getAddress()
const gas = await env.ovmEth.estimateGas.transfer(addr, amount)
expect(gas).is.instanceof(BigNumber)
})

it('Should estimate gas for ETH withdraw', async () => {
const amount = utils.parseEther('0.5')
const gas = await env.ovmEth.estimateGas.withdraw(amount)
expect(gas).is.instanceof(BigNumber)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add some more constraints here such as it being greater than zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be happy to add a check for greater than 0, but I didn't want to do any exact checks because that would be flakey over time. I was really trying to check to make sure that it didn't throw an error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For any kind of gas snapshot tests we could use a pattern like the one here https://gist.github.com/gakonst/258a6ccd6bb752248999a13e8dd82a64

})
})

it('deposit', async () => {
const depositAmount = 10
const preBalances = await getBalances(env)
Expand Down