Skip to content

Unexpected SOLO Sellback After XRP Purchase on XRPL DEX #52

@therealcryptrillionaire456

Description

I am experiencing an issue where every time I use my script to purchase SOLO with XRP on the XRPL DEX, my order appears to execute correctly, but then immediately sells the SOLO back for XRP—often at a loss. This issue persists even though I have ensured that my trust line is set correctly and I have sufficient XRP balance.

Expected Behavior:

  • The script should successfully buy SOLO using XRP.
  • SOLO should be credited to my account without an immediate sellback.

Actual Behavior:

  • The script places an order to buy SOLO with XRP.
  • The transaction appears to succeed with a tesSUCCESS status.
  • However, instead of retaining the SOLO, my account ends up selling it back.
  • This results in an unexpected loop where SOLO is not retained, and repeated transactions lead to fee losses.

Steps to Reproduce:

  1. Trust Line Verification:

    • I have set up a trust line for SOLO with the issuer rsoLo2S1kiGeCcn6hCUXVrCpGMWLrRrLZz.
    • account_lines confirms my trust line is active with balance: 0 and limit: 100000.
  2. Buying SOLO with XRP:

    • I submit an OfferCreate transaction to buy SOLO with XRP.
    • The transaction details include:
      {
        "TransactionType": "OfferCreate",
        "Account": "rB5grw3ZcWyLgBZsk4yiWBDxEHFGaQLYtP",
        "TakerPays": "3000000",  // 3 XRP
        "TakerGets": {
          "currency": "534F4C4F00000000000000000000000000000000",
          "issuer": "rsoLo2S1kiGeCcn6hCUXVrCpGMWLrRrLZz",
          "value": "19.8"  // Expecting to receive 19.8 SOLO
        },
        "Flags": 524288, // tfSell
        "Fee": "12"
      }
    • The transaction succeeds and returns a valid transaction hash.
  3. Unexpected SOLO Sellback:

    • Shortly after, another OfferCreate transaction appears to be executed, selling the acquired SOLO back for XRP.
    • This results in loss due to unfavorable price shifts and fees.

Debugging Steps Taken: ✔️ Trust Line Set Correctly: Verified using account_lines API. ✔️ Sufficient XRP Balance: Checked before transaction execution. ✔️ Correct Order Book Prices: Extracted from book_offers API before placing an order. ✔️ Flags Adjustments: Used tfSell, tfImmediateOrCancel, and tfFillOrKill to test behavior. ✔️ Checked Open Orders: Verified no conflicting open orders before execution.

Transaction Hashes for Reference:

  1. Buy SOLO: 0641A7D78A083442BF6F2F0FBEC73B3708C656B825E18BFA0C9E4B63A48266DA
  2. Unexpected Sellback: 93385492FF26AB275C6E7487CAC5282328CA25FACB84C8EE4C2C3A3DB0BE55DF

Questions for XRPL Team:

  1. Why does an automatic SOLO sellback occur after buying with XRP?
  2. Does the trust line need to be funded before SOLO can be acquired via OfferCreate?
  3. Could there be a ledger behavior causing the order book logic to misinterpret the buy order as a sell order?
  4. Are there any recommended transaction flags that could prevent this behavior?
  5. Is there a specific sequence required when setting the trust line and placing orders?
  • XRPL Client: xrpl.js
  • Node.js Version: v20.15.1
  • XRPL Network: Mainnet

I appreciate any guidance on resolving this issue as I am working on an arbitrage trading bot and need to ensure reliable behavior for DEX transactions.

Thank you for your assistance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions