second-state/smart-contract-search-engine

Update harvest.py to process config.ini abi for DApp versioning

tpmccallum opened this issue · 1 comments

Create new code to parse the key of each abi
When given the following ...

[abis]
fairplay_v1 = https://raw.githubusercontent.com/CyberMiles/smart_contracts/master/FairPlay/v1/dapp/FairPlay.abi

The harvest.py will know that the index name is "fairplay" and that the version to be stored is "v1"

def harvestFull():
    harvester = Harvest()
    for (outerKey, outerValue) in harvester.abis.items():
        print("%s:" % outerKey)
        indexName = outerKey.split('_')[0]
        version = outerKey.split('_')[1]
        print("Processing index %s" % indexName)
        print("Version %s" % version)
        jsonObject = json.loads(outerValue['json'])
        harvester.harvest(indexName, version, jsonObject)
def harvest(self, _esIndex, _version, _contractAbiJSONData,  _stop=False):
outerData['dappVersion'] = _version