Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
8e7fa64
add aave_v2 lending
Lifowyy Sep 13, 2024
6a207bd
aave stash
will0x0909 Oct 22, 2024
a00869b
aavev2 stash
will0x0909 Oct 22, 2024
1194496
aavev2 stash
will0x0909 Oct 23, 2024
cf3c955
reserve create
will0x0909 Oct 23, 2024
8c363f9
reserve create
will0x0909 Oct 23, 2024
0a2f03d
reserve create
will0x0909 Oct 23, 2024
26910ac
stash
will0x0909 Oct 23, 2024
b5e9bd7
stash
will0x0909 Oct 23, 2024
9ec7121
stash
will0x0909 Oct 23, 2024
47bf8d8
stash
will0x0909 Oct 23, 2024
2b9d777
todo testing
will0x0909 Oct 24, 2024
86ff5f9
todo testing
will0x0909 Oct 24, 2024
7458459
todo testing
will0x0909 Oct 24, 2024
e4926e0
todo testing
will0x0909 Oct 24, 2024
d3eb646
todo testing
will0x0909 Oct 24, 2024
21189e9
todo testing
will0x0909 Oct 24, 2024
555df21
todo testing
will0x0909 Oct 24, 2024
fa61a3c
todo testing
will0x0909 Oct 24, 2024
0f58376
almost
will0x0909 Oct 24, 2024
684a5ff
almost
will0x0909 Oct 24, 2024
79e16f2
bugfix
will0x0909 Oct 24, 2024
5d78e55
bugfix
will0x0909 Oct 24, 2024
8e36cf8
bugfix
will0x0909 Oct 24, 2024
5069eff
adding rpc call logic
will0x0909 Oct 24, 2024
1039b7f
delete
will0x0909 Oct 25, 2024
bffe377
stash
will0x0909 Oct 25, 2024
ecf1cc9
stash
will0x0909 Oct 25, 2024
c925f2d
stash
will0x0909 Oct 25, 2024
71b6969
todo debugging
will0x0909 Oct 25, 2024
45a05ea
todo debugging
will0x0909 Oct 25, 2024
f1fde22
todo debugging
will0x0909 Oct 25, 2024
ab424d8
a runnable version.but data...
will0x0909 Oct 25, 2024
ed5bfa6
done!
will0x0909 Oct 27, 2024
05cc9a8
done!
will0x0909 Oct 27, 2024
c316bcd
done!
will0x0909 Oct 27, 2024
bd41dae
done!
will0x0909 Oct 27, 2024
74b835f
bugfixed
will0x0909 Oct 28, 2024
13de17e
adding v1 pool
will0x0909 Oct 28, 2024
7b003a5
done
will0x0909 Oct 28, 2024
c343acb
ignore asset
will0x0909 Oct 28, 2024
90602a2
bugfix
will0x0909 Oct 28, 2024
3b306ed
bugfix
will0x0909 Oct 28, 2024
2207d11
bugfix
will0x0909 Oct 28, 2024
d5ee613
fixing
will0x0909 Oct 28, 2024
819bb62
bugfix
will0x0909 Oct 29, 2024
8645ce6
bugfix
will0x0909 Oct 29, 2024
1e1dbe0
bugfix
will0x0909 Oct 29, 2024
aa2ca17
bugfix
will0x0909 Oct 29, 2024
87f4735
bugfix
will0x0909 Oct 29, 2024
35693fb
bugfix
will0x0909 Oct 29, 2024
07684cb
bugfix
will0x0909 Oct 29, 2024
8cdd4ac
bugfix
will0x0909 Oct 29, 2024
0bb74e1
bugfix
will0x0909 Oct 29, 2024
d61aa7d
stash
will0x0909 Oct 29, 2024
952ac91
done?
will0x0909 Oct 29, 2024
9ddde7a
format code
will0x0909 Oct 29, 2024
cbbb816
format code
will0x0909 Oct 29, 2024
ab051cd
all done!
will0x0909 Oct 29, 2024
751aed2
V1 and V2 are different things
will0x0909 Oct 30, 2024
af29011
multicall adjusted🌩
will0x0909 Oct 30, 2024
5a7f42c
done
will0x0909 Oct 30, 2024
de09c13
done
will0x0909 Oct 30, 2024
77181c3
done
will0x0909 Oct 30, 2024
904e200
done
will0x0909 Oct 30, 2024
2a5b613
done
will0x0909 Oct 30, 2024
909dccd
withdraw bug fixed
will0x0909 Oct 31, 2024
2071161
aave v1 stash
will0x0909 Oct 30, 2024
08ab796
stash
will0x0909 Oct 31, 2024
256bd73
stash
will0x0909 Oct 31, 2024
f62ef18
stash aave v1
will0x0909 Nov 11, 2024
d131759
aave v1 finish
will0x0909 Nov 12, 2024
2528fa4
rebase 1.0
will0x0909 Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ sync_record
alembic.ini
!indexer/modules/custom/hemera_ens/abi/*.json
!indexer/modules/custom/cyber_id/abi/*.json
!indexer/modules/custom/aave_v2/abi/*.json

36 changes: 28 additions & 8 deletions cli/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ def wrapper(*args, **kwargs):
help="End block",
envvar="END_BLOCK",
)
@click.option(
"-nb",
"--noncontinuous-blocks",
default=None,
show_default=True,
type=str,
help="a list of noncontinuous blocks. eg: 1,11,122",
envvar="",
)
@click.option(
"--retry-from-record",
default=True,
Expand Down Expand Up @@ -343,6 +352,7 @@ def stream(
db_version,
start_block,
end_block,
noncontinuous_blocks,
entity_types,
output_types,
source_types,
Expand Down Expand Up @@ -467,11 +477,21 @@ def stream(
process_size=process_size,
process_time_out=process_time_out,
)

controller.action(
start_block=start_block,
end_block=end_block,
block_batch_size=block_batch_size,
period_seconds=period_seconds,
pid_file=pid_file,
)
if noncontinuous_blocks:
block_ids = sorted(set(map(int, noncontinuous_blocks.split(","))))
for block_id in block_ids:
controller.action(
start_block=block_id,
end_block=block_id,
block_batch_size=block_batch_size,
period_seconds=period_seconds,
pid_file=pid_file,
)
else:
controller.action(
start_block=start_block,
end_block=end_block,
block_batch_size=block_batch_size,
period_seconds=period_seconds,
pid_file=pid_file,
)
77 changes: 77 additions & 0 deletions common/utils/abi_code_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
Author : xuzh
Project : hemera_indexer
"""
import json
import logging
import os
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union, cast

import eth_abi
Expand Down Expand Up @@ -63,6 +66,9 @@ def get_abi(self) -> ABIEvent:
"""
return self._event_abi

def get_name(self) -> str:
return self.get_abi().get("name")

def get_signature(self) -> str:
"""
Returns the signature of the event.
Expand Down Expand Up @@ -100,6 +106,77 @@ def decode_log_ignore_indexed(self, log) -> Optional[Dict[str, Any]]:
return decode_log_ignore_indexed(self._event_abi, log)


class AbiReader:
"""A class to read ABI (Application Binary Interface) files.

This class handles reading ABI files from a specified directory and provides
methods to access event ABIs and entire contract ABIs.

Attributes:
call_path (str): The path from where the class is being called
relative_path (str): Relative path to the ABI directory
abi_map (Dict[str, list]): Mapping of contract addresses to their ABIs
"""

def __init__(self, call_path: str, relative_path: str = "abi") -> None:
"""Initialize the AbiReader with paths and load ABIs.

Args:
call_path: Path from where the class is being called
relative_path: Relative path to the ABI directory

Raises:
FileNotFoundError: If the ABI directory doesn't exist
"""
self.call_path = Path(call_path)
self.relative_path = relative_path
self.abi_map = self._read_abi()

def _get_absolute_path(self) -> Path:
current_dir = self.call_path.parent
return current_dir / self.relative_path

def _read_abi(self) -> Dict[str, list]:
abi_map = {}
abs_path = self._get_absolute_path()

if not abs_path.exists():
raise FileNotFoundError(f"ABI directory not found: {abs_path}")

try:
for file_path in abs_path.glob("*.json"):
try:
abi_data = json.loads(file_path.read_text())
address = abi_data["address"].lower()
abi = abi_data["abi"]
if not isinstance(abi, list):
continue
abi_map[address] = abi
except json.JSONDecodeError:
print(f"Invalid JSON in file: {file_path}")
except KeyError as e:
print(f"Missing required field {e} in file: {file_path}")

except Exception as e:
print(f"Error reading ABI files: {e}")
raise

return abi_map

def get_event_abi(self, address: str, event_name: str) -> Optional[Dict[str, Any]]:
address = address.lower()
if address not in self.abi_map:
print(f"No ABI found for address: {address}")
return None
return next(
(abi for abi in self.abi_map[address] if abi.get("type") == "event" and abi.get("name") == event_name), None
)

def get_entire_abi(self, address: str) -> Optional[list]:
address = address.lower()
return self.abi_map.get(address)


def decode_log_ignore_indexed(
fn_abi: ABIEvent,
log,
Expand Down
10 changes: 10 additions & 0 deletions config/indexer-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,13 @@ eigen_layer_job:
address: "0x858646372cc42e1a627fce94aa7a7033e7cf075a"
DELEGATION:
address: "0x39053d51b77dc0d36036fc1fcc8cb819df8ef37a"

export_aave_v2_job:
POOL_CONFIGURE: "0x311bb771e4f8952e6da169b425e7e92d6ac45756"
POOL_V2: "0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9"

export_aave_v1_job:
POOL_V1: "0x398ec7346dcd622edc5ae82352f02be94c62d119"
POOL_V1_CORE: "0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3"
INIT_PROXY: "0x4965f6fa20fe9728decf5165016fc338a5a85abf"
POOL: "0x7937d4799803fbbe595ed57278bc4ca21f3bffcb"
30 changes: 30 additions & 0 deletions enumeration/entity_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
from indexer.domain.token_transfer import ERC20TokenTransfer, ERC721TokenTransfer, ERC1155TokenTransfer
from indexer.domain.trace import Trace
from indexer.domain.transaction import Transaction
from indexer.modules.custom.aave_v1.domains.aave_v1_domain import (
AaveV1AddressCurrentD,
AaveV1BorrowD,
AaveV1CallRecordsD,
AaveV1DepositD,
AaveV1FlashLoanD,
AaveV1LiquidationAddressCurrentD,
AaveV1LiquidationCallD,
AaveV1RepayD,
AaveV1ReserveD,
AaveV1ReserveDataCurrentD,
AaveV1ReserveDataD,
AaveV1WithdrawD,
)
from indexer.modules.custom.address_index.domain import *
from indexer.modules.custom.address_index.domain.address_contract_operation import AddressContractOperation
from indexer.modules.custom.address_index.domain.address_internal_transaction import AddressInternalTransaction
Expand Down Expand Up @@ -77,6 +91,8 @@ class EntityType(IntFlag):

KARAK = 1 << 11

AAVEV1 = 1 << 12

EIGEN_LAYER = 1 << 13

UNISWAP_V2 = 1 << 14
Expand Down Expand Up @@ -213,3 +229,17 @@ def generate_output_types(entity_types):
yield UniswapV2SwapEvent
yield UniswapV2Erc20TotalSupply
yield UniswapV2Erc20CurrentTotalSupply

if entity_types & EntityType.AAVEV1:
yield AaveV1AddressCurrentD
yield AaveV1BorrowD
yield AaveV1CallRecordsD
yield AaveV1DepositD
yield AaveV1FlashLoanD
yield AaveV1LiquidationAddressCurrentD
yield AaveV1LiquidationCallD
yield AaveV1RepayD
yield AaveV1ReserveD
yield AaveV1WithdrawD
yield AaveV1ReserveDataD
yield AaveV1ReserveDataCurrentD
2 changes: 1 addition & 1 deletion indexer/controller/stream_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
sync_recorder: BaseRecorder,
job_scheduler: JobScheduler,
limit_reader: LimitReader,
max_retries=5,
max_retries=1,
retry_from_record=False,
delay=0,
process_numbers=1,
Expand Down
2 changes: 2 additions & 0 deletions indexer/modules/custom/aave_v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"""The Aave protocol v1 was released in January 2020 and eventually superseded by Aave protocol v2 in December on the same year
"""
Loading