soliditysmartcontractscontractnft

How Can a Owner Add a Function to Already Deployed Smart Contract


I'll be frank, I made a stupid mistake. In polygon network I deployed a NFT smart contract. I forgot to add withdraw function in my smart contract. Can we add this function to my smart contract that already deployed.

You can see the smart contract code in here: https://polygonscan.com/address/0xeCd093eD38449d8d64bb015D97072BdcaA594832#code


Solution

  • Unfortunately, you cannot.

    Upgrading smart contracts is not possible on EVM chains unless the contracts were designed for it. You can read more on the topic on Ethereum StackExchange.

    I also suggest you test you minimally unit tests contracts before deploying.