Esempio n. 1
0
 async def bounty_list(self,  # type: HummingbotApplication
                       ):
     """ List available bounties """
     if self.liquidity_bounty is None:
         self.liquidity_bounty = LiquidityBounty.get_instance()
     await self.liquidity_bounty.fetch_active_bounties()
     self._notify(self.liquidity_bounty.formatted_bounties())
Esempio n. 2
0
    async def bounty_restore_id(self,  # type: HummingbotApplication
                               ):
        """ Retrieve bounty client id with email when the id is lost"""
        if self.liquidity_bounty is None:
            self.liquidity_bounty: LiquidityBounty = LiquidityBounty.get_instance()

        self.placeholder_mode = True
        self.app.toggle_hide_input()
        self._notify("Starting registration process for liquidity bounties:")

        try:
            email: str = await self.app.prompt("What is the email address you used to register for the bounty? >>> ")
            msg: str = await self.liquidity_bounty.restore_id(email)
            self._notify(msg)

            verification_code: str = await self.app.prompt("Please enter the verification code you received in the "
                                                           "email >>> ")
            client_id = await self.liquidity_bounty.send_verification_code(email, verification_code)

            liquidity_bounty_config_map.get("liquidity_bounty_enabled").value = True
            liquidity_bounty_config_map.get("liquidity_bounty_client_id").value = client_id
            await save_to_yml(LIQUIDITY_BOUNTY_CONFIG_PATH, liquidity_bounty_config_map)

            self._notify("\nYour bounty ID has been reset successfully. You may now start collecting bounties!\n")
            self.liquidity_bounty.start()
        except Exception as e:
            self._notify(f"Bounty reset aborted: {str(e)}")

        self.app.change_prompt(prompt=">>> ")
        self.app.toggle_hide_input()
        self.placeholder_mode = False
 def _initialize_liquidity_bounty(self):
     if (
         liquidity_bounty_config_map.get("liquidity_bounty_enabled").value is not None
         and liquidity_bounty_config_map.get("liquidity_bounty_client_id").value is not None
     ):
         self.liquidity_bounty = LiquidityBounty.get_instance()
         self.liquidity_bounty.start()
Esempio n. 4
0
 def setUpClass(cls):
     read_configs_from_yml()
     cls.clock: Clock = Clock(ClockMode.REALTIME)
     cls.stack = contextlib.ExitStack()
     cls._clock = cls.stack.enter_context(cls.clock)
     cls.ev_loop: asyncio.BaseEventLoop = asyncio.get_event_loop()
     cls.bounty: LiquidityBounty = LiquidityBounty.get_instance()
     cls.bounty.start()
Esempio n. 5
0
 async def bounty_registration(self,  # type: HummingbotApplication
                               ):
     """ Register for the bounty program """
     if liquidity_bounty_config_map.get("liquidity_bounty_enabled").value and \
         liquidity_bounty_config_map.get("liquidity_bounty_client_id").value:
         self._notify("You are already registered to collect bounties.")
         return
     await self.bounty_config_loop()
     self._notify("Registering for liquidity bounties...")
     self.liquidity_bounty = LiquidityBounty.get_instance()
     try:
         registration_results = await self.liquidity_bounty.register()
         self._notify("Registration successful.")
         client_id = registration_results["client_id"]
         liquidity_bounty_config_map.get("liquidity_bounty_client_id").value = client_id
         await save_to_yml(LIQUIDITY_BOUNTY_CONFIG_PATH, liquidity_bounty_config_map)
         self.liquidity_bounty.start()
         self._notify("Hooray! You are now collecting bounties. ")
     except Exception as e:
         self._notify(str(e))
         self.liquidity_bounty = None