diff --git a/prediction_market_agent/agents/microchain_agent/deploy.py b/prediction_market_agent/agents/microchain_agent/deploy.py index c4ac77ae..a50aa07e 100644 --- a/prediction_market_agent/agents/microchain_agent/deploy.py +++ b/prediction_market_agent/agents/microchain_agent/deploy.py @@ -107,7 +107,9 @@ def run_general_agent( initial_formatted_system_prompt = agent.system_prompt iteration = 0 - while self.max_iterations is None or iteration < self.max_iterations: + while not agent.do_stop and ( + self.max_iterations is None or iteration < self.max_iterations + ): starting_history_length = len(agent.history) try: # After the first iteration, resume=True to not re-initialize the agent. diff --git a/prediction_market_agent/agents/microchain_agent/nft_treasury_game/messages_functions.py b/prediction_market_agent/agents/microchain_agent/nft_treasury_game/messages_functions.py index 5c6107fb..d10d064e 100644 --- a/prediction_market_agent/agents/microchain_agent/nft_treasury_game/messages_functions.py +++ b/prediction_market_agent/agents/microchain_agent/nft_treasury_game/messages_functions.py @@ -4,6 +4,7 @@ from prediction_market_agent_tooling.loggers import logger from prediction_market_agent_tooling.tools.hexbytes_custom import HexBytes from prediction_market_agent_tooling.tools.web3_utils import xdai_to_wei +from web3 import Web3 from prediction_market_agent.agents.microchain_agent.microchain_agent_keys import ( MicrochainAgentKeys, @@ -51,6 +52,7 @@ def __call__(self, address: str, message: str, fee: float) -> str: api_keys = APIKeys_PMAT(BET_FROM_PRIVATE_KEY=keys.bet_from_private_key) send_message( api_keys=api_keys, + recipient=Web3.to_checksum_address(address), message=HexBytes(compress_message(message)), amount_wei=xdai_to_wei(keys.cap_sending_xdai(xdai_type(fee))), ) diff --git a/prediction_market_agent/db/agent_communication.py b/prediction_market_agent/db/agent_communication.py index 1b180d19..326eb2e7 100644 --- a/prediction_market_agent/db/agent_communication.py +++ b/prediction_market_agent/db/agent_communication.py @@ -44,12 +44,15 @@ def pop_message(api_keys: APIKeys_PMAT) -> MessageContainer: def send_message( - api_keys: APIKeys_PMAT, message: HexBytes, amount_wei: Wei + api_keys: APIKeys_PMAT, + recipient: ChecksumAddress, + message: HexBytes, + amount_wei: Wei, ) -> TxReceipt: agent_comm_contract = AgentCommunicationContract() return agent_comm_contract.send_message( api_keys=api_keys, - agent_address=api_keys.bet_from_address, + agent_address=recipient, message=message, amount_wei=amount_wei, web3=ContractOnGnosisChain.get_web3(),