I have below solidity contract from Truffle quick start guide.

    pragma solidity >=0.4.0 <0.6.0;

    contract TaskMaster {

        mapping (address=>uint) public balances;
        address public owner;

        constructor () public {
            owner = msg.sender;
            balances[owner] = 10000;

        function reward(address doer, uint rewardAmount) 
        public isOwner() hasSufficientFunds(rewardAmount)
        returns (bool sufficientFunds) {
            balances[msg.sender] -= rewardAmount;
            balances[doer] += rewardAmount;
            return sufficientFunds;

        function getBalance(address addr) public view returns (uint balance) {
            return balances[addr];

        modifier isOwner() {
            require(msg.sender == owner);

        modifier hasSufficientFunds(uint rewardAmount) {
            require(balances[msg.sender] >= rewardAmount);

I have a question on the function reward the way it is going to work. To me it looks like it is always going to return false because named return type sufficientFunds is not altered.

If not, could anyone explain how does that works?


Your interpretation is correct. That function always returns false.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.