0

If a custom ERC-20 token is initially issued, can its solidity code be modified for all existing holders and circulating supply to include a new function?

For example, you issue ERC-20 token in January purely as a currency, but in August you decide to add both a staking and farming functions to the original contract? How to go about handling this sort of amendment to an already issued token?

user610620
  • 1,508
  • 6
  • 24
  • 52
  • 1
    https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable is the closest solution. But I hope someone can tell us a full story. – Tom Fishman Dec 18 '21 at 05:00

1 Answers1

1

Just if uses a proxy pattern (upgradable contract).

The majority of ERC-20 tokens aren't upgradable, but I've seen stable coins contracts and game tokens contracts using upgradable ERC-20.

For instance, USDC uses proxy pattern: https://etherscan.io/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48#readContract

a good explanation about upgradable smart-contracts: https://ethereum.stackexchange.com/a/80206/86156

Openzeppelin documentation about upgradable smart-contracts: https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable.

  • Heard of upgradable ERC-20s. How to tell in Etherscan Contracts if a contract token is an upgradable ERC-20? – user610620 Dec 18 '21 at 23:42
  • 1
    Etherscan recently added "Read as Proxy" and "Write as Proxy" buttons when is n upgradable contract. Also, you can see in the contract code, they will have a initialize function instead of a constructor – anajuliabit Dec 19 '21 at 00:20
  • could you link a popular example of a proxy token – user610620 Dec 19 '21 at 01:23
  • 1
    USDC - that I linked in the answer, it's a good example.

    I also recently saw the CryptoPlanes ERC-20 token uses proxy. Is in Binance Smart Chain but it's a good example too.

    The upgradable proxy contract, i.e, the one that does not change and that users interact: https://bscscan.com/address/0x04260673729c5f2b9894a467736f3d85f8d34fc8#code

    The current implementation contract: https://bscscan.com/address/0xc0e36a4c8bf041f0e54b82e2e32aa4c6c207505e#code

    – anajuliabit Dec 19 '21 at 02:41