Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add AMMClawback support #1127

Merged
merged 4 commits into from
Feb 20, 2025
Merged

feat: add AMMClawback support #1127

merged 4 commits into from
Feb 20, 2025

Conversation

pdp2121
Copy link
Collaborator

@pdp2121 pdp2121 commented Feb 12, 2025

High Level Overview of Change

Add AMMClawback transaction.
Spec: https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0073-amm-clawback

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Translation Updates
  • Release

Before / After

Simple page (without tfClawTwoAssets Flag)

Screenshot 2025-02-19 at 2 00 06 PM

Simple page (with tfClawTwoAssets Flag)

Screenshot 2025-02-19 at 2 00 35 PM

TableDetail (without tfClawTwoAssets Flag)

Screenshot 2025-02-19 at 2 01 53 PM

TableDetail (with tfClawTwoAssets Flag)

Screenshot 2025-02-19 at 2 01 40 PM

<span className="label">{t('claws_back')}</span>
<Amount value={amount} displayIssuer />
and
<Amount value={amount2} displayIssuer />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if the flag tfClawTwoAssets is enabled, only one IOU is sent back to the issuer. The other asset in the pair is sent back to the holder account.

The difference occurs in the behavior of AMMWithdraw transaction -- both the assets are proportionally withdrawn instead of a single-asset withdrawal.

Is it possible to indicate this in the wording of the explorer?

Asset1 is clawed_back and sent to the Issuer1 whereas Asset2 is transferred back to the Holder

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Will fix this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ckeshava, based on the description on xrpl.org for the tfClawTwoAssets:
Claw back the specified amount of Asset, and a corresponding amount of Asset2 based on the AMM pool's asset proportion; both assets must be issued by the issuer in the Account field. If this flag isn't enabled, the issuer claws back the specified amount of Asset, while a corresponding proportion of Asset2 goes back to the Holder.
I think both asset would be clawed back to the issuer with the flag enabled, otherwise there's no need for the condition that the second asset has to be issued by the issuer as well. I think my initial wording is correct here

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exact behavior depends on whether the second asset was issued by the Issuer. I don't remember the initial wording in your PR. We can use the language from the official documentation verbatim.

describe('AMMClawback: Simple', () => {
it('renders without tfClawTwoAssets flag, only one asset should be clawed back', () => {
const wrapper = createWrapper(mockAMMClawbackNoFlag)
expectSimpleRowText(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to understand the difference between this file andsrc/containers/shared/components/Transaction/AMMClawback/test/AMMClawbackTableDetail.test.tsx. Both of them are testing the three different possibilities for the AMMClawback transaction. How are they different?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TableDetail vs Simple

"expected_date": null
"expected_date": null,
"transaction_type_name_AMMClawback": null,
"action_from_and": null

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use a more informative name for this variable? what does this indicate action_from_and ? Could it be translate_amm_clawback_txn ?

Copy link
Collaborator Author

@pdp2121 pdp2121 Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is generic on purpose so others can re-use this pattern for any other purposes (if you look at other translation variables you will see the same pattern)

@@ -557,5 +557,7 @@
"search_results_banner": null,
"enable_amendment_name": null,
"amendment_status": null,
"expected_date": null
"expected_date": null,
"transaction_type_name_AMMClawback": null,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go up where the other transaction types are.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto with the others

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put these at the bottom for other translators to find easily but sure I can put it back to the group

@pdp2121
Copy link
Collaborator Author

pdp2121 commented Feb 14, 2025

I have addressed the comments. Ready for re-reviewing

@pdp2121 pdp2121 requested review from mvadari and ckeshava February 14, 2025 19:57
@pdp2121 pdp2121 force-pushed the amm-clawback-support branch from f834017 to 512d873 Compare February 19, 2025 18:57
@pdp2121 pdp2121 requested a review from ckeshava February 19, 2025 19:03
@ckeshava
Copy link

ckeshava commented Feb 19, 2025

Is the version field inside package.json updated with newer releases?

@pdp2121 pdp2121 merged commit baaf892 into staging Feb 20, 2025
4 checks passed
@pdp2121 pdp2121 deleted the amm-clawback-support branch February 20, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants