From cb6bb4ac3d339ebdc70256067c2f0d47f0681ddb Mon Sep 17 00:00:00 2001 From: Evan Griffiths <56087052+evangriffiths@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:59:24 +0100 Subject: [PATCH] Remove unused util function 'get_market_token_balance' (#70) * Remove unused util function 'get_market_token_balance' --- .../agents/microchain_agent/utils.py | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/prediction_market_agent/agents/microchain_agent/utils.py b/prediction_market_agent/agents/microchain_agent/utils.py index 01707223..26722a54 100644 --- a/prediction_market_agent/agents/microchain_agent/utils.py +++ b/prediction_market_agent/agents/microchain_agent/utils.py @@ -1,7 +1,6 @@ import typing as t from decimal import Decimal -from eth_typing import ChecksumAddress from prediction_market_agent_tooling.markets.agent_market import ( AgentMarket, FilterBy, @@ -16,16 +15,8 @@ from prediction_market_agent_tooling.markets.omen.data_models import ( get_boolean_outcome as get_omen_boolean_outcome, ) -from prediction_market_agent_tooling.markets.omen.omen_contracts import ( - OmenConditionalTokenContract, -) -from prediction_market_agent_tooling.markets.omen.omen_subgraph_handler import ( - OmenSubgraphHandler, -) from prediction_market_agent_tooling.tools.balances import get_balances -from prediction_market_agent_tooling.tools.hexbytes_custom import HexBytes from pydantic import BaseModel -from web3.types import Wei from prediction_market_agent.utils import APIKeys @@ -72,20 +63,6 @@ def get_balance(market_type: MarketType) -> BetAmount: raise ValueError(f"Market type '{market_type}' not supported") -def get_market_token_balance( - user_address: ChecksumAddress, market_condition_id: HexBytes, market_index_set: int -) -> Wei: - # We get the multiple positions for each market - positions = OmenSubgraphHandler().get_positions(market_condition_id) - # Find position matching market_outcome - position_for_index_set = next( - p for p in positions if market_index_set in p.indexSets - ) - position_as_int = int(position_for_index_set.id.hex(), 16) - balance = OmenConditionalTokenContract().balanceOf(user_address, position_as_int) - return balance - - def get_boolean_outcome(market_type: MarketType, outcome: str) -> bool: if market_type == MarketType.OMEN: return get_omen_boolean_outcome(outcome)