Skip to content

Commit

Permalink
fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Aug 21, 2024
1 parent 82ac708 commit 7c41dfa
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.provenance.explorer.domain.entities

import com.google.protobuf.Any
import cosmos.base.abci.v1beta1.Abci
import ibc.core.channel.v1.QueryOuterClass
import io.provenance.explorer.OBJECT_MAPPER
import io.provenance.explorer.config.ResourceNotFoundException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.provenance.explorer.domain.models.explorer

import cosmos.base.abci.v1beta1.Abci
import io.provenance.explorer.domain.entities.AccountRecord
import io.provenance.explorer.domain.entities.IbcAckType
import io.provenance.explorer.domain.entities.IbcChannelRecord
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,3 @@ fun ServiceOuterClass.GetTxResponse.eventsAtIndex(index: Int): List<Abci.StringE
this.txResponse.logsList[index].eventsList
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class IbcService(
"recipient" -> ledger.passThroughAddress = accountService.getAccountRaw(it.value)
}
}

"send_packet" -> v.attributesList.forEach {
when (it.key) {
"packet_data_hex" ->
Expand All @@ -113,6 +114,7 @@ class IbcService(
ledger.balanceOut = node.get("amount").asText()
}
}

"packet_data" ->
if (ledger.denom.isEmpty()) {
it.value.toObjectNode().let { node ->
Expand All @@ -124,6 +126,7 @@ class IbcService(
ledger.balanceOut = node.get("amount").asText()
}
}

"packet_sequence" -> ledger.sequence = it.value.toInt()
}
}
Expand Down Expand Up @@ -157,6 +160,7 @@ class IbcService(
ledger.balanceIn = node.get("amount").asText()
}
}

"packet_data" ->
if (ledger.toAddress.isEmpty()) {
it.value.toObjectNode().let { node ->
Expand All @@ -165,9 +169,11 @@ class IbcService(
ledger.balanceIn = node.get("amount").asText()
}
}

"packet_sequence" -> ledger.sequence = it.value.toInt()
}
}

"transfer" ->
v.attributesList.forEach {
when (it.key) {
Expand Down Expand Up @@ -212,6 +218,7 @@ class IbcService(
"packet_sequence" -> ledger.sequence = it.value.toInt()
}
}

"fungible_token_packet" -> v.attributesList.firstOrNull { it.key == "success" }
?.let {
ledger.changesEffected = true
Expand Down Expand Up @@ -248,6 +255,7 @@ class IbcService(
"packet_sequence" -> ledger.sequence = it.value.toInt()
}
}

"timeout" -> ledger.changesEffected = true
}
}
Expand Down Expand Up @@ -280,6 +288,7 @@ class IbcService(
"packet_sequence" -> ledger.sequence = it.value.toInt()
}
}

"timeout" -> ledger.changesEffected = true
}
}
Expand Down Expand Up @@ -417,6 +426,7 @@ class IbcService(
).let { it[obj.srcPortAttr]!! to it[obj.srcChannelAttr]!! }
saveIbcChannel(port, channel)
}

else -> null
}

Expand All @@ -425,6 +435,7 @@ class IbcService(
obj.msgClient != null -> obj.msgClient
obj.clientAttr != null ->
tx.mapEventAttrValues(idx, obj.event, listOf(obj.clientAttr))[obj.clientAttr]!!

else -> null
}
txUpdate.apply { this.ibcJoin.add(TxIbcRecord.buildInsert(txInfo, client, channel?.id?.value)) }
Expand All @@ -449,27 +460,33 @@ class IbcService(
val msg = any.toMsgTransfer()
parseTransfer(msg, tx.eventsAtIndex(idx))
}

any.typeUrl.endsWith("MsgIbcTransferRequest") -> {
if (!txSuccess) return@forEachIndexed
val msg = any.toMsgIbcTransferRequest()
parseTransfer(msg.transfer, tx.eventsAtIndex(idx))
}

any.typeUrl.endsWith("MsgRecvPacket") -> {
val msg = any.toMsgRecvPacket()
parseRecv(txSuccess, msg, tx.eventsAtIndex(idx))
}

any.typeUrl.endsWith("MsgAcknowledgement") -> {
val msg = any.toMsgAcknowledgement()
parseAcknowledge(txSuccess, msg, tx.eventsAtIndex(idx))
}

any.typeUrl.endsWith("MsgTimeout") -> {
val msg = any.toMsgTimeout()
parseTimeout(txSuccess, msg, tx.eventsAtIndex(idx))
}

