latest changes
This commit is contained in:
parent
3464a81a2d
commit
ea5010fc4e
7
app.py
7
app.py
@ -1,11 +1,15 @@
|
|||||||
from flask import Flask, render_template, jsonify
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from flask import Flask, jsonify
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def hello_world():
|
def hello_world():
|
||||||
return 'Hello, World!'
|
return 'Hello, World!'
|
||||||
|
|
||||||
|
|
||||||
@app.route('/getmarkerlist')
|
@app.route('/getmarkerlist')
|
||||||
def marker_list():
|
def marker_list():
|
||||||
dblist = os.listdir("databases/")
|
dblist = os.listdir("databases/")
|
||||||
@ -15,4 +19,5 @@ def marker_list():
|
|||||||
|
|
||||||
return jsonify(dbdict)
|
return jsonify(dbdict)
|
||||||
|
|
||||||
|
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
|
|||||||
19
models.py
19
models.py
@ -1,11 +1,12 @@
|
|||||||
|
from sqlalchemy import Column, Integer, Float, String
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy import Column, Integer, Float, String, ForeignKey
|
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
ContractBase = declarative_base()
|
ContractBase = declarative_base()
|
||||||
SystemBase = declarative_base()
|
SystemBase = declarative_base()
|
||||||
LatestCacheBase = declarative_base()
|
LatestCacheBase = declarative_base()
|
||||||
|
|
||||||
|
|
||||||
class ActiveTable(Base):
|
class ActiveTable(Base):
|
||||||
__tablename__ = "activeTable"
|
__tablename__ = "activeTable"
|
||||||
|
|
||||||
@ -54,6 +55,8 @@ class TransactionHistory(Base):
|
|||||||
transactionHash = Column('transactionHash', String)
|
transactionHash = Column('transactionHash', String)
|
||||||
blockchainReference = Column('blockchainReference', String)
|
blockchainReference = Column('blockchainReference', String)
|
||||||
jsonData = Column('jsonData', String)
|
jsonData = Column('jsonData', String)
|
||||||
|
transactionType = Column('transactionType', String)
|
||||||
|
parsedFloData = Column('parsedFloData', String)
|
||||||
|
|
||||||
|
|
||||||
class TokenContractAssociation(Base):
|
class TokenContractAssociation(Base):
|
||||||
@ -69,7 +72,8 @@ class TokenContractAssociation(Base):
|
|||||||
transactionHash = Column('transactionHash', String)
|
transactionHash = Column('transactionHash', String)
|
||||||
blockchainReference = Column('blockchainReference', String)
|
blockchainReference = Column('blockchainReference', String)
|
||||||
jsonData = Column('jsonData', String)
|
jsonData = Column('jsonData', String)
|
||||||
|
transactionType = Column('transactionType', String)
|
||||||
|
parsedFloData = Column('parsedFloData', String)
|
||||||
|
|
||||||
|
|
||||||
class ContractStructure(ContractBase):
|
class ContractStructure(ContractBase):
|
||||||
@ -109,6 +113,7 @@ class ContractTransactionHistory(ContractBase):
|
|||||||
transactionHash = Column('transactionHash', String)
|
transactionHash = Column('transactionHash', String)
|
||||||
blockchainReference = Column('blockchainReference', String)
|
blockchainReference = Column('blockchainReference', String)
|
||||||
jsonData = Column('jsonData', String)
|
jsonData = Column('jsonData', String)
|
||||||
|
parsedFloData = Column('parsedFloData', String)
|
||||||
|
|
||||||
|
|
||||||
class RejectedContractTransactionHistory(SystemBase):
|
class RejectedContractTransactionHistory(SystemBase):
|
||||||
@ -129,6 +134,8 @@ class RejectedContractTransactionHistory(SystemBase):
|
|||||||
blockchainReference = Column('blockchainReference', String)
|
blockchainReference = Column('blockchainReference', String)
|
||||||
jsonData = Column('jsonData', String)
|
jsonData = Column('jsonData', String)
|
||||||
rejectComment = Column('rejectComment', String)
|
rejectComment = Column('rejectComment', String)
|
||||||
|
parsedFloData = Column('parsedFloData', String)
|
||||||
|
|
||||||
|
|
||||||
class RejectedTransactionHistory(SystemBase):
|
class RejectedTransactionHistory(SystemBase):
|
||||||
__tablename__ = "rejectedTransactionHistory"
|
__tablename__ = "rejectedTransactionHistory"
|
||||||
@ -145,6 +152,8 @@ class RejectedTransactionHistory(SystemBase):
|
|||||||
blockchainReference = Column('blockchainReference', String)
|
blockchainReference = Column('blockchainReference', String)
|
||||||
jsonData = Column('jsonData', String)
|
jsonData = Column('jsonData', String)
|
||||||
rejectComment = Column('rejectComment', String)
|
rejectComment = Column('rejectComment', String)
|
||||||
|
transactionType = Column('transactionType', String)
|
||||||
|
parsedFloData = Column('parsedFloData', String)
|
||||||
|
|
||||||
|
|
||||||
class ActiveContracts(SystemBase):
|
class ActiveContracts(SystemBase):
|
||||||
@ -171,6 +180,7 @@ class SystemData(SystemBase):
|
|||||||
attribute = Column('attribute', String)
|
attribute = Column('attribute', String)
|
||||||
value = Column('value', String)
|
value = Column('value', String)
|
||||||
|
|
||||||
|
|
||||||
class ContractAddressMapping(SystemBase):
|
class ContractAddressMapping(SystemBase):
|
||||||
__tablename__ = "contractAddressMapping"
|
__tablename__ = "contractAddressMapping"
|
||||||
|
|
||||||
@ -184,6 +194,7 @@ class ContractAddressMapping(SystemBase):
|
|||||||
blockNumber = Column('blockNumber', Integer)
|
blockNumber = Column('blockNumber', Integer)
|
||||||
blockHash = Column('blockHash', String)
|
blockHash = Column('blockHash', String)
|
||||||
|
|
||||||
|
|
||||||
class TokenAddressMapping(SystemBase):
|
class TokenAddressMapping(SystemBase):
|
||||||
__tablename__ = "tokenAddressMapping"
|
__tablename__ = "tokenAddressMapping"
|
||||||
|
|
||||||
@ -194,6 +205,7 @@ class TokenAddressMapping(SystemBase):
|
|||||||
blockNumber = Column('blockNumber', Integer)
|
blockNumber = Column('blockNumber', Integer)
|
||||||
blockHash = Column('blockHash', String)
|
blockHash = Column('blockHash', String)
|
||||||
|
|
||||||
|
|
||||||
class LatestTransactions(LatestCacheBase):
|
class LatestTransactions(LatestCacheBase):
|
||||||
__tablename__ = "latestTransactions"
|
__tablename__ = "latestTransactions"
|
||||||
id = Column('id', Integer, primary_key=True)
|
id = Column('id', Integer, primary_key=True)
|
||||||
@ -203,11 +215,10 @@ class LatestTransactions(LatestCacheBase):
|
|||||||
transactionType = Column('transactionType', String)
|
transactionType = Column('transactionType', String)
|
||||||
parsedFloData = Column('parsedFloData', String)
|
parsedFloData = Column('parsedFloData', String)
|
||||||
|
|
||||||
|
|
||||||
class LatestBlocks(LatestCacheBase):
|
class LatestBlocks(LatestCacheBase):
|
||||||
__tablename__ = "latestBlocks"
|
__tablename__ = "latestBlocks"
|
||||||
id = Column('id', Integer, primary_key=True)
|
id = Column('id', Integer, primary_key=True)
|
||||||
blockNumber = Column('blockNumber', String)
|
blockNumber = Column('blockNumber', String)
|
||||||
blockHash = Column('blockHash', String)
|
blockHash = Column('blockHash', String)
|
||||||
jsonData = Column('jsonData', String)
|
jsonData = Column('jsonData', String)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
19
parsing.py
19
parsing.py
@ -1,6 +1,7 @@
|
|||||||
import re
|
|
||||||
import arrow
|
|
||||||
import configparser
|
import configparser
|
||||||
|
import re
|
||||||
|
|
||||||
|
import arrow
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read('config.ini')
|
config.read('config.ini')
|
||||||
@ -194,11 +195,13 @@ def extractContractConditions(text, contracttype, marker, blocktime):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
expirytime_split = expirytime.split(' ')
|
expirytime_split = expirytime.split(' ')
|
||||||
parse_string = '{}/{}/{} {}'.format(expirytime_split[3], months[expirytime_split[1]], expirytime_split[2], expirytime_split[4])
|
parse_string = '{}/{}/{} {}'.format(expirytime_split[3], months[expirytime_split[1]],
|
||||||
|
expirytime_split[2], expirytime_split[4])
|
||||||
expirytime_object = arrow.get(parse_string, 'YYYY/M/D HH:mm:ss').replace(tzinfo=expirytime_split[5])
|
expirytime_object = arrow.get(parse_string, 'YYYY/M/D HH:mm:ss').replace(tzinfo=expirytime_split[5])
|
||||||
blocktime_object = arrow.get(blocktime)
|
blocktime_object = arrow.get(blocktime)
|
||||||
if expirytime_object < blocktime_object:
|
if expirytime_object < blocktime_object:
|
||||||
print('Expirytime of the contract is earlier than the block it is incorporated in. This incorporation will be rejected ')
|
print(
|
||||||
|
'Expirytime of the contract is earlier than the block it is incorporated in. This incorporation will be rejected ')
|
||||||
return None
|
return None
|
||||||
extractedRules['expiryTime'] = expirytime
|
extractedRules['expiryTime'] = expirytime
|
||||||
except:
|
except:
|
||||||
@ -245,7 +248,6 @@ def extractContractConditions(text, contracttype, marker, blocktime):
|
|||||||
payeeAddress = searchResult.split(marker)[0]
|
payeeAddress = searchResult.split(marker)[0]
|
||||||
extractedRules['payeeAddress'] = payeeAddress
|
extractedRules['payeeAddress'] = payeeAddress
|
||||||
|
|
||||||
|
|
||||||
if len(extractedRules) > 1 and 'expiryTime' in extractedRules:
|
if len(extractedRules) > 1 and 'expiryTime' in extractedRules:
|
||||||
return extractedRules
|
return extractedRules
|
||||||
else:
|
else:
|
||||||
@ -263,7 +265,6 @@ def extractTriggerCondition(text):
|
|||||||
|
|
||||||
# Combine test
|
# Combine test
|
||||||
def parse_flodata(string, blockinfo, netvariable):
|
def parse_flodata(string, blockinfo, netvariable):
|
||||||
|
|
||||||
# todo Rule 20 - remove 'text:' from the start of flodata if it exists
|
# todo Rule 20 - remove 'text:' from the start of flodata if it exists
|
||||||
if string[0:5] == 'text:':
|
if string[0:5] == 'text:':
|
||||||
string = string.split('text:')[1]
|
string = string.split('text:')[1]
|
||||||
@ -336,7 +337,8 @@ def parse_flodata(string, blockinfo, netvariable):
|
|||||||
elif incorporation and not transfer:
|
elif incorporation and not transfer:
|
||||||
contracttype = extractContractType(cleanstring)
|
contracttype = extractContractType(cleanstring)
|
||||||
contractaddress = extractAddress(nospacestring)
|
contractaddress = extractAddress(nospacestring)
|
||||||
contractconditions = extractContractConditions(cleanstring, contracttype, marker=hashList[0][:-1], blocktime=blockinfo['time'])
|
contractconditions = extractContractConditions(cleanstring, contracttype, marker=hashList[0][:-1],
|
||||||
|
blocktime=blockinfo['time'])
|
||||||
|
|
||||||
if config['DEFAULT']['NET'] == 'mainnet' and blockinfo['height'] < 3454510:
|
if config['DEFAULT']['NET'] == 'mainnet' and blockinfo['height'] < 3454510:
|
||||||
if None not in [contracttype, contractconditions]:
|
if None not in [contracttype, contractconditions]:
|
||||||
@ -378,7 +380,8 @@ def parse_flodata(string, blockinfo, netvariable):
|
|||||||
# todo Rule 37 - Extract the trigger condition given by the committee. If its missing, reject
|
# todo Rule 37 - Extract the trigger condition given by the committee. If its missing, reject
|
||||||
triggerCondition = extractTriggerCondition(cleanstring)
|
triggerCondition = extractTriggerCondition(cleanstring)
|
||||||
if triggerCondition is not None:
|
if triggerCondition is not None:
|
||||||
parsed_data = {'type': 'smartContractPays', 'contractName': atList[0][:-1], 'triggerCondition': triggerCondition.group().strip()[1:-1]}
|
parsed_data = {'type': 'smartContractPays', 'contractName': atList[0][:-1],
|
||||||
|
'triggerCondition': triggerCondition.group().strip()[1:-1]}
|
||||||
else:
|
else:
|
||||||
parsed_data = {'type': 'noise'}
|
parsed_data = {'type': 'noise'}
|
||||||
else:
|
else:
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user