示例#1
0
文件: run.py 项目: btc2nxt/p2pWorld
def run(ctx):
    ctx.create_js_file(
        substitutions={
            "foundation_abi": ctx.foundation_abi,
            "foundation_bin": ctx.foundation_bin,
            "max_delegate_number": ctx.args.deploy_max_delegate_number,
            "debating_days": ctx.args.deploy_debating_days
        }
    )
    output = ctx.run_script('deploy.js')
    results = extract_test_dict('deploy', output)

    try:
        ctx.foundation_addr = results['foundation_address']
    except:
        print(
            "ERROR: Could not find expected results in the deploy scenario"
            ". The output was:\n{}".format(output)
        )
        sys.exit(1)
    print("Foundation address is: {}".format(ctx.foundation_addr))
    with open(ctx.save_file, "w") as f:
        f.write(json.dumps({
            "foundation_addr": ctx.foundation_addr
        }))

    # after deployment recalculate for the subsequent tests what the min
    # amount of tokens is in the case of extrabalance tests
    if ctx.scenario_uses_extrabalance():
        ctx.args.deploy_min_tokens_to_create = (
            int(ctx.args.deploy_min_tokens_to_create * 1.5)
        )
示例#2
0
def run(ctx):
    ctx.create_js_file(substitutions={
        "dao_abi":
        ctx.dao_abi,
        "dao_bin":
        ctx.dao_bin,
        "creator_abi":
        ctx.creator_abi,
        "creator_bin":
        ctx.creator_bin,
        "offer_abi":
        ctx.offer_abi,
        "offer_bin":
        ctx.offer_bin,
        "usn_abi":
        ctx.usn_abi,
        "usn_bin":
        ctx.usn_bin,
        "offer_onetime":
        ctx.args.deploy_onetime_costs,
        "offer_total":
        ctx.args.deploy_total_costs,
        "min_tokens_to_create":
        ctx.args.deploy_min_tokens_to_create,
        "default_proposal_deposit":
        ctx.args.deploy_proposal_deposit
    },
                       cb_before_creation=calculate_closing_time)
    output = ctx.run_script('deploy.js')
    results = extract_test_dict('deploy', output)

    try:
        ctx.dao_creator_addr = results['dao_creator_address']
        ctx.dao_addr = results['dao_address']
        ctx.offer_addr = results['offer_address']
        ctx.usn_addr = results['usn_address']
    except:
        print("ERROR: Could not find expected results in the deploy scenario"
              ". The output was:\n{}".format(output))
        sys.exit(1)
    print("DAO Creator address is: {}".format(ctx.dao_creator_addr))
    print("DAO address is: {}".format(ctx.dao_addr))
    print("SampleOffer address is: {}".format(ctx.offer_addr))
    print("USNRewardPayOut address is: {}".format(ctx.usn_addr))
    with open(ctx.save_file, "w") as f:
        f.write(
            json.dumps({
                "dao_creator_addr": ctx.dao_creator_addr,
                "dao_addr": ctx.dao_addr,
                "offer_addr": ctx.offer_addr,
                "usn_addr": ctx.usn_addr,
                "closing_time": ctx.closing_time
            }))

    # after deployment recalculate for the subsequent tests what the min
    # amount of tokens is in the case of extrabalance tests
    if ctx.scenario_uses_extrabalance():
        ctx.args.deploy_min_tokens_to_create = (int(
            ctx.args.deploy_min_tokens_to_create * 1.5))
示例#3
0
文件: run.py 项目: simon-jentzsch/DAO
def deploy_contract(ctx, substitutions, name, result, cb=None):
    ctx.create_js_file(substitutions=substitutions,
                       specific_name=name,
                       cb_before_creation=cb)
    output = ctx.run_script('{}.js'.format(name))
    results = extract_test_dict(name, output)

    try:
        setattr(ctx, result, results[result])
    except:
        print("ERROR: Could not find '{}' in the deploy scenario"
              ". The output was:\n{}".format(result, output))
        sys.exit(1)
示例#4
0
文件: run.py 项目: DaGitNah/DAO
def run(ctx):
    ctx.create_js_file(
        substitutions={
            "dao_abi": ctx.dao_abi,
            "dao_bin": ctx.dao_bin,
            "creator_abi": ctx.creator_abi,
            "creator_bin": ctx.creator_bin,
            "offer_abi": ctx.offer_abi,
            "offer_bin": ctx.offer_bin,
            "usn_abi": ctx.usn_abi,
            "usn_bin": ctx.usn_bin,
            "offer_onetime": ctx.args.deploy_onetime_costs,
            "offer_total": ctx.args.deploy_total_costs,
            "min_tokens_to_create": ctx.args.deploy_min_tokens_to_create,
            "default_proposal_deposit": ctx.args.deploy_proposal_deposit
        },
        cb_before_creation=calculate_closing_time
    )
    output = ctx.run_script('deploy.js')
    results = extract_test_dict('deploy', output)

    try:
        ctx.dao_creator_addr = results['dao_creator_address']
        ctx.dao_addr = results['dao_address']
        ctx.offer_addr = results['offer_address']
        ctx.usn_addr = results['usn_address']
    except:
        print(
            "ERROR: Could not find expected results in the deploy scenario"
            ". The output was:\n{}".format(output)
        )
        sys.exit(1)
    print("DAO Creator address is: {}".format(ctx.dao_creator_addr))
    print("DAO address is: {}".format(ctx.dao_addr))
    print("SampleOffer address is: {}".format(ctx.offer_addr))
    print("USNRewardPayOut address is: {}".format(ctx.usn_addr))
    with open(ctx.save_file, "w") as f:
        f.write(json.dumps({
            "dao_creator_addr": ctx.dao_creator_addr,
            "dao_addr": ctx.dao_addr,
            "offer_addr": ctx.offer_addr,
            "usn_addr": ctx.usn_addr,
            "closing_time": ctx.closing_time
        }))

    # after deployment recalculate for the subsequent tests what the min
    # amount of tokens is in the case of extrabalance tests
    if ctx.scenario_uses_extrabalance():
        ctx.args.deploy_min_tokens_to_create = (
            int(ctx.args.deploy_min_tokens_to_create * 1.5)
        )
