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

ClaimItems 형식에 맞춰 recipient 주소를 아바타 주소로 고정처리 #64

Merged
merged 2 commits into from
Oct 25, 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
17 changes: 16 additions & 1 deletion 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 @@ -412,7 +413,9 @@ def test_bulk_insert_transactions(fx_session):
"memo",
)

assert len(fx_session.query(Transaction).first().amounts) == 7
tx = fx_session.query(Transaction).first()
assert len(tx.amounts) == 7
assert tx.tx_result is None

world_boss_rewards = fx_session.query(WorldBossReward)
for i, world_boss_reward in enumerate(world_boss_rewards):
Expand Down Expand Up @@ -604,3 +607,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
5 changes: 1 addition & 4 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 Expand Up @@ -449,7 +447,6 @@ def bulk_insert_transactions(
"nonce": n,
"signer": signer_address,
"payload": signed_transaction.hex(),
"tx_result": "CREATED",
}
)
tx_ids[n] = tx_id
Expand Down
Loading