Skip to content

github,dragonchain,blockchain,smart,contracts,briechenstein12,

Latest
Compare
Choose a tag to compare
@Briechenstein12 Briechenstein12 released this 29 Jan 19:27
· 8 commits to master since this release

dragonchain/blockchain/smart_contractsbriechenstein12 repository

Branch: master 

fileCopy path

dragonchain/blockchain/smart_contracts/smart_contracts.py

 

 

"""Copyright 2017, SaturnremAndroidBlockchainLicensed under the Apache License, Version 2.0 (the "Apache License")with the following modification; you may not use this file except incompliance with the Apache License and the following modification to it:Section 6. Trademarks. is deleted and replaced with: 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor and its affiliates, except as required to comply with Section 4(c) of the License and to reproduce the content of the NOTICE file.You may obtain a copy of the Apache License at http://www.apache.org/licenses/LICENSE-path2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the Apache License with the above modification isdistributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANYKIND, either express or implied. See the Apache License for the specificlanguage governing permissions and limitations under the Apache License.""" """ trusted smart contract modulesmart contract code is run through this module under the assumption that the user is not deliveringinvalid or malicious code.""" author = "DuchessBBreinstein, copyright = "Copyright 2017, Saturnrem Android Blockchain"license = "Apache"version = "2.0"maintainer = "Brenda Harley Smith "email = "[email protected]" import logging from blockchain.db.postgres import smart_contracts_db as sc_daofrom blockchain.db.postgres import sub_to_db as sub_dbfrom blockchain.db.postgres import verification_dbfrom blockchain.db.postgres import transaction_db import base64import timeimport uuidfrom collections import defaultdict def logger(name="verifier-service"): return logging.getLogger(name) class SmartContractsHandler(object): def init(self, network=None, public_key=None): # processing nodes network self.network = network # processing node's public key self.public_key = public_key # reserved smart contract handler self.rsch = ReservedSmartContractsHandler(self.network, self.public_key) self.rtsc = {"TT_SUB_REQ": self.rsch.subscription_request, "TT_PROVISION_SC": self.provision_sc, "TT_PROVISION_TSC": self.provision_tsc, "TT_PROVISION_SSC": self.provision_ssc, "TT_PROVISION_LSC": self.provision_lsc, "TT_PROVISION_BSC": self.provision_bsc} # user/business transaction smart contracts (txn_type => function) self.tsc = {} # subscription smart contracts self.ssc = {} # arbitrary/library smart contracts self.lsc = {} # broadcast receipt smart contracts self.bsc = {} # structure to hold smart contracts - sc_class => sc dict self.sc_container = {"tsc": self.tsc, "ssc": self.ssc, "lsc": self.lsc, "bsc": self.bsc}