Beispiel #1
0
def init():
    """
    compile all contracts and deploy common contracts
    """

    app.logger.warn("clean databases")
    db.drop_all()
    db.create_all()

    app.logger.warn("compile all contracts")
    compile_and_abis(is_compile=True)

    for c_name in UniqueContractsList:
        addr = deploy_contract(c_name)
        c = Contracts(name=c_name, addr=addr)
        db.session.add(c)
        db.session.commit()

    EngineerListAddr = Contracts.query.filter(
        Contracts.name == "EngineerList").first().addr
    CreditAddr = Contracts.query.filter(
        Contracts.name == "Credit").first().addr

    call_contract(EngineerListAddr,
                  "EngineerList",
                  "setCreditContractAddr",
                  args=[to_checksum_address(CreditAddr)])

    if debug:
        init_accounts()