Skip to content

Commit

Permalink
Merge pull request #14 from dvilelaf/fix/omen
Browse files Browse the repository at this point in the history
Fix/omen
  • Loading branch information
dvilelaf authored Jul 2, 2024
2 parents b658937 + 016d685 commit f89de3d
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 16 deletions.
5 changes: 3 additions & 2 deletions packages/dvilela/agents/tsunami/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion packages/dvilela/services/tsunami/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions packages/dvilela/skills/tsunami_abci/behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down
4 changes: 3 additions & 1 deletion packages/dvilela/skills/tsunami_abci/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions packages/dvilela/skills/tsunami_abci/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 4 additions & 3 deletions packages/dvilela/skills/tsunami_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: {}
Expand Down
3 changes: 2 additions & 1 deletion packages/dvilela/skills/tsunami_chained_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions scripts/aea-config-replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit f89de3d

Please sign in to comment.