Skip to content

Commit

Permalink
Fix NFT contract usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kongzii committed Jan 17, 2025
1 parent 49f24d7 commit c38e310
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
NFT_TOKEN_FACTORY,
TREASURY_ADDRESS,
)
from prediction_market_agent.agents.microchain_agent.nft_treasury_game.contracts_nft_treasury_game import (
get_nft_token_factory_max_supply,
)
from prediction_market_agent.agents.microchain_agent.nft_treasury_game.deploy_nft_treasury_game import (
DEPLOYED_NFT_AGENTS,
DeployableAgentNFTGameAbstract,
Expand Down Expand Up @@ -313,7 +310,7 @@ def show_treasury_part() -> None:
treasury_xdai_balance = get_balances(TREASURY_ADDRESS).xdai
st.markdown(
f"""### Treasury
Currently holds <span style='font-size: 1.1em;'><strong>{treasury_xdai_balance:.2f} xDAI</strong></span>. There are {get_nft_token_factory_max_supply()} NFT keys.""",
Currently holds <span style='font-size: 1.1em;'><strong>{treasury_xdai_balance:.2f} xDAI</strong></span>. There are {DeployableAgentNFTGameAbstract.retrieve_total_number_of_keys()} NFT keys.""",
unsafe_allow_html=True,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from functools import cache

from prediction_market_agent_tooling.gtypes import ChecksumAddress
from prediction_market_agent_tooling.tools.contract import (
ContractOwnableERC721OnGnosisChain,
)
from web3 import Web3

from prediction_market_agent.agents.microchain_agent.nft_treasury_game.constants_nft_treasury_game import (
NFT_TOKEN_FACTORY,
Expand All @@ -13,22 +10,3 @@

class ContractNFTFactoryOnGnosisChain(ContractOwnableERC721OnGnosisChain):
address: ChecksumAddress = NFT_TOKEN_FACTORY

def max_supply(self, web3: Web3 | None = None) -> int:
n_tokens: int = self.call("MAX_SUPPLY", web3=web3)
return n_tokens

def token_ids_owned_by(
self, owner: ChecksumAddress, web3: Web3 | None = None
) -> list[int]:
token_ids = list(range(self.max_supply(web3=web3)))
return [
token_id
for token_id in token_ids
if self.owner_of(token_id=token_id, web3=web3) == owner
]


@cache
def get_nft_token_factory_max_supply() -> int:
return ContractNFTFactoryOnGnosisChain().max_supply()
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
NFT_TOKEN_FACTORY,
TREASURY_ADDRESS,
)
from prediction_market_agent.agents.microchain_agent.nft_treasury_game.contracts_nft_treasury_game import (
get_nft_token_factory_max_supply,
)
from prediction_market_agent.agents.microchain_agent.nft_treasury_game.messages_functions import (
GameRoundEnd,
)
Expand Down Expand Up @@ -301,7 +298,7 @@ def get_initial_system_prompt(cls) -> str:

def nft_treasury_game_base_prompt(wallet_address: ChecksumAddress) -> str:
keys = MicrochainAgentKeys()
n_nft_keys = get_nft_token_factory_max_supply()
n_nft_keys = DeployableAgentNFTGameAbstract.retrieve_total_number_of_keys()
other_agents_keys_formatted = ", ".join(
x.wallet_address
for x in DEPLOYED_NFT_AGENTS
Expand Down

0 comments on commit c38e310

Please sign in to comment.