Skip to content

Commit

Permalink
Merge pull request #21 from valory-xyz/fix/check-swap-status
Browse files Browse the repository at this point in the history
fix: remove retries for status check
  • Loading branch information
Adamantios authored Oct 14, 2024
2 parents 93b84f8 + 552f2bf commit 96332a9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 20 deletions.
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 @@
"contract/valory/merkl_distributor/0.1.0": "bafybeihaqsvmncuzmwv2r6iuzc5t7ur6ugdhephz7ydftypksjidpsylbq",
"contract/valory/staking_token/0.1.0": "bafybeifrvtkofw5c26b3irm6izqfdpik6vpjhm6hqwcdzx333h6vhdanai",
"contract/valory/staking_activity_checker/0.1.0": "bafybeibjzsi2r5b6xd4iwl4wbwldptnynryzsdpifym4mkv32ynswx22ou",
"skill/valory/liquidity_trader_abci/0.1.0": "bafybeiehcunbb5b5nbazahgham47ankof4ad52b4nmjlgornwdwagyotna",
"skill/valory/optimus_abci/0.1.0": "bafybeiex2jwrqzebrhrleczty3bzfurdkmhbbwg3wd4zfwmyravjntumk4",
"agent/valory/optimus/0.1.0": "bafybeig4dhq3ub6hnvromcfgezatybxujvaliape64jqtk24qldlk2vutq",
"service/valory/optimus/0.1.0": "bafybeige2z6ek4qictsutpyc4njfokrabvm3w7fffq343iltf5xssxzol4"
"skill/valory/liquidity_trader_abci/0.1.0": "bafybeicll2viv2bs7jmkzr7lskc7qgscvdv3gurlqgzr36npdzvckpja4u",
"skill/valory/optimus_abci/0.1.0": "bafybeid2luqlruokidipj5s4xp7ygetfyirck5j7wmkgzjqfuydx27p42a",
"agent/valory/optimus/0.1.0": "bafybeieanzpdxesfkufg573qakjyqkxnv4wxr3sd4vmlozzic7gxlx6aqq",
"service/valory/optimus/0.1.0": "bafybeifdjaennczbswrpzgfty6gvwbhf4xx2dbizir5mdzcjpb6k3zhloy"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/agents/optimus/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ protocols:
skills:
- valory/abstract_abci:0.1.0:bafybeidz54kvxhbdmpruzguuzzq7bjg4pekjb5amqobkxoy4oqknnobopu
- valory/abstract_round_abci:0.1.0:bafybeiajjzuh6vf23crp55humonknirvv2f4s3dmdlfzch6tc5ow52pcgm
- valory/liquidity_trader_abci:0.1.0:bafybeiehcunbb5b5nbazahgham47ankof4ad52b4nmjlgornwdwagyotna
- valory/optimus_abci:0.1.0:bafybeiex2jwrqzebrhrleczty3bzfurdkmhbbwg3wd4zfwmyravjntumk4
- valory/liquidity_trader_abci:0.1.0:bafybeicll2viv2bs7jmkzr7lskc7qgscvdv3gurlqgzr36npdzvckpja4u
- valory/optimus_abci:0.1.0:bafybeid2luqlruokidipj5s4xp7ygetfyirck5j7wmkgzjqfuydx27p42a
- valory/registration_abci:0.1.0:bafybeiffipsowrqrkhjoexem7ern5ob4fabgif7wa6gtlszcoaop2e3oey
- valory/reset_pause_abci:0.1.0:bafybeif4lgvbzsmzljesxbphycdv52ka7qnihyjrjpfaseclxadcmm6yiq
- valory/termination_abci:0.1.0:bafybeiekkpo5qef5zaeagm3si6v45qxcojvtjqe4a5ceccvk4q7k3xi3bi
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/optimus/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ aea_version: '>=1.0.0, <2.0.0'
license: Apache-2.0
fingerprint: {}
fingerprint_ignore_patterns: []
agent: valory/optimus:0.1.0:bafybeig4dhq3ub6hnvromcfgezatybxujvaliape64jqtk24qldlk2vutq
agent: valory/optimus:0.1.0:bafybeieanzpdxesfkufg573qakjyqkxnv4wxr3sd4vmlozzic7gxlx6aqq
number_of_agents: 1
deployment: {}
---
Expand Down
19 changes: 8 additions & 11 deletions packages/valory/skills/liquidity_trader_abci/behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,7 @@ def get_next_event(self) -> Generator[None, None, Tuple[str, Dict]]:
actions = self.synchronized_data.actions
if not actions:
self.context.logger.info("No actions to prepare")
return Event.DONE.value, {}, {}
return Event.DONE.value, {}

