mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-20 14:39:22 +00:00
fix(core/nem): fix NEM usage of format_amount
[no changelog]
This commit is contained in:
parent
85ba7c12ba
commit
b6837d19b7
@ -45,7 +45,7 @@ async def ask_transfer_mosaic(
|
||||
return
|
||||
|
||||
definition = get_mosaic_definition(mosaic.namespace, mosaic.mosaic, common.network)
|
||||
mosaic_quantity = mosaic.quantity * transfer.amount / NEM_MOSAIC_AMOUNT_DIVISOR
|
||||
mosaic_quantity = mosaic.quantity * transfer.amount // NEM_MOSAIC_AMOUNT_DIVISOR
|
||||
|
||||
if definition:
|
||||
await confirm_properties(
|
||||
@ -103,7 +103,7 @@ def _get_xem_amount(transfer: NEMTransfer):
|
||||
# otherwise xem amount is taken from the nem xem mosaic if present
|
||||
for mosaic in transfer.mosaics:
|
||||
if is_nem_xem_mosaic(mosaic.namespace, mosaic.mosaic):
|
||||
return mosaic.quantity * transfer.amount / NEM_MOSAIC_AMOUNT_DIVISOR
|
||||
return mosaic.quantity * transfer.amount // NEM_MOSAIC_AMOUNT_DIVISOR
|
||||
# if there are mosaics but do not include xem, 0 xem is sent
|
||||
return 0
|
||||
|
||||
@ -116,7 +116,7 @@ def _get_levy_msg(mosaic_definition, quantity: int, network: int) -> str:
|
||||
levy_fee = mosaic_definition["fee"]
|
||||
else:
|
||||
levy_fee = (
|
||||
quantity * mosaic_definition["fee"] / NEM_LEVY_PERCENTILE_DIVISOR_ABSOLUTE
|
||||
quantity * mosaic_definition["fee"] // NEM_LEVY_PERCENTILE_DIVISOR_ABSOLUTE
|
||||
)
|
||||
return (
|
||||
format_amount(levy_fee, levy_definition["divisibility"])
|
||||
|
@ -456,9 +456,9 @@
|
||||
"test_msg_nem_signtx_transfers.py-test_nem_signtx_encrypted_payload": "a62817329e675c9648a3834bf5feb5fea40b5f65aaeeadb115b8f0b55804d245",
|
||||
"test_msg_nem_signtx_transfers.py-test_nem_signtx_known_mosaic": "61b7a05c0d52483b9e12fe7df81aef46535c89d119f9a11f9d54d224a5be5d2c",
|
||||
"test_msg_nem_signtx_transfers.py-test_nem_signtx_known_mosaic_with_levy": "fa0fa195b557a27472a1879079faa72a13054f2e0efc8f6e9a3f0daba7384fc2",
|
||||
"test_msg_nem_signtx_transfers.py-test_nem_signtx_multiple_mosaics": "0be2153a526d7b8266a09da50feb4eeab117255bd3c34f6cfc906c063e2e3b10",
|
||||
"test_msg_nem_signtx_transfers.py-test_nem_signtx_multiple_mosaics": "a1f3ad6744443336ef2c6b42d27a1f06d6d173a50f39d4eda3b8d5cf57becd83",
|
||||
"test_msg_nem_signtx_transfers.py-test_nem_signtx_simple": "921869434cb375480391bd2e2dd7031975084f0f1e6c57e69f3ab87f24e86d5a",
|
||||
"test_msg_nem_signtx_transfers.py-test_nem_signtx_unknown_mosaic": "09e1972ee120c6651c48db56a65e6696eba0178acab6f67384fc5b05a545679e",
|
||||
"test_msg_nem_signtx_transfers.py-test_nem_signtx_unknown_mosaic": "4e1b2be8902129d890f43cb2332cd87c5c017cf0f70f3497886d79a6879e4340",
|
||||
"test_msg_nem_signtx_transfers.py-test_nem_signtx_xem_as_mosaic": "58c8390a6bae376e7cb0469c976cc55725111c208f3e7b8dddf4352a3ad88263",
|
||||
"test_msg_ping.py::test_ping": "5551c263e8e09c8ae683f4dec3dd9d7ecc05ebbd3f2556604b27479c8f1fbc82",
|
||||
"test_msg_recoverydevice_bip39_dryrun.py::test_bad_parameters[label-test]": "c09de07fbbf1e047442180e2facb5482d06a1a428891b875b7dd93c9e4704ae1",
|
||||
|
Loading…
Reference in New Issue
Block a user