3

Contract A imports Contract B and Contract B contains a modifier that I want to use in contract A. Contract A is set to inherit from Contract B, however I get the following when I try to use the modifier in Contract A:

Error: solc: exit status 1
<stdin>:1:1: Error: Declaration "modifierInB" not found in "B" (referenced as "./B").
import {modifierInB} from "./B";
^--------------------------------^

I have tried this with the below with similar results

import "./B";

Any idea where I'm going wrong or can I simply not move a Contract containing a modifier to another file?

  • You found an answer for this ? – siva Sep 19 '17 at 5:01
0

You don't need to import the modifier, just import B, and make A inherit from it. Then on A, you can define a function that uses the modifierInB.

Take a look here: https://github.com/elopio/solidity-experiments/tree/master/contracts/ContractWithInheritedModifier

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.