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

Skip jupiter tx in user bank withdrawal indexing #7527

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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