diff --git a/.github/workflows/common_checks.yaml b/.github/workflows/common_checks.yaml index 569353076..b31fddd6a 100644 --- a/.github/workflows/common_checks.yaml +++ b/.github/workflows/common_checks.yaml @@ -124,4 +124,4 @@ jobs: wget https://github.com/zricethezav/gitleaks/releases/download/v8.10.1/gitleaks_8.10.1_linux_x64.tar.gz && \ tar -xzf gitleaks_8.10.1_linux_x64.tar.gz && \ sudo install gitleaks /usr/bin && \ - gitleaks detect --report-format json --report-path leak_report + gitleaks detect --report-format json --report-path leak_report -v diff --git a/.gitignore b/.gitignore index d10a3be7e..17e103ca2 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ packages/valory/protocols/tendermint .env .1env keys.json +keys_json/ leak_report agent/ diff --git a/.gitleaksignore b/.gitleaksignore index 3a1f40366..6a7e97a12 100644 --- a/.gitleaksignore +++ b/.gitleaksignore @@ -20,3 +20,9 @@ ed30ffbaaf3c10476dc642d388985c250afaeb8d:packages/valory/skills/market_manager_a d004f2345bf31b27c343eb52c1bc5a2698e838d6:packages/valory/skills/market_manager_abci/graph_tooling/requests.py:generic-api-key:221 b2c15c1a44ba680dd747a6fbdda9f2e9aced39eb:packages/valory/contracts/service_staking_token/contract.yaml:generic-api-key:10 fc7d0697d1543849b07750430843e6b01426cc7a:packages/valory/services/trader_omen_gnosis/service.yaml:generic-api-key:64 +63bb4c2347c3def7bd65d554c8d536b79325afb9:packages/valory/skills/trader_abci/skill.yaml:generic-api-key:154 +809a4d8befaf483c8d5d775f3271e7d8601e2985:packages/valory/skills/decision_maker_abci/skill.yaml:generic-api-key:186 +809a4d8befaf483c8d5d775f3271e7d8601e2985:packages/valory/skills/trader_abci/skill.yaml:generic-api-key:154 +ae28aeb8ad56e1873bfb3996c5d5ad8367709cd1:packages/valory/skills/decision_maker_abci/skill.yaml:generic-api-key:186 +ae28aeb8ad56e1873bfb3996c5d5ad8367709cd1:packages/valory/skills/trader_abci/skill.yaml:generic-api-key:154 + diff --git a/packages/packages.json b/packages/packages.json index ce669c9ca..27ad03efb 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -9,15 +9,16 @@ "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", "contract/valory/conditional_tokens/0.1.0": "bafybeigucumqbsk74nj4rpm4p2cpiky4dj6uws7nfmgpimuviaxcamwqnu", "contract/valory/agent_registry/0.1.0": "bafybeibedc7ehebk3ikr4cowjbvgpxqpu65nforgqmraxqxiq5jv6rboqe", - "contract/valory/service_staking_token/0.1.0": "bafybeibpe24zfvpipaut77tsutmednncjviqeoekxltsndovdz3ugek7bu", + "contract/valory/service_staking_token/0.1.0": "bafybeid44l7qekvkwkvmfl4kcqchnaktttacp7lbx464mzqqs5cnefj35e", "contract/valory/transfer_nft_condition/0.1.0": "bafybeicgpoag2lymofz3vnen76q7gtig5hzimn32o57php4uerr6t25em4", "skill/valory/market_manager_abci/0.1.0": "bafybeidygkw7mwhbk3ry3au5c5265vms5eti375v5jthd4be5dfnnoache", - "skill/valory/decision_maker_abci/0.1.0": "bafybeigyrxb6ycg243crte5mmmut2znfhlnc43rqn3mnp3sylvf563teki", - "skill/valory/trader_abci/0.1.0": "bafybeifupwnewnhskanrklryt2vxalc5jkqedr2ywt3ux6fpaugc6kuu6q", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibl6b5negw35fumbvl6dvcu7dammqmac5x3htapu3p7yf7lkqr73a", - "skill/valory/staking_abci/0.1.0": "bafybeibf565rftitlrlovlvchoe45ng72ctec74fsvrmegp3o4uepu4q2e", - "agent/valory/trader/0.1.0": "bafybeicxc3v3ungi6qindlyayahmngk23xf6carthxilva3jmd3jdkn3mu", - "service/valory/trader/0.1.0": "bafybeibtstpn3x3shp5nujacgbwidmc5nwxdcz55p2qptwufkucnkhgr54" + "skill/valory/decision_maker_abci/0.1.0": "bafybeibvq365gs7ibi7bkzoqyiirdcbpros2q7z3zpsqxhbcfy5d77y7je", + "skill/valory/trader_abci/0.1.0": "bafybeibss6panq224ec5eecn2jh5lqzyvptahnlrtxcfz6gvej5mdtdqei", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibcuvrm5fvmh7nuee4tmbof6debprdqzhvhdpzp2dbddtwva4wz3y", + "skill/valory/staking_abci/0.1.0": "bafybeicrp3dbvxcb2wa7kdgpkxu7aqji5fwq6icwcfw7anfcpqv26irsr4", + "skill/valory/check_stop_trading_abci/0.1.0": "bafybeiedpw6gudh7ddrcfpggnbxmbfaqn57a5geg645c2ymuzwy3rtckii", + "agent/valory/trader/0.1.0": "bafybeieqcfsz3bgh5kkw5fg3zb7laznfv57riclspqfe4eooi4wkq5ds2e", + "service/valory/trader/0.1.0": "bafybeieqm5hdfk22mnqtw4onc3oyqccu6yydop7hdrmuqsucja7vvv55bq" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", @@ -30,7 +31,7 @@ "protocol/valory/ipfs/0.1.0": "bafybeiftxi2qhreewgsc5wevogi7yc5g6hbcbo4uiuaibauhv3nhfcdtvm", "contract/valory/gnosis_safe_proxy_factory/0.1.0": "bafybeib6podeifufgmawvicm3xyz3uaplbcrsptjzz4unpseh7qtcpar74", "contract/valory/gnosis_safe/0.1.0": "bafybeibq77mgzhyb23blf2eqmia3kc6io5karedfzhntvpcebeqdzrgyqa", - "contract/valory/mech/0.1.0": "bafybeiejdn3rqqa7smbeiypajy63um7okteimvj6bsud3gezneycmdc6te", + "contract/valory/mech/0.1.0": "bafybeiejkna5d7hllaxm6avsnffxfs6n4nx2lncmjz6iodkt2xhcy3mbva", "contract/valory/service_registry/0.1.0": "bafybeicbxmbzt757lbmyh6762lrkcrp3oeum6dk3z7pvosixasifsk6xlm", "contract/valory/multisend/0.1.0": "bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y", "contract/valory/erc20/0.1.0": "bafybeigvftdxjgnlsoemst5d57cor36idywk7bwcfj2bjqijxdxo3xpurq", @@ -45,6 +46,6 @@ "skill/valory/abstract_round_abci/0.1.0": "bafybeih3enhagoql7kzpeyzzu2scpkif6y3ubakpralfnwxcvxexdyvy5i", "skill/valory/transaction_settlement_abci/0.1.0": "bafybeigtzlk4uakmd54rxnznorcrstsr52kta474lgrnvx5ovr546vj7sq", "skill/valory/termination_abci/0.1.0": "bafybeihq6qtbwt6i53ayqym63vhjexkcppy26gguzhhjqywfmiuqghvv44", - "skill/valory/mech_interact_abci/0.1.0": "bafybeig2kvyn52kskydyono5wmjsfwtzeq5pcsrtn7p72rfesjatzwgrnq" + "skill/valory/mech_interact_abci/0.1.0": "bafybeib3aytq2a5hk6vjsak3eznuilndx4p53utdylbyhcmt6ty7kk6euq" } } \ No newline at end of file diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 53cfd248f..b777d25e9 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -19,14 +19,13 @@ contracts: - valory/gnosis_safe_proxy_factory:0.1.0:bafybeib6podeifufgmawvicm3xyz3uaplbcrsptjzz4unpseh7qtcpar74 - valory/service_registry:0.1.0:bafybeicbxmbzt757lbmyh6762lrkcrp3oeum6dk3z7pvosixasifsk6xlm - valory/market_maker:0.1.0:bafybeihyi42hkmu2knrunfdbunjh6j3ibfrnwj7rmqw7mm7pmerzcwzfiq -- valory/erc20:0.1.0:bafybeigvftdxjgnlsoemst5d57cor36idywk7bwcfj2bjqijxdxo3xpurq - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y -- valory/mech:0.1.0:bafybeiejdn3rqqa7smbeiypajy63um7okteimvj6bsud3gezneycmdc6te +- valory/mech:0.1.0:bafybeiejkna5d7hllaxm6avsnffxfs6n4nx2lncmjz6iodkt2xhcy3mbva - valory/conditional_tokens:0.1.0:bafybeigucumqbsk74nj4rpm4p2cpiky4dj6uws7nfmgpimuviaxcamwqnu - valory/realitio:0.1.0:bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeibedc7ehebk3ikr4cowjbvgpxqpu65nforgqmraxqxiq5jv6rboqe -- valory/service_staking_token:0.1.0:bafybeibpe24zfvpipaut77tsutmednncjviqeoekxltsndovdz3ugek7bu +- valory/service_staking_token:0.1.0:bafybeid44l7qekvkwkvmfl4kcqchnaktttacp7lbx464mzqqs5cnefj35e - valory/transfer_nft_condition:0.1.0:bafybeicgpoag2lymofz3vnen76q7gtig5hzimn32o57php4uerr6t25em4 protocols: - open_aea/signing:1.0.0:bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi @@ -44,12 +43,13 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeidw4mbx3os3hmv7ley7b3g3gja7ydpitr7mxbjpwzxin2mzyt5yam - valory/termination_abci:0.1.0:bafybeihq6qtbwt6i53ayqym63vhjexkcppy26gguzhhjqywfmiuqghvv44 - valory/transaction_settlement_abci:0.1.0:bafybeigtzlk4uakmd54rxnznorcrstsr52kta474lgrnvx5ovr546vj7sq -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibl6b5negw35fumbvl6dvcu7dammqmac5x3htapu3p7yf7lkqr73a +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibcuvrm5fvmh7nuee4tmbof6debprdqzhvhdpzp2dbddtwva4wz3y - valory/market_manager_abci:0.1.0:bafybeidygkw7mwhbk3ry3au5c5265vms5eti375v5jthd4be5dfnnoache -- valory/decision_maker_abci:0.1.0:bafybeigyrxb6ycg243crte5mmmut2znfhlnc43rqn3mnp3sylvf563teki -- valory/trader_abci:0.1.0:bafybeifupwnewnhskanrklryt2vxalc5jkqedr2ywt3ux6fpaugc6kuu6q -- valory/staking_abci:0.1.0:bafybeibf565rftitlrlovlvchoe45ng72ctec74fsvrmegp3o4uepu4q2e -- valory/mech_interact_abci:0.1.0:bafybeig2kvyn52kskydyono5wmjsfwtzeq5pcsrtn7p72rfesjatzwgrnq +- valory/decision_maker_abci:0.1.0:bafybeibvq365gs7ibi7bkzoqyiirdcbpros2q7z3zpsqxhbcfy5d77y7je +- valory/trader_abci:0.1.0:bafybeibss6panq224ec5eecn2jh5lqzyvptahnlrtxcfz6gvej5mdtdqei +- valory/staking_abci:0.1.0:bafybeicrp3dbvxcb2wa7kdgpkxu7aqji5fwq6icwcfw7anfcpqv26irsr4 +- valory/check_stop_trading_abci:0.1.0:bafybeiedpw6gudh7ddrcfpggnbxmbfaqn57a5geg645c2ymuzwy3rtckii +- valory/mech_interact_abci:0.1.0:bafybeib3aytq2a5hk6vjsak3eznuilndx4p53utdylbyhcmt6ty7kk6euq customs: - valory/mike_strat:0.1.0:bafybeihjiol7f4ch4piwfikurdtfwzsh6qydkbsztpbwbwb2yrqdqf726m - valory/bet_amount_per_threshold:0.1.0:bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24 @@ -174,7 +174,9 @@ models: average_block_time: ${int:5} abt_error_mult: ${int:5} mech_contract_address: ${str:0x77af31De935740567Cf4fF1986D04B2c964A786a} - request_price: ${int:null} + mech_request_price: ${int:null} + mech_chain_id: ${str:gnosis} + mech_wrapped_native_token_address: ${str:0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d} sample_bets_closing_days: ${int:10} trading_strategy: ${str:kelly_criterion} use_fallback_strategy: ${bool:true} @@ -213,6 +215,8 @@ models: "0x0000000000000000000000000000000000000000"], ["order_address", "0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4"], ["price", "1000000000000000000"]]} staking_contract_address: ${str:0x2Ef503950Be67a98746F484DA0bBAdA339DF3326} + disable_trading: ${bool:false} + stop_trading_if_staking_kpi_met: ${bool:true} agent_balance_threshold: ${int:10000000000000000} refill_check_interval: ${int:10} tool_punishment_multiplier: ${int:1} diff --git a/packages/valory/contracts/service_staking_token/contract.py b/packages/valory/contracts/service_staking_token/contract.py index e3c29de9e..05883b20d 100644 --- a/packages/valory/contracts/service_staking_token/contract.py +++ b/packages/valory/contracts/service_staking_token/contract.py @@ -121,6 +121,28 @@ def get_next_checkpoint_ts( ts = contract.functions.getNextRewardCheckpointTimestamp().call() return dict(data=ts) + @classmethod + def ts_checkpoint( + cls, + ledger_api: LedgerApi, + contract_address: str, + ) -> JSONLike: + """Retrieve the checkpoint's timestamp.""" + contract = cls.get_instance(ledger_api, contract_address) + ts_checkpoint = contract.functions.tsCheckpoint().call() + return dict(data=ts_checkpoint) + + @classmethod + def liveness_ratio( + cls, + ledger_api: LedgerApi, + contract_address: str, + ) -> JSONLike: + """Retrieve the liveness ratio.""" + contract = cls.get_instance(ledger_api, contract_address) + liveness_ratio = contract.functions.livenessRatio().call() + return dict(data=liveness_ratio) + @classmethod def get_liveness_period( cls, diff --git a/packages/valory/contracts/service_staking_token/contract.yaml b/packages/valory/contracts/service_staking_token/contract.yaml index ddc04eb50..19c395a79 100644 --- a/packages/valory/contracts/service_staking_token/contract.yaml +++ b/packages/valory/contracts/service_staking_token/contract.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeid3wfzglolebuo6jrrsopswzu4lk77bm76mvw3euizlsjtnt3wmgu build/ServiceStakingToken.json: bafybeib6frfpqtr4dfyxuylehqmic2iawofydx7u24t7j5zbrsc4m4ijoi - contract.py: bafybeicxwbqmiohfmbikc76cxlt5sext6ly2wmvemysr53alnp5qjq6jmm + contract.py: bafybeihtnccnhtqyiwqomythtuey6vdbsj5swufxl5pcu3ptepmiaolxy4 fingerprint_ignore_patterns: [] contracts: [] class_name: ServiceStakingTokenContract diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 2cfe0c728..f267fc119 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:bafybeicxc3v3ungi6qindlyayahmngk23xf6carthxilva3jmd3jdkn3mu +agent: valory/trader:0.1.0:bafybeieqcfsz3bgh5kkw5fg3zb7laznfv57riclspqfe4eooi4wkq5ds2e number_of_agents: 4 deployment: {} --- @@ -79,8 +79,10 @@ type: skill languages: ${LANGUAGES:list:["en_US"]} average_block_time: ${ABT:int:5} abt_error_mult: ${ABT_ERROR_MULT:int:5} - mech_contract_address: ${MECH_CONTRACT_ADDRESS:str:0x77af31de935740567cf4ff1986d04b2c964a786a} - request_price: ${REQUEST_PRICE:int:null} + mech_contract_address: ${MECH_CONTRACT_ADDRESS:str:0x77af31De935740567Cf4fF1986D04B2c964A786a} + mech_request_price: ${MECH_REQUEST_PRICE:int:null} + mech_chain_id: ${MECH_CHAIN_ID:str:gnosis} + mech_wrapped_native_token_address: ${MECH_WRAPPED_NATIVE_TOKEN_ADDRESS:str:0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d} sample_bets_closing_days: ${SAMPLE_BETS_CLOSING_DAYS:int:10} trading_strategy: ${TRADING_STRATEGY:str:kelly_criterion} use_fallback_strategy: ${USE_FALLBACK_STRATEGY:bool:true} @@ -108,6 +110,8 @@ type: skill "stabilityai-stable-diffusion-xl-beta-v2-2-2", "stabilityai-stable-diffusion-512-v2-1", "stabilityai-stable-diffusion-768-v2-1"]} staking_contract_address: ${STAKING_CONTRACT_ADDRESS:str:0x2Ef503950Be67a98746F484DA0bBAdA339DF3326} + disable_trading: ${DISABLE_TRADING:bool:false} + stop_trading_if_staking_kpi_met: ${STOP_TRADING_IF_STAKING_KPI_MET:bool:true} agent_balance_threshold: ${AGENT_BALANCE_THRESHOLD:int:10000000000000000} refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} @@ -176,8 +180,10 @@ type: skill languages: ${LANGUAGES:list:["en_US"]} average_block_time: ${ABT:int:5} abt_error_mult: ${ABT_ERROR_MULT:int:5} - mech_contract_address: ${MECH_CONTRACT_ADDRESS:str:0x77af31de935740567cf4ff1986d04b2c964a786a} - request_price: ${REQUEST_PRICE:int:null} + mech_contract_address: ${MECH_CONTRACT_ADDRESS:str:0x77af31De935740567Cf4fF1986D04B2c964A786a} + mech_request_price: ${MECH_REQUEST_PRICE:int:null} + mech_chain_id: ${MECH_CHAIN_ID:str:gnosis} + mech_wrapped_native_token_address: ${MECH_WRAPPED_NATIVE_TOKEN_ADDRESS:str:0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d} sample_bets_closing_days: ${SAMPLE_BETS_CLOSING_DAYS:int:10} trading_strategy: ${TRADING_STRATEGY:str:kelly_criterion} use_fallback_strategy: ${USE_FALLBACK_STRATEGY:bool:true} @@ -205,6 +211,8 @@ type: skill "stabilityai-stable-diffusion-xl-beta-v2-2-2", "stabilityai-stable-diffusion-512-v2-1", "stabilityai-stable-diffusion-768-v2-1"]} staking_contract_address: ${STAKING_CONTRACT_ADDRESS:str:0x2Ef503950Be67a98746F484DA0bBAdA339DF3326} + disable_trading: ${DISABLE_TRADING:bool:false} + stop_trading_if_staking_kpi_met: ${STOP_TRADING_IF_STAKING_KPI_MET:bool:true} agent_balance_threshold: ${AGENT_BALANCE_THRESHOLD:int:10000000000000000} refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} @@ -271,8 +279,10 @@ type: skill languages: ${LANGUAGES:list:["en_US"]} average_block_time: ${ABT:int:5} abt_error_mult: ${ABT_ERROR_MULT:int:5} - mech_contract_address: ${MECH_CONTRACT_ADDRESS:str:0x77af31de935740567cf4ff1986d04b2c964a786a} - request_price: ${REQUEST_PRICE:int:null} + mech_contract_address: ${MECH_CONTRACT_ADDRESS:str:0x77af31De935740567Cf4fF1986D04B2c964A786a} + mech_request_price: ${MECH_REQUEST_PRICE:int:null} + mech_chain_id: ${MECH_CHAIN_ID:str:gnosis} + mech_wrapped_native_token_address: ${MECH_WRAPPED_NATIVE_TOKEN_ADDRESS:str:0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d} sample_bets_closing_days: ${SAMPLE_BETS_CLOSING_DAYS:int:10} trading_strategy: ${TRADING_STRATEGY:str:kelly_criterion} use_fallback_strategy: ${USE_FALLBACK_STRATEGY:bool:true} @@ -300,6 +310,8 @@ type: skill "stabilityai-stable-diffusion-xl-beta-v2-2-2", "stabilityai-stable-diffusion-512-v2-1", "stabilityai-stable-diffusion-768-v2-1"]} staking_contract_address: ${STAKING_CONTRACT_ADDRESS:str:0x2Ef503950Be67a98746F484DA0bBAdA339DF3326} + disable_trading: ${DISABLE_TRADING:bool:false} + stop_trading_if_staking_kpi_met: ${STOP_TRADING_IF_STAKING_KPI_MET:bool:true} agent_balance_threshold: ${AGENT_BALANCE_THRESHOLD:int:10000000000000000} refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} @@ -366,8 +378,10 @@ type: skill languages: ${LANGUAGES:list:["en_US"]} average_block_time: ${ABT:int:5} abt_error_mult: ${ABT_ERROR_MULT:int:5} - mech_contract_address: ${MECH_CONTRACT_ADDRESS:str:0x77af31de935740567cf4ff1986d04b2c964a786a} - request_price: ${REQUEST_PRICE:int:null} + mech_contract_address: ${MECH_CONTRACT_ADDRESS:str:0x77af31De935740567Cf4fF1986D04B2c964A786a} + mech_request_price: ${MECH_REQUEST_PRICE:int:null} + mech_chain_id: ${MECH_CHAIN_ID:str:gnosis} + mech_wrapped_native_token_address: ${MECH_WRAPPED_NATIVE_TOKEN_ADDRESS:str:0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d} sample_bets_closing_days: ${SAMPLE_BETS_CLOSING_DAYS:int:10} trading_strategy: ${TRADING_STRATEGY:str:kelly_criterion} use_fallback_strategy: ${USE_FALLBACK_STRATEGY:bool:true} @@ -395,6 +409,8 @@ type: skill "stabilityai-stable-diffusion-xl-beta-v2-2-2", "stabilityai-stable-diffusion-512-v2-1", "stabilityai-stable-diffusion-768-v2-1"]} staking_contract_address: ${STAKING_CONTRACT_ADDRESS:str:0x2Ef503950Be67a98746F484DA0bBAdA339DF3326} + disable_trading: ${DISABLE_TRADING:bool:false} + stop_trading_if_staking_kpi_met: ${STOP_TRADING_IF_STAKING_KPI_MET:bool:true} agent_balance_threshold: ${AGENT_BALANCE_THRESHOLD:int:10000000000000000} refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} diff --git a/packages/valory/skills/check_stop_trading_abci/README.md b/packages/valory/skills/check_stop_trading_abci/README.md new file mode 100644 index 000000000..02ad18706 --- /dev/null +++ b/packages/valory/skills/check_stop_trading_abci/README.md @@ -0,0 +1,5 @@ +# Check stop trading abci + +## Description + +This package contains the check stop trading skill for an AEA. diff --git a/packages/valory/skills/check_stop_trading_abci/__init__.py b/packages/valory/skills/check_stop_trading_abci/__init__.py new file mode 100644 index 000000000..da4d21162 --- /dev/null +++ b/packages/valory/skills/check_stop_trading_abci/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 2024 Valory AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ------------------------------------------------------------------------------ + +"""This module contains the check stop trading skill for an AEA.""" + +from aea.configurations.base import PublicId + + +PUBLIC_ID = PublicId.from_str("valory/check_stop_trading_abci:0.1.0") diff --git a/packages/valory/skills/check_stop_trading_abci/behaviours.py b/packages/valory/skills/check_stop_trading_abci/behaviours.py new file mode 100644 index 000000000..3810b54cf --- /dev/null +++ b/packages/valory/skills/check_stop_trading_abci/behaviours.py @@ -0,0 +1,171 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 2024 Valory AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ------------------------------------------------------------------------------ + +"""This module contains the behaviours for the check stop trading skill.""" + +import math +from typing import Generator, Set, Type, cast + +from packages.valory.contracts.mech.contract import Mech as MechContract +from packages.valory.skills.abstract_round_abci.base import get_name +from packages.valory.skills.abstract_round_abci.behaviour_utils import BaseBehaviour +from packages.valory.skills.abstract_round_abci.behaviours import AbstractRoundBehaviour +from packages.valory.skills.check_stop_trading_abci.models import CheckStopTradingParams +from packages.valory.skills.check_stop_trading_abci.payloads import CheckStopTradingPayload +from packages.valory.skills.check_stop_trading_abci.rounds import ( + CheckStopTradingRound, + CheckStopTradingAbciApp, +) +from packages.valory.skills.staking_abci.behaviours import ( + StakingInteractBaseBehaviour, + WaitableConditionType, +) +from packages.valory.contracts.service_staking_token.contract import StakingState + + +# Liveness ratio from the staking contract is expressed in calls per 10**18 seconds. +LIVENESS_RATIO_SCALE_FACTOR = 10**18 + +# A safety margin in case there is a delay between the moment the KPI condition is +# satisfied, and the moment where the checkpoint is called. +REQUIRED_MECH_REQUESTS_SAFETY_MARGIN = 1 + +class CheckStopTradingBehaviour(StakingInteractBaseBehaviour): + """A behaviour that checks stop trading conditions.""" + + matching_round = CheckStopTradingRound + + @property + def mech_request_count(self) -> int: + """Get the liveness period.""" + return self._mech_request_count + + @mech_request_count.setter + def mech_request_count(self, mech_request_count: int) -> None: + """Set the liveness period.""" + self._mech_request_count = mech_request_count + + def _get_mech_request_count(self) -> WaitableConditionType: + """Get the mech request count.""" + status = yield from self.contract_interact( + contract_address=self.params.mech_contract_address, + contract_public_id=MechContract.contract_id, + contract_callable="get_requests_count", + data_key="requests_count", + placeholder=get_name(CheckStopTradingBehaviour.mech_request_count), + address=self.synchronized_data.safe_contract_address, + ) + return status + + @property + def is_first_period(self) -> bool: + """Return whether it is the first period of the service.""" + return self.synchronized_data.period_count == 0 + + @property + def params(self) -> CheckStopTradingParams: + """Return the params.""" + return cast(CheckStopTradingParams, self.context.params) + + def is_staking_kpi_met(self) -> Generator[None, None, bool]: + """Return whether the staking KPI has been met (only for staked services).""" + yield from self.wait_for_condition_with_sleep(self._check_service_staked) + self.context.logger.debug(f"{self.service_staking_state=}") + if self.service_staking_state != StakingState.STAKED: + return False + + yield from self.wait_for_condition_with_sleep(self._get_mech_request_count) + mech_request_count = self.mech_request_count + self.context.logger.debug(f"{self.mech_request_count=}") + + yield from self.wait_for_condition_with_sleep(self._get_service_info) + mech_request_count_on_last_checkpoint = self.service_info[2][1] + self.context.logger.debug(f"{mech_request_count_on_last_checkpoint=}") + + yield from self.wait_for_condition_with_sleep(self._get_ts_checkpoint) + last_ts_checkpoint = self.ts_checkpoint + self.context.logger.debug(f"{last_ts_checkpoint=}") + + yield from self.wait_for_condition_with_sleep(self._get_liveness_period) + liveness_period = self.liveness_period + self.context.logger.debug(f"{liveness_period=}") + + yield from self.wait_for_condition_with_sleep(self._get_liveness_ratio) + liveness_ratio = self.liveness_ratio + self.context.logger.debug(f"{liveness_ratio=}") + + mech_requests_since_last_cp = mech_request_count - mech_request_count_on_last_checkpoint + self.context.logger.debug(f"{mech_requests_since_last_cp=}") + + current_timestamp = self.synced_timestamp + self.context.logger.debug(f"{current_timestamp=}") + + required_mech_requests = math.ceil(max( + (current_timestamp - last_ts_checkpoint) * liveness_ratio / LIVENESS_RATIO_SCALE_FACTOR, + (liveness_period) * liveness_ratio / LIVENESS_RATIO_SCALE_FACTOR + )) + REQUIRED_MECH_REQUESTS_SAFETY_MARGIN + self.context.logger.debug(f"{required_mech_requests=}") + + if mech_requests_since_last_cp >= required_mech_requests: + return True + return False + + def _compute_stop_trading(self) -> Generator: + # This is a "hacky" way of getting required data initialized on + # the Trader: On first period, the FSM needs to initialize some + # data on the trading branch so that it is available in the + # cross-period persistent keys. + if self.is_first_period: + self.context.logger.debug(f"{self.is_first_period=}") + return False + + stop_trading_conditions = [] + + self.context.logger.debug(f"{self.params.disable_trading=}") + stop_trading_conditions.append(self.params.disable_trading) + + self.context.logger.debug(f"{self.params.stop_trading_if_staking_kpi_met=}") + if self.params.stop_trading_if_staking_kpi_met: + staking_kpi_met = yield from self.is_staking_kpi_met() + self.context.logger.debug(f"{staking_kpi_met=}") + stop_trading_conditions.append(staking_kpi_met) + + return any(stop_trading_conditions) + + def async_act(self) -> Generator: + """Do the action.""" + with self.context.benchmark_tool.measure(self.behaviour_id).local(): + stop_trading = yield from self._compute_stop_trading() + self.context.logger.info(f"Computed {stop_trading=}") + payload = CheckStopTradingPayload( + self.context.agent_address, stop_trading + ) + + with self.context.benchmark_tool.measure(self.behaviour_id).consensus(): + yield from self.send_a2a_transaction(payload) + yield from self.wait_until_round_end() + self.set_done() + + +class CheckStopTradingRoundBehaviour(AbstractRoundBehaviour): + """This behaviour manages the consensus stages for the check stop trading behaviour.""" + + initial_behaviour_cls = CheckStopTradingBehaviour + abci_app_cls = CheckStopTradingAbciApp + behaviours: Set[Type[BaseBehaviour]] = {CheckStopTradingBehaviour} # type: ignore diff --git a/packages/valory/skills/check_stop_trading_abci/dialogues.py b/packages/valory/skills/check_stop_trading_abci/dialogues.py new file mode 100644 index 000000000..74cc46dc5 --- /dev/null +++ b/packages/valory/skills/check_stop_trading_abci/dialogues.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 2024 Valory AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ------------------------------------------------------------------------------ + +"""This module contains the classes required for dialogue management.""" + +from packages.valory.skills.abstract_round_abci.dialogues import ( + AbciDialogue as BaseAbciDialogue, +) +from packages.valory.skills.abstract_round_abci.dialogues import ( + AbciDialogues as BaseAbciDialogues, +) +from packages.valory.skills.abstract_round_abci.dialogues import ( + ContractApiDialogue as BaseContractApiDialogue, +) +from packages.valory.skills.abstract_round_abci.dialogues import ( + ContractApiDialogues as BaseContractApiDialogues, +) +from packages.valory.skills.abstract_round_abci.dialogues import ( + HttpDialogue as BaseHttpDialogue, +) +from packages.valory.skills.abstract_round_abci.dialogues import ( + HttpDialogues as BaseHttpDialogues, +) +from packages.valory.skills.abstract_round_abci.dialogues import ( + LedgerApiDialogue as BaseLedgerApiDialogue, +) +from packages.valory.skills.abstract_round_abci.dialogues import ( + LedgerApiDialogues as BaseLedgerApiDialogues, +) +from packages.valory.skills.abstract_round_abci.dialogues import ( + SigningDialogue as BaseSigningDialogue, +) +from packages.valory.skills.abstract_round_abci.dialogues import ( + SigningDialogues as BaseSigningDialogues, +) +from packages.valory.skills.abstract_round_abci.dialogues import ( + TendermintDialogue as BaseTendermintDialogue, +) +from packages.valory.skills.abstract_round_abci.dialogues import ( + TendermintDialogues as BaseTendermintDialogues, +) + + +AbciDialogue = BaseAbciDialogue +AbciDialogues = BaseAbciDialogues + + +HttpDialogue = BaseHttpDialogue +HttpDialogues = BaseHttpDialogues + + +SigningDialogue = BaseSigningDialogue +SigningDialogues = BaseSigningDialogues + + +LedgerApiDialogue = BaseLedgerApiDialogue +LedgerApiDialogues = BaseLedgerApiDialogues + + +ContractApiDialogue = BaseContractApiDialogue +ContractApiDialogues = BaseContractApiDialogues + + +TendermintDialogue = BaseTendermintDialogue +TendermintDialogues = BaseTendermintDialogues diff --git a/packages/valory/skills/check_stop_trading_abci/fsm_specification.yaml b/packages/valory/skills/check_stop_trading_abci/fsm_specification.yaml new file mode 100644 index 000000000..e71d9e9b8 --- /dev/null +++ b/packages/valory/skills/check_stop_trading_abci/fsm_specification.yaml @@ -0,0 +1,23 @@ +alphabet_in: +- DONE +- NONE +- NO_MAJORITY +- ROUND_TIMEOUT +- SKIP_TRADING +default_start_state: CheckStopTradingRound +final_states: +- FinishedCheckStopTradingRound +- FinishedWithSkipTradingRound +label: CheckStopTradingAbciApp +start_states: +- CheckStopTradingRound +states: +- CheckStopTradingRound +- FinishedCheckStopTradingRound +- FinishedWithSkipTradingRound +transition_func: + (CheckStopTradingRound, DONE): FinishedCheckStopTradingRound + (CheckStopTradingRound, NONE): CheckStopTradingRound + (CheckStopTradingRound, NO_MAJORITY): CheckStopTradingRound + (CheckStopTradingRound, ROUND_TIMEOUT): CheckStopTradingRound + (CheckStopTradingRound, SKIP_TRADING): FinishedWithSkipTradingRound diff --git a/packages/valory/skills/check_stop_trading_abci/handlers.py b/packages/valory/skills/check_stop_trading_abci/handlers.py new file mode 100644 index 000000000..64bac3a39 --- /dev/null +++ b/packages/valory/skills/check_stop_trading_abci/handlers.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 2024 Valory AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ------------------------------------------------------------------------------ + + +"""This module contains the handlers for the check stop trading skill.""" + +from packages.valory.skills.abstract_round_abci.handlers import ABCIRoundHandler +from packages.valory.skills.abstract_round_abci.handlers import ( + ContractApiHandler as BaseContractApiHandler, +) +from packages.valory.skills.abstract_round_abci.handlers import ( + HttpHandler as BaseHttpHandler, +) +from packages.valory.skills.abstract_round_abci.handlers import ( + IpfsHandler as BaseIpfsHandler, +) +from packages.valory.skills.abstract_round_abci.handlers import ( + LedgerApiHandler as BaseLedgerApiHandler, +) +from packages.valory.skills.abstract_round_abci.handlers import ( + SigningHandler as BaseSigningHandler, +) +from packages.valory.skills.abstract_round_abci.handlers import ( + TendermintHandler as BaseTendermintHandler, +) + + +ABCICheckStopTradingHandler = ABCIRoundHandler +HttpHandler = BaseHttpHandler +SigningHandler = BaseSigningHandler +LedgerApiHandler = BaseLedgerApiHandler +ContractApiHandler = BaseContractApiHandler +TendermintHandler = BaseTendermintHandler +IpfsHandler = BaseIpfsHandler diff --git a/packages/valory/skills/check_stop_trading_abci/models.py b/packages/valory/skills/check_stop_trading_abci/models.py new file mode 100644 index 000000000..0e2a0c49d --- /dev/null +++ b/packages/valory/skills/check_stop_trading_abci/models.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 2024 Valory AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ------------------------------------------------------------------------------ + + +"""Models for the check stop trading ABCI application.""" + +from typing import Any + +from packages.valory.skills.abstract_round_abci.models import BaseParams +from packages.valory.skills.abstract_round_abci.models import ( + BenchmarkTool as BaseBenchmarkTool, +) +from packages.valory.skills.abstract_round_abci.models import Requests as BaseRequests +from packages.valory.skills.abstract_round_abci.models import ( + SharedState as BaseSharedState, +) +from packages.valory.skills.check_stop_trading_abci.rounds import CheckStopTradingAbciApp +from packages.valory.skills.staking_abci.models import StakingParams + + +Requests = BaseRequests +BenchmarkTool = BaseBenchmarkTool + + +class CheckStopTradingParams(StakingParams): + """CheckStopTrading parameters.""" + + def __init__(self, *args: Any, **kwargs: Any) -> None: + """Initialize the parameters' object.""" + self.disable_trading: bool = self._ensure( + "disable_trading", kwargs, bool + ) + self.stop_trading_if_staking_kpi_met: bool = self._ensure( + "stop_trading_if_staking_kpi_met", kwargs, bool + ) + super().__init__(*args, **kwargs) + + +class SharedState(BaseSharedState): + """Keep the current shared state of the skill.""" + + abci_app_cls = CheckStopTradingAbciApp diff --git a/packages/valory/skills/check_stop_trading_abci/payloads.py b/packages/valory/skills/check_stop_trading_abci/payloads.py new file mode 100644 index 000000000..5831cff87 --- /dev/null +++ b/packages/valory/skills/check_stop_trading_abci/payloads.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 2024 Valory AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ------------------------------------------------------------------------------ + +"""This module contains the transaction payloads for the check stop trading abci.""" + +from dataclasses import dataclass + +from packages.valory.skills.abstract_round_abci.base import BaseTxPayload + + +@dataclass(frozen=True) +class CheckStopTradingPayload(BaseTxPayload): + """A transaction payload for the check stop trading abci.""" + + vote: bool diff --git a/packages/valory/skills/check_stop_trading_abci/rounds.py b/packages/valory/skills/check_stop_trading_abci/rounds.py new file mode 100644 index 000000000..75fb5e9e0 --- /dev/null +++ b/packages/valory/skills/check_stop_trading_abci/rounds.py @@ -0,0 +1,129 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 2024 Valory AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ------------------------------------------------------------------------------ + +"""This module contains the rounds for the check stop trading ABCI application.""" + +from abc import ABC +from enum import Enum +from typing import Dict, Set, Type + +from packages.valory.skills.abstract_round_abci.base import ( + AbciApp, + AbciAppTransitionFunction, + AbstractRound, + AppState, + BaseSynchronizedData, + get_name, + VotingRound, + CollectionRound, + DegenerateRound, + DeserializedCollection, +) +from packages.valory.skills.check_stop_trading_abci.payloads import CheckStopTradingPayload + + +class Event(Enum): + """Event enumeration for the check stop trading skill.""" + + DONE = "done" + NONE = "none" + ROUND_TIMEOUT = "round_timeout" + NO_MAJORITY = "no_majority" + SKIP_TRADING = "skip_trading" + + +class SynchronizedData(BaseSynchronizedData): + """Class to represent the synchronized data. + + This data is replicated by the tendermint application. + """ + + def _get_deserialized(self, key: str) -> DeserializedCollection: + """Strictly get a collection and return it deserialized.""" + serialized = self.db.get_strict(key) + return CollectionRound.deserialize_collection(serialized) + + +class CheckStopTradingRound(VotingRound): + """A round for checking stop trading conditions.""" + + payload_class = CheckStopTradingPayload + synchronized_data_class = SynchronizedData + done_event = Event.SKIP_TRADING + negative_event = Event.DONE + none_event = Event.NONE + no_majority_event = Event.NO_MAJORITY + collection_key = get_name(SynchronizedData.participant_to_votes) + + +class FinishedCheckStopTradingRound(DegenerateRound, ABC): + """A round that represents check stop trading has finished.""" + + +class FinishedWithSkipTradingRound(DegenerateRound, ABC): + """A round that represents check stop trading has finished with skip trading.""" + + +class CheckStopTradingAbciApp(AbciApp[Event]): # pylint: disable=too-few-public-methods + """CheckStopTradingAbciApp + + Initial round: CheckStopTradingRound + + Initial states: {CheckStopTradingRound} + + Transition states: + 0. CheckStopTradingRound + - done: 1. + - none: 0. + - round timeout: 0. + - no majority: 0. + - skip trading: 2. + 1. FinishedCheckStopTradingRound + 2. FinishedWithSkipTradingRound + + Final states: {FinishedCheckStopTradingRound, FinishedWithSkipTradingRound} + + Timeouts: + round timeout: 30.0 + """ + + initial_round_cls: Type[AbstractRound] = CheckStopTradingRound + transition_function: AbciAppTransitionFunction = { + CheckStopTradingRound: { + Event.DONE: FinishedCheckStopTradingRound, + Event.NONE: CheckStopTradingRound, + Event.ROUND_TIMEOUT: CheckStopTradingRound, + Event.NO_MAJORITY: CheckStopTradingRound, + Event.SKIP_TRADING: FinishedWithSkipTradingRound, + }, + FinishedCheckStopTradingRound: {}, + FinishedWithSkipTradingRound: {}, + } + final_states: Set[AppState] = { + FinishedCheckStopTradingRound, + FinishedWithSkipTradingRound, + } + event_to_timeout: Dict[Event, float] = { + Event.ROUND_TIMEOUT: 30.0, + } + db_pre_conditions: Dict[AppState, Set[str]] = {CheckStopTradingRound: set()} + db_post_conditions: Dict[AppState, Set[str]] = { + FinishedCheckStopTradingRound: set(), + FinishedWithSkipTradingRound: set(), + } diff --git a/packages/valory/skills/check_stop_trading_abci/skill.yaml b/packages/valory/skills/check_stop_trading_abci/skill.yaml new file mode 100644 index 000000000..39d491055 --- /dev/null +++ b/packages/valory/skills/check_stop_trading_abci/skill.yaml @@ -0,0 +1,142 @@ +name: check_stop_trading_abci +author: valory +version: 0.1.0 +type: skill +description: This skill implements the check for stop trading for an AEA. +license: Apache-2.0 +aea_version: '>=1.0.0, <2.0.0' +fingerprint: + README.md: bafybeif2pq7fg5upl6vmfgfzpiwsh4nbk4zaeyz6upyucqi5tasrxgq4ee + __init__.py: bafybeifc23rlw2hzhplp3wfceixnmwq5ztnixhh7jp4dd5av3crwp3x22a + behaviours.py: bafybeifun2lehddh6az5h7unpa5kix7vi6e2obejfhfwwzjbdhelagmeoe + dialogues.py: bafybeictrrnwcijiejczy23dfvbx5kujgef3dulzqhs3etl2juvz5spm2e + fsm_specification.yaml: bafybeihhau35a5xclncjpxh5lg7qiw34xs4d5qlez7dnjpkf45d3gc57ai + handlers.py: bafybeiard64fwxib3rtyp67ymhf222uongcyqhfhdyttpsyqkmyh5ajipu + models.py: bafybeietyrst4ng4dtncerz4cz4urqoqar5rui3mbqfeemhjns4jgxhrzy + payloads.py: bafybeidh5bqywun4chrbsci2xbcrnnzuys5sswxwbxq3yl2ksawi3xsi5q + rounds.py: bafybeieif76cskoxxi7d6rptvj6iq5joevfcpgwhm3jwzrd46rdfahb2oa +fingerprint_ignore_patterns: [] +connections: [] +contracts: +- valory/service_staking_token:0.1.0:bafybeid44l7qekvkwkvmfl4kcqchnaktttacp7lbx464mzqqs5cnefj35e +- valory/mech:0.1.0:bafybeiejkna5d7hllaxm6avsnffxfs6n4nx2lncmjz6iodkt2xhcy3mbva +protocols: [] +skills: +- valory/abstract_round_abci:0.1.0:bafybeih3enhagoql7kzpeyzzu2scpkif6y3ubakpralfnwxcvxexdyvy5i +- valory/staking_abci:0.1.0:bafybeicrp3dbvxcb2wa7kdgpkxu7aqji5fwq6icwcfw7anfcpqv26irsr4 +behaviours: + main: + args: {} + class_name: CheckStopTradingRoundBehaviour +handlers: + abci: + args: {} + class_name: ABCICheckStopTradingHandler + contract_api: + args: {} + class_name: ContractApiHandler + http: + args: {} + class_name: HttpHandler + ipfs: + args: {} + class_name: IpfsHandler + ledger_api: + args: {} + class_name: LedgerApiHandler + signing: + args: {} + class_name: SigningHandler + tendermint: + args: {} + class_name: TendermintHandler +models: + abci_dialogues: + args: {} + class_name: AbciDialogues + benchmark_tool: + args: + log_dir: /logs + class_name: BenchmarkTool + contract_api_dialogues: + args: {} + class_name: ContractApiDialogues + http_dialogues: + args: {} + class_name: HttpDialogues + ipfs_dialogues: + args: {} + class_name: IpfsDialogues + ledger_api_dialogues: + args: {} + class_name: LedgerApiDialogues + params: + args: + cleanup_history_depth: 1 + cleanup_history_depth_current: null + drand_public_key: 868f005eb8e6e4ca0a47c8a77ceaa5309a47978a7c71bc5cce96366b5d7a569937c529eeda66c7293784a9402801af31 + genesis_config: + genesis_time: '2022-05-20T16:00:21.735122717Z' + chain_id: chain-c4daS1 + consensus_params: + block: + max_bytes: '22020096' + max_gas: '-1' + time_iota_ms: '1000' + evidence: + max_age_num_blocks: '100000' + max_age_duration: '172800000000000' + max_bytes: '1048576' + validator: + pub_key_types: + - ed25519 + version: {} + voting_power: '10' + keeper_timeout: 30.0 + max_attempts: 10 + max_healthcheck: 120 + multisend_address: '0x0000000000000000000000000000000000000000' + on_chain_service_id: null + request_retry_delay: 1.0 + request_timeout: 10.0 + reset_pause_duration: 10 + reset_tendermint_after: 2 + retry_attempts: 400 + retry_timeout: 3 + round_timeout_seconds: 350.0 + service_id: check_stop_trading + service_registry_address: null + setup: + all_participants: + - '0x0000000000000000000000000000000000000000' + safe_contract_address: '0x0000000000000000000000000000000000000000' + consensus_threshold: null + share_tm_config_on_startup: false + sleep_time: 5 + tendermint_check_sleep_delay: 3 + tendermint_com_url: http://localhost:8080 + tendermint_max_retries: 5 + tendermint_p2p_url: localhost:26656 + tendermint_url: http://localhost:26657 + termination_sleep: 900 + tx_timeout: 10.0 + use_termination: false + use_slashing: false + slash_cooldown_hours: 3 + slash_threshold_amount: 10000000000000000 + light_slash_unit_amount: 5000000000000000 + serious_slash_unit_amount: 8000000000000000 + disable_trading: false + stop_trading_if_staking_kpi_met: true + class_name: CheckStopTradingParams + requests: + args: {} + class_name: Requests + signing_dialogues: + args: {} + class_name: SigningDialogues + state: + args: {} + class_name: SharedState +dependencies: {} +is_abstract: true diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 6e42a3e26..4630ee44f 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -62,7 +62,7 @@ contracts: - valory/market_maker:0.1.0:bafybeihyi42hkmu2knrunfdbunjh6j3ibfrnwj7rmqw7mm7pmerzcwzfiq - valory/erc20:0.1.0:bafybeigvftdxjgnlsoemst5d57cor36idywk7bwcfj2bjqijxdxo3xpurq - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y -- valory/mech:0.1.0:bafybeiejdn3rqqa7smbeiypajy63um7okteimvj6bsud3gezneycmdc6te +- valory/mech:0.1.0:bafybeiejkna5d7hllaxm6avsnffxfs6n4nx2lncmjz6iodkt2xhcy3mbva - valory/conditional_tokens:0.1.0:bafybeigucumqbsk74nj4rpm4p2cpiky4dj6uws7nfmgpimuviaxcamwqnu - valory/realitio:0.1.0:bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 @@ -76,7 +76,7 @@ skills: - valory/abstract_round_abci:0.1.0:bafybeih3enhagoql7kzpeyzzu2scpkif6y3ubakpralfnwxcvxexdyvy5i - valory/market_manager_abci:0.1.0:bafybeidygkw7mwhbk3ry3au5c5265vms5eti375v5jthd4be5dfnnoache - valory/transaction_settlement_abci:0.1.0:bafybeigtzlk4uakmd54rxnznorcrstsr52kta474lgrnvx5ovr546vj7sq -- valory/mech_interact_abci:0.1.0:bafybeig2kvyn52kskydyono5wmjsfwtzeq5pcsrtn7p72rfesjatzwgrnq +- valory/mech_interact_abci:0.1.0:bafybeib3aytq2a5hk6vjsak3eznuilndx4p53utdylbyhcmt6ty7kk6euq behaviours: main: args: {} @@ -181,7 +181,9 @@ models: tx_timeout: 10.0 use_termination: false mech_contract_address: '0x77af31de935740567cf4ff1986d04b2c964a786a' - request_price: null + mech_request_price: null + mech_chain_id: gnosis + mech_wrapped_native_token_address: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d' sample_bets_closing_days: 10 trading_strategy: strategy_name use_fallback_strategy: true diff --git a/packages/valory/skills/staking_abci/behaviours.py b/packages/valory/skills/staking_abci/behaviours.py index fcf5a3c66..b3ac91d65 100644 --- a/packages/valory/skills/staking_abci/behaviours.py +++ b/packages/valory/skills/staking_abci/behaviours.py @@ -19,8 +19,9 @@ """This module contains the behaviours for the staking skill.""" +from abc import ABC from datetime import datetime, timedelta -from typing import Any, Callable, Generator, Optional, Set, Type, cast +from typing import Any, Callable, Generator, Optional, Set, Tuple, Type, cast from aea.configurations.data_types import PublicId @@ -59,34 +60,30 @@ SAFE_GAS = 0 -class CallCheckpointBehaviour(BaseBehaviour): - """Behaviour that calls the checkpoint contract function if the service is staked and if it is necessary.""" - - matching_round = CallCheckpointRound +class StakingInteractBaseBehaviour(BaseBehaviour, ABC): + """Base behaviour that contains methods to interact with the staking contract.""" def __init__(self, **kwargs: Any) -> None: """Initialize the behaviour.""" super().__init__(**kwargs) - self._service_staking_state: StakingState = StakingState.UNSTAKED - self._next_checkpoint: int = 0 - self._checkpoint_data: bytes = b"" - self._safe_tx_hash: str = "" - - @property - def params(self) -> StakingParams: - """Return the params.""" - return cast(StakingParams, self.context.params) - - @property - def synchronized_data(self) -> SynchronizedData: - """Return the synchronized data.""" - return SynchronizedData(super().synchronized_data.db) + params = cast(StakingParams, self.context.params) + self._staking_contract_address = params.staking_contract_address @property def synced_timestamp(self) -> int: """Return the synchronized timestamp across the agents.""" return int(self.round_sequence.last_round_transition_timestamp.timestamp()) + @property + def staking_contract_address(self) -> str: + """Get the staking contract address.""" + return self._staking_contract_address + + @staking_contract_address.setter + def staking_contract_address(self, staking_contract_address: str) -> None: + """Set the staking contract address.""" + self._staking_contract_address = staking_contract_address + @property def service_staking_state(self) -> StakingState: """Get the service's staking state.""" @@ -104,7 +101,7 @@ def next_checkpoint(self) -> int: @next_checkpoint.setter def next_checkpoint(self, next_checkpoint: int) -> None: - """Whether the service is staked.""" + """Set the next checkpoint.""" self._next_checkpoint = next_checkpoint @property @@ -113,30 +110,44 @@ def is_checkpoint_reached(self) -> bool: return self.next_checkpoint <= self.synced_timestamp @property - def checkpoint_data(self) -> bytes: - """Get the checkpoint data.""" - return self._checkpoint_data + def ts_checkpoint(self) -> int: + """Get the last checkpoint timestamp.""" + return self._checkpoint_ts - @checkpoint_data.setter - def checkpoint_data(self, data: bytes) -> None: - """Set the request data.""" - self._checkpoint_data = data + @ts_checkpoint.setter + def ts_checkpoint(self, checkpoint_ts: int) -> None: + """Set the last checkpoint timestamp.""" + self._checkpoint_ts = checkpoint_ts @property - def safe_tx_hash(self) -> str: - """Get the safe_tx_hash.""" - return self._safe_tx_hash + def liveness_period(self) -> int: + """Get the liveness period.""" + return self._liveness_period - @safe_tx_hash.setter - def safe_tx_hash(self, safe_hash: str) -> None: - """Set the safe_tx_hash.""" - length = len(safe_hash) - if length != TX_HASH_LENGTH: - raise ValueError( - f"Incorrect length {length} != {TX_HASH_LENGTH} detected " - f"when trying to assign a safe transaction hash: {safe_hash}" - ) - self._safe_tx_hash = safe_hash[2:] + @liveness_period.setter + def liveness_period(self, liveness_period: int) -> None: + """Set the liveness period.""" + self._liveness_period = liveness_period + + @property + def liveness_ratio(self) -> int: + """Get the liveness ratio.""" + return self._liveness_ratio + + @liveness_ratio.setter + def liveness_ratio(self, liveness_ratio: int) -> None: + """Set the liveness period.""" + self._liveness_ratio = liveness_ratio + + @property + def service_info(self) -> Tuple[Any]: + """Get the service info.""" + return self._service_info + + @service_info.setter + def service_info(self, service_info: Tuple[Any]) -> None: + """Set the service info.""" + self._service_info = service_info def wait_for_condition_with_sleep( self, @@ -217,7 +228,7 @@ def _staking_contract_interact( ) -> WaitableConditionType: """Interact with the staking contract.""" status = yield from self.contract_interact( - contract_address=self.params.staking_contract_address, + contract_address=self.staking_contract_address, contract_public_id=ServiceStakingTokenContract.contract_id, contract_callable=contract_callable, data_key=data_key, @@ -252,6 +263,99 @@ def _get_next_checkpoint(self) -> WaitableConditionType: ) return status + def _get_ts_checkpoint(self) -> WaitableConditionType: + """Get the timestamp in which the next checkpoint is reached.""" + status = yield from self._staking_contract_interact( + contract_callable="ts_checkpoint", + placeholder=get_name(CallCheckpointBehaviour.ts_checkpoint), + ) + return status + + def _get_liveness_period(self) -> WaitableConditionType: + """Get the liveness period.""" + status = yield from self._staking_contract_interact( + contract_callable="get_liveness_period", + placeholder=get_name(CallCheckpointBehaviour.liveness_period), + ) + return status + + def _get_liveness_ratio(self) -> WaitableConditionType: + """Get the liveness ratio.""" + status = yield from self._staking_contract_interact( + contract_callable="liveness_ratio", + placeholder=get_name(CallCheckpointBehaviour.liveness_ratio), + ) + return status + + def _get_service_info(self) -> WaitableConditionType: + """Get the service info.""" + service_id = self.params.on_chain_service_id + if service_id is None: + self.context.logger.warning( + "Cannot perform any staking-related operations without a configured on-chain service id. " + "Assuming service status 'UNSTAKED'." + ) + return True + + status = yield from self._staking_contract_interact( + contract_callable="get_service_info", + placeholder=get_name(CallCheckpointBehaviour.service_info), + service_id=service_id, + ) + return status + + +class CallCheckpointBehaviour( + StakingInteractBaseBehaviour +): # pylint-disable too-many-ancestors + """Behaviour that calls the checkpoint contract function if the service is staked and if it is necessary.""" + + matching_round = CallCheckpointRound + + def __init__(self, **kwargs: Any) -> None: + """Initialize the behaviour.""" + super().__init__(**kwargs) + self._service_staking_state: StakingState = StakingState.UNSTAKED + self._next_checkpoint: int = 0 + self._checkpoint_data: bytes = b"" + self._safe_tx_hash: str = "" + + @property + def params(self) -> StakingParams: + """Return the params.""" + return cast(StakingParams, self.context.params) + + @property + def synchronized_data(self) -> SynchronizedData: + """Return the synchronized data.""" + return SynchronizedData(super().synchronized_data.db) + + @property + def checkpoint_data(self) -> bytes: + """Get the checkpoint data.""" + return self._checkpoint_data + + @checkpoint_data.setter + def checkpoint_data(self, data: bytes) -> None: + """Set the request data.""" + self._checkpoint_data = data + + @property + def safe_tx_hash(self) -> str: + """Get the safe_tx_hash.""" + return self._safe_tx_hash + + @safe_tx_hash.setter + def safe_tx_hash(self, safe_hash: str) -> None: + """Set the safe_tx_hash.""" + length = len(safe_hash) + if length != TX_HASH_LENGTH: + raise ValueError( + f"Incorrect length {length} != {TX_HASH_LENGTH} detected " + f"when trying to assign a safe transaction hash: {safe_hash}" + ) + self._safe_tx_hash = safe_hash[2:] + def _build_checkpoint_tx(self) -> WaitableConditionType: """Get the request tx data encoded.""" result = yield from self._staking_contract_interact( diff --git a/packages/valory/skills/staking_abci/skill.yaml b/packages/valory/skills/staking_abci/skill.yaml index b33c9ee65..4e96a01e5 100644 --- a/packages/valory/skills/staking_abci/skill.yaml +++ b/packages/valory/skills/staking_abci/skill.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: bafybeifrpl36fddmgvniwvghqtxdzc44ry6l2zvqy37vu3y2xvwyd23ugy __init__.py: bafybeiageyes36ujnvvodqd5vlnihgz44rupysrk2ebbhskjkueetj6dai - behaviours.py: bafybeickkxb3stdbz5dwvs27t4vrji3uig673tmbl56py3tnwesydgcyn4 + behaviours.py: bafybeibio2hl5vic3zpx4oyco2jsqfhc2nn5xyoazfjosdk4r7o5d7oj74 dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm fsm_specification.yaml: bafybeicuoejmaks3ndwhbflp64kkfdkrdyn74a2fplarg4l3gxlonfmeoq handlers.py: bafybeichsi2y5zvzffupj2vhgagocwvnm7cbzr6jmavp656mfrzsdvkfnu @@ -19,7 +19,7 @@ fingerprint_ignore_patterns: [] connections: [] contracts: - valory/gnosis_safe:0.1.0:bafybeibq77mgzhyb23blf2eqmia3kc6io5karedfzhntvpcebeqdzrgyqa -- valory/service_staking_token:0.1.0:bafybeibpe24zfvpipaut77tsutmednncjviqeoekxltsndovdz3ugek7bu +- valory/service_staking_token:0.1.0:bafybeid44l7qekvkwkvmfl4kcqchnaktttacp7lbx464mzqqs5cnefj35e protocols: - valory/contract_api:1.0.0:bafybeidgu7o5llh26xp3u3ebq3yluull5lupiyeu6iooi2xyymdrgnzq5i skills: diff --git a/packages/valory/skills/trader_abci/behaviours.py b/packages/valory/skills/trader_abci/behaviours.py index 104598227..3abcf2b38 100644 --- a/packages/valory/skills/trader_abci/behaviours.py +++ b/packages/valory/skills/trader_abci/behaviours.py @@ -25,6 +25,9 @@ AbstractRoundBehaviour, BaseBehaviour, ) +from packages.valory.skills.check_stop_trading_abci.behaviours import ( + CheckStopTradingRoundBehaviour, +) from packages.valory.skills.decision_maker_abci.behaviours.round_behaviour import ( AgentDecisionMakerRoundBehaviour, ) @@ -71,5 +74,6 @@ class TraderConsensusBehaviour(AbstractRoundBehaviour): *TransactionSettlementRoundBehaviour.behaviours, *PostTxSettlementFullBehaviour.behaviours, *StakingRoundBehaviour.behaviours, + *CheckStopTradingRoundBehaviour.behaviours, } background_behaviours_cls = {BackgroundBehaviour} # type: ignore diff --git a/packages/valory/skills/trader_abci/composition.py b/packages/valory/skills/trader_abci/composition.py index eadee3f53..dd10414ba 100644 --- a/packages/valory/skills/trader_abci/composition.py +++ b/packages/valory/skills/trader_abci/composition.py @@ -24,6 +24,12 @@ chain, ) from packages.valory.skills.abstract_round_abci.base import BackgroundAppConfig +from packages.valory.skills.check_stop_trading_abci.rounds import ( + CheckStopTradingAbciApp, + CheckStopTradingRound, + FinishedCheckStopTradingRound, + FinishedWithSkipTradingRound, +) from packages.valory.skills.decision_maker_abci.rounds import DecisionMakerAbciApp from packages.valory.skills.decision_maker_abci.states.claim_subscription import ( ClaimRound, @@ -103,7 +109,9 @@ abci_app_transition_mapping: AbciAppTransitionMapping = { FinishedRegistrationRound: UpdateBetsRound, - FinishedMarketManagerRound: SamplingRound, + FinishedMarketManagerRound: CheckStopTradingRound, + FinishedCheckStopTradingRound: SamplingRound, + FinishedWithSkipTradingRound: RedeemRound, FailedMarketManagerRound: ResetAndPauseRound, FinishedDecisionMakerRound: PreTxSettlementRound, ChecksPassedRound: RandomnessTransactionSubmissionRound, @@ -146,6 +154,7 @@ TxSettlementMultiplexerAbciApp, ResetPauseAbciApp, StakingAbciApp, + CheckStopTradingAbciApp, ), abci_app_transition_mapping, ).add_background_app(termination_config) diff --git a/packages/valory/skills/trader_abci/fsm_specification.yaml b/packages/valory/skills/trader_abci/fsm_specification.yaml index c2e09de15..fa31f61ea 100644 --- a/packages/valory/skills/trader_abci/fsm_specification.yaml +++ b/packages/valory/skills/trader_abci/fsm_specification.yaml @@ -30,6 +30,7 @@ alphabet_in: - SERVICE_EVICTED - SERVICE_NOT_STAKED - SKIP_REQUEST +- SKIP_TRADING - SLOTS_UNSUPPORTED_ERROR - STAKING_DONE - SUBSCRIPTION_DONE @@ -53,6 +54,7 @@ states: - BlacklistingRound - CallCheckpointRound - CheckLateTxHashesRound +- CheckStopTradingRound - CheckTransactionHistoryRound - ClaimRound - CollectSignatureRound @@ -106,6 +108,11 @@ transition_func: (CheckLateTxHashesRound, NEGATIVE): HandleFailedTxRound (CheckLateTxHashesRound, NONE): HandleFailedTxRound (CheckLateTxHashesRound, NO_MAJORITY): HandleFailedTxRound + (CheckStopTradingRound, DONE): SamplingRound + (CheckStopTradingRound, NONE): CheckStopTradingRound + (CheckStopTradingRound, NO_MAJORITY): CheckStopTradingRound + (CheckStopTradingRound, ROUND_TIMEOUT): CheckStopTradingRound + (CheckStopTradingRound, SKIP_TRADING): RedeemRound (CheckTransactionHistoryRound, CHECK_LATE_ARRIVING_MESSAGE): SynchronizeLateMessagesRound (CheckTransactionHistoryRound, CHECK_TIMEOUT): CheckTransactionHistoryRound (CheckTransactionHistoryRound, DONE): PostTxSettlementRound @@ -210,7 +217,7 @@ transition_func: (ToolSelectionRound, NONE): ToolSelectionRound (ToolSelectionRound, NO_MAJORITY): ToolSelectionRound (ToolSelectionRound, ROUND_TIMEOUT): ToolSelectionRound - (UpdateBetsRound, DONE): SamplingRound + (UpdateBetsRound, DONE): CheckStopTradingRound (UpdateBetsRound, FETCH_ERROR): ResetAndPauseRound (UpdateBetsRound, NO_MAJORITY): UpdateBetsRound (UpdateBetsRound, ROUND_TIMEOUT): UpdateBetsRound diff --git a/packages/valory/skills/trader_abci/models.py b/packages/valory/skills/trader_abci/models.py index 1ae88ce94..6aea32e59 100644 --- a/packages/valory/skills/trader_abci/models.py +++ b/packages/valory/skills/trader_abci/models.py @@ -26,6 +26,7 @@ BenchmarkTool as BaseBenchmarkTool, ) from packages.valory.skills.abstract_round_abci.models import Requests as BaseRequests +from packages.valory.skills.check_stop_trading_abci.models import CheckStopTradingParams from packages.valory.skills.decision_maker_abci.models import ( AgentToolsSpecs as DecisionMakerAgentToolsSpecs, ) @@ -58,7 +59,6 @@ MechResponseSpecs as BaseMechResponseSpecs, ) from packages.valory.skills.reset_pause_abci.rounds import Event as ResetPauseEvent -from packages.valory.skills.staking_abci.models import StakingParams from packages.valory.skills.termination_abci.models import TerminationParams from packages.valory.skills.trader_abci.composition import TraderAbciApp from packages.valory.skills.transaction_settlement_abci.rounds import Event as TSEvent @@ -100,8 +100,8 @@ class RandomnessApi(ApiSpecs): class TraderParams( DecisionMakerParams, # It also contains MechInteractParams TerminationParams, - StakingParams, TxSettlementMultiplexerParams, + CheckStopTradingParams, # It also contains StakingParams ): """A model to represent the trader params.""" diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 5cfda829c..7891429a4 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -8,12 +8,12 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: bafybeiab4xgadptz4mhvno4p6xvkh7p4peg7iuhotabydriu74dmj6ljga __init__.py: bafybeido7wa33h4dtleap57vzgyb4fsofk4vindsqcekyfo5i56i2rll2a - behaviours.py: bafybeigx2uevbnytt6hpwfsrk32u6pyv5scyqvyyzm2a25xaufrxvkldxi - composition.py: bafybeidvxtqoghju4tkesiwi6qfzxe3zf2nbqmehimwvp5skmohkeozmei + behaviours.py: bafybeigc6hszbu66ccajny5eh7thfgsrlr36je4mzziwp4mupgvtaeu6aa + composition.py: bafybeidazh2w4do27n2fmwh5eyca7tet5dxw4uilh4wkhoazlgyhr7w3eu dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm - fsm_specification.yaml: bafybeiaulbsq76cc5h7jjz6oiezoui452mtyk6g2kbmhhzsggqrjqw4cuy + fsm_specification.yaml: bafybeicibuzg6mf6632jin3d6xylkb7if5o4dqpire6ijhor5v2e6rvo7u handlers.py: bafybeibkiqwe7hoqccjirimd44nzeqkabc7oo74romqklssion27s5sa2a - models.py: bafybeigk7hs7xsfjoszsque6r6yvbrrhattfuli2nfend4istk465e6try + models.py: bafybeih2bhwwqms32da3zlcpxfwoy725xdbs42e7u55enwuscacffwchaa fingerprint_ignore_patterns: [] connections: [] contracts: [] @@ -25,10 +25,11 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeigtzlk4uakmd54rxnznorcrstsr52kta474lgrnvx5ovr546vj7sq - valory/termination_abci:0.1.0:bafybeihq6qtbwt6i53ayqym63vhjexkcppy26gguzhhjqywfmiuqghvv44 - valory/market_manager_abci:0.1.0:bafybeidygkw7mwhbk3ry3au5c5265vms5eti375v5jthd4be5dfnnoache -- valory/decision_maker_abci:0.1.0:bafybeigyrxb6ycg243crte5mmmut2znfhlnc43rqn3mnp3sylvf563teki -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibl6b5negw35fumbvl6dvcu7dammqmac5x3htapu3p7yf7lkqr73a -- valory/staking_abci:0.1.0:bafybeibf565rftitlrlovlvchoe45ng72ctec74fsvrmegp3o4uepu4q2e -- valory/mech_interact_abci:0.1.0:bafybeig2kvyn52kskydyono5wmjsfwtzeq5pcsrtn7p72rfesjatzwgrnq +- valory/decision_maker_abci:0.1.0:bafybeibvq365gs7ibi7bkzoqyiirdcbpros2q7z3zpsqxhbcfy5d77y7je +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibcuvrm5fvmh7nuee4tmbof6debprdqzhvhdpzp2dbddtwva4wz3y +- valory/staking_abci:0.1.0:bafybeicrp3dbvxcb2wa7kdgpkxu7aqji5fwq6icwcfw7anfcpqv26irsr4 +- valory/check_stop_trading_abci:0.1.0:bafybeiedpw6gudh7ddrcfpggnbxmbfaqn57a5geg645c2ymuzwy3rtckii +- valory/mech_interact_abci:0.1.0:bafybeib3aytq2a5hk6vjsak3eznuilndx4p53utdylbyhcmt6ty7kk6euq behaviours: main: args: {} @@ -148,7 +149,9 @@ models: average_block_time: 5 abt_error_mult: 5 mech_contract_address: '0x77af31de935740567cf4ff1986d04b2c964a786a' - request_price: null + mech_request_price: null + mech_chain_id: gnosis + mech_wrapped_native_token_address: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d' sample_bets_closing_days: 10 trading_strategy: strategy_name use_fallback_strategy: true @@ -181,6 +184,8 @@ models: - stabilityai-stable-diffusion-512-v2-1 - stabilityai-stable-diffusion-768-v2-1 staking_contract_address: '0x2Ef503950Be67a98746F484DA0bBAdA339DF3326' + disable_trading: false + stop_trading_if_staking_kpi_met: true agent_balance_threshold: 10000000000000000 refill_check_interval: 10 redeem_round_timeout: 3600.0 diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 222267cf4..960e65895 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,9 +21,9 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeih3enhagoql7kzpeyzzu2scpkif6y3ubakpralfnwxcvxexdyvy5i -- valory/decision_maker_abci:0.1.0:bafybeigyrxb6ycg243crte5mmmut2znfhlnc43rqn3mnp3sylvf563teki -- valory/staking_abci:0.1.0:bafybeibf565rftitlrlovlvchoe45ng72ctec74fsvrmegp3o4uepu4q2e -- valory/mech_interact_abci:0.1.0:bafybeig2kvyn52kskydyono5wmjsfwtzeq5pcsrtn7p72rfesjatzwgrnq +- valory/decision_maker_abci:0.1.0:bafybeibvq365gs7ibi7bkzoqyiirdcbpros2q7z3zpsqxhbcfy5d77y7je +- valory/staking_abci:0.1.0:bafybeicrp3dbvxcb2wa7kdgpkxu7aqji5fwq6icwcfw7anfcpqv26irsr4 +- valory/mech_interact_abci:0.1.0:bafybeib3aytq2a5hk6vjsak3eznuilndx4p53utdylbyhcmt6ty7kk6euq behaviours: main: args: {}