When I'm trying to deploy contracts that contain assert and require using truffle I receive

Error: Undeclared identifier.


pragma solidity ^0.4.8;

contract Owned{

    address public owner = msg.sender;

    modifier onlyOwner(){
        assert(msg.sender == owner);

    function kill() onlyOwner{
        require(msg.sender ==owner);

I know that in the past truffle created its own assert.sol but surely they've updated it to be consistent with Solidity, and it doesn't explain why require also fail.

I'll highly appreciate any thoughts on how to overcome this issue.

  • 1
    it works perfectly on my machine. I'm able to compile and migrate the same code. which version of truffle are you using?
    – Sanchit
    Jun 28 '17 at 12:03
  • I'm using v3.2.1
    – shultz
    Jun 28 '17 at 13:26
  • 1
    I'm using truffle 3.2.5, try upgrading it.
    – Sanchit
    Jun 28 '17 at 13:58
  • added it as an answer, hope you can upvote it or accept it :P
    – Sanchit
    Jun 28 '17 at 16:14

The code works perfectly on my machine. I'm able to migrate and compile the given code.

The truffle version I'm using is - 3.2.5

Upgrade to this version, shall fix your issue.

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.