fix broken aave classifier spec

This commit is contained in:
Guilherme Peyrelongue Heise 2021-08-03 16:40:35 -04:00
parent 790fbee002
commit 72569a576a
6 changed files with 9 additions and 2 deletions

1
cache/12498502-new.json vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -13,16 +13,19 @@ ABI_DIRECTORY_PATH = THIS_FILE_DIRECTORY / "abis"
def get_abi(abi_name: str, protocol: Optional[Protocol]) -> Optional[ABI]:
abi_filename = f"{abi_name}.json"
abi_path = (
ABI_DIRECTORY_PATH / abi_filename
if protocol is None
else ABI_DIRECTORY_PATH / protocol.value / abi_filename
)
#import pdb; pdb.set_trace()
if abi_path.is_file():
with abi_path.open() as abi_file:
abi_json = json.load(abi_file)
return parse_obj_as(ABI, abi_json)
import pdb; pdb.set_trace()
return None

View File

@ -101,7 +101,7 @@ ERC20_SPEC = ClassifierSpec(
AAVE_SPEC = ClassifierSpec(
abi_name="AaveLendingPool",
protocol= Protocol.aave
protocol= Protocol.aave,
classifications={
"liquidationCall(address,address,address,uint256,bool)": Classification.liquidate,
},

View File

@ -11,6 +11,7 @@ class Classification(Enum):
swap = "swap"
burn = "burn"
transfer = "transfer"
liquidate = "liquidate"
class Protocol(Enum):

View File

@ -17,9 +17,11 @@ class TraceClassifier:
self._decoders_by_abi_name: Dict[str, ABIDecoder] = {}
for spec in self._classifier_specs:
#import pdb; pdb.set_trace()
abi = get_abi(spec.abi_name, spec.protocol)
if abi is None:
import pdb; pdb.set_trace()
raise ValueError(f"No ABI found for {spec.abi_name}")
decoder = ABIDecoder(abi)