示例#5
0
文件: run.py 项目: CBobRobison/DAO
def deploy_contract(ctx, substitutions, name, result, cb=None):
    ctx.create_js_file(
        substitutions=substitutions,
        specific_name=name,
        cb_before_creation=cb
    )
    output = ctx.run_script('{}.js'.format(name))
    results = extract_test_dict(name, output)

    try:
        setattr(ctx, result, results[result])
    except:
        print(
            "ERROR: Could not find '{}' in the deploy scenario"
            ". The output was:\n{}".format(result, output)
        )
        sys.exit(1)
示例#6
0
文件: run.py 项目: desdonnelly/DAO
def run(ctx):
    ctx.create_js_file(substitutions={
        "dao_abi":
        ctx.dao_abi,
        "dao_bin":
        ctx.dao_bin,
        "creator_abi":
        ctx.creator_abi,
        "creator_bin":
        ctx.creator_bin,
        "offer_abi":
        ctx.offer_abi,
        "offer_bin":
        ctx.offer_bin,
        "offer_onetime":
        ctx.args.deploy_onetime_costs,
        "offer_total":
        ctx.args.deploy_total_costs,
        "min_value":
        ctx.args.deploy_min_value,
        "default_proposal_deposit":
        ctx.args.deploy_proposal_deposit
    },
                       cb_before_creation=calculate_closing_time)
    output = ctx.run_script('deploy.js')
    results = extract_test_dict('deploy', output)

    try:
        ctx.dao_creator_addr = results['dao_creator_address']
        ctx.dao_addr = results['dao_address']
        ctx.offer_addr = results['offer_address']
    except:
        print("ERROR: Could not find expected results in the deploy scenario"
              ". The output was:\n{}".format(output))
        sys.exit(1)
    print("DAO Creator address is: {}".format(ctx.dao_creator_addr))
    print("DAO address is: {}".format(ctx.dao_addr))
    print("SampleOffer address is: {}".format(ctx.offer_addr))
    with open(ctx.save_file, "w") as f:
        f.write(
            json.dumps({
                "dao_creator_addr": ctx.dao_creator_addr,
                "dao_addr": ctx.dao_addr,
                "offer_addr": ctx.offer_addr,
                "closing_time": ctx.closing_time
            }))
示例#7
0
    def run_test_deploy(self):
        print("Running the Deploy Test Scenario")
        self.create_js_file(
            'deploy',
            {
                "dao_abi": self.dao_abi,
                "dao_bin": self.dao_bin,
                "creator_abi": self.creator_abi,
                "creator_bin": self.creator_bin,
                "offer_abi": self.offer_abi,
                "offer_bin": self.offer_bin,
                "offer_onetime": self.args.offer_onetime_costs,
                "offer_total": self.args.offer_total_costs,
                "min_value": self.min_value,
            },
            calculate_closing_time
        )
        output = self.run_script('deploy.js')
        results = extract_test_dict('deploy', output)

        try:
            self.dao_creator_addr = results['dao_creator_address']
            self.dao_addr = results['dao_address']
            self.offer_addr = results['offer_address']
        except:
            print(
                "ERROR: Could not find expected results in the deploy scenario"
                ". The output was:\n{}".format(output)
            )
            sys.exit(1)
        print("DAO Creator address is: {}".format(self.dao_creator_addr))
        print("DAO address is: {}".format(self.dao_addr))
        print("SampleOffer address is: {}".format(self.offer_addr))
        with open(self.save_file, "w") as f:
            f.write(json.dumps({
                "dao_creator_addr": self.dao_creator_addr,
                "dao_addr": self.dao_addr,
                "offer_addr": self.offer_addr,
                "closing_time": self.closing_time
            }))
示例#8
0
文件: run.py 项目: desdonnelly/DAO
def run(ctx):
    ctx.create_js_file(
        substitutions={
            "dao_abi": ctx.dao_abi,
            "dao_bin": ctx.dao_bin,
            "creator_abi": ctx.creator_abi,
            "creator_bin": ctx.creator_bin,
            "offer_abi": ctx.offer_abi,
            "offer_bin": ctx.offer_bin,
            "offer_onetime": ctx.args.deploy_onetime_costs,
            "offer_total": ctx.args.deploy_total_costs,
            "min_value": ctx.args.deploy_min_value,
            "default_proposal_deposit": ctx.args.deploy_proposal_deposit
        },
        cb_before_creation=calculate_closing_time
    )
    output = ctx.run_script('deploy.js')
    results = extract_test_dict('deploy', output)

    try:
        ctx.dao_creator_addr = results['dao_creator_address']
        ctx.dao_addr = results['dao_address']
        ctx.offer_addr = results['offer_address']
    except:
        print(
            "ERROR: Could not find expected results in the deploy scenario"
            ". The output was:\n{}".format(output)
        )
        sys.exit(1)
    print("DAO Creator address is: {}".format(ctx.dao_creator_addr))
    print("DAO address is: {}".format(ctx.dao_addr))
    print("SampleOffer address is: {}".format(ctx.offer_addr))
    with open(ctx.save_file, "w") as f:
        f.write(json.dumps({
            "dao_creator_addr": ctx.dao_creator_addr,
            "dao_addr": ctx.dao_addr,
            "offer_addr": ctx.offer_addr,
            "closing_time": ctx.closing_time
        }))