diff --git a/packages/packages.json b/packages/packages.json index b1fd41975..154c87639 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -15,15 +15,15 @@ "contract/valory/mech_activity/0.1.0": "bafybeiec6nnvfs6captlncrtjfygpp275vkfajvj4frrnab7thsca6337e", "contract/valory/staking_token/0.1.0": "bafybeig4fl35dn7d5gnprux2nwsqbirm7zkiujz3xvrwcjuktz6hkq4as4", "contract/valory/relayer/0.1.0": "bafybeihzgjyvhtorugjw3yldznqsbwo3aqpxowm7k2nrvj6qtwpsc7jl7u", - "skill/valory/market_manager_abci/0.1.0": "bafybeigvo6hh2lz4h4om67qxugxdeq23inbezyo6u4bb3uth23tniuka6m", - "skill/valory/decision_maker_abci/0.1.0": "bafybeifztxsujapt5f475f73zuok3pg4laj3slvf5ick6s3uxt7ds5qt3y", - "skill/valory/trader_abci/0.1.0": "bafybeiagrarjq27oiw5wdn3sxri7fre3yc5azn4jtektwf6cn2mxqzhlcq", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeidr5qdyk7e4wkodpqrnf56t5xyqf4t7mwvtyqsziglb3uoadz5wwu", + "skill/valory/market_manager_abci/0.1.0": "bafybeig44vtxcq7aarqkg2mskly3zwwnyfc45rtdvorwz6ywspwg3obqn4", + "skill/valory/decision_maker_abci/0.1.0": "bafybeiejbfkl4im6srigta53ysan3tu5hlbb44cbd2mgryp2hsanyxpdge", + "skill/valory/trader_abci/0.1.0": "bafybeigfccxw5v76pectrmh2a3ibd4gt2hhtskkqay6an3g7lgdyotuz34", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiaiek6b3p7dro45qjoecmgseznhixhrgqgxfiap7lqw4rbi5fyhvy", "skill/valory/staking_abci/0.1.0": "bafybeidubhfvlf6x627t4wetc6ran5sb4pttjphyhv6vefp2a4kcuca2be", "skill/valory/check_stop_trading_abci/0.1.0": "bafybeiboctfgetji6xlzw2buts5zsejnlrrhqkppme2p6fwzu26zznb324", - "agent/valory/trader/0.1.0": "bafybeifna5cj46m3ytqixm3eqevnthzcxa7sq63eitybfmb23zelfrfb2u", - "service/valory/trader/0.1.0": "bafybeicdglua2ylh4fmqwi5o6rspv77gep5dtb247bn2xiwtwh5h4zcuza", - "service/valory/trader_pearl/0.1.0": "bafybeigpd2mqjnpkufadkgojgqb2qdtj4ygmjxgmllageykclpoyidb7le" + "agent/valory/trader/0.1.0": "bafybeiaxm4ts4odvhmbltyaa7rngm6jio7b4fdwvwszahw2ndfjdpd547a", + "service/valory/trader/0.1.0": "bafybeig3dk2wuzspnu7aeop2wbxd7sfe5yjlsj3yreen6v6vrtqwj4htyq", + "service/valory/trader_pearl/0.1.0": "bafybeicnm3uxoo7xfotbuhiafqalhfai2etkj5pqha6v4gejy4ilg5lcom" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index ff5d90067..6ce00db86 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -47,10 +47,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeiameewywqigpupy3u2iwnkfczeiiucue74x2l5lbge74rmw6bgaie - valory/termination_abci:0.1.0:bafybeif2zim2de356eo3sipkmoev5emwadpqqzk3huwqarywh4tmqt3vzq - valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidr5qdyk7e4wkodpqrnf56t5xyqf4t7mwvtyqsziglb3uoadz5wwu -- valory/market_manager_abci:0.1.0:bafybeigvo6hh2lz4h4om67qxugxdeq23inbezyo6u4bb3uth23tniuka6m -- valory/decision_maker_abci:0.1.0:bafybeifztxsujapt5f475f73zuok3pg4laj3slvf5ick6s3uxt7ds5qt3y -- valory/trader_abci:0.1.0:bafybeiagrarjq27oiw5wdn3sxri7fre3yc5azn4jtektwf6cn2mxqzhlcq +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiaiek6b3p7dro45qjoecmgseznhixhrgqgxfiap7lqw4rbi5fyhvy +- valory/market_manager_abci:0.1.0:bafybeig44vtxcq7aarqkg2mskly3zwwnyfc45rtdvorwz6ywspwg3obqn4 +- valory/decision_maker_abci:0.1.0:bafybeiejbfkl4im6srigta53ysan3tu5hlbb44cbd2mgryp2hsanyxpdge +- valory/trader_abci:0.1.0:bafybeigfccxw5v76pectrmh2a3ibd4gt2hhtskkqay6an3g7lgdyotuz34 - valory/staking_abci:0.1.0:bafybeidubhfvlf6x627t4wetc6ran5sb4pttjphyhv6vefp2a4kcuca2be - valory/check_stop_trading_abci:0.1.0:bafybeiboctfgetji6xlzw2buts5zsejnlrrhqkppme2p6fwzu26zznb324 - valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e @@ -178,6 +178,9 @@ models: languages: ${list:["en_US"]} average_block_time: ${int:5} abt_error_mult: ${int:5} + the_graph_error_message_key: ${str:message} + the_graph_payment_required_error: ${str:payment required for subsequent requests + for this API key} mech_contract_address: ${str:0x77af31De935740567Cf4fF1986D04B2c964A786a} mech_request_price: ${int:null} mech_chain_id: ${str:gnosis} @@ -269,6 +272,9 @@ models: response_key: ${str:data:blocks} response_index: ${int:0} response_type: ${str:dict} + error_key: ${str:errors} + error_index: ${int:0} + error_type: ${str:dict} retries: ${int:5} url: ${str:https://api.thegraph.com/subgraphs/name/stakewise/ethereum-gnosis} omen_subgraph: @@ -278,6 +284,9 @@ models: method: ${str:POST} response_key: ${str:data:fixedProductMarketMakers} response_type: ${str:list} + error_key: ${str:errors} + error_index: ${int:0} + error_type: ${str:dict} retries: ${int:5} url: ${str:https://api.thegraph.com/subgraphs/name/protofire/omen-xdai} randomness_api: @@ -312,6 +321,9 @@ models: method: ${str:POST} response_key: ${str:data:fpmmTrades} response_type: ${str:list} + error_key: ${str:errors} + error_index: ${int:0} + error_type: ${str:dict} retries: ${int:5} url: ${str:https://api.thegraph.com/subgraphs/name/protofire/omen-xdai} conditional_tokens_subgraph: @@ -321,6 +333,9 @@ models: method: ${str:POST} response_key: ${str:data:user:userPositions} response_type: ${str:list} + error_key: ${str:errors} + error_index: ${int:0} + error_type: ${str:dict} retries: ${int:5} url: ${str:https://api.thegraph.com/subgraphs/name/gnosis/conditional-tokens-gc} realitio_subgraph: @@ -330,6 +345,9 @@ models: method: ${str:POST} response_key: ${str:data:answers} response_type: ${str:list} + error_key: ${str:errors} + error_index: ${int:0} + error_type: ${str:dict} retries: ${int:5} url: ${str:https://api.thegraph.com/subgraphs/name/realityeth/realityeth-gnosis} --- diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index cbcabfd80..0673410e6 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeifna5cj46m3ytqixm3eqevnthzcxa7sq63eitybfmb23zelfrfb2u +agent: valory/trader:0.1.0:bafybeiaxm4ts4odvhmbltyaa7rngm6jio7b4fdwvwszahw2ndfjdpd547a number_of_agents: 4 deployment: agent: @@ -83,6 +83,9 @@ type: skill languages: ${LANGUAGES:list:["en_US"]} average_block_time: ${ABT:int:5} abt_error_mult: ${ABT_ERROR_MULT:int:5} + the_graph_error_message_key: ${THE_GRAPH_ERROR_MESSAGE_KEY:str:message} + the_graph_payment_required_error: ${THE_GRAPH_PAYMENT_REQUIRED_ERROR:str:payment + required for subsequent requests for this API key} mech_contract_address: ${MECH_CONTRACT_ADDRESS:str:0x77af31De935740567Cf4fF1986D04B2c964A786a} mech_request_price: ${MECH_REQUEST_PRICE:int:null} mech_chain_id: ${MECH_CHAIN_ID:str:gnosis} @@ -178,6 +181,9 @@ type: skill response_key: ${NETWORK_SUBGRAPH_RESPONSE_KEY:str:data:blocks} response_index: ${NETWORK_SUBGRAPH_RESPONSE_INDEX:int:0} response_type: ${NETWORK_SUBGRAPH_RESPONSE_TYPE:str:dict} + error_key: ${NETWORK_SUBGRAPH_ERROR_KEY:str:errors} + error_index: ${NETWORK_SUBGRAPH_ERROR_INDEX:int:0} + error_type: ${NETWORK_SUBGRAPH_ERROR_TYPE:str:dict} retries: ${NETWORK_SUBGRAPH_RETRIES:int:5} url: ${NETWORK_SUBGRAPH_URL:str:https://api.thegraph.com/subgraphs/name/stakewise/ethereum-gnosis} omen_subgraph: &id007 @@ -187,6 +193,9 @@ type: skill method: ${OMEN_SUBGRAPH_METHOD:str:POST} response_key: ${OMEN_SUBGRAPH_RESPONSE_KEY:str:data:fixedProductMarketMakers} response_type: ${OMEN_SUBGRAPH_RESPONSE_TYPE:str:list} + error_key: ${NETWORK_SUBGRAPH_ERROR_KEY:str:errors} + error_index: ${NETWORK_SUBGRAPH_ERROR_INDEX:int:0} + error_type: ${NETWORK_SUBGRAPH_ERROR_TYPE:str:dict} retries: ${OMEN_SUBGRAPH_RETRIES:int:5} url: ${OMEN_SUBGRAPH_URL:str:https://api.thegraph.com/subgraphs/name/protofire/omen-xdai} randomness_api: &id008 @@ -221,6 +230,9 @@ type: skill method: ${TRADES_SUBGRAPH_METHOD:str:POST} response_key: ${TRADES_SUBGRAPH_RESPONSE_KEY:str:data:fpmmTrades} response_type: ${TRADES_SUBGRAPH_RESPONSE_TYPE:str:list} + error_key: ${NETWORK_SUBGRAPH_ERROR_KEY:str:errors} + error_index: ${NETWORK_SUBGRAPH_ERROR_INDEX:int:0} + error_type: ${NETWORK_SUBGRAPH_ERROR_TYPE:str:dict} retries: ${TRADES_SUBGRAPH_RETRIES:int:5} url: ${TRADES_SUBGRAPH_URL:str:https://api.thegraph.com/subgraphs/name/protofire/omen-xdai} conditional_tokens_subgraph: &id012 @@ -230,6 +242,9 @@ type: skill method: ${CONDITIONAL_TOKENS_SUBGRAPH_METHOD:str:POST} response_key: ${CONDITIONAL_TOKENS_SUBGRAPH_RESPONSE_KEY:str:data:user:userPositions} response_type: ${CONDITIONAL_TOKENS_SUBGRAPH_RESPONSE_TYPE:str:list} + error_key: ${NETWORK_SUBGRAPH_ERROR_KEY:str:errors} + error_index: ${NETWORK_SUBGRAPH_ERROR_INDEX:int:0} + error_type: ${NETWORK_SUBGRAPH_ERROR_TYPE:str:dict} retries: ${CONDITIONAL_TOKENS_SUBGRAPH_RETRIES:int:5} url: ${CONDITIONAL_TOKENS_SUBGRAPH_URL:str:https://api.thegraph.com/subgraphs/name/gnosis/conditional-tokens-gc} realitio_subgraph: &id013 @@ -239,6 +254,9 @@ type: skill method: ${REALITIO_SUBGRAPH_METHOD:str:POST} response_key: ${REALITIO_SUBGRAPH_RESPONSE_KEY:str:data:answers} response_type: ${REALITIO_SUBGRAPH_RESPONSE_TYPE:str:list} + error_key: ${NETWORK_SUBGRAPH_ERROR_KEY:str:errors} + error_index: ${NETWORK_SUBGRAPH_ERROR_INDEX:int:0} + error_type: ${NETWORK_SUBGRAPH_ERROR_TYPE:str:dict} retries: ${REALITIO_SUBGRAPH_RETRIES:int:5} url: ${REALITIO_SUBGRAPH_URL:str:https://api.thegraph.com/subgraphs/name/realityeth/realityeth-gnosis} 1: @@ -288,6 +306,9 @@ type: skill languages: ${LANGUAGES:list:["en_US"]} average_block_time: ${ABT:int:5} abt_error_mult: ${ABT_ERROR_MULT:int:5} + the_graph_error_message_key: ${THE_GRAPH_ERROR_MESSAGE_KEY:str:message} + the_graph_payment_required_error: ${THE_GRAPH_PAYMENT_REQUIRED_ERROR:str:payment + required for subsequent requests for this API key} mech_contract_address: ${MECH_CONTRACT_ADDRESS:str:0x77af31De935740567Cf4fF1986D04B2c964A786a} mech_request_price: ${MECH_REQUEST_PRICE:int:null} mech_chain_id: ${MECH_CHAIN_ID:str:gnosis} @@ -400,6 +421,9 @@ type: skill languages: ${LANGUAGES:list:["en_US"]} average_block_time: ${ABT:int:5} abt_error_mult: ${ABT_ERROR_MULT:int:5} + the_graph_error_message_key: ${THE_GRAPH_ERROR_MESSAGE_KEY:str:message} + the_graph_payment_required_error: ${THE_GRAPH_PAYMENT_REQUIRED_ERROR:str:payment + required for subsequent requests for this API key} mech_contract_address: ${MECH_CONTRACT_ADDRESS:str:0x77af31De935740567Cf4fF1986D04B2c964A786a} mech_request_price: ${MECH_REQUEST_PRICE:int:null} mech_chain_id: ${MECH_CHAIN_ID:str:gnosis} @@ -512,6 +536,9 @@ type: skill languages: ${LANGUAGES:list:["en_US"]} average_block_time: ${ABT:int:5} abt_error_mult: ${ABT_ERROR_MULT:int:5} + the_graph_error_message_key: ${THE_GRAPH_ERROR_MESSAGE_KEY:str:message} + the_graph_payment_required_error: ${THE_GRAPH_PAYMENT_REQUIRED_ERROR:str:payment + required for subsequent requests for this API key} mech_contract_address: ${MECH_CONTRACT_ADDRESS:str:0x77af31De935740567Cf4fF1986D04B2c964A786a} mech_request_price: ${MECH_REQUEST_PRICE:int:null} mech_chain_id: ${MECH_CHAIN_ID:str:gnosis} diff --git a/packages/valory/services/trader_pearl/service.yaml b/packages/valory/services/trader_pearl/service.yaml index bdac64a5b..aabd9ccff 100644 --- a/packages/valory/services/trader_pearl/service.yaml +++ b/packages/valory/services/trader_pearl/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeifna5cj46m3ytqixm3eqevnthzcxa7sq63eitybfmb23zelfrfb2u +agent: valory/trader:0.1.0:bafybeiaxm4ts4odvhmbltyaa7rngm6jio7b4fdwvwszahw2ndfjdpd547a number_of_agents: 1 deployment: agent: diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index fa6791042..ab96cbd14 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -56,7 +56,10 @@ from packages.valory.skills.decision_maker_abci.policy import EGreedyPolicy from packages.valory.skills.decision_maker_abci.redeem_info import Trade from packages.valory.skills.decision_maker_abci.rounds import DecisionMakerAbciApp -from packages.valory.skills.market_manager_abci.models import MarketManagerParams +from packages.valory.skills.market_manager_abci.models import ( + MarketManagerParams, + Subgraph, +) from packages.valory.skills.mech_interact_abci.models import ( Params as MechInteractParams, ) @@ -569,13 +572,13 @@ def is_winning(self) -> bool: ) -class TradesSubgraph(ApiSpecs): +class TradesSubgraph(Subgraph): """A model that wraps ApiSpecs for the OMEN's subgraph specifications for trades.""" -class ConditionalTokensSubgraph(ApiSpecs): - """A model that wraps ApiSpecs for the Coniditonal Tokens's subgraph specifications.""" +class ConditionalTokensSubgraph(Subgraph): + """A model that wraps ApiSpecs for the Conditional Tokens' subgraph specifications.""" -class RealitioSubgraph(ApiSpecs): +class RealitioSubgraph(Subgraph): """A model that wraps ApiSpecs for the Realitio's subgraph specifications.""" diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 0dbf98a8e..9e5d1385a 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -32,7 +32,7 @@ fingerprint: handlers.py: bafybeigod6gbjrxy4mbmulbzsbokeaoycoqys64vqtxnumishfukzf73za io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa - models.py: bafybeihsvfsa5dbx54p3twnln5wbln2annmnszfrrzdguweugffdlsuigu + models.py: bafybeif76bwktyx6i4h7gqunn33q2s4fjlstm4xb5hhsj3zmq4jsofmq4i payloads.py: bafybeia32ds4ks5g3rhd43w6siy74vi5inaheuxhswiy5ndykxtgncoeu4 policy.py: bafybeihp4lzv4ejyu6k5reukbpa6kamglicpymxfx6obm5pgugik4vc63y redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm @@ -82,7 +82,7 @@ protocols: - valory/http:1.0.0:bafybeifugzl63kfdmwrxwphrnrhj7bn6iruxieme3a4ntzejf6kmtuwmae skills: - valory/abstract_round_abci:0.1.0:bafybeiar2yhzxacfe3qqamqhaihtlcimquwedffctw55sowx6rac3cm3ui -- valory/market_manager_abci:0.1.0:bafybeigvo6hh2lz4h4om67qxugxdeq23inbezyo6u4bb3uth23tniuka6m +- valory/market_manager_abci:0.1.0:bafybeig44vtxcq7aarqkg2mskly3zwwnyfc45rtdvorwz6ywspwg3obqn4 - valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote - valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e behaviours: @@ -201,6 +201,9 @@ models: - en_US average_block_time: 5 abt_error_mult: 5 + the_graph_error_message_key: message + the_graph_payment_required_error: payment required for subsequent requests for + this API key sample_bets_closing_days: 10 trading_strategy: strategy_name use_fallback_strategy: true @@ -325,6 +328,9 @@ models: parameters: {} response_key: data:fpmmTrades response_type: list + error_key: errors + error_index: 0 + error_type: dict retries: 5 url: https://api.thegraph.com/subgraphs/name/protofire/omen-xdai class_name: TradesSubgraph @@ -337,6 +343,9 @@ models: parameters: {} response_key: data:user:userPositions response_type: list + error_key: errors + error_index: 0 + error_type: dict retries: 5 url: https://api.thegraph.com/subgraphs/name/gnosis/conditional-tokens-gc class_name: ConditionalTokensSubgraph @@ -349,6 +358,9 @@ models: parameters: {} response_key: data:answers response_type: list + error_key: errors + error_index: 0 + error_type: dict retries: 5 url: https://api.thegraph.com/subgraphs/name/realityeth/realityeth-gnosis class_name: RealitioSubgraph diff --git a/packages/valory/skills/market_manager_abci/behaviours.py b/packages/valory/skills/market_manager_abci/behaviours.py index 58e625075..fe9527ae2 100644 --- a/packages/valory/skills/market_manager_abci/behaviours.py +++ b/packages/valory/skills/market_manager_abci/behaviours.py @@ -173,7 +173,7 @@ def async_act(self) -> Generator: self.read_bets() yield from self._update_bets() self.store_bets() - bets_hash = self.hash_stored_bets() + bets_hash = self.hash_stored_bets() if self.bets else None payload = UpdateBetsPayload(self.context.agent_address, bets_hash) with self.context.benchmark_tool.measure(self.behaviour_id).consensus(): diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py index 8cf6253c7..627be35e8 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py @@ -399,3 +399,16 @@ def fetch_user_positions( all_positions.extend(positions) user_positions_id_gt = positions[-1]["id"] + + def clean_up(self) -> None: + """Clean up the resources.""" + markets_subgraphs = tuple(market for market, _ in self.params.creators_iterator) + other_subgraphs = ( + "conditional_tokens_subgraph", + "network_subgraph", + "realitio_subgraph", + "trades_subgraph", + ) + for subgraph in markets_subgraphs + other_subgraphs: + subgraph_specs = getattr(self.context, subgraph) + subgraph_specs.reset_retries() diff --git a/packages/valory/skills/market_manager_abci/models.py b/packages/valory/skills/market_manager_abci/models.py index 8419734c4..c39c3fc94 100644 --- a/packages/valory/skills/market_manager_abci/models.py +++ b/packages/valory/skills/market_manager_abci/models.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# Copyright 2023-2024 Valory AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,8 +20,10 @@ """Custom objects for the MarketManager ABCI application.""" +import builtins from typing import Any, Dict, Iterator, List, Tuple +from packages.valory.protocols.http import HttpMessage from packages.valory.skills.abstract_round_abci.models import ApiSpecs, BaseParams from packages.valory.skills.abstract_round_abci.models import ( BenchmarkTool as BaseBenchmarkTool, @@ -44,11 +46,31 @@ class SharedState(BaseSharedState): abci_app_cls = MarketManagerAbciApp -class OmenSubgraph(ApiSpecs): +class Subgraph(ApiSpecs): + """Specifies `ApiSpecs` with common functionality for subgraphs.""" + + def process_response(self, response: HttpMessage) -> Any: + """Process the response.""" + res = super().process_response(response) + if res is not None: + return res + + error_data = self.response_info.error_data + expected_error_type = getattr(builtins, self.response_info.error_type) + if isinstance(error_data, expected_error_type): + error_message_key = self.context.params.the_graph_error_message_key + error_message = error_data.get(error_message_key, None) + if self.context.params.the_graph_payment_required_error in error_message: + err = "Payment required for subsequent requests for the current 'The Graph' API key!" + self.context.logger.error(err) + return None + + +class OmenSubgraph(Subgraph): """A model that wraps ApiSpecs for the OMEN's subgraph specifications.""" -class NetworkSubgraph(ApiSpecs): +class NetworkSubgraph(Subgraph): """A model that wraps ApiSpecs for the network's subgraph specifications.""" @@ -72,6 +94,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.languages: List[str] = self._ensure("languages", kwargs, List[str]) self.average_block_time: int = self._ensure("average_block_time", kwargs, int) self.abt_error_mult: int = self._ensure("abt_error_mult", kwargs, int) + self.the_graph_error_message_key: str = self._ensure( + "the_graph_error_message_key", kwargs, str + ) + self.the_graph_payment_required_error: str = self._ensure( + "the_graph_payment_required_error", kwargs, str + ) super().__init__(*args, **kwargs) @property diff --git a/packages/valory/skills/market_manager_abci/rounds.py b/packages/valory/skills/market_manager_abci/rounds.py index 0c0af17f3..1ac6ea310 100644 --- a/packages/valory/skills/market_manager_abci/rounds.py +++ b/packages/valory/skills/market_manager_abci/rounds.py @@ -21,7 +21,7 @@ from abc import ABC from enum import Enum -from typing import Dict, Optional, Set, Tuple, Type, cast +from typing import Dict, Set, Tuple, Type, cast from packages.valory.skills.abstract_round_abci.base import ( AbciApp, @@ -97,19 +97,6 @@ class UpdateBetsRound(CollectSameUntilThresholdRound, MarketManagerAbstractRound collection_key = get_name(SynchronizedData.participant_to_bets_hash) synchronized_data_class = SynchronizedData - def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Enum]]: - """Process the end of the block.""" - res = super().end_block() - if res is None: - return None - - synced_data, event = cast(Tuple[SynchronizedData, Enum], res) - if event != Event.FETCH_ERROR: - return res - - synced_data.update(SynchronizedData, bets=synced_data.db.get("bets_hash", "")) - return synced_data, event - class FinishedMarketManagerRound(DegenerateRound, ABC): """A round that represents MarketManager has finished""" diff --git a/packages/valory/skills/market_manager_abci/skill.yaml b/packages/valory/skills/market_manager_abci/skill.yaml index 00fe7b42f..df3574874 100644 --- a/packages/valory/skills/market_manager_abci/skill.yaml +++ b/packages/valory/skills/market_manager_abci/skill.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: bafybeie6miwn67uin3bphukmf7qgiifh4xtm42i5v3nuyqxzxtehxsqvcq __init__.py: bafybeigrtedqzlq5mtql2ssjsdriw76ml3666m4e2c3fay6vmyzofl6v6e - behaviours.py: bafybeieg4lgfobmbqavfrjtrdrhp57jxid3llxvqkevixna3kgtm6fnigu + behaviours.py: bafybeiafcd3m6sviezhxjr5rtcwsybauanjplchgabjctr3ukikajczrha bets.py: bafybeid5jw3o57bivq32ojphjmu3xoulf6y6r2pnzuhyp7u6nz3pojpbuu dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm fsm_specification.yaml: bafybeic5cvwfbiu5pywyp3h5s2elvu7jqdrcwayay7o3v3ow47vu2jw53q @@ -19,16 +19,17 @@ fingerprint: graph_tooling/queries/omen.py: bafybeiesgavgoio6zeovdyvzeezz5qoosdgioktoen5ckrgyxpr4u3m3nu graph_tooling/queries/realitio.py: bafybeiftewjwk5fi6uqrhmalweun47voau2qkxi7hg3faxcmyy3va44zma graph_tooling/queries/trades.py: bafybeigu6c25kf3mrlvmwjeskgagswdjnnxsygpriygmip44us4xvuf7ji - graph_tooling/requests.py: bafybeib4bazwax5gz2dcisw4775kuawvnqa5vx6wvni4xj3kk6mwmdlfj4 + graph_tooling/requests.py: bafybeibjyb6av33aswnptttekj6t7k7xysgphh2bigoorcgkc54y2j3xkm graph_tooling/utils.py: bafybeig5hxhnqgyfn5ym3poc5nziqwpeozqbd6wa4s6c2hjn6iyedg3t3y handlers.py: bafybeihot2i2yvfkz2gcowvt66wdu6tkjbmv7hsmc4jzt4reqeaiuphbtu - models.py: bafybeifmb4cojxesv2lcw6j3pm3yqjpsiuwyxpuexjbz656fpapdqcj2ba + models.py: bafybeibjttnga54y4auz6f33ecfrngyw53b2xzpompm72drjsr4xoytmiy payloads.py: bafybeicfymvvtdpkcgmkvthfzmb7dqakepkzslqrz6rcs7nxkz7qq3mrzy - rounds.py: bafybeig4767ilvcz6w5xbp42y6ih3av7p4oz4a7tpm2yqmtezrjs5acebe + rounds.py: bafybeigdwc4sr7gvxth4suaz36x7fmrn3jhlertwq4rcch4clyuxq435wa fingerprint_ignore_patterns: [] connections: [] contracts: [] -protocols: [] +protocols: +- valory/http:1.0.0:bafybeifugzl63kfdmwrxwphrnrhj7bn6iruxieme3a4ntzejf6kmtuwmae skills: - valory/abstract_round_abci:0.1.0:bafybeiar2yhzxacfe3qqamqhaihtlcimquwedffctw55sowx6rac3cm3ui behaviours: @@ -141,6 +142,9 @@ models: - en_US average_block_time: 5 abt_error_mult: 5 + the_graph_error_message_key: message + the_graph_payment_required_error: payment required for subsequent requests for + this API key class_name: MarketManagerParams network_subgraph: args: @@ -152,6 +156,9 @@ models: response_key: data:blocks response_index: 0 response_type: dict + error_key: errors + error_index: 0 + error_type: dict retries: 5 url: https://api.thegraph.com/subgraphs/name/stakewise/ethereum-gnosis class_name: NetworkSubgraph @@ -164,6 +171,9 @@ models: parameters: {} response_key: data:fixedProductMarketMakers response_type: list + error_key: errors + error_index: 0 + error_type: dict retries: 5 url: https://api.thegraph.com/subgraphs/name/protofire/omen-xdai class_name: OmenSubgraph diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 3e3a07725..243cb4dde 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -24,9 +24,9 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeiameewywqigpupy3u2iwnkfczeiiucue74x2l5lbge74rmw6bgaie - valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote - valory/termination_abci:0.1.0:bafybeif2zim2de356eo3sipkmoev5emwadpqqzk3huwqarywh4tmqt3vzq -- valory/market_manager_abci:0.1.0:bafybeigvo6hh2lz4h4om67qxugxdeq23inbezyo6u4bb3uth23tniuka6m -- valory/decision_maker_abci:0.1.0:bafybeifztxsujapt5f475f73zuok3pg4laj3slvf5ick6s3uxt7ds5qt3y -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidr5qdyk7e4wkodpqrnf56t5xyqf4t7mwvtyqsziglb3uoadz5wwu +- valory/market_manager_abci:0.1.0:bafybeig44vtxcq7aarqkg2mskly3zwwnyfc45rtdvorwz6ywspwg3obqn4 +- valory/decision_maker_abci:0.1.0:bafybeiejbfkl4im6srigta53ysan3tu5hlbb44cbd2mgryp2hsanyxpdge +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiaiek6b3p7dro45qjoecmgseznhixhrgqgxfiap7lqw4rbi5fyhvy - valory/staking_abci:0.1.0:bafybeidubhfvlf6x627t4wetc6ran5sb4pttjphyhv6vefp2a4kcuca2be - valory/check_stop_trading_abci:0.1.0:bafybeiboctfgetji6xlzw2buts5zsejnlrrhqkppme2p6fwzu26zznb324 - valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e @@ -148,6 +148,9 @@ models: - en_US average_block_time: 5 abt_error_mult: 5 + the_graph_error_message_key: message + the_graph_payment_required_error: payment required for subsequent requests for + this API key mech_contract_address: '0x77af31de935740567cf4ff1986d04b2c964a786a' mech_request_price: null mech_chain_id: gnosis @@ -285,6 +288,9 @@ models: response_key: data:blocks response_index: 0 response_type: dict + error_key: errors + error_index: 0 + error_type: dict retries: 5 url: https://api.thegraph.com/subgraphs/name/stakewise/ethereum-gnosis class_name: NetworkSubgraph @@ -297,6 +303,9 @@ models: parameters: {} response_key: data:fixedProductMarketMakers response_type: list + error_key: errors + error_index: 0 + error_type: dict retries: 5 url: https://api.thegraph.com/subgraphs/name/protofire/omen-xdai class_name: OmenSubgraph @@ -344,6 +353,9 @@ models: parameters: {} response_key: data:fpmmTrades response_type: list + error_key: errors + error_index: 0 + error_type: dict retries: 5 url: https://api.thegraph.com/subgraphs/name/protofire/omen-xdai class_name: TradesSubgraph @@ -356,6 +368,9 @@ models: parameters: {} response_key: data:user:userPositions response_type: list + error_key: errors + error_index: 0 + error_type: dict retries: 5 url: https://api.thegraph.com/subgraphs/name/gnosis/conditional-tokens-gc class_name: ConditionalTokensSubgraph @@ -368,6 +383,9 @@ models: parameters: {} response_key: data:answers response_type: list + error_key: errors + error_index: 0 + error_type: dict retries: 5 url: https://api.thegraph.com/subgraphs/name/realityeth/realityeth-gnosis class_name: RealitioSubgraph diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index d1f5b281b..d6b4c6233 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeiar2yhzxacfe3qqamqhaihtlcimquwedffctw55sowx6rac3cm3ui -- valory/decision_maker_abci:0.1.0:bafybeifztxsujapt5f475f73zuok3pg4laj3slvf5ick6s3uxt7ds5qt3y +- valory/decision_maker_abci:0.1.0:bafybeiejbfkl4im6srigta53ysan3tu5hlbb44cbd2mgryp2hsanyxpdge - valory/staking_abci:0.1.0:bafybeidubhfvlf6x627t4wetc6ran5sb4pttjphyhv6vefp2a4kcuca2be - valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e behaviours: