diff --git a/packages/packages.json b/packages/packages.json index 91ae9fd03..621786ba6 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,17 +1,17 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeidnqerwkljbjgog73qaa5duu5ymsfjs6jsszeupseshx7go3n6afq", - "skill/valory/decision_maker_abci/0.1.0": "bafybeieryuvqcg5ko3mnkpw3j34scedrqgomo2xm42bhweszwgwgtjhi6u", - "skill/valory/trader_abci/0.1.0": "bafybeihxfq6vtr7krfwbmkh4j2ozlzdccl4ladxwwhkqmkaa74koivanu4", + "skill/valory/decision_maker_abci/0.1.0": "bafybeiersmwlzih3yhv5nhy7ay6lqe377wn757pugsl457ypoik57aotom", + "skill/valory/trader_abci/0.1.0": "bafybeiajxg7a47vubwyhqj7brrqheoq3ohwqlq3t4uck75r5p45klt43be", "contract/valory/market_maker/0.1.0": "bafybeidaz4dol7qsrwitw5jwasjtvd2vtlxhxizwkzen5kurblwacz4biu", - "agent/valory/trader/0.1.0": "bafybeiehv2cjbusia35yjxqim25jvq4d6tni5kcfckemgkvixzx327p7ui", - "service/valory/trader/0.1.0": "bafybeia5rzebe7z3nfgpfngp44rloro3do3y4wxxuroajftqbuiqojnjly", + "agent/valory/trader/0.1.0": "bafybeihyksse4ohe3x4tshyrlsral6dgptvb6uqvoteu7prlsdggqjk7tm", + "service/valory/trader/0.1.0": "bafybeiemvxyaai7lcfjx5zujfixxfew6vw2xfdpdqzwyyiwnsg6jxu55ny", "contract/valory/erc20/0.1.0": "bafybeid6p64a6tnovatbwybc6ocdd4u7bqkxsb4ks52rvf7ozcxxl6iaf4", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibkj47cuymq57ccbje6hjtidvpycs6rg2cpshoehi7filrsgokdfi", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicwz2jiwwkcufavqc3ttxkaowjcguq7cuaczzlsvonbv2fk373ezu", "contract/valory/mech/0.1.0": "bafybeiddc6pgurpyja2k64wzsb3jgcvl254s7rplgt5iooftsyfalqlbfq", "contract/valory/realitio/0.1.0": "bafybeicdgm2a7evjw6szcpo3uaam5mzd6axtevtzwvejr6uaeymbg437da", "contract/valory/realitio_proxy/0.1.0": "bafybeibvndq6756qck7forgeavhdbn6ykgqs2ufyg7n5g6qdfpveatxuwy", - "contract/valory/conditional_tokens/0.1.0": "bafybeicxwjdbmjajgr5rsmadtkxxwmcm42r2htef3tvng73uzib4hmb6qa", + "contract/valory/conditional_tokens/0.1.0": "bafybeig26ktayat3m32to3riescg7plsahdylmpf3ubsguiosqixdwjm6m", "contract/valory/agent_registry/0.1.0": "bafybeigpd6wvnbb7fbf6yd77rugepv5hrbb6l3qfodstwgemagtcgne3bm" }, "third_party": { diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 4edbe5237..7f8694200 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -22,7 +22,7 @@ contracts: - valory/erc20:0.1.0:bafybeid6p64a6tnovatbwybc6ocdd4u7bqkxsb4ks52rvf7ozcxxl6iaf4 - valory/multisend:0.1.0:bafybeieg4tywd5lww2vygvpkilg3hcepa4rmhehjuamyvdf6vazt554v6u - valory/mech:0.1.0:bafybeiddc6pgurpyja2k64wzsb3jgcvl254s7rplgt5iooftsyfalqlbfq -- valory/conditional_tokens:0.1.0:bafybeicxwjdbmjajgr5rsmadtkxxwmcm42r2htef3tvng73uzib4hmb6qa +- valory/conditional_tokens:0.1.0:bafybeig26ktayat3m32to3riescg7plsahdylmpf3ubsguiosqixdwjm6m - valory/realitio:0.1.0:bafybeicdgm2a7evjw6szcpo3uaam5mzd6axtevtzwvejr6uaeymbg437da - valory/realitio_proxy:0.1.0:bafybeibvndq6756qck7forgeavhdbn6ykgqs2ufyg7n5g6qdfpveatxuwy protocols: @@ -41,10 +41,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeigeoc363gv3wp2rrmk6p2fdxney33nxd3owtpfugzapgruwe4klyu - valory/termination_abci:0.1.0:bafybeigqpij2sgrpnilqjljfciixop4fldq5qceixc7534q6af4potdmdm - valory/transaction_settlement_abci:0.1.0:bafybeia7rzsbea3ch4gcafyp3z6uvqh4npws2xpdwbkkdbrqqpjops7nui -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibkj47cuymq57ccbje6hjtidvpycs6rg2cpshoehi7filrsgokdfi +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicwz2jiwwkcufavqc3ttxkaowjcguq7cuaczzlsvonbv2fk373ezu - valory/market_manager_abci:0.1.0:bafybeidnqerwkljbjgog73qaa5duu5ymsfjs6jsszeupseshx7go3n6afq -- valory/decision_maker_abci:0.1.0:bafybeieryuvqcg5ko3mnkpw3j34scedrqgomo2xm42bhweszwgwgtjhi6u -- valory/trader_abci:0.1.0:bafybeihxfq6vtr7krfwbmkh4j2ozlzdccl4ladxwwhkqmkaa74koivanu4 +- valory/decision_maker_abci:0.1.0:bafybeiersmwlzih3yhv5nhy7ay6lqe377wn757pugsl457ypoik57aotom +- valory/trader_abci:0.1.0:bafybeiajxg7a47vubwyhqj7brrqheoq3ohwqlq3t4uck75r5p45klt43be default_ledger: ethereum required_ledgers: - ethereum diff --git a/packages/valory/contracts/conditional_tokens/contract.py b/packages/valory/contracts/conditional_tokens/contract.py index 07f470417..b1ded5aa7 100644 --- a/packages/valory/contracts/conditional_tokens/contract.py +++ b/packages/valory/contracts/conditional_tokens/contract.py @@ -51,6 +51,7 @@ def check_redeemed( condition_ids: List[HexBytes], index_sets: List[List[int]], from_block_numbers: Dict[HexBytes, BlockIdentifier], + chunk_size: int = 50_000, ) -> JSONLike: """Filter to find out whether a position has already been redeemed.""" earliest_block = DEFAULT_FROM_BLOCK @@ -71,18 +72,21 @@ def check_redeemed( collateral_tokens_checksummed = [ to_checksum(token) for token in collateral_tokens ] - - payout_filter = contract_instance.events.PayoutRedemption.build_filter() - payout_filter.fromBlock = earliest_block - payout_filter.toBlock = DEFAULT_TO_BLOCK - payout_filter.args.redeemer.match_single(redeemer_checksummed) - payout_filter.args.collateralToken.match_any(*collateral_tokens_checksummed) - payout_filter.args.parentCollectionId.match_any(*parent_collection_ids) - payout_filter.args.conditionId.match_any(*condition_ids) - payout_filter.args.indexSets.match_any(*index_sets) - + latest_block = ledger_api.api.eth.block_number try: - redeemed = list(payout_filter.deploy(ledger_api.api).get_all_entries()) + redeemed = [] + for from_block in range(earliest_block, latest_block, chunk_size): + to_block = min(from_block + chunk_size, latest_block) + payout_filter = contract_instance.events.PayoutRedemption.build_filter() + payout_filter.args.redeemer.match_single(redeemer_checksummed) + payout_filter.args.collateralToken.match_any(*collateral_tokens_checksummed) + payout_filter.args.parentCollectionId.match_any(*parent_collection_ids) + payout_filter.args.conditionId.match_any(*condition_ids) + payout_filter.args.indexSets.match_any(*index_sets) + payout_filter.fromBlock = from_block + payout_filter.toBlock = to_block + redeemed_chunk = list(payout_filter.deploy(ledger_api.api).get_all_entries()) + redeemed.extend(redeemed_chunk) except (Urllib3ReadTimeoutError, RequestsReadTimeoutError): msg = ( "The RPC timed out! This usually happens if the filtering is too wide. " diff --git a/packages/valory/contracts/conditional_tokens/contract.yaml b/packages/valory/contracts/conditional_tokens/contract.yaml index 467447920..b754d54f6 100644 --- a/packages/valory/contracts/conditional_tokens/contract.yaml +++ b/packages/valory/contracts/conditional_tokens/contract.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeidhdxio3oq5gqdnxmngumvt3fcd6zyiyrpk5f2k4dwhflbg4e5iky build/ConditionalTokens.json: bafybeia2ahis7zx2yhhf23kpkcxu56hto6fwg6ptjg5ld46lp4dgz7cz3e - contract.py: bafybeigzs6lox5rebabne5knyxxpz4erdlgveogcebsqa4lxasyis3ichu + contract.py: bafybeibex3xrphf7ssmblx3bo6cy3qzv2wk3nxmnv3k6w56yr6cwnkejlq fingerprint_ignore_patterns: [] class_name: ConditionalTokensContract contract_interface_paths: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index a29b0bd62..d8fbd0945 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeiehv2cjbusia35yjxqim25jvq4d6tni5kcfckemgkvixzx327p7ui +agent: valory/trader:0.1.0:bafybeihyksse4ohe3x4tshyrlsral6dgptvb6uqvoteu7prlsdggqjk7tm number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index bfa3b3f5a..e1550e3ef 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -49,7 +49,7 @@ contracts: - valory/erc20:0.1.0:bafybeid6p64a6tnovatbwybc6ocdd4u7bqkxsb4ks52rvf7ozcxxl6iaf4 - valory/multisend:0.1.0:bafybeieg4tywd5lww2vygvpkilg3hcepa4rmhehjuamyvdf6vazt554v6u - valory/mech:0.1.0:bafybeiddc6pgurpyja2k64wzsb3jgcvl254s7rplgt5iooftsyfalqlbfq -- valory/conditional_tokens:0.1.0:bafybeicxwjdbmjajgr5rsmadtkxxwmcm42r2htef3tvng73uzib4hmb6qa +- valory/conditional_tokens:0.1.0:bafybeig26ktayat3m32to3riescg7plsahdylmpf3ubsguiosqixdwjm6m - valory/realitio:0.1.0:bafybeicdgm2a7evjw6szcpo3uaam5mzd6axtevtzwvejr6uaeymbg437da - valory/realitio_proxy:0.1.0:bafybeibvndq6756qck7forgeavhdbn6ykgqs2ufyg7n5g6qdfpveatxuwy - valory/agent_registry:0.1.0:bafybeigpd6wvnbb7fbf6yd77rugepv5hrbb6l3qfodstwgemagtcgne3bm diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index b9799882f..b81041fff 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeia7rzsbea3ch4gcafyp3z6uvqh4npws2xpdwbkkdbrqqpjops7nui - valory/termination_abci:0.1.0:bafybeigqpij2sgrpnilqjljfciixop4fldq5qceixc7534q6af4potdmdm - valory/market_manager_abci:0.1.0:bafybeidnqerwkljbjgog73qaa5duu5ymsfjs6jsszeupseshx7go3n6afq -- valory/decision_maker_abci:0.1.0:bafybeieryuvqcg5ko3mnkpw3j34scedrqgomo2xm42bhweszwgwgtjhi6u -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibkj47cuymq57ccbje6hjtidvpycs6rg2cpshoehi7filrsgokdfi +- valory/decision_maker_abci:0.1.0:bafybeiersmwlzih3yhv5nhy7ay6lqe377wn757pugsl457ypoik57aotom +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicwz2jiwwkcufavqc3ttxkaowjcguq7cuaczzlsvonbv2fk373ezu behaviours: main: args: {} diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index aa1fe1b05..8e4cb454f 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -20,7 +20,7 @@ contracts: [] protocols: [] skills: - valory/abstract_round_abci:0.1.0:bafybeih2fyfb6kkf7r45pvdk7pyyebr5xloia4xiqxtb3qsrasnstqmepq -- valory/decision_maker_abci:0.1.0:bafybeieryuvqcg5ko3mnkpw3j34scedrqgomo2xm42bhweszwgwgtjhi6u +- valory/decision_maker_abci:0.1.0:bafybeiersmwlzih3yhv5nhy7ay6lqe377wn757pugsl457ypoik57aotom behaviours: main: args: {}