Skip to content

Commit

Permalink
Remove unused util function 'get_market_token_balance' (#70)
Browse files Browse the repository at this point in the history
* Remove unused util function 'get_market_token_balance'
  • Loading branch information
evangriffiths authored Apr 12, 2024
1 parent bb64fe5 commit cb6bb4a
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions prediction_market_agent/agents/microchain_agent/utils.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cb6bb4a

Please sign in to comment.