Skip to content

Commit

Permalink
Fix recipient address to avatar for claim_items data
Browse files Browse the repository at this point in the history
  • Loading branch information
ipdae committed Oct 23, 2024
1 parent 8524a2b commit ddb919f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 13 additions & 0 deletions tests/raid_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
get_transfer_assets_plain_value,
get_tx_delay_factor,
list_tx_nonce,
row_to_recipient,
update_agent_address,
write_ranking_rewards_csv,
write_tx_result_csv,
Expand Down Expand Up @@ -604,3 +605,15 @@ def test_get_prepare_reward_assets_plain_value(fx_session):
23890,
],
]


@pytest.mark.parametrize("ticker", ["CRYSTAL", "Item_NT_500000", "RUNESTONE_FENRIR1"])
def test_row_to_recipient(ticker: str):
content = f"3,25,0x01069aaf336e6aEE605a8A54D0734b43B62f8Fe4,5b65f5D0e23383FA18d74A62FbEa383c7D11F29d,150000,{ticker},18,175"
row = content.split(",")
recipient: Recipient = row_to_recipient(row)
assert recipient["recipient"] == "5b65f5D0e23383FA18d74A62FbEa383c7D11F29d"
amount = recipient["amount"]
assert amount["quantity"] == 150000
assert amount["decimalPlaces"] == 18
assert amount["ticker"] == ticker
4 changes: 1 addition & 3 deletions world_boss/app/raid.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,12 @@ def write_ranking_rewards_csv(


def row_to_recipient(row: RecipientRow) -> Recipient:
agent_address = row[2]
avatar_address = row[3]
amount = int(row[4])
ticker = row[5]
decimal_places = int(row[6])
recipient = agent_address if ticker == "CRYSTAL" else avatar_address
return {
"recipient": recipient,
"recipient": avatar_address,
"amount": {
"quantity": amount,
"decimalPlaces": decimal_places,
Expand Down

0 comments on commit ddb919f

Please sign in to comment.