Is it possible to use a modifier from a different contract?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Is there a way to use modifiers from a different contract? My attempt did not work.



contract con1

modifier supermod(uint _value)
require(_value == 1);
_;



contract con2

con1 public contract1;

function setCon1Address(address _address)public
contract1 = con1(_address);


function test() contract1.supermod(uint _value)
..stuff..













share|improve this question



























    up vote
    1
    down vote

    favorite












    Is there a way to use modifiers from a different contract? My attempt did not work.



    contract con1

    modifier supermod(uint _value)
    require(_value == 1);
    _;



    contract con2

    con1 public contract1;

    function setCon1Address(address _address)public
    contract1 = con1(_address);


    function test() contract1.supermod(uint _value)
    ..stuff..













    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Is there a way to use modifiers from a different contract? My attempt did not work.



      contract con1

      modifier supermod(uint _value)
      require(_value == 1);
      _;



      contract con2

      con1 public contract1;

      function setCon1Address(address _address)public
      contract1 = con1(_address);


      function test() contract1.supermod(uint _value)
      ..stuff..













      share|improve this question















      Is there a way to use modifiers from a different contract? My attempt did not work.



      contract con1

      modifier supermod(uint _value)
      require(_value == 1);
      _;



      contract con2

      con1 public contract1;

      function setCon1Address(address _address)public
      contract1 = con1(_address);


      function test() contract1.supermod(uint _value)
      ..stuff..










      solidity contract-development






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 52 mins ago









      Ismael

      13.2k42345




      13.2k42345










      asked 1 hour ago









      Lomo

      234




      234




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          Modifiers have a similar scope to internal functions. The only way to access supermod from con2 is if con2 inherits from con1






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "642"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f60511%2fis-it-possible-to-use-a-modifier-from-a-different-contract%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote













            Modifiers have a similar scope to internal functions. The only way to access supermod from con2 is if con2 inherits from con1






            share|improve this answer
























              up vote
              2
              down vote













              Modifiers have a similar scope to internal functions. The only way to access supermod from con2 is if con2 inherits from con1






              share|improve this answer






















                up vote
                2
                down vote










                up vote
                2
                down vote









                Modifiers have a similar scope to internal functions. The only way to access supermod from con2 is if con2 inherits from con1






                share|improve this answer












                Modifiers have a similar scope to internal functions. The only way to access supermod from con2 is if con2 inherits from con1







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 1 hour ago









                flygoing

                5,299727




                5,299727



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f60511%2fis-it-possible-to-use-a-modifier-from-a-different-contract%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    What does second last employer means? [closed]

                    Installing NextGIS Connect into QGIS 3?

                    One-line joke