Skip to content

Commit

Permalink
Merge pull request #166 from valory-xyz/fix/redeeming
Browse files Browse the repository at this point in the history
Fix/redeeming
  • Loading branch information
0xArdi authored Dec 1, 2023
2 parents 4bdf566 + 35d95c2 commit 3b83824
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 26 deletions.
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": "bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i",
"skill/valory/decision_maker_abci/0.1.0": "bafybeihnjjfzoiihujnjd2gzbvmayz7avo5myslvl24wvyqj7zq4ufkvw4",
"skill/valory/trader_abci/0.1.0": "bafybeihqqz7yvn33iirooeqk7e6iz4dr5grwrfbkavamis6bnfoz6yj5pu",
"skill/valory/decision_maker_abci/0.1.0": "bafybeicbv5yf6rfabezmxjpwm7tjufop2yrquby6tq6kimo2tppvknhlym",
"skill/valory/trader_abci/0.1.0": "bafybeieszk2tzxxi5ulku6v5x3i3zltvzbxhgbm6f3pwxbzsejrdru6cla",
"contract/valory/market_maker/0.1.0": "bafybeid5jnetbsusgxkpqzwyiqlwut55xktfbeloipxcemcuu5oopmqtl4",
"agent/valory/trader/0.1.0": "bafybeigt6hd5cwuusdbu4u3ieqzvs4v4vihlr344rz55pb6neys55cwlre",
"service/valory/trader/0.1.0": "bafybeiaabwa7whlwpep5j2gpidnfvqgkgyo2vrw655t6epwtbh67umsb5m",
"agent/valory/trader/0.1.0": "bafybeifneutrvfu462ebebzoi7belih7j2jjaxex7f4tsaum4tzl42rus4",
"service/valory/trader/0.1.0": "bafybeif4g4626hotgl7k6vfvdc5zezynkpm3fkuih7xhs7lejuiegbppcu",
"contract/valory/erc20/0.1.0": "bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiaqh4pujl2o2ginl5lbe7p7en7t2ncs25gohysxdks5kd4lmqav3q",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicgaji7zj2zqjq4ppvurd3ecdfdjtyhrxzn3meyncji74ndivubdu",
"contract/valory/mech/0.1.0": "bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju",
"contract/valory/realitio/0.1.0": "bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa",
"contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4",
Expand Down
8 changes: 5 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:bafybeiencz2uytz6fqj5wg7mcunevxjh4xg5gd6pqcgkshgqywhcimweyi
- valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224
- valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiaqh4pujl2o2ginl5lbe7p7en7t2ncs25gohysxdks5kd4lmqav3q
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicgaji7zj2zqjq4ppvurd3ecdfdjtyhrxzn3meyncji74ndivubdu
- valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i
- valory/decision_maker_abci:0.1.0:bafybeihnjjfzoiihujnjd2gzbvmayz7avo5myslvl24wvyqj7zq4ufkvw4
- valory/trader_abci:0.1.0:bafybeihqqz7yvn33iirooeqk7e6iz4dr5grwrfbkavamis6bnfoz6yj5pu
- valory/decision_maker_abci:0.1.0:bafybeicbv5yf6rfabezmxjpwm7tjufop2yrquby6tq6kimo2tppvknhlym
- valory/trader_abci:0.1.0:bafybeieszk2tzxxi5ulku6v5x3i3zltvzbxhgbm6f3pwxbzsejrdru6cla
- valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe
default_ledger: ethereum
required_ledgers:
Expand Down Expand Up @@ -192,9 +192,11 @@ models:
realitio_address: ${str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57}
event_filtering_batch_size: ${int:5000}
reduce_factor: ${float:0.25}
minimum_batch_size: ${int:500}
max_filtering_retries: ${int:6}
redeeming_batch_size: ${int:5}
slippage: ${float:0.01}
redeem_round_timeout: ${float:3600.0}
policy_epsilon: ${float:0.1}
policy_store_path: ${str:/data/}
irrelevant_tools: ${list:["openai-text-davinci-002", "openai-text-davinci-003",
Expand Down
10 changes: 9 additions & 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:bafybeigt6hd5cwuusdbu4u3ieqzvs4v4vihlr344rz55pb6neys55cwlre
agent: valory/trader:0.1.0:bafybeifneutrvfu462ebebzoi7belih7j2jjaxex7f4tsaum4tzl42rus4
number_of_agents: 4
deployment: {}
---
Expand Down Expand Up @@ -107,6 +107,7 @@ type: skill
event_filtering_batch_size: ${EVENT_FILTERING_BATCH_SIZE:int:5000}
reduce_factor: ${REDUCE_FACTOR:float:0.25}
max_filtering_retries: ${MAX_FILTERING_RETRIES:int:6}
minimum_batch_size: ${MINIMUM_BATCH_SIZE:int:500}
redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1}
slippage: ${SLIPPAGE:float:0.01}
policy_epsilon: ${POLICY_EPSILON:float:0.1}
Expand All @@ -119,6 +120,7 @@ type: skill
agent_balance_threshold: ${AGENT_BALANCE_THRESHOLD:int:10000000000000000}
refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10}
tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1}
redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0}
benchmark_tool: &id005
args:
log_dir: ${LOG_DIR:str:/benchmarks}
Expand Down Expand Up @@ -186,6 +188,7 @@ type: skill
event_filtering_batch_size: ${EVENT_FILTERING_BATCH_SIZE:int:5000}
reduce_factor: ${REDUCE_FACTOR:float:0.25}
max_filtering_retries: ${MAX_FILTERING_RETRIES:int:6}
minimum_batch_size: ${MINIMUM_BATCH_SIZE:int:500}
redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1}
slippage: ${SLIPPAGE:float:0.01}
policy_epsilon: ${POLICY_EPSILON:float:0.1}
Expand All @@ -198,6 +201,7 @@ type: skill
agent_balance_threshold: ${AGENT_BALANCE_THRESHOLD:int:10000000000000000}
refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10}
tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1}
redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0}
benchmark_tool: *id005
2:
models:
Expand Down Expand Up @@ -263,6 +267,7 @@ type: skill
event_filtering_batch_size: ${EVENT_FILTERING_BATCH_SIZE:int:5000}
reduce_factor: ${REDUCE_FACTOR:float:0.25}
max_filtering_retries: ${MAX_FILTERING_RETRIES:int:6}
minimum_batch_size: ${MINIMUM_BATCH_SIZE:int:500}
redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1}
slippage: ${SLIPPAGE:float:0.01}
policy_epsilon: ${POLICY_EPSILON:float:0.1}
Expand All @@ -275,6 +280,7 @@ type: skill
agent_balance_threshold: ${AGENT_BALANCE_THRESHOLD:int:10000000000000000}
refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10}
tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1}
redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0}
benchmark_tool: *id005
3:
models:
Expand Down Expand Up @@ -340,6 +346,7 @@ type: skill
event_filtering_batch_size: ${EVENT_FILTERING_BATCH_SIZE:int:5000}
reduce_factor: ${REDUCE_FACTOR:float:0.25}
max_filtering_retries: ${MAX_FILTERING_RETRIES:int:6}
minimum_batch_size: ${MINIMUM_BATCH_SIZE:int:500}
redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1}
slippage: ${SLIPPAGE:float:0.01}
policy_epsilon: ${POLICY_EPSILON:float:0.1}
Expand All @@ -352,6 +359,7 @@ type: skill
agent_balance_threshold: ${AGENT_BALANCE_THRESHOLD:int:10000000000000000}
refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10}
tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1}
redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0}
benchmark_tool: *id005
---
public_id: valory/ledger:0.19.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,14 @@ def _check_already_redeemed(self) -> WaitableConditionType:
if not result:
n_retries += 1
keep_fraction = 1 - self.params.reduce_factor
batch_size = int(batch_size * keep_fraction)
reduced_batch_size = int(batch_size * keep_fraction)
# ensure that the batch size is at least the minimum batch size
batch_size = max(reduced_batch_size, self.params.minimum_batch_size)
self.redeeming_progress.event_filtering_batch_size = batch_size
self.context.logger.warning(
f"Repeating this call with a decreased batch size of {batch_size}."
)

