예제 #1
0
    def compile_contracts(self, keep_limits):
        if not self.solc:
            print("Error: No valid solc compiler provided")
            sys.exit(1)
        print("Compiling the DAO contracts...")

        dao_contract = os.path.join(self.contracts_dir, "DAO.sol")
        if not os.path.isfile(dao_contract):
            print("DAO contract not found at {}".format(dao_contract))
            sys.exit(1)
        dao_contract = edit_dao_source(self.contracts_dir, keep_limits,
                                       self.args.proposal_halveminquorum)

        res = self.compile_contract(dao_contract)
        contract = res["contracts"]["DAO"]
        DAOCreator = res["contracts"]["DAO_Creator"]
        self.creator_abi = DAOCreator["abi"]
        self.creator_bin = DAOCreator["bin"]
        self.dao_abi = contract["abi"]
        self.dao_bin = contract["bin"]

        offer = os.path.join(self.contracts_dir, "SampleOffer.sol")
        res = self.compile_contract(offer)
        self.offer_abi = res["contracts"]["SampleOffer"]["abi"]
        self.offer_bin = res["contracts"]["SampleOffer"]["bin"]

        # also delete the temporary created files
        rm_file(os.path.join(self.contracts_dir, "DAOcopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "TokenSaleCopy.sol"))
예제 #2
0
파일: test.py 프로젝트: stephantual/DAO
    def compile_contracts(self, keep_limits):
        if not self.solc:
            print("Error: No valid solc compiler provided")
            sys.exit(1)
        print("Compiling the DAO contracts...")

        dao_contract = os.path.join(self.contracts_dir, "DAO.sol")
        if not os.path.isfile(dao_contract):
            print("DAO contract not found at {}".format(dao_contract))
            sys.exit(1)
        dao_contract = edit_dao_source(
            self.contracts_dir,
            keep_limits,
            self.args.proposal_halveminquorum,
            self.args.split_execution_period,
            self.args.scenario == "extrabalance"
        )

        res = self.compile_contract(dao_contract)
        contract = res["contracts"]["DAO"]
        DAOCreator = res["contracts"]["DAO_Creator"]
        self.creator_abi = DAOCreator["abi"]
        self.creator_bin = DAOCreator["bin"]
        self.dao_abi = contract["abi"]
        self.dao_bin = contract["bin"]

        offer = os.path.join(self.contracts_dir, "SampleOffer.sol")
        res = self.compile_contract(offer)
        self.offer_abi = res["contracts"]["SampleOffer"]["abi"]
        self.offer_bin = res["contracts"]["SampleOffer"]["bin"]

        # also delete the temporary created files
        rm_file(os.path.join(self.contracts_dir, "DAOcopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "TokenCreationCopy.sol"))
예제 #3
0
파일: test.py 프로젝트: CBobRobison/DAO
    def compile_contracts(self, keep_limits):
        if not self.solc:
            print("Error: No valid solc compiler provided")
            sys.exit(1)

        # checkout the requested version of the DAO sources
        self.checkout_dao_version()
        print("Compiling the DAO contracts...")
        dao_contract = os.path.join(self.contracts_dir, "DAO.sol")
        if not os.path.isfile(dao_contract):
            print("DAO contract not found at {}".format(dao_contract))
            sys.exit(1)
        dao_contract = edit_dao_source(
            self.contracts_dir,
            keep_limits,
            1,  # min_proposal_debate
            1,  # min_proposal_split
            self.args.proposal_halveminquorum,
            self.args.split_execution_period,
            self.scenario_uses_extrabalance(),
            self.args.scenario == "fuel_fail_extrabalance",
            self.args.deploy_offer_payment_period,
            self.args.deploy_pfoffer_payout_freeze_period
        )
        # compile USNRewardPayout and all contracts it depends on
        usn = os.path.join(self.contracts_dir, "USNRewardPayOutCopy.sol")
        res = self.compile_contract(usn)
        contract = res["contracts"]["DAO"]
        DAOCreator = res["contracts"]["DAO_Creator"]
        self.creator_abi = DAOCreator["abi"]
        self.creator_bin = DAOCreator["bin"]
        self.dao_abi = contract["abi"]
        self.dao_bin = contract["bin"]
        self.offer_abi = res["contracts"]["RewardOffer"]["abi"]
        self.offer_bin = res["contracts"]["RewardOffer"]["bin"]
        self.usn_abi = res["contracts"]["USNRewardPayOut"]["abi"]
        self.usn_bin = res["contracts"]["USNRewardPayOut"]["bin"]

        # compile PFOffer
        pfoffer = os.path.join(self.contracts_dir, "PFOfferCopy.sol")
        res = self.compile_contract(pfoffer)
        self.pfoffer_abi = res["contracts"]["PFOffer"]["abi"]
        self.pfoffer_bin = res["contracts"]["PFOffer"]["bin"]

        # also delete the temporary created files
        self.reset_dao_version()
        rm_file(os.path.join(self.contracts_dir, "DAOcopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "TokenCreationCopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "RewardOfferCopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "OfferCopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "PFOfferCopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "USNRewardPayOutCopy.sol"))
예제 #4
0
파일: test.py 프로젝트: ether-camp/DAO
    def compile_contracts(self, keep_limits):
        if not self.solc:
            print("Error: No valid solc compiler provided")
            sys.exit(1)

        # checkout the requested version of the DAO sources
        self.checkout_dao_version()
        print("Compiling the DAO contracts...")
        compile_success = True
        try:
            dao_contract = os.path.join(self.contracts_dir, "DAO.sol")
            if not os.path.isfile(dao_contract):
                print("DAO contract not found at {}".format(dao_contract))
                sys.exit(1)
            dao_contract = edit_dao_source(
                self.contracts_dir,
                keep_limits,
                1,  # min_proposal_debate
                1,  # min_proposal_split
                self.args.proposal_halveminquorum,
                self.args.split_execution_period,
                self.scenario_uses_extrabalance(),
                self.args.scenario == "fuel_fail_extrabalance",
                self.args.deploy_offer_payment_period,
                self.args.deploy_pfoffer_payout_freeze_period
            )
            # compile USNRewardPayout and all contracts it depends on
            usn = os.path.join(self.contracts_dir, "USNRewardPayOutCopy.sol")
            res = self.compile_contract(usn)
            contract = res["contracts"]["DAO"]
            DAOCreator = res["contracts"]["DAO_Creator"]
            self.creator_abi = DAOCreator["abi"]
            self.creator_bin = DAOCreator["bin"]
            self.dao_abi = contract["abi"]
            self.dao_bin = contract["bin"]
            self.offer_abi = res["contracts"]["RewardOffer"]["abi"]
            self.offer_bin = res["contracts"]["RewardOffer"]["bin"]
            self.usn_abi = res["contracts"]["USNRewardPayOut"]["abi"]
            self.usn_bin = res["contracts"]["USNRewardPayOut"]["bin"]

            # compile PFOffer
            pfoffer = os.path.join(self.contracts_dir, "PFOfferCopy.sol")
            res = self.compile_contract(pfoffer)
            self.pfoffer_abi = res["contracts"]["PFOffer"]["abi"]
            self.pfoffer_bin = res["contracts"]["PFOffer"]["bin"]
        except:
            compile_success = False
        self.compile_cleanup()
        if not compile_success:
            print("ERROR at contract compiling")
            sys.exit(1)
예제 #5
0
    def compile_contracts(self, keep_limits):
        if not self.solc:
            print("Error: No valid solc compiler provided")
            sys.exit(1)
        print("Compiling the DAO contracts...")

        dao_contract = os.path.join(self.contracts_dir, "DAO.sol")
        if not os.path.isfile(dao_contract):
            print("DAO contract not found at {}".format(dao_contract))
            sys.exit(1)
        dao_contract = edit_dao_source(
            self.contracts_dir,
            keep_limits,
            1,  # min_proposal_debate
            1,  # min_proposal_split
            self.args.proposal_halveminquorum,
            self.args.split_execution_period,
            self.scenario_uses_extrabalance(),
            self.args.scenario == "fuel_fail_extrabalance",
            self.args.deploy_offer_payment_period)
        usn = os.path.join(self.contracts_dir, "USNRewardPayOutCopy.sol")
        res = self.compile_contract(usn)
        contract = res["contracts"]["DAO"]
        DAOCreator = res["contracts"]["DAO_Creator"]
        self.creator_abi = DAOCreator["abi"]
        self.creator_bin = DAOCreator["bin"]
        self.dao_abi = contract["abi"]
        self.dao_bin = contract["bin"]
        self.offer_abi = res["contracts"]["SampleOffer"]["abi"]
        self.offer_bin = res["contracts"]["SampleOffer"]["bin"]
        self.usn_abi = res["contracts"]["USNRewardPayOut"]["abi"]
        self.usn_bin = res["contracts"]["USNRewardPayOut"]["bin"]

        # also delete the temporary created files
        rm_file(os.path.join(self.contracts_dir, "DAOcopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "TokenCreationCopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "SampleOfferCopy.sol"))
        rm_file(
            os.path.join(self.contracts_dir,
                         "SampleOfferWithoutRewardCopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "USNRewardPayOutCopy.sol"))
예제 #6
0
파일: test.py 프로젝트: PRESSToken/DAO
    def compile_contracts(self, keep_limits):
        if not self.solc:
            print("Error: No valid solc compiler provided")
            sys.exit(1)
        print("Compiling the DAO contracts...")

        dao_contract = os.path.join(self.contracts_dir, "DAO.sol")
        if not os.path.isfile(dao_contract):
            print("DAO contract not found at {}".format(dao_contract))
            sys.exit(1)
        dao_contract = edit_dao_source(
            self.contracts_dir,
            keep_limits,
            1,  # min_proposal_debate
            1,  # min_proposal_split
            self.args.proposal_halveminquorum,
            self.args.split_execution_period,
            self.scenario_uses_extrabalance(),
            self.args.scenario == "fuel_fail_extrabalance",
            self.args.deploy_offer_payment_period
        )
        usn = os.path.join(self.contracts_dir, "USNRewardPayOutCopy.sol")
        res = self.compile_contract(usn)
        contract = res["contracts"]["DAO"]
        DAOCreator = res["contracts"]["DAO_Creator"]
        self.creator_abi = DAOCreator["abi"]
        self.creator_bin = DAOCreator["bin"]
        self.dao_abi = contract["abi"]
        self.dao_bin = contract["bin"]
        self.offer_abi = res["contracts"]["SampleOffer"]["abi"]
        self.offer_bin = res["contracts"]["SampleOffer"]["bin"]
        self.usn_abi = res["contracts"]["USNRewardPayOut"]["abi"]
        self.usn_bin = res["contracts"]["USNRewardPayOut"]["bin"]

        # also delete the temporary created files
        rm_file(os.path.join(self.contracts_dir, "DAOcopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "TokenCreationCopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "SampleOfferCopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "SampleOfferWithoutRewardCopy.sol"))
        rm_file(os.path.join(self.contracts_dir, "USNRewardPayOutCopy.sol"))
예제 #7
0
    def compile_contracts(self, keep_limits):
        if not self.solc:
            print("Error: No valid solc compiler provided")
            sys.exit(1)

        # checkout the requested version of the DAO sources
        self.checkout_dao_version()
        print("Compiling the DAO contracts...")
        compile_success = True
        try:
            dao_contract = os.path.join(self.contracts_dir, "DAO.sol")
            if not os.path.isfile(dao_contract):
                print("DAO contract not found at {}".format(dao_contract))
                sys.exit(1)
            dao_contract = edit_dao_source(
                self.contracts_dir,
                keep_limits,
                1,  # min_proposal_debate
                1,  # min_proposal_split
                self.args.proposal_halveminquorum,
                self.args.split_execution_period,
                self.scenario_uses_extrabalance(),
                self.args.scenario == "fuel_fail_extrabalance",
                self.args.deploy_offer_payment_period,
                self.args.deploy_pfoffer_payout_freeze_period,
                self.args.deploy_pfoffer_vote_status_deadline
                if not ctx.args.scenario == "pfoffer_checkvotestatus_fail" else
                ctx.args.proposal_debate_seconds - 1)
            # compile USNRewardPayout and all contracts it depends on
            usn = os.path.join(self.contracts_dir, "USNRewardPayOutCopy.sol")
            res = self.compile_contract(usn)
            contract = res["contracts"]["DAO"]
            DAOCreator = res["contracts"]["DAO_Creator"]
            self.creator_abi = DAOCreator["abi"]
            self.creator_bin = DAOCreator["bin"]
            self.dao_abi = contract["abi"]
            self.dao_bin = contract["bin"]
            self.offer_abi = res["contracts"]["RewardOffer"]["abi"]
            self.offer_bin = res["contracts"]["RewardOffer"]["bin"]
            self.usn_abi = res["contracts"]["USNRewardPayOut"]["abi"]
            self.usn_bin = res["contracts"]["USNRewardPayOut"]["bin"]

            # If a compilation test was requested we can stop here.
            # Until solc gets a version that can compile PFOFfer we don't
            # add it to the test so that Travis can compile succesfully
            if self.args.compile_test:
                print("DAO Contracts compiled successfully!")
                sys.exit(220)

            # compile PFOffer
            pfoffer = os.path.join(self.contracts_dir, "PFOfferCopy.sol")
            res = self.compile_contract(pfoffer)
            self.pfoffer_abi = res["contracts"]["PFOffer"]["abi"]
            self.pfoffer_bin = res["contracts"]["PFOffer"]["bin"]
        except SystemExit as e:
            if e.code != 220:
                # 220 is sys.exit(succesful_compilation) in the case of the
                # simple compilation test. If not then compilation must have
                # failed.
                compile_success = False
                raise
        except:
            compile_success = False
        finally:
            self.compile_cleanup()

        if not compile_success:
            print("ERROR at contract compiling")
            sys.exit(1)
        elif self.args.compile_test:
            sys.exit(0)
예제 #8
0
파일: test.py 프로젝트: GriffGreen/DAO
    def compile_contracts(self, keep_limits):
        if not self.solc:
            print("Error: No valid solc compiler provided")
            sys.exit(1)

        # checkout the requested version of the DAO sources
        self.checkout_dao_version()
        print("Compiling the DAO contracts...")
        compile_success = True
        try:
            dao_contract = os.path.join(self.contracts_dir, "DAO.sol")
            if not os.path.isfile(dao_contract):
                print("DAO contract not found at {}".format(dao_contract))
                sys.exit(1)
            dao_contract = edit_dao_source(
                self.contracts_dir,
                keep_limits,
                1,  # min_proposal_debate
                1,  # min_proposal_split
                self.args.proposal_halveminquorum,
                self.args.split_execution_period,
                self.scenario_uses_extrabalance(),
                self.args.scenario == "fuel_fail_extrabalance",
                self.args.deploy_offer_payment_period,
                self.args.deploy_pfoffer_payout_freeze_period,
                self.args.deploy_pfoffer_vote_status_deadline
                if not ctx.args.scenario == "pfoffer_checkvotestatus_fail"
                else ctx.args.proposal_debate_seconds - 1
            )
            # compile USNRewardPayout and all contracts it depends on
            usn = os.path.join(self.contracts_dir, "USNRewardPayOutCopy.sol")
            res = self.compile_contract(usn)
            contract = res["contracts"]["DAO"]
            DAOCreator = res["contracts"]["DAO_Creator"]
            self.creator_abi = DAOCreator["abi"]
            self.creator_bin = DAOCreator["bin"]
            self.dao_abi = contract["abi"]
            self.dao_bin = contract["bin"]
            self.offer_abi = res["contracts"]["RewardOffer"]["abi"]
            self.offer_bin = res["contracts"]["RewardOffer"]["bin"]
            self.usn_abi = res["contracts"]["USNRewardPayOut"]["abi"]
            self.usn_bin = res["contracts"]["USNRewardPayOut"]["bin"]

            # If a compilation test was requested we can stop here.
            # Until solc gets a version that can compile PFOFfer we don't
            # add it to the test so that Travis can compile succesfully
            if self.args.compile_test:
                print("DAO Contracts compiled successfully!")
                sys.exit(220)

            # compile PFOffer
            pfoffer = os.path.join(self.contracts_dir, "PFOfferCopy.sol")
            res = self.compile_contract(pfoffer)
            self.pfoffer_abi = res["contracts"]["PFOffer"]["abi"]
            self.pfoffer_bin = res["contracts"]["PFOffer"]["bin"]
        except SystemExit as e:
            if e.code != 220:
                # 220 is sys.exit(succesful_compilation) in the case of the
                # simple compilation test. If not then compilation must have
                # failed.
                compile_success = False
                raise
        except:
            compile_success = False
        finally:
            self.compile_cleanup()

        if not compile_success:
            print("ERROR at contract compiling")
            sys.exit(1)
        elif self.args.compile_test:
            sys.exit(0)