Coder Social home page Coder Social logo

Comments (9)

thomas-nguy avatar thomas-nguy commented on July 30, 2024

Related PR

#12

from era-contracts.

githubdoramon avatar githubdoramon commented on July 30, 2024

On initial question @thomas-nguy - Why requiring token to have 18 decimals and don't make this customizable?

from era-contracts.

thomas-nguy avatar thomas-nguy commented on July 30, 2024

@githubdoramon
At the EVM layer (L2) the gas token should have an 18 decimals representation (many operations and sdks depends on it for wei/gwei conversion), if we choose a base token that does not have 18 decimals it will create complications.

from era-contracts.

githubdoramon avatar githubdoramon commented on July 30, 2024

@githubdoramon At the EVM layer (L2) the gas token should have a 18 decimals representation (many operations and sdks depends on it for wei/gwei conversion), if we choose a base token that does not have 18 decimals it will create complications.

@thomas-nguy
Good point. We could still create the L@ version with 18 decimals regardless of decimals amount on L1, and upon withdrawals leave any remainder on the L2 side when converting back. Not at ALL a priority or needed on the first iteration, but could be a future use case (imagine Circle wants a hyperchain for example).

from era-contracts.

mm-zk avatar mm-zk commented on July 30, 2024

Hey @thomas-nguy ,

First - thanks for great description of the issue (and a draft PR).

IMHO - I'd be leaning towards doing these changes in separate Facet right now - this will allow faster experimentation. And once the features stabilize, we could add them to the main facet if needed.

from era-contracts.

mm-zk avatar mm-zk commented on July 30, 2024

For the part about:

it is crucial to implement an Oracle in the future to adjust the gas_price on layer2 according to the related price of the base token against Ethereum (could be a coefficient factor stored in DB and updated by a trusted oracle)

I guess we'd have to modify the GasAdjuster (more details here: https://github.com/matter-labs/zksync-era/blob/main/docs/advanced/gas_and_fees.md)

from era-contracts.

thomas-nguy avatar thomas-nguy commented on July 30, 2024

Hi @mm-zk .

I agree with the facet approach. I think this is the best way to test new features in the zk contract without breaking existing logic.

The reason I use the "same facet" approach in the PR #12 is to make the changes more obvious to review, but I will re-open a new PR using the new facet approach

Regarding the GasAdjuster, it seems that we have the same idea :)

I have opened up a PR in the zksync repository that give an idea of our implementation

matter-labs/zksync-era#96

Let me know if this approach is acceptable

from era-contracts.

jaguard2021 avatar jaguard2021 commented on July 30, 2024

Advantages:

Diversification of Base Tokens: Supporting ERC20 as the base token allows for the use of custom tokens, enhancing flexibility and catering to diverse user needs.

"Minimum Change" Principle: The "minimum change" approach can help reduce risks and system complexity by altering only necessary parts without significantly disrupting existing functionalities.

Contract Flexibility:

CustomBaseMailBox: Adding a new facet like CustomBaseMailBox can facilitate the management of logic related to custom base tokens without disturbing the existing Mailbox. This can aid in separating responsibilities and improving code clarity.

Changes to Existing Contract: Implementing changes to the existing contract can provide a non-breaking change solution, but care must be taken to avoid increasing the complexity of the already existing contract.

Disadvantages:

Maintenance Duplication: Opting for an approach with two facets (CustomBaseMailBox and MailBox) may lead to maintenance duplication. Every change in one facet must be manually implemented in the other facet, increasing the risk of errors.

Oracle and Token Conversion: The solution proposes introducing an Oracle in the future to adjust gas_price on Layer 2 and a mechanism for converting the base token to ETH on Layer 1. While this considers costs and stability, the implementation needs careful consideration to avoid introducing additional complexity.

Gas Price Considerations: Adjusting gas_price on Layer 2 based on the price of the base token against Ethereum requires careful consideration and management to avoid potential exploitation or instability in the network.

from era-contracts.

shahar4 avatar shahar4 commented on July 30, 2024

@thomas-nguy thanks again for this fantastic issue! I'm closing this for now and will resume the main design.

from era-contracts.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.