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

Dispatch $AUDIO matching challenges in non-prod envs #6276

Merged
merged 3 commits into from
Oct 9, 2023
Merged
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
44 changes: 25 additions & 19 deletions discovery-provider/src/tasks/index_user_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
FETCH_TX_SIGNATURES_BATCH_SIZE,
TX_SIGNATURES_MAX_BATCHES,
TX_SIGNATURES_RESIZE_LENGTH,
USDC_DECIMALS,
)
from src.solana.solana_client_manager import SolanaClientManager
from src.solana.solana_helpers import (
Expand Down Expand Up @@ -654,25 +655,30 @@ def process_transfer_instruction(
"index_user_bank.py | Found purchase event but purchase_metadata is None"
)
return
# amount = int(
# round(balance_changes[receiver_account]["change"]) / 10**USDC_DECIMALS
# )
# challenge_event_bus.dispatch(
# ChallengeEvent.audio_matching_buyer,
# slot,
# sender_user_id,
# {"track_id": purchase_metadata["id"], "amount": amount},
# )
# challenge_event_bus.dispatch(
# ChallengeEvent.audio_matching_seller,
# slot,
# receiver_user_id,
# {
# "track_id": purchase_metadata["id"],
# "sender_user_id": sender_user_id,
# "amount": amount,
# },
# )

# TODO: Remove on launch: https://linear.app/audius/issue/PAY-1987/remove-check-to-only-disburse-dollaraudio-matching-challenges-in-non
env = shared_config["discprov"]["env"]
if env in ("stage", "dev"):
amount = int(
round(balance_changes[receiver_account]["change"])
/ 10**USDC_DECIMALS
)
challenge_event_bus.dispatch(
ChallengeEvent.audio_matching_buyer,
slot,
sender_user_id,
{"track_id": purchase_metadata["id"], "amount": amount},
)
challenge_event_bus.dispatch(
ChallengeEvent.audio_matching_seller,
slot,
receiver_user_id,
{
"track_id": purchase_metadata["id"],
"sender_user_id": sender_user_id,
"amount": amount,
},
)


class CreateTokenAccount(TypedDict):
Expand Down