Is it possible to use a modifier from a different contract?
Clash 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..
solidity contract-development
add a comment |Â
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..
solidity contract-development
add a comment |Â
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..
solidity contract-development
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
solidity contract-development
edited 55 mins ago
Ismael
13.2k42345
13.2k42345
asked 1 hour ago
Lomo
234
234
add a comment |Â
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
Modifiers have a similar scope to internal functions. The only way to access supermod
from con2
is if con2
inherits from con1
answered 1 hour ago
flygoing
5,299727
5,299727
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password