Added accepting_token, selling_token info for token swap as part of smart contract info

This commit is contained in:
Vivek Teega 2023-04-22 17:44:29 +00:00
parent 0c4b624073
commit d17112523d

View File

@ -18,6 +18,7 @@ import atexit
import pyflo import pyflo
from operator import itemgetter from operator import itemgetter
import pdb import pdb
import ast
app = Quart(__name__) app = Quart(__name__)
@ -107,9 +108,11 @@ def smartcontract_morph_helper(smart_contracts):
contractDict['contractAddress'] = contract[2] contractDict['contractAddress'] = contract[2]
contractDict['status'] = contract[3] contractDict['status'] = contract[3]
contractDict['contractType'] = contract[5] contractDict['contractType'] = contract[5]
if contractDict['contractType'] == 'continuous-event': if contractDict['contractType'] in ['continuous-event', 'continuos-event']:
contractDict['contractSubType'] = 'tokenswap' contractDict['contractSubType'] = 'tokenswap'
accepting_selling_tokens = contract[4] accepting_selling_tokens = ast.literal_eval(contract[4])
contractDict['acceptingToken'] = accepting_selling_tokens[0]
contractDict['sellingToken'] = accepting_selling_tokens[1]
elif contractDict['contractType'] == 'one-time-event': elif contractDict['contractType'] == 'one-time-event':
contractDict['tokenIdentification'] = contract[4] contractDict['tokenIdentification'] = contract[4]
# pull the contract structure # pull the contract structure