positions = self.synchronized_data.positions
last_round_id = self.context.state.round_sequence._abci_app._previous_rounds[
Expand All @@ -1831,9 +1831,11 @@ def get_next_event(self) -> Generator[None, None, Tuple[str, Dict]]:

if last_executed_action_index is not None:
if self.synchronized_data.last_action == Action.ENTER_POOL.value:
self._post_execute_enter_pool(actions, last_executed_action_index)
yield from self._post_execute_enter_pool(
actions, last_executed_action_index
)
if self.synchronized_data.last_action == Action.EXIT_POOL.value:
self._post_execute_exit_pool()
yield from self._post_execute_exit_pool()
if (
self.synchronized_data.last_action == Action.CLAIM_REWARDS.value
and last_round_id != DecisionMakingRound.auto_round_id()
Expand All @@ -1856,7 +1858,7 @@ def get_next_event(self) -> Generator[None, None, Tuple[str, Dict]]:

if current_action_index >= len(self.synchronized_data.actions):
self.context.logger.info("All actions have been executed")
return Event.DONE.value, {}, {}
return Event.DONE.value, {}

res = yield from self._prepare_next_action(
positions, actions, current_action_index, last_round_id
Expand Down Expand Up @@ -2236,8 +2238,8 @@ def get_swap_status(

url = f"{self.params.lifi_check_status_url}?txHash={tx_hash}"
self.context.logger.info(f"checking status from endpoint {url}")
MAX_RETRIES = 10
for _attempt in range(MAX_RETRIES):

while True:
response = yield from self.get_http_response(
method="GET",
url=url,
Expand Down Expand Up @@ -2274,11 +2276,6 @@ def get_swap_status(

return status, sub_status

self.context.logger.error(
f"Failed to fetch status after {MAX_RETRIES} retries."
)
return None, None

def get_enter_pool_tx_hash(
self, positions, action
) -> Generator[None, None, Tuple[Optional[str], Optional[str], Optional[str]]]:
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/liquidity_trader_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
aea_version: '>=1.0.0, <2.0.0'
fingerprint:
__init__.py: bafybeia7bn2ahqqwkf63ptje6rfnftuwrsp33sswgpcbh5osbesxxr6g4m
behaviours.py: bafybeig5qm7kznx5paaxsel3ju2xotwk47vgswhbclzdttsbna4hfxj43u
behaviours.py: bafybeihi6lt7svxnhkj3w56fbetnp562vcrf7whex2ie5ig5zuor76sydy
dialogues.py: bafybeiay23otskx2go5xhtgdwfw2kd6rxd62sxxdu3njv7hageorl5zxzm
fsm_specification.yaml: bafybeiabbiulb7k6xkjysulmy6o4ugnhxlpp5jiaeextvwj65q4ttadoeq
handlers.py: bafybeidxw2lvgiifmo4siobpwuwbxscuifrdo3gnkjyn6bgexotj5f7zf4
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/optimus_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ skills:
- valory/registration_abci:0.1.0:bafybeiffipsowrqrkhjoexem7ern5ob4fabgif7wa6gtlszcoaop2e3oey
- valory/reset_pause_abci:0.1.0:bafybeif4lgvbzsmzljesxbphycdv52ka7qnihyjrjpfaseclxadcmm6yiq
- valory/termination_abci:0.1.0:bafybeiekkpo5qef5zaeagm3si6v45qxcojvtjqe4a5ceccvk4q7k3xi3bi
- valory/liquidity_trader_abci:0.1.0:bafybeiehcunbb5b5nbazahgham47ankof4ad52b4nmjlgornwdwagyotna
- valory/liquidity_trader_abci:0.1.0:bafybeicll2viv2bs7jmkzr7lskc7qgscvdv3gurlqgzr36npdzvckpja4u
- valory/transaction_settlement_abci:0.1.0:bafybeielv6eivt2z6nforq43xewl2vmpfwpdu2s2vfogobziljnwsclmlm
behaviours:
main:
Expand Down

0 comments on commit 96332a9

Please sign in to comment.