Example #1
0
def data(web3, Data, constants, user0):
    _priv, owner = user0
    deploy_txn = Data.deploy()
    deploy_receipt = wait_for_transaction_receipt(web3, deploy_txn)
    assert deploy_receipt is not None
    _contract = Data(address=deploy_receipt['contractAddress'])
    concise_contract = ConciseContract(_contract)
    assert owner == concise_contract.owner()
    return concise_contract
Example #2
0
def mp3(web3, Mp3, user0):
    _priv, owner = user0
    deploy_txn = Mp3.deploy()
    deploy_receipt = wait_for_transaction_receipt(web3, deploy_txn)
    assert deploy_receipt is not None
    _contract = Mp3(address=deploy_receipt['contractAddress'])
    concise_contract = ConciseContract(_contract)
    assert owner == concise_contract.owner()
    return concise_contract
Example #3
0
def crowdsale(web3, Crowdsale, user0, user2):
    _priv, owner = user0
    _priv, crowdsale_wallet = user2
    deploy_txn = Crowdsale.deploy(args=[crowdsale_wallet])
    deploy_receipt = wait_for_transaction_receipt(web3, deploy_txn)
    assert deploy_receipt is not None
    _contract = Crowdsale(address=deploy_receipt['contractAddress'])
    concise_contract = ConciseContract(_contract)
    assert owner == concise_contract.owner()
    return concise_contract
Example #4
0
# Instantiate and deploy contract
RPS = w3.eth.contract(abi=abi, bytecode=bytecode)
txHash = RPS.constructor().transact()

# receipt = t.get_transaction_receipt(txHash)
tx_receipt = w3.eth.waitForTransactionReceipt(txHash)

rpsAddress = tx_receipt.contractAddress

# Instantiate contract
rps = w3.eth.contract(address=rpsAddress, abi=abi)
pprint("contract address: " + str(rps.address))

# Use concise contract for easier reading
rps = ConciseContract(rps)
assert rps.owner() == accounts[0]

# --------------First game------------------
# Rock = 0, Paper = 1, Scissors = 2
# Evaluation: 1 = win, 2 = draw, 3 = loss  (from perspective of player 1)


class Player(object):
    """docstring for Player."""
    def __init__(self, arg):
        super(Player, self).__init__()
        self.arg = arg


class Game(object):
    """docstring for Game."""