cmd/loop: add max swap fee flags for static in#1114
cmd/loop: add max swap fee flags for static in#1114starius merged 3 commits intolightninglabs:masterfrom
Conversation
Summary of ChangesHello, 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 introduces fee control mechanisms for static address loop-ins. By allowing users to specify maximum swap fees in either absolute satoshis or parts-per-million (PPM), it provides a safer way to manage swap costs without needing manual quote-then-retry workflows. The changes include new CLI flags, robust resolution logic for these caps, and comprehensive unit tests to ensure correct behavior under various scenarios. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces fee capping for static address loop-ins by adding --max_swap_fee_sat and --max_swap_fee_ppm CLI flags. It includes a new utility for resolving the effective fee cap and validating it against server quotes. Feedback focuses on improving the idiomatic use of the math/big package and optimizing the allocation of big integer constants.
Add resolveMaxSwapFee helper that computes an effective maximum swap fee from --max_swap_fee_sat and --max_swap_fee_ppm CLI flags. When both are set the tighter (lower) cap wins. The helper also rejects early if the server-quoted fee already exceeds the resolved cap.
Add --max_swap_fee_sat and --max_swap_fee_ppm flags to `loop static in`. When set, the resolved cap is checked against the current quote before confirmation and sent in MaxSwapFeeSatoshis instead of the quoted fee, giving scripts a budget ceiling without the quote-then-retry workaround.
hieblmi
left a comment
There was a problem hiding this comment.
Nice PR, LGTM!
I also checked that there are no further discrepancies between existing RPC fields and exposure in the cli.
Add
--max_swap_fee_satand--max_swap_fee_ppmflags toloop static in. When set, the resolved cap is checked against the current quote before confirmation and sent inMaxSwapFeeSatoshisinstead of the quoted fee, giving scripts a budget ceiling without the quote-then-retry workaround.Fix #1113
Pull Request Checklist
release_notes.mdif your PR contains major features, breaking changes or bugfixes