continue

self.redeeming_progress.payouts.update(self.payouts_batch)
Expand Down Expand Up @@ -773,7 +776,6 @@ def _store_utilized_tools(self) -> None:

def finish_behaviour(self, payload: BaseTxPayload) -> Generator:
"""Finish the behaviour."""
self.redeeming_progress = RedeemingProgress()
self._store_utilized_tools()
yield from super().finish_behaviour(payload)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ alphabet_in:
- NO_MAJORITY
- NO_OP
- NO_REDEEMING
- REDEEM_ROUND_TIMEOUT
- ROUND_TIMEOUT
- SLOTS_UNSUPPORTED_ERROR
- TIE
Expand Down Expand Up @@ -68,7 +69,7 @@ transition_func:
(RedeemRound, NONE): ImpossibleRound
(RedeemRound, NO_MAJORITY): RedeemRound
(RedeemRound, NO_REDEEMING): FinishedWithoutRedeemingRound
(RedeemRound, ROUND_TIMEOUT): RedeemRound
(RedeemRound, REDEEM_ROUND_TIMEOUT): FinishedWithoutRedeemingRound
(SamplingRound, DONE): ToolSelectionRound
(SamplingRound, NONE): FinishedWithoutDecisionRound
(SamplingRound, NO_MAJORITY): SamplingRound
Expand Down
5 changes: 5 additions & 0 deletions packages/valory/skills/decision_maker_abci/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
"event_filtering_batch_size", kwargs, int
)
self.reduce_factor: float = self._ensure("reduce_factor", kwargs, float)
# the minimum batch size for redeeming operations, this is added to avoid the batch size to be too small
self.minimum_batch_size: int = self._ensure("minimum_batch_size", kwargs, int)
self.max_filtering_retries: int = self._ensure(
"max_filtering_retries", kwargs, int
)
Expand All @@ -239,6 +241,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
self.redeeming_batch_size: int = self._ensure(
"redeeming_batch_size", kwargs, int
)
self.redeem_round_timeout: float = self._ensure(
"redeem_round_timeout", kwargs, float
)
# a slippage in the range of [0, 1] to apply to the `minOutcomeTokensToBuy` when buying shares on a fpmm
self._slippage: float = 0.0
self.slippage: float = self._ensure("slippage", kwargs, float)
Expand Down
8 changes: 6 additions & 2 deletions packages/valory/skills/decision_maker_abci/rounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class DecisionMakerAbciApp(AbciApp[Event]):
- done: 8.
- no redeeming: 10.
- no majority: 6.
- round timeout: 6.
- redeem round timeout: 10.
- none: 12.
7. HandleFailedTxRound
- blacklist: 4.
Expand All @@ -126,6 +126,7 @@ class DecisionMakerAbciApp(AbciApp[Event]):
Timeouts:
round timeout: 30.0
redeem round timeout: 3600.0
"""

initial_round_cls: AppState = SamplingRound
Expand Down Expand Up @@ -184,7 +185,9 @@ class DecisionMakerAbciApp(AbciApp[Event]):
Event.DONE: FinishedDecisionMakerRound,
Event.NO_REDEEMING: FinishedWithoutRedeemingRound,
Event.NO_MAJORITY: RedeemRound,
Event.ROUND_TIMEOUT: RedeemRound,
# in case of a round timeout, there likely is something wrong with redeeming
# it could be the RPC, or some other issue. We don't want to be stuck trying to redeem.
Event.REDEEM_ROUND_TIMEOUT: FinishedWithoutRedeemingRound,
# this is here because of `autonomy analyse fsm-specs` falsely reporting it as missing from the transition
Event.NONE: ImpossibleRound,
},
Expand Down Expand Up @@ -217,6 +220,7 @@ class DecisionMakerAbciApp(AbciApp[Event]):
}
event_to_timeout: Dict[Event, float] = {
Event.ROUND_TIMEOUT: 30.0,
Event.REDEEM_ROUND_TIMEOUT: 3600.0,
}
db_pre_conditions: Dict[AppState, Set[str]] = {
RedeemRound: set(),
Expand Down
12 changes: 7 additions & 5 deletions packages/valory/skills/decision_maker_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ fingerprint:
behaviours/decision_receive.py: bafybeifacce2ke7oltnwnpdjdqfd74eaaw5wxnjfzk6c5tqdsxsmbzjj3m
behaviours/decision_request.py: bafybeievr7vae43e7jr4eqqhwe3emvgiih7ysa66jcb5g2oz5lbxua232q
behaviours/handle_failed_tx.py: bafybeidxpc6u575ymct5tdwutvzov6zqfdoio5irgldn3fw7q3lg36mmxm
behaviours/reedem.py: bafybeiekq77eatvf7xczbnyd4s6met4ci57ethwwoyxf5mhrcq7vuwiaxu
behaviours/reedem.py: bafybeifegxnjid4obmbodlc7ogw2ahoa64bgfneeltxw6mdubglfijylq4
behaviours/round_behaviour.py: bafybeig4tdktyu6hapoqymnxh2bgpds547st6a44heue657wkctwe4gjvm
behaviours/sampling.py: bafybeifzhm4sspdvt227ksl5hjn26offgqpwempgbcwbr6dq7gyi2a46sm
behaviours/tool_selection.py: bafybeifpvrrbftlkjsoiysnasihzttousk6hxnukzrln6z2d33e3zexkje
dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm
fsm_specification.yaml: bafybeifnob3ceim2mj7lqagtnpwqjqqxs5eg3oiwc73gwm6x5i2dvvlcya
fsm_specification.yaml: bafybeidqrxj3l3e555znk4wxx6spwaijz3bhc5yialhzbhd6ngk52w7jbq
handlers.py: bafybeihj33szgrcxnpd73s4nvluyxwwsvhjum2cuq3ilhhe6vfola3k7vy
models.py: bafybeihmqhxixmklpp656o7i27fas2afabusmar2heyfnx5e3kgzdcvkji
models.py: bafybeif3ubulx7cr7bh7yvwhik2footnfi6ofvjoioym3w6eka3owi67pe
payloads.py: bafybeigcic4vewdglakzpyqevhfwsolh4ywnbvxo5bgned7gl5uo3jif7m
policy.py: bafybeidpmx4ek3qze63zpuwixyf6t7bdv62ewgkzt3ljrzadiwdw64cueq
redeem_info.py: bafybeibddfxwp3577c3dl2utaowwltquu5fg6crezpumoebw563wxpbfrm
rounds.py: bafybeibbpiqyifu3bxldmxv3ebwwymwhkqid7eglf4gz7g6mmtcxtconle
rounds.py: bafybeifvov25vwzbbzgg4zvtptsnqve7t7hbjq3b7wuhie4fdwq2e7th7q
states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy
states/base.py: bafybeid265zag7ivlc6fng5croomwds2r43ozzcmom7yp4kzfz7o5bav6a
states/base.py: bafybeibhcc4pc3m6qelvdvxssnuglcwfaff55cr2kule74ekauyf3bahpq
states/bet_placement.py: bafybeibalhxhp2c4oljmiwqi6ds3g36fgtabmf42mb5sgq6z22znrcbhda
states/blacklisting.py: bafybeifruvxwwltndwazkzzbpc5nnnad3z5t5ofy6d3i7nssljbxl6gvxu
states/decision_receive.py: bafybeib3roo27nccj4eylaqwwzztzzzwsi6px5atjrch5wbqmpln2kyy6y
Expand Down Expand Up @@ -190,9 +190,11 @@ models:
conditional_tokens_address: '0xCeAfDD6bc0bEF976fdCd1112955828E00543c0Ce'
realitio_proxy_address: '0xAB16D643bA051C11962DA645f74632d3130c81E2'
realitio_address: '0x79e32aE03fb27B07C89c0c568F80287C01ca2E57'
redeem_round_timeout: 3600.0
event_filtering_batch_size: 5000
reduce_factor: 0.25
max_filtering_retries: 6
minimum_batch_size: 500
redeeming_batch_size: 5
policy_store_path: /data/
slippage: 0.01
Expand Down
1 change: 1 addition & 0 deletions packages/valory/skills/decision_maker_abci/states/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Event(Enum):
BLACKLIST = "blacklist"
NO_OP = "no_op"
ROUND_TIMEOUT = "round_timeout"
REDEEM_ROUND_TIMEOUT = "redeem_round_timeout"
NO_MAJORITY = "no_majority"


Expand Down
3 changes: 2 additions & 1 deletion packages/valory/skills/trader_abci/fsm_specification.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ alphabet_in:
- NO_OP
- NO_REDEEMING
- REDEEMING_DONE
- REDEEM_ROUND_TIMEOUT
- REFILL_REQUIRED
- RESET_AND_PAUSE_TIMEOUT
- RESET_TIMEOUT
Expand Down Expand Up @@ -138,7 +139,7 @@ transition_func:
(RedeemRound, NONE): ImpossibleRound
(RedeemRound, NO_MAJORITY): RedeemRound
(RedeemRound, NO_REDEEMING): CallCheckpointRound
(RedeemRound, ROUND_TIMEOUT): RedeemRound
(RedeemRound, REDEEM_ROUND_TIMEOUT): CallCheckpointRound
(RegistrationRound, DONE): UpdateBetsRound
(RegistrationRound, NO_MAJORITY): RegistrationRound
(RegistrationStartupRound, DONE): UpdateBetsRound
Expand Down
1 change: 1 addition & 0 deletions packages/valory/skills/trader_abci/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def setup(self) -> None:
TSEvent.VALIDATE_TIMEOUT: self.params.validate_timeout,
TSEvent.FINALIZE_TIMEOUT: self.params.finalize_timeout,
TSEvent.CHECK_TIMEOUT: self.params.history_check_timeout,
DecisionMakerEvent.REDEEM_ROUND_TIMEOUT: self.params.redeem_round_timeout,
ResetPauseEvent.RESET_AND_PAUSE_TIMEOUT: reset_pause_timeout,
}

Expand Down
10 changes: 6 additions & 4 deletions packages/valory/skills/trader_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ fingerprint:
behaviours.py: bafybeieesrefrpo5c5upzztgm5fwfrmxeagilacuau5nacobhsfvgpbzby
composition.py: bafybeiajga2m7pv7v4bxsjsnncavdns6gujg7qg7opfjyznlzip3gbd3nm
dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm
fsm_specification.yaml: bafybeihlhdsmmihnvwtggc2t2neqkm5uduw5krpgcxpz7m7xp5kjkf6jsm
fsm_specification.yaml: bafybeib3ycl5bjo5uilyaly7uoovvc3b3gpjrkuvdos5ffsgmrs73j6bkm
handlers.py: bafybeicamc6vmozij5dwvkxmbxjazsgf3sacojhstbjtq7vfggszxugvey
models.py: bafybeifxiptjrnv4hbw5l3mfxvb7hksmxf726kvab5lcms5btuc3vaahem
models.py: bafybeicn2hiu22rwbprphl7zftgxeeehsuj6nirydmyugwiqay6avvjbna
fingerprint_ignore_patterns: []
connections: []
contracts: []
Expand All @@ -25,8 +25,8 @@ skills:
- valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq
- valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224
- valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i
- valory/decision_maker_abci:0.1.0:bafybeihnjjfzoiihujnjd2gzbvmayz7avo5myslvl24wvyqj7zq4ufkvw4
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiaqh4pujl2o2ginl5lbe7p7en7t2ncs25gohysxdks5kd4lmqav3q
- valory/decision_maker_abci:0.1.0:bafybeicbv5yf6rfabezmxjpwm7tjufop2yrquby6tq6kimo2tppvknhlym
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicgaji7zj2zqjq4ppvurd3ecdfdjtyhrxzn3meyncji74ndivubdu
- valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe
behaviours:
main:
Expand Down Expand Up @@ -173,6 +173,7 @@ models:
event_filtering_batch_size: 5000
reduce_factor: 0.25
max_filtering_retries: 6
minimum_batch_size: 500
redeeming_batch_size: 5
slippage: 0.01
policy_epsilon: 0.1
Expand All @@ -189,6 +190,7 @@ models:
staking_contract_address: '0x5add592ce0a1B5DceCebB5Dcac086Cd9F9e3eA5C'
agent_balance_threshold: 10000000000000000
refill_check_interval: 10
redeem_round_timeout: 3600.0
tool_punishment_multiplier: 1
class_name: TraderParams
network_subgraph:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
AbstractRoundBehaviour,
BaseBehaviour,
)
from packages.valory.skills.decision_maker_abci.models import RedeemingProgress
from packages.valory.skills.decision_maker_abci.payloads import VotingPayload
from packages.valory.skills.tx_settlement_multiplexer_abci.models import (
TxSettlementMultiplexerParams,
Expand Down Expand Up @@ -128,10 +129,30 @@ def synchronized_data(self) -> SynchronizedData:
"""Return the synchronized data."""
return SynchronizedData(super().synchronized_data.db)

def _on_redeem_round_tx_settled(self) -> None:
"""Handle the redeem round."""
self.context.logger.info(
"Redeeming transaction was settled. Resetting the redeeming progress."
)
self.shared_state.redeeming_progress = RedeemingProgress() # type: ignore

def _on_tx_settled(self) -> None:
"""Handle the tx settled event."""
tx_submitter = self.synchronized_data.tx_submitter
handler_name = f"_on_{tx_submitter}_tx_settled"
handler = getattr(self, handler_name, None)
if handler is None:
self.context.logger.info(
f"No post tx settlement handler exists for {tx_submitter} txs."
)
return
handler()

def async_act(self) -> Generator:
"""Simply log that a tx is settled and wait for the round end."""
msg = f"The transaction submitted by {self.synchronized_data.tx_submitter} was successfully settled."
self.context.logger.info(msg)
self._on_tx_settled()
yield from self.wait_until_round_end()
self.set_done()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0'
fingerprint:
README.md: bafybeiegcjg2wjrsqhrmvyulioch3d67rnbzkx5af3ztkaw7kxathjreda
__init__.py: bafybeide6k22zk4f3hyzhpapaoddsnxpw5elqcfvrxxj4nfvpzctv6jqhu
behaviours.py: bafybeihmhpvorg4tgdhrhtv6ks6uxza4k5qxvnxanfhil75t54rfb5ykta
behaviours.py: bafybeifboxplklx3eqaljkugio7y72thpb5jdboqcickefuklhverksw5y
dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm
fsm_specification.yaml: bafybeidwxjna36auqbtqlehx73kyb6o74suhzj5bothgtiapcj35b7gzve
handlers.py: bafybeiafbqr7ojfcbwohvee7x4zzswad3ymfrrbjlfz7uuuttmn3qdfs6q
Expand All @@ -21,7 +21,7 @@ protocols:
- valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru
skills:
- valory/abstract_round_abci:0.1.0:bafybeidau7loztcfy3mxvoqrv7otbpciemd2wf3lsxyjraq4dcvuvib25e
- valory/decision_maker_abci:0.1.0:bafybeihnjjfzoiihujnjd2gzbvmayz7avo5myslvl24wvyqj7zq4ufkvw4
- valory/decision_maker_abci:0.1.0:bafybeicbv5yf6rfabezmxjpwm7tjufop2yrquby6tq6kimo2tppvknhlym
- valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe
behaviours:
main:
Expand Down

0 comments on commit 3b83824

Please sign in to comment.