Skip to content

Commit

Permalink
Wrap fav currency for ClaimItems
Browse files Browse the repository at this point in the history
  • Loading branch information
ipdae committed Oct 15, 2024
1 parent 9cdfed4 commit 0c59515
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
20 changes: 18 additions & 2 deletions tests/raid_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,14 @@ def test_get_claim_items_plain_value(memo: str):
"ticker": "RUNESTONE_FENRIR1",
},
},
{
"recipient": "0x2531e5e06cBD11aF54f98D39578990716fFC7dBa",
"amount": {
"quantity": 100,
"decimalPlaces": 0,
"ticker": "Item_NT_500000",
},
},
]
plain_value: ActionPlainValue = get_claim_items_plain_value(recipients, memo)
assert plain_value["type_id"] == "claim_items"
Expand All @@ -481,15 +489,23 @@ def test_get_claim_items_plain_value(memo: str):
{
"decimalPlaces": b"\x12",
"minters": None,
"ticker": "CRYSTAL",
"ticker": "FAV__CRYSTAL",
},
10000000000000000000,
],
[
{
"decimalPlaces": b"\x00",
"minters": None,
"ticker": "RUNESTONE_FENRIR1",
"ticker": "FAV__RUNESTONE_FENRIR1",
},
100,
],
[
{
"decimalPlaces": b"\x00",
"minters": None,
"ticker": "Item_NT_500000",
},
100,
],
Expand Down
6 changes: 5 additions & 1 deletion world_boss/app/raid.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,12 +514,16 @@ def get_claim_items_plain_value(
amount = r["amount"]
decimal_places = amount["decimalPlaces"]
address = bytes.fromhex(r["recipient"].replace("0x", ""))
ticker: str = amount["ticker"]
# wrapp fav currency
if not ticker.startswith("Item"):
ticker = f"FAV__{ticker}"
claim_data_dict[address].append(
[
{
"decimalPlaces": decimal_places.to_bytes(1, "big"),
"minters": None,
"ticker": amount["ticker"],
"ticker": ticker,
},
amount["quantity"] * 10**decimal_places,
],
Expand Down

0 comments on commit 0c59515

Please sign in to comment.