Skip to content

Commit

Permalink
juno stars: fixed handling of restake transactions for rpc data source
Browse files Browse the repository at this point in the history
  • Loading branch information
hodgerpodger committed Feb 16, 2023
1 parent a827e0e commit 2a27937
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
28 changes: 28 additions & 0 deletions src/staketaxcsv/common/ibc/handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,34 @@ def handle_exec(exporter, txinfo, msginfo):
txinfo.fee = ""
txinfo.fee_currency = ""

if _is_exec_rpc_data(msginfo):
_handle_exec_rpc_data(exporter, txinfo, msginfo)
else:
_handle_exec_lcd_data(exporter, txinfo, msginfo)


def _is_exec_rpc_data(msginfo):
message = msginfo.message

if (
msginfo.msg_type == co.MSG_TYPE_EXEC and
message.get("@type", None) == "/cosmos.authz.v1beta1.MsgExec" and
message.get("module", None) == "staking"
):
return True
else:
return False


def _handle_exec_rpc_data(exporter, txinfo, msginfo):
transfers_in, transfers_out = msginfo.transfers
if len(transfers_in) == 0:
pass
else:
handle_staking(exporter, txinfo, msginfo)


def _handle_exec_lcd_data(exporter, txinfo, msginfo):
msg_types = set(map(lambda x: x["@type"].split(".")[-1], msginfo.message["msgs"]))

# execs can have multiple messages, but the most common are to delegate and withdraw
Expand Down
3 changes: 1 addition & 2 deletions src/staketaxcsv/common/ibc/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ def handle_message(exporter, txinfo, msginfo, debug=False):
handle.handle_exec(exporter, txinfo, msginfo)
return True


if msg_type in [co.MSG_TYPE_VOTE, co.MSG_TYPE_SET_WITHDRAW_ADDRESS]:
elif msg_type in [co.MSG_TYPE_VOTE, co.MSG_TYPE_SET_WITHDRAW_ADDRESS]:
# simple transactions with no transfers
handle.handle_simple(exporter, txinfo, msginfo)
elif msg_type in [co.MSG_TYPE_SUBMIT_PROPOSAL, co.MSG_TYPE_DEPOSIT]:
Expand Down
2 changes: 1 addition & 1 deletion src/staketaxcsv/stars/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def process_tx(wallet_address, elem, exporter):
if result:
continue

if msginfo.msg_type == 'MsgInitialClaim':
if msginfo.msg_type in ('MsgInitialClaim', "initial_claim"):
result_airdrop = handle_airdrop(exporter, txinfo, msginfo)
if result_airdrop:
continue
Expand Down

0 comments on commit 2a27937

Please sign in to comment.