Can I see the implementation behind an upgradeable contract?

For example, this contract uses a proxy:

When trying to see the code, I see the code for the proxy, but I don't know how to see the implementation (the code the calls are forwarded to).

If it's possible, can you please tell me how I can find the implementation ?
Thanks.

Sorry if it's a noob question, I am a noob :slight_smile:

you can read the storage slot where it is located. from the proxy code: bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

here is a prior post about it

Thanks for the reply.
I read your reply as well as the thread you pointed me to, but I still feel lost.

Can you please tell me step by step how I can get the code of the implementation ?
From that link it seems that you can get it programmatically, but is there a way to get it via some web page ? Like you get the proxy code from bscscan ?

Thank you again for the help.

bscscan sometimes points you to the implementation address. you can get this value programmatically using web3js, web3py or any other flavor of web3 lib (contracts can't read other contracts storage). you can also retrieve the contract bytecode (the source code might not be available on bscscan)

web3.eth.getStorageAt(addr, _IMPLEMENTATION_SLOT) returns the address for the implementation

Does this mean that if this isn't my contract, I can't read the implementation ?

If so, doesn't this go against the idea that the contracts are transparent which was one of the supposed benefits of the blockchain ?

not from other contracts. As i mentioned, you can read the contract's storage using one of the web3 libs (which is what interacts with the blockchain, to interact with a contract you are already using a web3 lib)

So, for my example, I'd need to do something like:

web3.eth.getStorageAt(addr, '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc')

I put the value of _IMPLEMENTATION_SLOT for the 2nd argument, but what do I need for the 1st argument ?

Where do I find the value for the address param ?

Thanks again.

You can find the docs for getStorageAt() here

You asked how to find the implementation behind a proxy. Maybe the addr is the proxy addr ??

You probably should do some reading to understand better how contracts, web3 lib and blockchain interact with each other