Two Solidity functions foo
and bar
both calling modifier m
which emits an event Called
with a unique identifier for the calling function. It could be any identifier, but it has to be unique per contract.
The modifier m
can’t be called with more arguments as part of the requirements.
contract MyContract {
event Called(bytes functionID);
function foo() private m {
// ...
}
function bar() private m {
// ...
}
modifier m {
emit Called( /* TODO: unique identifier for "calling" function, ie. foo or bar */ );
_;
}
}
How can I identify the calling function from within the modifier?