Skip to content

Commit

Permalink
Skip jupiter tx in user bank withdrawal indexing (#7527)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondjacobson authored Feb 8, 2024
1 parent ea6169a commit 97a0839
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/discovery-provider/src/solana/solana_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ def get_derived_address(base, hashed_eth_pk, spl_token_id):

# Static Memo Program ID
MEMO_PROGRAM_ID = "Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo"

# Static Jupiter Swap Program ID
JUPITER_PROGRAM_ID = "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
5 changes: 5 additions & 0 deletions packages/discovery-provider/src/tasks/index_user_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
)
from src.solana.solana_client_manager import SolanaClientManager
from src.solana.solana_helpers import (
JUPITER_PROGRAM_ID,
SPL_TOKEN_ID_PK,
get_address_pair,
get_base_address,
Expand Down Expand Up @@ -96,6 +97,8 @@
Pubkey.from_string(PAYMENT_ROUTER_ADDRESS) if PAYMENT_ROUTER_ADDRESS else None
)

JUPITER_PROGRAM_ID_PUBKEY = Pubkey.from_string(JUPITER_PROGRAM_ID)

# Transfer instructions don't have a mint acc arg but do have userbank authority.
# So re-derive the claimable token PDAs for each mint here to help us determine mint later.
WAUDIO_PDA, _ = get_base_address(WAUDIO_MINT_PUBKEY, USER_BANK_KEY)
Expand Down Expand Up @@ -679,6 +682,8 @@ def process_transfer_instruction(
# not the claimable tokens program, so we will always have a sender_user_id
if receiver_user_id is None:
transaction_type = get_transfer_type_from_memo(memos=memos)
if JUPITER_PROGRAM_ID_PUBKEY in account_keys:
transaction_type = USDCTransactionType.prepare_withdrawal

# Attempt to look up account owner, fallback to recipient address
receiver_account_owner = (
Expand Down

0 comments on commit 97a0839

Please sign in to comment.