def contract(self, tester_chain): deployer = Deployer() abi, bytecode, contract_name = deployer.compile_contract( 'RootChain/RootChain.sol') address = tester_chain.chain.tx(sender=tester_chain.k0, to=b'', startgas=(4 * 10**6), value=0, data=utils.decode_hex(bytecode)) tester_chain.chain.mine() return tester_chain.ABIContract(tester_chain.chain, abi, address)
def get_child_chain(): authority = plasma_config['AUTHORITY'] root_chain = Deployer().get_contract('RootChain/RootChain.sol') return ChildChain(authority, root_chain)
def get_root_chain(self): if self._root_chain is None: self._root_chain = Deployer().get_contract('RootChain/RootChain.sol') return self._root_chain
def __init__(self, root_chain=Deployer().get_contract('RootChain/RootChain.sol'), child_chain=ChildChainService('http://localhost:8546')): self.root_chain = root_chain self.child_chain = child_chain
def deploy_contracts(): Deployer().deploy_contract('RootChain/RootChain.sol')
from plasma_cash.root_chain.deployer import Deployer from ethereum import utils import time last_block = 1 plasma_latest_block = 0 last_submit_block = 0 f = open('config.json', 'r') config = json.load(f) f.close() operator_key = config['op_Key'] authority = utils.privtoaddr(operator_key) authority_address = w3.toChecksumAddress('0x' + authority.hex()) root_chain = Deployer().get_contract('RootChain/RootChain.sol') twothirds = 1 class Block(object): def __init__(self, blkRoot, blkNum, isDepositBlock, depositTx, depositTxProof): self.blkRoot = blkRoot self.blkNum = blkNum self.isDepositBlock = isDepositBlock self.depositTx = depositTx self.depositTxProof = depositTxProof self.signature = set() def add_signature(self, signature):
def get_child_chain(self): if self._child_chain is None: authority = plasma_config['AUTHORITY'] root_chain = Deployer().get_contract('RootChain/RootChain.sol') self._child_chain = ChildChain(authority, root_chain) return self._child_chain