diff --git a/packages/dvilela/agents/tsunami/aea-config.yaml b/packages/dvilela/agents/tsunami/aea-config.yaml index 65bf1c6..8255d0d 100644 --- a/packages/dvilela/agents/tsunami/aea-config.yaml +++ b/packages/dvilela/agents/tsunami/aea-config.yaml @@ -47,8 +47,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote - valory/registration_abci:0.1.0:bafybeieu7vq3pyns4t5ty6u3sbmpkd7yznpg3rmqifoz3jhy7pmqyg3w6q - valory/reset_pause_abci:0.1.0:bafybeiameewywqigpupy3u2iwnkfczeiiucue74x2l5lbge74rmw6bgaie -- dvilela/tsunami_abci:0.1.0:bafybeifqfdqdod7fvq5ifnku7mfpwevnodjxbqelfqupdxmy6zpmayj66u -- dvilela/tsunami_chained_abci:0.1.0:bafybeihu4us5fs7g4swr2b3o2yes2do5apzwbe4nbvhzch4ch5sfjmhely +- dvilela/tsunami_abci:0.1.0:bafybeidruxapjidrw5biadllcs77skedw7ehewcrzos35fm6nvtoyvkk7m +- dvilela/tsunami_chained_abci:0.1.0:bafybeihoac2qx4h4icy4r4vjqinkeclb22aolfuyav4ysu2h6jyn6jclf4 default_ledger: ethereum required_ledgers: - ethereum @@ -234,6 +234,7 @@ models: telegram_chat_id: ${int:null} service_endpoint: ${str:https://tsunami.dummy.com/} boardroom_api_key: ${str:null} + subgraph_api_key: ${str:null} --- public_id: valory/http_server:0.22.0:bafybeicblltx7ha3ulthg7bzfccuqqyjmihhrvfeztlgrlcoxhr7kf6nbq type: connection diff --git a/packages/dvilela/services/tsunami/service.yaml b/packages/dvilela/services/tsunami/service.yaml index 0aaf6e7..5848505 100644 --- a/packages/dvilela/services/tsunami/service.yaml +++ b/packages/dvilela/services/tsunami/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibh5bgshii5oqjfuhwmiivfvfqy7fw5pzvarxkpe4qrgivxtc3xym fingerprint_ignore_patterns: [] -agent: dvilela/tsunami:0.1.0:bafybeiaewgming24cl54mwgrh4x7u3u4rrnmfwywyq65x527zguy2sc224 +agent: dvilela/tsunami:0.1.0:bafybeiflmxrzfchky2cloqcdtwa4htgr6zniel3xj4bpqtzmpbads3c2vy number_of_agents: 1 deployment: agent: @@ -110,6 +110,7 @@ extra: telegram_chat_id: ${TELEGRAM_CHAT_ID:int:null} service_endpoint: ${SERVICE_ENDPOINT:str:https://tsunami.dummy.com/} boardroom_api_key: ${BOARDROOM_API_KEY:str:null} + subgraph_api_key: ${SUBGRAPH_API_KEY:str:null} --- public_id: valory/ledger:0.19.0 type: connection diff --git a/packages/dvilela/skills/tsunami_abci/behaviours.py b/packages/dvilela/skills/tsunami_abci/behaviours.py index e62cb02..fda802a 100644 --- a/packages/dvilela/skills/tsunami_abci/behaviours.py +++ b/packages/dvilela/skills/tsunami_abci/behaviours.py @@ -112,7 +112,7 @@ OLAS_REGISTRY_URL = "https://registry.olas.network" GITHUB_REPO_LATEST_URL = "https://api.github.com/repos/{repo}/releases/latest" DAY_IN_SECONDS = 3600 * 24 -OMEN_API_ENDPOINT = "https://api.thegraph.com/subgraphs/name/protofire/omen-xdai" +OMEN_API_ENDPOINT = "https://gateway-arbitrum.network.thegraph.com/api/{SUBGRAPH_API_KEY}/subgraphs/id/9fUVQpFwzpdWS9bq5WkAnmKbNNcoBwatMR4yZq81pbbz" OMEN_RUN_HOUR = 15 SUNO_RUN_HOUR = 10 SUNO_RUN_DAY = 4 @@ -744,7 +744,7 @@ def build_treasury_tweet( # pylint: disable=too-many-arguments,too-many-locals, event.args["amounts"], event.args["serviceIds"] ): service_name = service_id_to_name[str(service_id)] - donations.append(f"☴ {amount / 1e18:.2f} ETH for {service_name}") + donations.append(f"☴ {amount / 1e18:.4f} ETH for {service_name}") kwargs = { "donator": event.args["sender"], @@ -1186,9 +1186,13 @@ def get_omen_tweets( # pylint: disable=too-many-locals,too-many-return-statemen "extensions": {"headers": None}, } + url = OMEN_API_ENDPOINT.replace( + "{SUBGRAPH_API_KEY}", self.params.subgraph_api_key + ) + response = yield from self.get_http_response( # type: ignore method="POST", - url=OMEN_API_ENDPOINT, + url=url, content=json.dumps(content_json).encode(), headers=headers, ) @@ -1217,7 +1221,7 @@ def get_omen_tweets( # pylint: disable=too-many-locals,too-many-return-statemen response = yield from self.get_http_response( # type: ignore method="POST", - url=OMEN_API_ENDPOINT, + url=url, content=json.dumps(content_json).encode(), headers=headers, ) diff --git a/packages/dvilela/skills/tsunami_abci/handlers.py b/packages/dvilela/skills/tsunami_abci/handlers.py index 3281ee5..8ba0af8 100644 --- a/packages/dvilela/skills/tsunami_abci/handlers.py +++ b/packages/dvilela/skills/tsunami_abci/handlers.py @@ -238,7 +238,9 @@ def handle(self, message: Message) -> None: super().handle(message) return - self.context.logger.info(f"Selected hander: {handler}") + self.context.logger.info( + f"Selected hander: {handler.__name__ if handler else None}" + ) # Retrieve dialogues http_dialogues = cast(HttpDialogues, self.context.http_dialogues) diff --git a/packages/dvilela/skills/tsunami_abci/models.py b/packages/dvilela/skills/tsunami_abci/models.py index f79f03c..226e161 100644 --- a/packages/dvilela/skills/tsunami_abci/models.py +++ b/packages/dvilela/skills/tsunami_abci/models.py @@ -91,4 +91,5 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.service_endpoint = self._ensure("service_endpoint", kwargs, str) self.governance_enabled = self._ensure("governance_enabled", kwargs, bool) self.boardroom_api_key = self._ensure("boardroom_api_key", kwargs, str) + self.subgraph_api_key = self._ensure("subgraph_api_key", kwargs, str) super().__init__(*args, **kwargs) diff --git a/packages/dvilela/skills/tsunami_abci/skill.yaml b/packages/dvilela/skills/tsunami_abci/skill.yaml index ee024d3..ae70f5d 100644 --- a/packages/dvilela/skills/tsunami_abci/skill.yaml +++ b/packages/dvilela/skills/tsunami_abci/skill.yaml @@ -8,13 +8,13 @@ license: Apache-2.0 aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeiaicsttkv5xapta2eqove7si2pyv3zmshkqolluxpnrh3hkulqsqu - behaviours.py: bafybeicvm5ndzsx62bk5yn7vcmy7ib7i4kayhxdox65k64s6kayptagave + behaviours.py: bafybeiez7hucyto47mudwjpvdh5syrkwx2xhuyk6r2djpbhww4mlm77swa dialogues.py: bafybeidmgjji6zw6wcvhijrxb74batj2kc2lskfuqxv76duv2j7azcqwra fsm_specification.yaml: bafybeidlfuabsldhezjaovupkvzrtydpcimzz6r56phsi2psrtdzougu4u - handlers.py: bafybeicpj6stfkt3sfz3aycf63pugnzb7bgugcmbl2k3cnwyo7a4yexyam + handlers.py: bafybeibsrwy75bo6tmfmthqckda7lr6q52bq7ojx43d3tjszoo7n3xyedi html/index.html: bafybeia7qpqjoredervujs5naa7rawl7d7u25y5jkoszfn45znaxfthhoi html/surf.html: bafybeic5g7xwh5rsztxmrftkddtklghj2qewdijxm5pbb4wonp6lcjjvei - models.py: bafybeicx5tpwcxy2hufcaydozc6ho4fjalgk4imfh3jgelt2rxea3h4ipu + models.py: bafybeicnp5oi5pnns62kj4dgdut5l6q4a7nollzi44ysl2ze7chrln62di payloads.py: bafybeicejv72ralhxgwzkcprgj5akehu65jfik2cpwsnrxs7zlglpdrl6u prompts.py: bafybeicjacdvtggitktvwnzqq6nsic7zf7qpaaf4gy7uepzjdr55ql2cs4 rounds.py: bafybeidmfi6v335lgvjidptqrvuruhtk5hhq3fkcubwbln7xbn2iiok7di @@ -171,6 +171,7 @@ models: telegram_chat_id: null service_endpoint: tsunami.dummy.com/ boardroom_api_key: null + subgraph_api_key: null class_name: Params requests: args: {} diff --git a/packages/dvilela/skills/tsunami_chained_abci/skill.yaml b/packages/dvilela/skills/tsunami_chained_abci/skill.yaml index e4fb121..1fe1055 100644 --- a/packages/dvilela/skills/tsunami_chained_abci/skill.yaml +++ b/packages/dvilela/skills/tsunami_chained_abci/skill.yaml @@ -23,7 +23,7 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeiameewywqigpupy3u2iwnkfczeiiucue74x2l5lbge74rmw6bgaie - valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote - valory/termination_abci:0.1.0:bafybeif2zim2de356eo3sipkmoev5emwadpqqzk3huwqarywh4tmqt3vzq -- dvilela/tsunami_abci:0.1.0:bafybeifqfdqdod7fvq5ifnku7mfpwevnodjxbqelfqupdxmy6zpmayj66u +- dvilela/tsunami_abci:0.1.0:bafybeidruxapjidrw5biadllcs77skedw7ehewcrzos35fm6nvtoyvkk7m behaviours: main: args: {} @@ -164,6 +164,7 @@ models: telegram_chat_id: null service_endpoint: tsunami.dummy.com/ boardroom_api_key: null + subgraph_api_key: null class_name: Params randomness_api: args: diff --git a/packages/packages.json b/packages/packages.json index dea220d..79fbd6e 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -8,10 +8,10 @@ "connection/dvilela/llama/0.1.0": "bafybeiauzzq2pxmn4brdqgdyxrrikbc5ywjpmetlajyohute5qtnn37aqq", "connection/valory/twitter/0.1.0": "bafybeif6g5sulx4hpm75vt776r6d7obfawsrjom3xq2fsgzdb4d3dssoy4", "connection/dvilela/suno/0.1.0": "bafybeihy2phtjwbz27ntv55wxfk754kp5tjceujzsdbppjafljoydjflhi", - "skill/dvilela/tsunami_abci/0.1.0": "bafybeifqfdqdod7fvq5ifnku7mfpwevnodjxbqelfqupdxmy6zpmayj66u", - "skill/dvilela/tsunami_chained_abci/0.1.0": "bafybeihu4us5fs7g4swr2b3o2yes2do5apzwbe4nbvhzch4ch5sfjmhely", - "agent/dvilela/tsunami/0.1.0": "bafybeiaewgming24cl54mwgrh4x7u3u4rrnmfwywyq65x527zguy2sc224", - "service/dvilela/tsunami/0.1.0": "bafybeia6d44xzn7iy5y7ie52bfpfhrqr62qcg3w4r6z3fidu7mjpjnh4yq" + "skill/dvilela/tsunami_abci/0.1.0": "bafybeidruxapjidrw5biadllcs77skedw7ehewcrzos35fm6nvtoyvkk7m", + "skill/dvilela/tsunami_chained_abci/0.1.0": "bafybeihoac2qx4h4icy4r4vjqinkeclb22aolfuyav4ysu2h6jyn6jclf4", + "agent/dvilela/tsunami/0.1.0": "bafybeiflmxrzfchky2cloqcdtwa4htgr6zniel3xj4bpqtzmpbads3c2vy", + "service/dvilela/tsunami/0.1.0": "bafybeihbhhm4xj477gww7dxwas7tvi6hdwojkm3jwt47im6uqscz7faple" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/scripts/aea-config-replace.py b/scripts/aea-config-replace.py index aad7b06..fa11ff5 100644 --- a/scripts/aea-config-replace.py +++ b/scripts/aea-config-replace.py @@ -120,6 +120,10 @@ def main() -> None: "reset_pause_duration" ] = f"${{int:{os.getenv('RESET_PAUSE_DURATION')}}}" + config[8]["models"]["params"]["args"][ + "subgraph_api_key" + ] = f"${{str:{os.getenv('SUBGRAPH_API_KEY')}}}" + with open(Path("tsunami", "aea-config.yaml"), "w", encoding="utf-8") as file: yaml.dump_all(config, file, sort_keys=False)