Skip to content

Commit

Permalink
Fix Omen's get_trade_balance
Browse files Browse the repository at this point in the history
  • Loading branch information
kongzii committed Feb 26, 2025
1 parent c7b6b46 commit ce7c54e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions prediction_market_agent_tooling/markets/omen/omen.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,12 @@ def redeem_winnings(api_keys: APIKeys) -> None:

@staticmethod
def get_trade_balance(api_keys: APIKeys, web3: Web3 | None = None) -> xDai:
return wei_to_xdai(
KEEPING_ERC20_TOKEN.balanceOf(api_keys.bet_from_address, web3=web3)
native_token_balance = get_balances(api_keys.public_key, web3=web3).xdai
return xdai_type(
wei_to_xdai(
KEEPING_ERC20_TOKEN.balanceOf(api_keys.bet_from_address, web3=web3)
)
+ native_token_balance
)

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions prediction_market_agent_tooling/tools/tokens/main_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# This is the token where agents will hold their funds,
# except for a small portion that will be kept in the native token of the network to pay for the fees.
# Auto deposit must work from native token into this token.
# If changed, then keep in mind that we assume this token is equal to 1 USD.
# Also if changed, `withdraw_wxdai_to_xdai_to_keep_balance` will require update.
KEEPING_ERC20_TOKEN = ContractDepositableWrapperERC20OnGnosisChain(
Expand Down

0 comments on commit ce7c54e

Please sign in to comment.