Skip to content

feat: route test and try_from_tagged_swap_context#41

Draft
Arrowana wants to merge 2 commits intoblueshift-gg:masterfrom
Arrowana:feat/route-test-and-design-change-met-dlmm
Draft

feat: route test and try_from_tagged_swap_context#41
Arrowana wants to merge 2 commits intoblueshift-gg:masterfrom
Arrowana:feat/route-test-and-design-change-met-dlmm

Conversation

@Arrowana
Copy link
Copy Markdown
Contributor

@Arrowana Arrowana commented Mar 27, 2026

Summary

It is insufficient to drive swapping with program id since:
A. a program might have a new swap instruction, which requires different accounts and data see any major protocol Meteora DLMM, Orca Whirlpool...
B. One single program can ship with multiple "swap" ixs (swap, deposit, withdraw...), example Jupiter perps, at which point there is a sort of tangle between data and accounts.
try_from_swap_context does not have access to data.

To support backward compatibility at runtime between clients and programs then those need to be addressed

Another solution is not to tag the exact desired swap and encapsulate that into the data which we would pass to the swap context, however this seems tricky for A. there will be ambiguity should a protocol ever change, as a result we just pay 1 byte to ensure uniform behaviour and future proofing every single swap.

As a result we use SwapProtocolTag to match the swap.

Changes

  • Add route which executes a linear route, sequential swaps of the initial amount, this exhibits the essential need to have a trait for in/out token accounts
  • Add Meteora DLMM since i thought there was no variable accounts swaps but turns out there is, this can be removed if necessary.

Testing

  • make format
  • make clippy
  • make test
  • make test-upstream (if relevant)

Protocol integration checklist (if applicable)

  • Feature flag added and used for all protocol code
  • Action context enums updated
  • Detection logic updated
  • Account parsing validates count and types
  • Tests added or updated

@ChiefWoods
Copy link
Copy Markdown
Contributor

The protocol tag makes sense, would solve the same problem with Damm V2 swaps

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.

2 participants