Conversation
WalkthroughA new method for converting a Changes
Sequence Diagram(s)sequenceDiagram
participant JS/TS
participant Rust Float
participant Solidity Contract
JS/TS->>Rust Float: to_fixed_decimal_js(decimals)
Rust Float->>Rust Float: to_fixed_decimal(decimals)
Rust Float->>Solidity Contract: toFixedDecimalLosslessCall(Float, decimals)
Solidity Contract-->>Rust Float: U256 fixed decimal value
Rust Float-->>JS/TS: String(fixed decimal)
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🧰 Additional context used🧠 Learnings (5)📓 Common learningssrc/concrete/DecimalFloat.sol (4)test_js/float.test.ts (7)crates/float/src/js_api.rs (4)crates/float/src/lib.rs (9)🧬 Code Graph Analysis (1)crates/float/src/lib.rs (1)
🪛 Biome (1.9.4)test_js/float.test.ts[error] 32-32: Forbidden non-null assertion. (lint/style/noNonNullAssertion) [error] 33-33: Forbidden non-null assertion. (lint/style/noNonNullAssertion) [error] 39-39: Forbidden non-null assertion. (lint/style/noNonNullAssertion) [error] 40-40: Forbidden non-null assertion. (lint/style/noNonNullAssertion) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (6)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Motivation
We need to be able to convert floats into U256 so that when a user clicks "Max" in the withdrawal flow the amount gets displayed correctly in the form
Solution
Expose
toFixedDecimalfor use in the js libChecks
By submitting this for review, I'm confirming I've done the following:
Summary by CodeRabbit
New Features
Tests