Skip to content

Commit

Permalink
Allow staking income to be negative
Browse files Browse the repository at this point in the history
  • Loading branch information
eprbell committed Jun 7, 2024
1 parent 53ff552 commit 80b58cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/rp2/in_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ def __init__(

self.__exchange: str = configuration.type_check_exchange("exchange", exchange)
self.__holder: str = configuration.type_check_holder("holder", holder)
self.__crypto_in: RP2Decimal = configuration.type_check_positive_decimal("crypto_in", crypto_in, non_zero=True)
self.__crypto_in: RP2Decimal
if self.transaction_type == TransactionType.STAKING:
# Staking income can be negative: in certain cases the protocol can remove from the stash rather than
# add to it (e.g. if the node stays offline too long).
self.__crypto_in = configuration.type_check_decimal("crypto_in", crypto_in)
else:
self.__crypto_in = configuration.type_check_positive_decimal("crypto_in", crypto_in, non_zero=True)
self.__crypto_fee: RP2Decimal = configuration.type_check_positive_decimal("crypto_fee", crypto_fee) if crypto_fee else ZERO
self.__fiat_fee: RP2Decimal = configuration.type_check_positive_decimal("fiat_fee", fiat_fee) if fiat_fee else ZERO

Expand Down

0 comments on commit 80b58cb

Please sign in to comment.