Hey guys,
How can read the immutable variables from a deployed smart contract?
As immutable variables are stored in the contract bytecode, I can't use getStorageAt.
Is there any similar way?
As of now, I can see them directly on etherscan by searching PUSH32 in the opcodes, but I wanted to know if I can do this via scripts.
question asked here too - https://ethereum.stackexchange.com/questions/152367/how-to-read-private-immutable-field
Jul 12, 2023, 10:17 AM
There is no straightforward way instead of some messy bytecode slicing afaik. If its provided as a constructor arg, you're in luck
Jul 12, 2023, 12:46 PM
I see
As we are talking about constructor arguments, I just noticed that there's a difference between what's there on etherscan, and what I get from getStorageAt. (This is not about an immutable variable). The expected value is what I get from getStorageAt.
Is it something that happens often? Coz I have seen this for the first time.
As we are talking about constructor arguments, I just noticed that there's a difference between what's there on etherscan, and what I get from getStorageAt. (This is not about an immutable variable). The expected value is what I get from getStorageAt.
Is it something that happens often? Coz I have seen this for the first time.
Jul 12, 2023, 12:54 PM
How exactly are you reading private var on etherscan?
Jul 12, 2023, 12:57 PM
It was a constructor argument
Jul 12, 2023, 12:58 PM
Can you share the contract? Constructor arg will be always appended at the end of bytecode and etherscan never really gave a false value for me
Jul 12, 2023, 1:01 PM
Texting you in DM ser, is it okay?
Jul 12, 2023, 1:01 PM
Yeh sure
Jul 12, 2023, 1:01 PM