Let's consider this situation:
interface ITest
{
function check()
external;
}
contract Test is ITest
{
address private admin;
constructor()
public
{
admin = msg.sender;
}
modifier onlyAdmin
{
assert(msg.sender == admin);
_;
}
function check()
external onlyAdmin
{
// work only with admin
}
}
contract OtherTest
{
ITest private test;
constructor(
address testAddress
)
public
{
test = ITest(testAddress);
test.check();
}
}
It doesn't give any error. Is this safe and is it working as expected? Will this function work only for admin? Interestingly, it seems to work on VM.