0

I wrote upgradable smart contract using solidity and upgraded contract several time. When I upgraded smart contract, implementation contract address was changed. But under that address, the old implementation contract address still remains.

https://rinkeby.etherscan.io/address/0x245dBBE31f33569D3d7F1e0df10c93547c44065D#readProxyContract

enter image description here

How to change or hide this old address?

PrincePRS
  • 51
  • 1

1 Answers1

1

Particularly you can't hide anything once it is stored on the Blockchain. The old address will still be visible.

But if you want that calling to the old contract should fail, you can simply create a self destruct function inside your smart contract and call it when you have updated the smart contract and deployed it with a new address.

Tip -

  • Always have smart contracts with the self destruct functionality
  • Whenever you update your smart contract i.e deploy it to a new address, call the self destruct function on the old contract address for it to be destroyed.

Syntax for self destruct -

contract YourContract {
    // State variables
    // Some functions
   
    function destruct(address addr) ownerOnly {
         selfdestruct(addr);
    }
    // The above function sends all ether from the contract to the specified address

}