Solidity Error – ParserError: Expected Identifier but Got ‘address’

contract-invocation

I am trying to execute the following code:

pragma solidity ^0.5.1;

contract contractA {
    function blah(int x, int y) public payable {}
}
contract contractB {
   function invokeContractA() { 
      address a = contractA.address(this);
      uint ValueToSend = 1234;  
      a.blah.value(ValueToSend)(2, 3);
   }  
}

I was getting following error in the ocde:

browser/callMethod.sol:7:31: ParserError: Expected identifier but got
'address' address a = contractA.address(this); ^—–^

After searching from ethereum.stackexchange, I found the solution and now my contract B looks like this:

    contract contractB {
    function invokeContractA(address _addA) public  { 
        contractA a = contractA(_addA);
        uint ValueToSend = 1234;    
        a.blah.value(ValueToSend)(2, 3);
    }  
}

Now I am getting following error on remix ide:

browser/callMethod.sol:4:19: Warning: Unused function parameter.
Remove or comment out the variable name to silence this warning.
function blah(int x, int y) public payable {} ^—^

Some body please guide me.

Zulfi.

Best Answer

The "error" you're seeing is not an error. It's a warning.

As the warning says, the cause is unused parameters. You can ignore the warning if you want, or you can address it by removing the unused parameters or just their names:

// Either this:
function blah() public payable {}

// Or this:
function blah(int, int) public payable {}
Related Topic