I created erc20 token with openzeppelin. and I'm testing it with ganache. everything is fine.. and I find this link OpenZeppelin Upgrades: Step by Step Tutorial for Truffle.. and then add this example to my contract.. and then I distribute my contract but then a new contract address pops up. Is there such a thing as updating the prepared contracts after they are distributed..as far as I understand, they are distributed only by proxy. Do I need to announce this new contract address to my buyers. If so, what will happen to my buyers' tokens? how can i understand this? thanks a lot.
Smart contract are never really upgradeable. When we talk about upgradeable smart contracts, what we are talking about are proxy that can change which contract they delegate to. This gives the impression of upgradeability, but the truth is no contract actually changed code.
If you have a contract currently deployed, that is not an upgradeable proxy, this contract's behavior is not modifiable, and you cannot use any of or tooling to "replace it". What our tooling does, is allow you to deploy proxies that can be upgraded from one version of the code to another. This means that for something to be upgradeable, it has to be designed that way from day 1. If you already have a token contract, that is not upgradeable, and you want to replace it with an upgradeable, you'll have to redeploy a new contract + proxy, advertise the address of the proxy to users/exchanges/... and plan a token migration.
I'm not sure I fully understand you question, so please fell free to reformulate it if my answer doesn't match what you were expecting.
Thank you @Amxx ..
Actually, what I want to ask is:
I would like to tell you in order.
1.) Suppose I published an erc20 contract with version 1 with a total supply of 1 teillion. When I publish it it gives me an address. eg 0x13d....
2.) When I forward this to my recipients, they start to receive my token from this address number.
3.) For example, my 1st customer bought 10000 units and my 2 customers bought 50000 units.
4.) then I changed my contract code. I created version 2. When I publish version 2, this time a new contract address appears. eg 0x4718d...
5.) the problem starts from here for me.
6.) What will be the balance of those who bought my previous contract? How do I transfer them to the new contract? Or should the contract addresses of version 2 and version 1 not change?
Actually the summary of my question is as follows
I want to issue a money token contract and sell it. like famous currencies.. Of course, being famous is a separate business, but I have to start somewhere.
If there are changes in the currency I will issue, what will be done at that stage? i hope i could explain
thanks in advance
Upgradeable contracts always have the same address for all versions. If you're seeing different addresses you're looking in the wrong places. Where are you getting the address?
Hi @frangio. Thank you for your answer.
i am still testing in my local.. with truffle & ganache & vscode.. i think i am doing wrong.. please tell me the path.. for example i create ver.1 contract and run truffle migration and then if i replace the code with ver.2 and then run truffle migration again .. then changing the contract name on the ganache. where is my mistake?
The address you should use is the one that will show up in the migrations output under "proxy", or the one that you can print to the console if you inspect the
address field of the contract returned by