kleros / openiico-contract

Contract of Interactive Coin Offering
MIT License
11 stars 5 forks source link

⚠️⚠️⚠️function valuationAndCutOff() does not return anything ⚠️⚠️⚠️ #28

Closed stefek99 closed 6 years ago

stefek99 commented 6 years ago

function valuationAndCutOff() public view returns (uint valuation, uint virtualValuation, uint currentCutOffBidID, uint currentCutOffBidmaxValuation, uint currentCutOffBidContrib) {

Where is the return statement in the code?

Is it intentional to have the function that returns and then nothing...

HMMM...

https://github.com/kleros/openiico-contract/blob/master/contracts/IICO.sol#L323-L346

epiqueras commented 6 years ago

Returns don't have to be explicit.

See https://ethereum.stackexchange.com/questions/34046/what-is-the-purpose-of-giving-name-to-return-variables-in-function-declaration.

stefek99 commented 6 years ago

Syntactic sugar of Solidity.

In my opinion, can cause more harm than good.

Explicit return is better.

clesaege commented 6 years ago

I'm a huge fan of keeping the code as small as possible, so when a return is not needed, it seems good not to use it.

stefek99 commented 6 years ago

1 line only:

modifier onlyOwner{ require(owner == msg.sender); _; }

53 lines:

https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/ownership/Ownable.sol

I really enjoy the concise code 👍