cic-eth-tasker: Add decimals and token name to default token api call return struct
This commit is contained in:
parent
af99ac823a
commit
235f5cede8
@ -16,4 +16,6 @@ def default_token(self):
|
|||||||
return {
|
return {
|
||||||
'symbol': self.default_token_symbol,
|
'symbol': self.default_token_symbol,
|
||||||
'address': self.default_token_address,
|
'address': self.default_token_address,
|
||||||
|
'name': self.default_token_name,
|
||||||
|
'decimals': self.default_token_decimals,
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ from chainlib.eth.connection import (
|
|||||||
from chainlib.chain import ChainSpec
|
from chainlib.chain import ChainSpec
|
||||||
from chainqueue.db.models.otx import Otx
|
from chainqueue.db.models.otx import Otx
|
||||||
from cic_eth_registry.error import UnknownContractError
|
from cic_eth_registry.error import UnknownContractError
|
||||||
|
from cic_eth_registry.erc20 import ERC20Token
|
||||||
import liveness.linux
|
import liveness.linux
|
||||||
|
|
||||||
|
|
||||||
@ -203,6 +204,11 @@ def main():
|
|||||||
|
|
||||||
BaseTask.default_token_symbol = config.get('CIC_DEFAULT_TOKEN_SYMBOL')
|
BaseTask.default_token_symbol = config.get('CIC_DEFAULT_TOKEN_SYMBOL')
|
||||||
BaseTask.default_token_address = registry.by_name(BaseTask.default_token_symbol)
|
BaseTask.default_token_address = registry.by_name(BaseTask.default_token_symbol)
|
||||||
|
default_token = ERC20Token(chain_spec, rpc, BaseTask.default_token_address)
|
||||||
|
default_token.load(rpc)
|
||||||
|
BaseTask.default_token_decimals = default_token.decimals
|
||||||
|
BaseTask.default_token_name = default_token.name
|
||||||
|
|
||||||
BaseTask.run_dir = config.get('CIC_RUN_DIR')
|
BaseTask.run_dir = config.get('CIC_RUN_DIR')
|
||||||
logg.info('default token set to {} {}'.format(BaseTask.default_token_symbol, BaseTask.default_token_address))
|
logg.info('default token set to {} {}'.format(BaseTask.default_token_symbol, BaseTask.default_token_address))
|
||||||
|
|
||||||
|
@ -67,6 +67,8 @@ def main():
|
|||||||
token_info = t.get()
|
token_info = t.get()
|
||||||
print('Default token symbol: {}'.format(token_info['symbol']))
|
print('Default token symbol: {}'.format(token_info['symbol']))
|
||||||
print('Default token address: {}'.format(token_info['address']))
|
print('Default token address: {}'.format(token_info['address']))
|
||||||
|
logg.debug('Default token name: {}'.format(token_info['name']))
|
||||||
|
logg.debug('Default token decimals: {}'.format(token_info['decimals']))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -33,6 +33,8 @@ class BaseTask(celery.Task):
|
|||||||
create_gas_oracle = RPCGasOracle
|
create_gas_oracle = RPCGasOracle
|
||||||
default_token_address = None
|
default_token_address = None
|
||||||
default_token_symbol = None
|
default_token_symbol = None
|
||||||
|
default_token_name = None
|
||||||
|
default_token_decimals = None
|
||||||
run_dir = '/run'
|
run_dir = '/run'
|
||||||
|
|
||||||
def create_session(self):
|
def create_session(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user