YNU-724: feat(contracts-new): account for different decimals on chains#504
YNU-724: feat(contracts-new): account for different decimals on chains#504nksazonov merged 5 commits intorelease/v1.0.0from
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
📝 WalkthroughWalkthroughThis pull request introduces comprehensive token decimals support across escrow and channel management contracts via a new WadMath library for decimal-aware comparisons. The Ledger struct gains a decimals field, validation utilities are added, event signatures are extended with channelId parameters, and internal functions transition from pure to view to support Wad-based arithmetic throughout the system. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
Summary of ChangesHello @nksazonov, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the contract's ability to manage cross-chain operations by properly accounting for tokens with different decimal precisions. It introduces a standardized mathematical approach for value comparisons and transfers, ensuring that amounts are correctly interpreted and processed regardless of their native decimal representation. This change is crucial for maintaining financial accuracy and preventing potential discrepancies in a multi-chain environment. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Code Review
This pull request introduces significant improvements to handle different decimal precisions across various chains in the channel and escrow operations. The new "WadMath" library provides robust "toWad" conversion functions, and the "Ledger" struct has been updated to include a "decimals" field. The "Utils" library now includes a "validateTokenDecimals" function to ensure consistency. All relevant calculations and comparisons in "ChannelEngine", "EscrowDepositEngine", and "EscrowWithdrawalEngine" have been updated to use these decimal-aware conversions, enhancing the correctness and reliability of cross-chain interactions. Comprehensive test cases have also been added to validate this new functionality.
|
In GetEscrowWithdrawalData and GetEscrowDepositData could you please add home channel ID |
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.