I would like to have a modifier that looks like this:
modifier restrictTargetType(uint contractType) {
if (contractTypes[target] != contractType) { throw; }
_
}
Where target
is an address passed as a function argument. Simply naming the function argument target
isn't sufficient, and gives me an Error: Undeclared identifier.
Best Answer
At the point where you use the modifier, the function arguments are already in scope. This means something like the following is possible:
There is no generic way to provide access to the function arguments, though.