How to get proxy implementation in V.5

Hi Guys.

I've found getProxyImplementation function is removed in https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3820.
It was very useful to get it from a contract directly.
Is there a new way how to get the current proxy implementation?

The best regards,
Vitalii

1 Like

You can find the answer to this question in one of the changes on the GitHub issue which you've linked above:

You can scroll further down in that change-list and see how OZ do it in their tests.

For example, in this change, they've replaced:

this.proxyAdmin.getProxyImplementation(this.proxy.address);

With:

getAddressInSlot(this.proxy, ImplementationSlot);

Where function getAddressInSlot is implemented in this change:

async function getAddressInSlot (address, slot) {
  const slotValue = await getSlot(address, slot);
  return web3.utils.toChecksumAddress(slotValue.substr(-40));
}
1 Like

It works.
Thank you @barakman.

1 Like