any.typeUrl.endsWith("MsgTimeoutOnClose") -> {
val msg = any.toMsgTimeoutOnClose()
parseTimeoutOnClose(txSuccess, msg, tx.eventsAtIndex(idx))
}

else -> logger.debug("This typeUrl is not yet supported in as an ibc ledger msg: ${any.typeUrl}")
.let { return@forEachIndexed }
}
Expand All @@ -484,6 +501,7 @@ class IbcService(
"No matching IBC ledger record for channel " +
"${ledger.channel!!.srcPort}/${ledger.channel!!.srcChannel}, sequence ${ledger.sequence}"

Check failure on line 502 in service/src/main/kotlin/io/provenance/explorer/service/IbcService.kt

View workflow job for this annotation

GitHub Actions / ktlint

Unexpected indentation (40) (should be 36)
)

IbcAckType.RECEIVE ->
IbcLedgerRecord.findMatchingRecord(ledger, txInfo.txHash)?.let {
txUpdate.apply {
Expand Down Expand Up @@ -514,8 +532,10 @@ class IbcService(
)
)
}

IbcAckType.TRANSFER ->
txUpdate.apply { this.ibcLedgers.add(buildIbcLedger(ledger, txInfo, null)) }

else -> logger.debug("Invalid IBC ack type: ${ledger.ackType}").let { return@forEachIndexed }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ import io.provenance.explorer.domain.entities.AccountRecord
import io.provenance.explorer.domain.entities.BlockCacheRecord
import io.provenance.explorer.domain.entities.BlockTxRetryRecord
import io.provenance.explorer.domain.entities.FeePayer
import io.provenance.explorer.domain.entities.IbcAckType
import io.provenance.explorer.domain.entities.IbcLedgerRecord
import io.provenance.explorer.domain.entities.IbcRelayerRecord
import io.provenance.explorer.domain.entities.NameRecord
import io.provenance.explorer.domain.entities.ProcessQueueRecord
import io.provenance.explorer.domain.entities.ProcessQueueType
Expand Down Expand Up @@ -71,32 +68,23 @@ import io.provenance.explorer.grpc.extensions.getAssociatedMetadata
import io.provenance.explorer.grpc.extensions.getAssociatedMetadataEvents
import io.provenance.explorer.grpc.extensions.getAssociatedSmContractMsgs
import io.provenance.explorer.grpc.extensions.getDenomEventByEvent
import io.provenance.explorer.grpc.extensions.getIbcLedgerMsgs
import io.provenance.explorer.grpc.extensions.getMsgSubTypes
import io.provenance.explorer.grpc.extensions.getMsgType
import io.provenance.explorer.grpc.extensions.getNameEventTypes
import io.provenance.explorer.grpc.extensions.getNameMsgs
import io.provenance.explorer.grpc.extensions.getSmContractEventByEvent
import io.provenance.explorer.grpc.extensions.getTxIbcClientChannel
import io.provenance.explorer.grpc.extensions.isIbcTransferMsg
import io.provenance.explorer.grpc.extensions.isMetadataDeletionMsg
import io.provenance.explorer.grpc.extensions.isStandardAddress
import io.provenance.explorer.grpc.extensions.isValidatorAddress
import io.provenance.explorer.grpc.extensions.mapEventAttrValues
import io.provenance.explorer.grpc.extensions.mapTxEventAttrValues
import io.provenance.explorer.grpc.extensions.scrubQuotes
import io.provenance.explorer.grpc.extensions.toMsgAcknowledgement
import io.provenance.explorer.grpc.extensions.toMsgBindNameRequest
import io.provenance.explorer.grpc.extensions.toMsgDeleteNameRequest
import io.provenance.explorer.grpc.extensions.toMsgDeposit
import io.provenance.explorer.grpc.extensions.toMsgDepositOld
import io.provenance.explorer.grpc.extensions.toMsgIbcTransferRequest
import io.provenance.explorer.grpc.extensions.toMsgRecvPacket
import io.provenance.explorer.grpc.extensions.toMsgSubmitProposal
import io.provenance.explorer.grpc.extensions.toMsgSubmitProposalOld
import io.provenance.explorer.grpc.extensions.toMsgTimeout
import io.provenance.explorer.grpc.extensions.toMsgTimeoutOnClose
import io.provenance.explorer.grpc.extensions.toMsgTransfer
import io.provenance.explorer.grpc.extensions.toMsgVote
import io.provenance.explorer.grpc.extensions.toMsgVoteOld
import io.provenance.explorer.grpc.extensions.toMsgVoteWeighted
Expand Down

0 comments on commit 7c41dfa

Please sign in to comment.