Better assertions for `amguPayable` functions in tests
SeanJCasey opened this issue · comments
Right now, the amgu.test.js
integration tests assert whether the actual amount of ETH charged for an amguPayable
function is less than an estimated amount. The estimated amount calculation more-or-less mirrors the amguConsumer
modifier code:
This needs to be more precise than greater than / less than, either:
A. [ideal] exact amounts
B. some tolerated % deviation from the estimate
Also, it would be nice to implement a calcAmguPayableInEther
helper, which could be used by amguPayable
and also for external estimations like our tests, for consistency...
@SeanJCasey we can't implement A because we can't calculate the exact gas cost of a function without its modifiers. For B, I think we can add one more assertion to check if estimatedEthToPay - realEthToPay
is within the range of a deviation