In the validator, I have defined:
txInfo :: TxInfo
txInfo = scriptContextTxInfo ctx
feePaid :: Integer
feePaid = Ada.getLovelace (Ada.fromValue (txInfoFee txInfo))
the strange thing is, when I do:
traceIfFalse "fee test" (feePaid >= 0)
, it evaluates to True, but
traceIfFalse "fee test" (feePaid == 0)
and
traceIfFalse "fee test" (feePaid > 0)
evaluates to False! How is this possible? Am I doing something wrong?
The very same thing happens when using Plutus.V1.Ledger.Contexts functions.
For example valueProduced (of ADA, using valueOf, so getting Integer) - valueSpent (same, Integer) equates to true if using >= or <= operator, but is neither >, < or ==.
Evaluating using Emulator Trace.
valueProduced, valueSpent example:
test :: TxInfo -> Order -> Integer
test info ord = subtractInteger (valueOf (valueProduced info) (quoteAssetSymbol ord) (quoteAssetName ord)) (valueOf (valueSpent info) (quoteAssetSymbol ord) (quoteAssetName ord))
Order has quoteAssetSymbol which is of type CurrencySymbol and is ADA (""), quoteAssetSymbol is of type TokenName, and is also ADA ("").
Tried using greaterThanEqualsInteger, equalsInteger, etc.. Same result