1

I know tezos strongly believes in immutability but I would like to clear out some curiosity regarding upgradability of a contract.

  1. If a function in a contract needs to be updated with it's logic , how can we do that?

  2. If we want to add a new function in an already originated contract, Is it possible or do we need to deploy a whole new contract ?

  3. How do we handle bugs if we get some issue in mainnet contract ? How are other product of tezos handling this ? Are there any example where a mainnet contract gets an issue and how was that issue handled?

  4. Is there any concept like OpenZeppelin(tools for deploying upgradeable smart contracts in solidity) in tezos ?

Looking forward for the answers.

1 Answer 1

1
  • 1,2. This is done by storing a lambda in a map/big_map and then calling it from the entry-point. That way you can update the logic of the entry point by storing another lambda.
    1. You should create a mechanism to handle this. (e.i. make the contract pausable)
    1. Yes, it is called lazy entry-points in smartpy. Here is also an example in ligo.

I am of the opinion that most contract's code should be final once they get deployed. Using a proxy approach is almost always preferable.

2
  • 2. How does storing lambda in a map/big_map helps in creating a entirely new function in a contract, here i am mentioning a new feature that will be written in a new function not in existing function. Is there any example? 3. How can we resolve the issue after making the contract pausable. 4. Do you have any example?
    – Kin
    Nov 22, 2022 at 8:36
  • 2. The lambda contains the body of the function. You cannot update the function signature. 3. Pointing to a new contract in the proxy contract or updating the lambda, depending on the approach you use. 4. Adding to the examples already provided above smartpy.io/ide?template=lazy_entry_points.py Nov 22, 2022 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.