简体   繁体   中英

After compiling my erc20 token, can I modify any function?

I have a question, I am getting into a Token project. And I am still practicing, my diyuntiva is the following. I can append more functions to the token and more smartcontract after compiling the token to the BSC or there is nothing else to do! Thanks for understanding

Solidity source code is compiled to the EVM-compatible bytecode. Then you can deploy the bytecode to the actual live network.

After you compile the code (using solc , short for the Solidity compiler), you can update it and recompile for as many times as you want.


But, I'm guessing you wanted to ask if you can update the code after you've deployed it to the network.

The simple answer is: No. Bytecode is immutable, and once you've deployed it, there's no way to change it.

Having said that, ... you can make use of the Proxy pattern , where you don't actually change the bytecode, just a pointer (value in storage) to an address that holds the contract implementation. This allows you to deploy a new version of your contract to a new implementation address (in the background), while users still interact with the original proxy address (in the front). See this page by OpenZeppelin for more details, code examples, and diagrams of how this works in more depth.

Advanced topic: Thanks to the combination of selfdestruct and create2 EVM opcodes, it's also possible to destroy the contract and redeploy it with new constructor params. This article sums it up neatly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM