Skip to content

Commit aa0c7f7

Browse files
authored
change job dependency and fix dataclass init (HemeraProtocol#163)
1 parent 73ccacf commit aa0c7f7

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

indexer/modules/custom/deposit_to_l2/deposit_to_l2_job.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from common.utils.cache_utils import BlockToLiveDict, TimeToLiveDict
1111
from common.utils.exception_control import FastShutdownError
12-
from indexer.domain.block import Block
12+
from indexer.domain.transaction import Transaction
1313
from indexer.jobs import FilterTransactionDataJob
1414
from indexer.modules.custom.deposit_to_l2.deposit_parser import parse_deposit_transaction_function, token_parse_mapping
1515
from indexer.modules.custom.deposit_to_l2.domain.address_token_deposit import AddressTokenDeposit
@@ -21,7 +21,7 @@
2121

2222

2323
class DepositToL2Job(FilterTransactionDataJob):
24-
dependency_types = [Block]
24+
dependency_types = [Transaction]
2525
output_types = [TokenDepositTransaction, AddressTokenDeposit]
2626
able_to_reorg = True
2727

@@ -86,7 +86,11 @@ def _process(self, **kwargs):
8686
transactions = list(
8787
filter(
8888
self._filter.get_or_specification().is_satisfied_by,
89-
[transaction for block in self._data_buff[Block.type()] for transaction in block.transactions],
89+
[
90+
transaction
91+
for transaction in self._data_buff[Transaction.type()]
92+
if transaction.receipt and transaction.receipt.status != 0
93+
],
9094
)
9195
)
9296
deposit_tokens = parse_deposit_transaction_function(
@@ -162,13 +166,13 @@ def check_history_deposit_from_db(
162166

163167
deposit = (
164168
AddressTokenDeposit(
165-
wallet_address=history_deposit.wallet_address,
169+
wallet_address="0x" + history_deposit.wallet_address.hex(),
166170
chain_id=history_deposit.chain_id,
167-
contract_address=history_deposit.contract_address,
168-
token_address=history_deposit.token_address,
169-
value=history_deposit.value,
171+
contract_address="0x" + history_deposit.contract_address.hex(),
172+
token_address="0x" + history_deposit.token_address.hex(),
173+
value=int(history_deposit.value),
170174
block_number=history_deposit.block_number,
171-
block_timestamp=history_deposit.block_timestamp,
175+
block_timestamp=int(round(history_deposit.block_timestamp.timestamp())),
172176
)
173177
if history_deposit
174178
else None

0 commit comments

Comments
 (0)