Is it possible to add a modifier to the auto-generated getter for a given variable? My use case is I am marking a contract as being in-process for updating and setting a modifier flag; I'd like to prevent reading the contract state while it's updating, restricted by this modifier.
I understand I could create my own getter, but then I am returning a tuple with no keys. When I access one of the structs via the auto-generated getter via web3 for a mapping at a specific mapping key (of the form mapping(uint => SomeStruct)
, I get the SomeStruct
instance along with the struct keys, which is nice but unexpected, since I'm not using the ABIEncoderV2 experimental encoder. I'd like to keep the ability to return this object, which as I've stated I don't think is possible if I define my own getter, without the experimental encoder.
private
(orinternal
), and then implement a getter function explicitly?function func() external view returns (uint256, uint256, uint256)
uint
which you use in order to query themapping
, and inside the function return your structure as a tuple (list) of values.