Skip to content

Commit

Permalink
fix: update rewards claimed timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Divya-Solulab committed Aug 29, 2024
1 parent cde7359 commit 14d9861
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
8 changes: 4 additions & 4 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"contract/valory/uniswap_v3_non_fungible_position_manager/0.1.0": "bafybeieljamerttxyo7z2yokwripnnhzkn4zply5lz457vsixf5wfu5px4",
"contract/valory/uniswap_v3_pool/0.1.0": "bafybeidglijnyueahpgivaykbhio2r3ovfeo23a256y3yb6g7be4hngx3a",
"contract/valory/merkl_distributor/0.1.0": "bafybeifctofnyhdic2sxmkqujvf3j2wwydhtvzhi6kdeutykenymplf4e4",
"skill/valory/liquidity_trader_abci/0.1.0": "bafybeihpcbu53vc7w3tp4t4hv7dqylzjqyspvnjiy62rudrni32zj5rfvy",
"skill/valory/optimus_abci/0.1.0": "bafybeibgu7qc52c7odhrvvjmqyyvukr3eobumxejyvi2htpxpivdkpqlfe",
"agent/valory/optimus/0.1.0": "bafybeifdglx3oedks6lsa6b3dkoqc4co3cayzgxvhln7jelb7s3drsvitm",
"service/valory/optimus/0.1.0": "bafybeie4y4pfxbpzudwkojwc6j33c34cuqm6rr7g5ieqtetoaqkrieguza"
"skill/valory/liquidity_trader_abci/0.1.0": "bafybeifxzzmy5jbgm7svukr6rlaufid5ws4whf65ocjk5xzhvtwn6zxesy",
"skill/valory/optimus_abci/0.1.0": "bafybeigsjrw4mfcq4ykpff5hwptywjvq7ba6xrsbn6usawmxy4ibwgwcb4",
"agent/valory/optimus/0.1.0": "bafybeiam3x7mwat2xrcscc2qitab472t6kxjpqyofnlouqe2mrhryyqtgm",
"service/valory/optimus/0.1.0": "bafybeiap4culn2xnqgbim4k7jlhu2zz5f2ujsc4kit5wrjewv5kfvmfmn4"
},
"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:bafybeihu2bcgjk2tqjiq2zhk3uogtfszqn4osvdt7ho3fubdpdj4jgdfjm
- valory/abstract_round_abci:0.1.0:bafybeibovsktd3uxur45nrcomq5shcn46cgxd5idmhxbmjhg32c5abyqim
- valory/liquidity_trader_abci:0.1.0:bafybeihpcbu53vc7w3tp4t4hv7dqylzjqyspvnjiy62rudrni32zj5rfvy
- valory/optimus_abci:0.1.0:bafybeibgu7qc52c7odhrvvjmqyyvukr3eobumxejyvi2htpxpivdkpqlfe
- valory/liquidity_trader_abci:0.1.0:bafybeifxzzmy5jbgm7svukr6rlaufid5ws4whf65ocjk5xzhvtwn6zxesy
- valory/optimus_abci:0.1.0:bafybeigsjrw4mfcq4ykpff5hwptywjvq7ba6xrsbn6usawmxy4ibwgwcb4
- valory/registration_abci:0.1.0:bafybeicnth5q4httefsusywx3zrrq4al47owvge72dqf2fziruicq6hqta
- valory/reset_pause_abci:0.1.0:bafybeievjciqdvxhqxfjd4whqs27h6qbxqzrae7wwj7fpvxlvmtw3x35im
- valory/termination_abci:0.1.0:bafybeid54buqxipiuduw7b6nnliiwsxajnltseuroad53wukfonpxca2om
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:bafybeifdglx3oedks6lsa6b3dkoqc4co3cayzgxvhln7jelb7s3drsvitm
agent: valory/optimus:0.1.0:bafybeiam3x7mwat2xrcscc2qitab472t6kxjpqyofnlouqe2mrhryyqtgm
number_of_agents: 1
deployment: {}
---
Expand Down
12 changes: 9 additions & 3 deletions packages/valory/skills/liquidity_trader_abci/behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ def async_act(self) -> Generator:
)
if invest_in_pool:
actions = yield from self.get_order_of_transactions()
self.context.logger.info(f"Actions: {actions}")

current_timestamp = cast(
SharedState, self.context.state
Expand Down Expand Up @@ -457,7 +456,8 @@ def async_act(self) -> Generator:
action = yield from self.build_claim_reward_action(rewards, chain)
if action:
actions.append(action)


self.context.logger.info(f"Actions: {actions}")
serialized_actions = json.dumps(actions)
sender = self.context.agent_address
payload = EvaluateStrategyPayload(sender=sender, actions=serialized_actions)
Expand Down Expand Up @@ -1184,7 +1184,7 @@ def get_next_event(self) -> Generator[None, None, Tuple[str, Dict, Optional[Dict
self.store_current_pool()
self.context.logger.info("Exit was successful! Removing current pool")

# If last action was Claim Rewards and it was successful we update the list of assets
# If last action was Claim Rewards and it was successful we update the list of assets and the last_reward_claimed_timestamp
if (
last_executed_action_index is not None
and Action(actions[last_executed_action_index]["action"])
Expand All @@ -1196,6 +1196,12 @@ def get_next_event(self) -> Generator[None, None, Tuple[str, Dict, Optional[Dict
action.get("tokens"), action.get("token_symbols")
):
self._add_token_to_assets(chain, token, token_symbol)

current_timestamp = cast(
SharedState, self.context.state
).round_sequence.last_round_transition_timestamp.timestamp()

return Event.UPDATE.value, {"last_reward_claimed_timestamp": current_timestamp}, {}

# if all actions have been executed we exit DecisionMaking
if current_action_index >= len(self.synchronized_data.actions):
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: bafybeih6fjcgvwzitvlujy56z3ugtk7nqfe47ohpdrpj7ggusigtmnyuya
behaviours.py: bafybeibichct63mitnlhdgiaqjbwi5cwiheixpf3b7fsal7dcnydoodr6y
dialogues.py: bafybeiay23otskx2go5xhtgdwfw2kd6rxd62sxxdu3njv7hageorl5zxzm
fsm_specification.yaml: bafybeia7dh7vuifjebf63wdqlw6gtrwcss5mapmdzhbju7i6edsw3zqxki
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:bafybeicnth5q4httefsusywx3zrrq4al47owvge72dqf2fziruicq6hqta
- valory/reset_pause_abci:0.1.0:bafybeievjciqdvxhqxfjd4whqs27h6qbxqzrae7wwj7fpvxlvmtw3x35im
- valory/termination_abci:0.1.0:bafybeid54buqxipiuduw7b6nnliiwsxajnltseuroad53wukfonpxca2om
- valory/liquidity_trader_abci:0.1.0:bafybeihpcbu53vc7w3tp4t4hv7dqylzjqyspvnjiy62rudrni32zj5rfvy
- valory/liquidity_trader_abci:0.1.0:bafybeifxzzmy5jbgm7svukr6rlaufid5ws4whf65ocjk5xzhvtwn6zxesy
- valory/transaction_settlement_abci:0.1.0:bafybeihq2yenstblmaadzcjousowj5kfn5l7ns5pxweq2gcrsczfyq5wzm
behaviours:
main:
Expand Down

0 comments on commit 14d9861

Please sign in to comment.