original_docstring: Triggered from a message on a Cloud Pub/Sub topic.
      Args:
           event (dict): Event payload.
           context (google.cloud.functions.Context): Metadata for the event.
      
docstring: Triggered from a message on a Cloud Pub/Sub topic.
docstring_tokens: Triggered from a message on a Cloud Pub / Sub topic .
code: def gcf_start(event, context):
      """Triggered from a message on a Cloud Pub/Sub topic.
      Args:
           event (dict): Event payload.
           context (google.cloud.functions.Context): Metadata for the event.
      """
      pubsub_message = base64.b64decode(event["data"]).decode("utf-8")
      prod = json.loads(pubsub_message)['prod']
      logging.info(f"Prod Mode: {prod}")
  
      wallet_address = get_config(key="wallet_address")
      starting_blockheight = int(get_config(key="mining_start_block"))
      last_recorded_win = get_last_recorded_win_block()
      
      response, newest_won_blockheight = check_wins(
          wallet_address=wallet_address, 
          starting_blockheight=starting_blockheight,
          last_won_block=last_recorded_win
      )
  
      print(response, newest_won_blockheight)
                  
      prod_discord_webhook = get_config(key="discord_webhook")
      test_discord_webhook = get_config(key="discord_webhook_test")
  
      if response:
          logging.info(f"Newest won block: {newest_won_blockheight}, Last recorded win: {last_recorded_win}")
          logging.info(response)
          post_to_discord(webhook_endpoint=test_discord_webhook, message=response)
  
          if prod:
              post_to_discord(webhook_endpoint=prod_discord_webhook, message=response)
              record_win_block(blockheight=newest_won_blockheight, prod=prod)
code_tokens: def gcf_start ( event , context ) : pubsub_message = base64 . b64decode ( event [ "data" ] ) . decode ( "utf-8" ) prod = json . loads ( pubsub_message ) [ 'prod' ] logging . info ( f"Prod Mode: {prod}" ) wallet_address = get_config ( key = "wallet_address" ) starting_blockheight = int ( get_config ( key = "mining_start_block" ) ) last_recorded_win = get_last_recorded_win_block ( ) response , newest_won_blockheight = check_wins ( wallet_address = wallet_address , starting_blockheight = starting_blockheight , last_won_block = last_recorded_win ) print ( response , newest_won_blockheight ) prod_discord_webhook = get_config ( key = "discord_webhook" ) test_discord_webhook = get_config ( key = "discord_webhook_test" ) if response : logging . info ( f"Newest won block: {newest_won_blockheight}, Last recorded win: {last_recorded_win}" ) logging . info ( response ) post_to_discord ( webhook_endpoint = test_discord_webhook , message = response ) if prod : post_to_discord ( webhook_endpoint = prod_discord_webhook , message = response ) record_win_block ( blockheight = newest_won_blockheight , prod = prod )
short_docstring: Triggered from a message on a Cloud Pub/Sub topic.
short_docstring_tokens: Triggered from a message on a Cloud Pub / Sub topic .
comment: """Triggered from a message on a Cloud Pub/Sub topic.
      Args:
           event (dict): Event payload.
           context (google.cloud.functions.Context): Metadata for the event.
      """