def test_no_tx(self): my_contract = ethdata.Contract( "0x1cB424cB77B19143825004d0bd0a4BEE2c5e91A8") my_contract.query_range = {"start": "2019-01-01", "end": "2019-01-01"} # no transactions for this contract assert len(my_contract.transaction_receipts) == 0 assert len(my_contract.event_logs) == 0
def test_tx(self): my_contract = ethdata.Contract( "0x1f52b87C3503e537853e160adBF7E330eA0Be7C4") my_contract.query_range = {"start": "2019-01-29", "end": "2019-01-29"} # On this date, there were 14 normal tx and 2 internal tx assert len(my_contract.transaction_receipts) > 0 assert len(my_contract.event_logs) > 0
def test_getter_5_invalid_contract(self): my_contract = ethdata.Contract( "0x1cB424cB77B19143825004d0bd0a4BEE2c5e91A8") assert len(my_contract.abi) == 0 with pytest.warns(UserWarning): assert my_contract.creation_date == "1970-01-01" my_contract.query_range = {"start": "2019-01-01", "end": "2019-01-01"} assert len(my_contract.transaction_receipts) == 0 assert len(my_contract.event_logs) == 0
def test_getter_4_valid_contract_internal_deploy_no_abi(self): my_contract = ethdata.Contract( "0x85b530d1fe5c67696a8858c3b08379e5a5204a96") assert len(my_contract.abi) == 0 assert len(my_contract.functions) == 0 assert len(my_contract.events) == 0 assert my_contract.creation_date == "2018-10-27" my_contract.query_range = {"start": "2018-11-15", "end": "2018-11-15"} # In this range, there was 1 normal tx and 1 internal tx assert len(my_contract.transaction_receipts) == 1 # In this range, there were 2 events assert len(my_contract.event_logs) == 2
def test_getter_3_valid_contract_normal_deploy_with_abi(self): my_contract = ethdata.Contract( "0x1f52b87C3503e537853e160adBF7E330eA0Be7C4") assert len(my_contract.abi) == 22 assert len(my_contract.functions) == 14 assert len(my_contract.events) == 6 assert my_contract.creation_date == "2018-01-08" my_contract.query_range = {"start": "2019-01-28", "end": "2019-01-29"} # In this range, there were 2 normal tx and 1 internal tx assert len(my_contract.transaction_receipts) == 2 # In this range, there were 2 events assert len(my_contract.event_logs) == 2
def test_getter_9_anon_event(self): my_contract = ethdata.Contract( "0x448a5065aebb8e423f0896e6c5d525c040f59af3") my_contract.query_range = {"start": "2018-11-06", "end": "2018-11-06"} assert len(my_contract.event_logs) == 800