I keep getting Invalid Opcode opcode in my constructor when deploying my smart contract in both truffle and remix IDE

mapping(address => bool) isMintApprover; 
uint minApprovers = 0;
 address payable headOffice;
 address payable beneficiary;

constructor (address[] memory _approvers, uint _minApprovers, address payable _beneficiary) public payable{
        require(_minApprovers <= _approvers.length, "Should be less than min");
         _minApprovers = minApprovers;
         headOffice = msg.sender;
         _beneficiary = beneficiary;

         for(uint i = 0; i<= _approvers.length; i++){
             address approver = _approvers[i];
             isMintApprover[approver] = true;

        //address[] memory _approvers, uint _minApprovers, address payable _beneficiary
  • what arguments do you provide to your constructor. the error is caused by the require statement.
    – Badr Bellaj
    Commented Apr 14, 2019 at 17:44

1 Answer 1


Change i <= _approvers.length to i < _approvers.length.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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