Skip to content

Commit

Permalink
refactor variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Aug 21, 2024
1 parent 7c41dfa commit 4f036d3
Showing 1 changed file with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class IbcService(
fun buildIbcLedgerAck(ledger: LedgerInfo, txData: TxData, ledgerId: Int) =
IbcLedgerAckRecord.buildInsert(ledger, txData, ledgerId)

fun parseTransfer(msg: MsgTransfer, logs: List<Abci.StringEvent>): LedgerInfo {
val typed = logs.associateBy { it.type }
fun parseTransfer(msg: MsgTransfer, events: List<Abci.StringEvent>): LedgerInfo {
val typed = events.associateBy { it.type }
val channel = typed["send_packet"]!!.let { event ->
val port = event.attributesList.first { it.key == "packet_src_port" }.value
val channel = event.attributesList.first { it.key == "packet_src_channel" }.value
Expand Down Expand Up @@ -135,14 +135,13 @@ class IbcService(
return ledger
}

fun parseRecv(txSuccess: Boolean, msg: MsgRecvPacket, logs: List<Abci.StringEvent>): LedgerInfo {
fun parseRecv(txSuccess: Boolean, msg: MsgRecvPacket, events: List<Abci.StringEvent>): LedgerInfo {
val ledger = LedgerInfo()
// ledger.logs = logs
ledger.ackType = IbcAckType.RECEIVE
ledger.movementIn = true
if (txSuccess) {
ledger.ack = true
val typed = logs.associateBy { it.type }
val typed = events.associateBy { it.type }
ledger.channel = typed["recv_packet"]!!.let { event ->
val port = event.attributesList.first { it.key == "packet_dst_port" }.value
val channel = event.attributesList.first { it.key == "packet_dst_channel" }.value
Expand Down Expand Up @@ -199,13 +198,12 @@ class IbcService(
return ledger
}

fun parseAcknowledge(txSuccess: Boolean, msg: MsgAcknowledgement, logs: List<Abci.StringEvent>): LedgerInfo {
fun parseAcknowledge(txSuccess: Boolean, msg: MsgAcknowledgement, events: List<Abci.StringEvent>): LedgerInfo {
val ledger = LedgerInfo()
// ledger.logs = logs
ledger.ackType = IbcAckType.ACKNOWLEDGEMENT
if (txSuccess) {
ledger.ack = true
val typed = logs.associateBy { it.type }
val typed = events.associateBy { it.type }
ledger.channel = typed["acknowledge_packet"]!!.let { event ->
val port = event.attributesList.first { it.key == "packet_src_port" }.value
val channel = event.attributesList.first { it.key == "packet_src_channel" }.value
Expand Down Expand Up @@ -236,13 +234,12 @@ class IbcService(
return ledger
}

fun parseTimeout(txSuccess: Boolean, msg: MsgTimeout, logs: List<Abci.StringEvent>): LedgerInfo {
fun parseTimeout(txSuccess: Boolean, msg: MsgTimeout, events: List<Abci.StringEvent>): LedgerInfo {
val ledger = LedgerInfo()
// ledger.logs = logs
ledger.ackType = IbcAckType.TIMEOUT
if (txSuccess) {
ledger.ack = true
val typed = logs.associateBy { it.type }
val typed = events.associateBy { it.type }
ledger.channel = typed["timeout_packet"]!!.let { event ->
val port = event.attributesList.first { it.key == "packet_src_port" }.value
val channel = event.attributesList.first { it.key == "packet_src_channel" }.value
Expand All @@ -269,13 +266,12 @@ class IbcService(
return ledger
}

fun parseTimeoutOnClose(txSuccess: Boolean, msg: MsgTimeoutOnClose, logs: List<Abci.StringEvent>): LedgerInfo {
fun parseTimeoutOnClose(txSuccess: Boolean, msg: MsgTimeoutOnClose, events: List<Abci.StringEvent>): LedgerInfo {
val ledger = LedgerInfo()
// ledger.logs = logs
ledger.ackType = IbcAckType.TIMEOUT
if (txSuccess) {
ledger.ack = true
val typed = logs.associateBy { it.type }
val typed = events.associateBy { it.type }
ledger.channel = typed["timeout_packet"]!!.let { event ->
val port = event.attributesList.first { it.key == "packet_src_port" }.value
val channel = event.attributesList.first { it.key == "packet_src_channel" }.value
Expand Down

0 comments on commit 4f036d3

Please sign in to comment.