The following code always reverts to "Contract must be empty".
But shouldn't address(this).balance == 0 if the contract hasn't even been instantiated yet?
Maybe since the contract doesn't even exist yet, neither does it's address/balance?
Even then, I thought all solidity values are set to 0 by default...
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.10 <0.7.0;
contract test {
constructor() public payable {
require(msg.value > 0, "User must submit a valid money amount");
require(address(this).balance == 0, "Contract must be empty");
}
}
address(this).balance >= msg.valueby definition. – goodvibration Jul 18 '20 at 07:53