OpenZeppelin create2

hello! guys!
I'm learning create2 code here : https://github.com/OpenZeppelin/openzeppelin-contracts/blob/ca2b85d786dfc07acfbf62de1893ff73363d614b/contracts/utils/Create2.sol#L37
and I find a question here

if (address(this).balance < amount) {
   revert Errors.InsufficientBalance(address(this).balance, amount);
}

if amount = 1ether
and balance is also 1 ether.
I think this create2 will revert for no gas here.
should change to this?

if (address(this).balance <= amount) {
   revert Errors.InsufficientBalance(address(this).balance, amount);
}

may be I'm wrong , please let me know the reason!
Thanks!

1 Like

No, the way you are thinking is applicable while using require statement, but this is an if revert statement.

Means, only when the balance is less than amount, it will revert. And if the balance and amount are equal OR if balance is greater than amount, it will execute.

Just think of it as a reverse logic for require statement

1 Like