def update(self): logger = self.get_logger() try: api = Tokens( contract_address=TETHER_CONTRACT_ADDRESS, api_key=s.ETHERSCAN_API_KEY, ) Tether( total_supply_eth=int(api.get_total_supply()) / 10 ** 6, num_holders_eth=_get_tether_num_holders(), ).save() except Exception as error: logger.error("tether error: {}".format(str(error))) self.update_state(state=states.FAILURE, meta=str(error)) raise Ignore()
def test_get_token_supply(): api = Tokens(contract_address=CONTRACT_ADDRESS, api_key=(API_KEY)) assert (api.get_total_supply() == ELCOIN_TOKEN_SUPPLY)
def test_get_token_supply(self): api = Tokens(contract_address=CONTRACT_ADDRESS, api_key=(API_KEY)) self.assertEqual(api.get_total_supply(), ELCOIN_TOKEN_SUPPLY)
from etherscan.tokens import Tokens import json with open('../../api_key.json', mode='r') as key_file: key = json.loads(key_file.read())['key'] # tokenname options are: # DGD # MKR # TheDAO api = Tokens(tokenname='SNT', api_key=key) supply = api.get_total_supply() print(supply)
def test_get_token_supply(): api = Tokens(tokenname=TOKEN_NAME, api_key=(API_KEY)) assert (api.get_total_supply() == DGD_TOKEN_SUPPLY)