3

I am trying to compile the Gav Wood's wallet on the latest Solidity compiler. Looks like the latest Solidity compiler has some issue with the code I do not totally understand. I'd like to know how to fix code or the compiling process.

I am getting error:

        Error: Documented parameter "{uint" not found in the parameter list of the function.
contracts/Wallet.sol:358:13: Warning: Return value of low-level calls not used.
            _to.call.value(_value)(_data);
            ^---------------------------^

The related code is:

    // first, take the opportunity to check that we're under the daily limit.
    if (underLimit(_value)) {
        SingleTransact(msg.sender, _value, _to, _data);
        // yes - just execute the call.
        _to.call.value(_value)(_data);
        return 0;
    }
2

This error refers to the bad formatting of Doxygen tags within DocString comments (commonly known as NatSpec Format comments).

If you do not format these tags value correctly, the Solidity compiler " moans " and does not compile (even if the rest of the code is correct unfortunately !).


Solving your problem

NB: Your question is really old and I couldn't find the original source code with the syntax error. I will use a modified version of Oleg Kondrahanov code example to explain (while removing constant keyword which is deprecated.

The problem in your code does not come from the _to.call.value(_value)(_data); (This is just a Warning and you can still compile with Warnings in Solidity). Rather the problem comes from how you document the parameter using doxygen tags in NatSpec.

In your case, you must include the name of the function parameter after the @param tag (not the type).

Change it from this :

/**
* Calculate the current price for buy in amount.
*
*      REPLACE THIS SECTION
*         |           |
*         v           v
* @param  {uint amount} Buy-in value in wei.
*/
function calculatePrice(uint amount) public pure returns (uint) {
    // Do something
}

To this :

/**
* Calculate the current price for buy in amount.
* 
*       WITH THIS
*        |    |
*        v    v
* @param amount Buy-in value in wei.  
*/
function calculatePrice(uint amount) public pure returns (uint) {
    // Do something
}

So after the @param doxygen tag, you always mention the variable name (As opposed to @return where you mention the variable type. So the format is like this :

   /**
    * @param _charity The ethereum address of the charity you want to donate
    * @param _amount The amount in Wei to donate to the charity
    * @return bool returns true if success
    */
    function donateEther(address _charity, uint _amount) public pure returns (bool) {
        // your code here
    }

What are NatSpec comments ?

In the former Remix IDE, you could see the difference between Standard Solidity comments vs Natspec comments by their colour. See the picture below :

Regular vs Natspec comments in Solidity

Basically, NatSpec comments are used for two purposes. When you compile a Solidity contract with the solc compiler via the CLI, you can specify one the following two flags (or both), to generate two documentation file (in JSON format):

  • solc <file_name.sol> --devdoc : generates Developer documentation
  • solc <file_name.sol> --userdoc : generates User documentation

Note that this does not create a separate file ! But just output the documentation in JSON format in your CLI. See the Solidity doc


Doxygen tags available

Doxygen tags available in Solidity include @title, @author, @notice, @dev, @param and @return. Only the @notice tag can be used to generate custom message on UI (when a user commit interact with a smart contracts). Example :

/// @notice Thank you for your donation, you are about to send `_value / 10**18` Ether to the charity address `_address`.
/// @param _value The amount of ether you want to donate
/// @param _charity The Ethereum address of the charity
function donateEther(address _charity, uint _amount) external returns (bool) {
    // your code here
}

Assuming the example we would send 0.34 ethers (currently ≈ 10 USD) to address 0x7a84B6d2B1A1021df402437712AaE717472e829F, the example code above would generate a message like this on the UI when you send the transaction :

Thank you for your donation, you are about to send 0.34 ethers
to the charity address 0x7a84B6d2B1A1021df402437712AaE717472e829F
  • Thank you for a very comprehensive answer! – Mikko Ohtamaa Jul 1 at 11:43
12

I am not sure if it is still useful for you but surely can help many other people to save time. So please mark as an answer if that was an issue.

This error comes from special comments like this /** */ and has nothing to do with code in your Wallet.sol

Somewhere in the code, and what's most frustrating in unknown file there is a function like this (real project example)

/**
* Calculate the current price for buy in amount.
*
* @param  {uint amount} Buy-in value in wei.
*/
function calculatePrice(uint value, address msgSender, uint decimals) 
    public 
    constant 
    returns (uint) {
    uint multiplier = 10 ** decimals;
    return value.times(multiplier) / oneTokenInWei;
}

You see, comment says that there is one parameter 'uint amount', but there is no such parameter in fact. Just delete that line.

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.