smart-contracts icon indicating copy to clipboard operation
smart-contracts copied to clipboard

check condition first, then change state

Open rstormsf opened this issue 6 years ago • 1 comments

https://github.com/TokenMarketNet/ico/blob/master/contracts/CrowdsaleBase.sol#L250

I believe that the check that if the contract is finalizeAgent should be done first and only then to modify state variable

  function setFinalizeAgent(FinalizeAgent addr) onlyOwner {
    require(addr.isFinalizeAgent());
    finalizeAgent = addr;
  }

rstormsf avatar Nov 13 '17 01:11 rstormsf

Why does it matter, if the tx is being reverted if the check fails?

tomericco avatar Mar 15 '18 09:03 tomericco