Skip to content

Commit

Permalink
fix failure based fees
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Nov 8, 2023
1 parent b3d4962 commit 3f25d9c
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,24 @@ fun Abci.TxResponse.getFailureTotalBaseFee(msgFeeClient: MsgFeeGrpcClient, heigh
this.eventsList
.firstOrNull { it.type == "tx" && it.attributesList.map { attr -> attr.key.toStringUtf8() }.contains("min_fee_charged") }
?.attributesList?.first { it.key.toStringUtf8() == "min_fee_charged" }
?.value?.toStringUtf8()?.denomAmountToPair()?.first?.toBigDecimal()
?.value?.toStringUtf8()?.denomAmountToPair()?.first?.let {
try {
it.toBigDecimal()
} catch (e: NumberFormatException) {
return BigDecimal.ZERO
}
}
?: (
this.eventsList
.firstOrNull { it.type == "coin_spent" && it.attributesList.map { attr -> attr.key.toStringUtf8() }.contains("amount") }
?.attributesList?.first { it.key.toStringUtf8() == "amount" }
?.value?.toStringUtf8()?.denomAmountToPair()?.first?.toBigDecimal()
?.value?.toStringUtf8()?.denomAmountToPair()?.first?.let {
try {
it.toBigDecimal()
} catch (e: NumberFormatException) {
return BigDecimal.ZERO
}
}
?: (
sigErrorComboList.firstOrNull { it == Pair(this.codespace, this.code) }?.let { BigDecimal.ZERO }
?: (
Expand Down

0 comments on commit 3f25d9c

Please sign in to comment.