Merge branch 'lash/decimals-in-api' into 'master'
cic-eth-tasker: Add decimals and token name to default token api call return struct Closes cic-eth#123 See merge request grassrootseconomics/cic-internal-integration!148
This commit is contained in:
commit
9dfbd7034c
@ -16,4 +16,6 @@ def default_token(self):
|
||||
return {
|
||||
'symbol': self.default_token_symbol,
|
||||
'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 chainqueue.db.models.otx import Otx
|
||||
from cic_eth_registry.error import UnknownContractError
|
||||
from cic_eth_registry.erc20 import ERC20Token
|
||||
import liveness.linux
|
||||
|
||||
|
||||
@ -207,6 +208,11 @@ def main():
|
||||
|
||||
BaseTask.default_token_symbol = config.get('CIC_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')
|
||||
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()
|
||||
print('Default token symbol: {}'.format(token_info['symbol']))
|
||||
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__':
|
||||
|
@ -33,6 +33,8 @@ class BaseTask(celery.Task):
|
||||
create_gas_oracle = RPCGasOracle
|
||||
default_token_address = None
|
||||
default_token_symbol = None
|
||||
default_token_name = None
|
||||
default_token_decimals = None
|
||||
run_dir = '/run'
|
||||
|
||||
def create_session(self):
|
||||
|
Loading…
Reference in New Issue
Block a user