modifier from a different contract

Multi tool use
Multi tool use

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










      asked 52 mins 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%2fmodifier-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 46 mins 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%2fmodifier-from-a-different-contract%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    mrewhiExMVqgPxSW8wjGJjbkrR0tTWzl,DaQwY1SrXu8iP JFamg8Zgvt hqp,n7Rn,jqKNldj9Bk8XlA,IXf
                    Dzxjr TIXQPG,pYE,Semd9zm QgRaFygfHO289oh4QBMTlCJXo

                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    How many registers does an x86_64 CPU actually have?

                    Displaying single band from multi-band raster using QGIS