Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix db update after the first redeeming period #152

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/packages.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"dev": {
"skill/valory/market_manager_abci/0.1.0": "bafybeigesvgfjjtzxnsofhwutsp4pyclxnn62z2luy4xt7yarm64u6pbti",
"skill/valory/decision_maker_abci/0.1.0": "bafybeiane2fugk6ojsfoznceqptumzxyv7btrahj7ae643k56rpiajqjpu",
"skill/valory/trader_abci/0.1.0": "bafybeihkfhgewgrynhj4esyn2l3knfj2pglic53qbygyfmxhtqzrgyxgqa",
"skill/valory/decision_maker_abci/0.1.0": "bafybeibuc4wl6olt6eyygn2e76gtxlef7vzfaxbymralqe6vc5qwpgtpbu",
"skill/valory/trader_abci/0.1.0": "bafybeiemwbcfcw4ggxmwhl4zjcft4sox7tybcbwgnvy7jz4qaekhzkfdde",
"contract/valory/market_maker/0.1.0": "bafybeih4r35d3plsjw56ham6xvi6dn4semmuihc53lh3qofpwj242rnjkq",
"agent/valory/trader/0.1.0": "bafybeicn4tk2j5anbhfjkittphrwnqrngisravjgae2f4icto3pf5hs4ci",
"service/valory/trader/0.1.0": "bafybeiga5c6gh7nsajqwjcljklxxl56jycc73u5ic7ufn66hpe27f3qdf4",
"agent/valory/trader/0.1.0": "bafybeicb4m2np45z5v5q573pgqzyiyp5wfermhn6ncuqqr4rof4oewle3u",
"service/valory/trader/0.1.0": "bafybeibsnfe7m3lif4jl7vkwrhia47hko5l5u5dboguhgv2pske3nflvoi",
"contract/valory/erc20/0.1.0": "bafybeidpjppgs7jlig2gdpdr3a6q3etbejpxrifjhzlcufpo5zf23dqv7y",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeihrpvpvahcwj3itkzp7xks4bulzuwzjei6zs7j7erdxxc33p6egje",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeihgcwtate3ujsfualxwhrf62vwbkgx7wdioeqy3pfc4eban4kzqjm",
"contract/valory/mech/0.1.0": "bafybeigjn4q6mxal2hxzjyzldl4t4aykkpxjnbsgnli2c3xwf6binkmn74",
"contract/valory/realitio/0.1.0": "bafybeiamgkwwqhray4fs2hlipwxkq7mosmi7ev7jut4vneetaaycc4ruji",
"contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4",
Expand Down
6 changes: 3 additions & 3 deletions packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ skills:
- valory/reset_pause_abci:0.1.0:bafybeiflxcl2dtzayyzzddc4f2astzxunyp66meutornanrgeemicdea5q
- valory/termination_abci:0.1.0:bafybeifazwrksp756h7z42qqfcgi6lya6wmhbx46l7ghlaooe45gqnju7q
- valory/transaction_settlement_abci:0.1.0:bafybeigxkdujugzvve2dszkwr5kgfx4uhz2epofo4lorbcnthmzfjegwzi
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihrpvpvahcwj3itkzp7xks4bulzuwzjei6zs7j7erdxxc33p6egje
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihgcwtate3ujsfualxwhrf62vwbkgx7wdioeqy3pfc4eban4kzqjm
- valory/market_manager_abci:0.1.0:bafybeigesvgfjjtzxnsofhwutsp4pyclxnn62z2luy4xt7yarm64u6pbti
- valory/decision_maker_abci:0.1.0:bafybeiane2fugk6ojsfoznceqptumzxyv7btrahj7ae643k56rpiajqjpu
- valory/trader_abci:0.1.0:bafybeihkfhgewgrynhj4esyn2l3knfj2pglic53qbygyfmxhtqzrgyxgqa
- valory/decision_maker_abci:0.1.0:bafybeibuc4wl6olt6eyygn2e76gtxlef7vzfaxbymralqe6vc5qwpgtpbu
- valory/trader_abci:0.1.0:bafybeiemwbcfcw4ggxmwhl4zjcft4sox7tybcbwgnvy7jz4qaekhzkfdde
- valory/staking_abci:0.1.0:bafybeifoejd5q6wgmqohhwp46uwk3g4ysr7f5mf2fbmjhxulwzwdy2udui
default_ledger: ethereum
required_ledgers:
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/trader/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeicn4tk2j5anbhfjkittphrwnqrngisravjgae2f4icto3pf5hs4ci
agent: valory/trader:0.1.0:bafybeicb4m2np45z5v5q573pgqzyiyp5wfermhn6ncuqqr4rof4oewle3u
number_of_agents: 4
deployment: {}
---
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/skills/decision_maker_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ fingerprint:
redeem_info.py: bafybeibddfxwp3577c3dl2utaowwltquu5fg6crezpumoebw563wxpbfrm
rounds.py: bafybeibbpiqyifu3bxldmxv3ebwwymwhkqid7eglf4gz7g6mmtcxtconle
states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy
states/base.py: bafybeihpib3jzoxlbdsjvjxaeuujrb5plwxf2rbg2egcjpucpwdecgvtba
states/base.py: bafybeid265zag7ivlc6fng5croomwds2r43ozzcmom7yp4kzfz7o5bav6a
states/bet_placement.py: bafybeibalhxhp2c4oljmiwqi6ds3g36fgtabmf42mb5sgq6z22znrcbhda
states/blacklisting.py: bafybeifruvxwwltndwazkzzbpc5nnnad3z5t5ofy6d3i7nssljbxl6gvxu
states/decision_receive.py: bafybeib3roo27nccj4eylaqwwzztzzzwsi6px5atjrch5wbqmpln2kyy6y
states/decision_request.py: bafybeic7otc3hjb753svbmur3yyk6szahc25yii3x4w4vcnpfz6jwvacuu
states/final_states.py: bafybeidiwhuyd5zm2cq7vhv2owcrxdpm7fnvn3db6p6tql4jz5hgpalflu
states/handle_failed_tx.py: bafybeihewm2vernvhktuorljdupjqcg2p5vs6wvsira2d62wkoyo5xlzjm
states/redeem.py: bafybeield6wxvhm4wbcgfgrb4lsq2kzceaiwixgfirqjydp6vxlokw3n34
states/redeem.py: bafybeicbhbljpav3fhnrpj4tvhxtpbbbvrwmha2scf6jdq37ox6vhc427y
states/sampling.py: bafybeidnvdogjlthjfe7jpaiuezm3xydrbxxukyoss4gx6t5fdin52rsta
states/tool_selection.py: bafybeiaaijv6dukp3bmsptcwkcmumc6wu6ztzkvaqzsqqjbfn4ozgyuykq
tests/__init__.py: bafybeiakpi3k3kc7wrjj7hrluvjcj36lu2gezpmrctwiz5yg2fe7ggnf3i
Expand Down
6 changes: 4 additions & 2 deletions packages/valory/skills/decision_maker_abci/states/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,17 @@ def utilized_tools(self) -> Dict[str, int]:
@property
def redeemed_condition_ids(self) -> Set[str]:
"""Get the condition ids of all the redeemed positions."""
ids = str(self.db.get("redeemed_condition_ids", "[]"))
ids = self.db.get("redeemed_condition_ids", None)
if ids is None:
return set()
return set(json.loads(ids))

@property
def payout_so_far(self) -> int:
"""Get the payout of all the redeemed positions so far."""
payout = self.db.get("payout_so_far", None)
if payout is None:
payout = 0
return 0
return int(payout)

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Enum]]:
if synced_data.period_count == 0:
# necessary for persisted keys to function properly and not raise an exception when the first period ends
update = {
db_key: getattr(synced_data, db_key)
db_key: getattr(synced_data.db, db_key, None)
for db_key in RedeemRound.selection_key
}
synced_data.db.update(**update)
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/skills/trader_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ skills:
- valory/transaction_settlement_abci:0.1.0:bafybeigxkdujugzvve2dszkwr5kgfx4uhz2epofo4lorbcnthmzfjegwzi
- valory/termination_abci:0.1.0:bafybeifazwrksp756h7z42qqfcgi6lya6wmhbx46l7ghlaooe45gqnju7q
- valory/market_manager_abci:0.1.0:bafybeigesvgfjjtzxnsofhwutsp4pyclxnn62z2luy4xt7yarm64u6pbti
- valory/decision_maker_abci:0.1.0:bafybeiane2fugk6ojsfoznceqptumzxyv7btrahj7ae643k56rpiajqjpu
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihrpvpvahcwj3itkzp7xks4bulzuwzjei6zs7j7erdxxc33p6egje
- valory/decision_maker_abci:0.1.0:bafybeibuc4wl6olt6eyygn2e76gtxlef7vzfaxbymralqe6vc5qwpgtpbu
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihgcwtate3ujsfualxwhrf62vwbkgx7wdioeqy3pfc4eban4kzqjm
- valory/staking_abci:0.1.0:bafybeifoejd5q6wgmqohhwp46uwk3g4ysr7f5mf2fbmjhxulwzwdy2udui
behaviours:
main:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protocols:
- valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru
skills:
- valory/abstract_round_abci:0.1.0:bafybeigrqhygo2hl2owisj5rqyh3acdvee773ajije64snlzalcgtaac7q
- valory/decision_maker_abci:0.1.0:bafybeiane2fugk6ojsfoznceqptumzxyv7btrahj7ae643k56rpiajqjpu
- valory/decision_maker_abci:0.1.0:bafybeibuc4wl6olt6eyygn2e76gtxlef7vzfaxbymralqe6vc5qwpgtpbu
- valory/staking_abci:0.1.0:bafybeifoejd5q6wgmqohhwp46uwk3g4ysr7f5mf2fbmjhxulwzwdy2udui
behaviours:
main:
Expand Down