Skip to content

Commit

Permalink
Merge pull request #244 from valory-xyz/fix/checkpoint
Browse files Browse the repository at this point in the history
Fix/checkpoint
  • Loading branch information
dvilelaf authored Dec 3, 2024
2 parents 660e37c + a549a17 commit 1ec20a1
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 33 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ In order to run a local demo service based on the IEKit:
2. Fetch the IEKit.

```bash
autonomy fetch valory/impact_evaluator:0.1.0:bafybeiatlrpepgcyxmiwlcfmudo4ea3dpytgo4ivkegqopugi2fbgwypsu --service
autonomy fetch valory/impact_evaluator:0.1.0:bafybeigexmn4jl2s43urlusyajcplmvf3sqcm3ty63ukzgloyfuigzude4 --service
```

3. Build the Docker image of the service agents
Expand Down
20 changes: 10 additions & 10 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@
"connection/valory/twitter/0.1.0": "bafybeiankzrpgovfe34wbxxwzmrg6lbdpe2uegcu4ujtswuopr3b7fsqdq",
"connection/valory/openai/0.1.0": "bafybeiaryip2lbiluf7vjsdq6r5qiqdesmhqevrzekfrxpugfypqja6gae",
"connection/valory/farcaster/0.1.0": "bafybeibbdas7lxbipksodaphjms3uop7vnzjqkroktjq2g6wbvgtlldaxi",
"skill/valory/dynamic_nft_abci/0.1.0": "bafybeibjo44mdovoaimfsagxxrvmj2nh7w22wig3xq7xx4x3ksrj3wi3pm",
"skill/valory/twitter_scoring_abci/0.1.0": "bafybeibowidqjmxzgvi2s3yocrsolkbofao5sjir6boapyja3s27jbkwc4",
"skill/valory/dynamic_nft_abci/0.1.0": "bafybeigyn5xcndifdqceieqotpkhmmadacybojdl4zl3bnpromrg5e4thi",
"skill/valory/twitter_scoring_abci/0.1.0": "bafybeibpevvo25gngej3mtd3ilkoevieq74d5ag5mevgycgtzd7r3ceemu",
"skill/valory/ceramic_read_abci/0.1.0": "bafybeibph35jhtvn6kgytj6mqdz4lpjkvtfqd75qorrt4onv6i2trxfttu",
"skill/valory/ceramic_write_abci/0.1.0": "bafybeihez2zrvvt6cyi5vu3fpomjlbo3v4fzyf4buv7ysxzj4dntr2wy3q",
"skill/valory/impact_evaluator_abci/0.1.0": "bafybeic5n47n3m5e6a62sscfafubmqughrw2mrt5tcoe34pbjnqpi36g5u",
"skill/valory/generic_scoring_abci/0.1.0": "bafybeih3zk4zx4ul3rkl5s4yaqxl5wkl723j23t5ggbzsn2u7t5w5abbsy",
"skill/valory/impact_evaluator_abci/0.1.0": "bafybeiarfz5dvfksl5gzeepe5o23sqngcfvck4u5xmqnb3rpgljomlozvy",
"skill/valory/generic_scoring_abci/0.1.0": "bafybeiho6p6ahlrbbavssqe6mgigj6lbpkifc2gspzfe2b6ayib3le4oxm",
"skill/valory/twitter_write_abci/0.1.0": "bafybeig4dc4cereyshk535pfpparvxiuaimdu4lsm3hnl5li7pxafho6lu",
"skill/valory/llm_abci/0.1.0": "bafybeihpfesi2sjqdcb2j2mqybhz7av7jlvf27ozk32wbwmklkdugycxyq",
"skill/valory/decision_making_abci/0.1.0": "bafybeiem7f6g5d72xbtfus52sypg5rykqzf5dzonoxx4s6aonewwmv3jrm",
"skill/valory/olas_week_abci/0.1.0": "bafybeibzg3jo5ilrii6f5cgk2htuipjueuyzjj6vfcqlnug4ooforjizni",
"skill/valory/decision_making_abci/0.1.0": "bafybeibovigvsxoq2huixbpeb7z5mxfvkwzf2zltveibj55eqbaepy2a74",
"skill/valory/olas_week_abci/0.1.0": "bafybeibjfxhu3j7ww2lxcekwtw7uiq7iptmhkzgjhk2342mbamrmvol7ma",
"skill/valory/mech_interact_abci/0.1.0": "bafybeib4vn6m2yumwoclh5aatcdt5yxcjc5owxmxy5o7t3nfzormgwkr64",
"skill/valory/farcaster_write_abci/0.1.0": "bafybeibbbfui3g2s63cg5vsvxqpzzdg2uxhd7a4ikwfo6dy7b2klqthvu4",
"skill/valory/farcaster_test_abci/0.1.0": "bafybeiblauv376hvy7dzi232fxf6iq5nxxnhvk2gy6g7kcsj7a4r2bilqa",
"skill/valory/staking_abci/0.1.0": "bafybeicabieii5mlugcq34hk4ylmmti5judectixo4y6kxzolzw7gexgl4",
"agent/valory/impact_evaluator/0.1.0": "bafybeifp66n4kppy52hovt3tc3an7s5bcqbfrbhfpt3spd4sizb6mcofdi",
"skill/valory/staking_abci/0.1.0": "bafybeiffqyu4plhkkezhz6oabgx6nb6v2ozhs53iruw7p4ucclbgvo5u24",
"agent/valory/impact_evaluator/0.1.0": "bafybeicsncua573sgxisxkxf3f6xflt2plyxeejh4lbstr6ybywuj6ekqi",
"agent/valory/farcaster_test/0.1.0": "bafybeig6yilme5s7fvru2b44dtr5xxqz3gf7p56swr7c5hip775l5wally",
"service/valory/impact_evaluator/0.1.0": "bafybeiatlrpepgcyxmiwlcfmudo4ea3dpytgo4ivkegqopugi2fbgwypsu",
"service/valory/impact_evaluator_local/0.1.0": "bafybeihy5xsp5muo55glmq4sih2jln7lfkqhokasg6ttunik3zqk2ci5a4"
"service/valory/impact_evaluator/0.1.0": "bafybeigexmn4jl2s43urlusyajcplmvf3sqcm3ty63ukzgloyfuigzude4",
"service/valory/impact_evaluator_local/0.1.0": "bafybeiczd3xkxlfzrpwhu5sqsj5z5d4i2ijlk5xmzf2466de2drn7snvhi"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
14 changes: 7 additions & 7 deletions packages/valory/agents/impact_evaluator/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ protocols:
skills:
- valory/abstract_abci:0.1.0:bafybeif2naoydlrqkdpnig34uejedwgurjwyvmbpcz53tif7pyukfdophq
- valory/abstract_round_abci:0.1.0:bafybeigjddhk7epta7xpnfvv426xedff5abh4xlkwi6cqgp4vkutgkvydm
- valory/impact_evaluator_abci:0.1.0:bafybeic5n47n3m5e6a62sscfafubmqughrw2mrt5tcoe34pbjnqpi36g5u
- valory/generic_scoring_abci:0.1.0:bafybeih3zk4zx4ul3rkl5s4yaqxl5wkl723j23t5ggbzsn2u7t5w5abbsy
- valory/twitter_scoring_abci:0.1.0:bafybeibowidqjmxzgvi2s3yocrsolkbofao5sjir6boapyja3s27jbkwc4
- valory/impact_evaluator_abci:0.1.0:bafybeiarfz5dvfksl5gzeepe5o23sqngcfvck4u5xmqnb3rpgljomlozvy
- valory/generic_scoring_abci:0.1.0:bafybeiho6p6ahlrbbavssqe6mgigj6lbpkifc2gspzfe2b6ayib3le4oxm
- valory/twitter_scoring_abci:0.1.0:bafybeibpevvo25gngej3mtd3ilkoevieq74d5ag5mevgycgtzd7r3ceemu
- valory/ceramic_read_abci:0.1.0:bafybeibph35jhtvn6kgytj6mqdz4lpjkvtfqd75qorrt4onv6i2trxfttu
- valory/ceramic_write_abci:0.1.0:bafybeihez2zrvvt6cyi5vu3fpomjlbo3v4fzyf4buv7ysxzj4dntr2wy3q
- valory/dynamic_nft_abci:0.1.0:bafybeibjo44mdovoaimfsagxxrvmj2nh7w22wig3xq7xx4x3ksrj3wi3pm
- valory/dynamic_nft_abci:0.1.0:bafybeigyn5xcndifdqceieqotpkhmmadacybojdl4zl3bnpromrg5e4thi
- valory/registration_abci:0.1.0:bafybeiagi6e2h7kochmlemy5c5yk6hwn37tfxiqvk2en74jhowsdwlmrny
- valory/reset_pause_abci:0.1.0:bafybeiezfedmmseox3ce5aucxsiszdmvskrwwbtpb2a3vw3sbmc5jt7nri
- valory/termination_abci:0.1.0:bafybeiea67epwwgngp7b3wavs6hpkaxv6etyaps6g6325bchfnf354mibq
- valory/transaction_settlement_abci:0.1.0:bafybeifmgmwdkx4esemxjacjwzqkqymkuklb5nehkwqkx7v335fllgswcq
- valory/twitter_write_abci:0.1.0:bafybeig4dc4cereyshk535pfpparvxiuaimdu4lsm3hnl5li7pxafho6lu
- valory/decision_making_abci:0.1.0:bafybeiem7f6g5d72xbtfus52sypg5rykqzf5dzonoxx4s6aonewwmv3jrm
- valory/decision_making_abci:0.1.0:bafybeibovigvsxoq2huixbpeb7z5mxfvkwzf2zltveibj55eqbaepy2a74
- valory/llm_abci:0.1.0:bafybeihpfesi2sjqdcb2j2mqybhz7av7jlvf27ozk32wbwmklkdugycxyq
- valory/olas_week_abci:0.1.0:bafybeibzg3jo5ilrii6f5cgk2htuipjueuyzjj6vfcqlnug4ooforjizni
- valory/olas_week_abci:0.1.0:bafybeibjfxhu3j7ww2lxcekwtw7uiq7iptmhkzgjhk2342mbamrmvol7ma
- valory/mech_interact_abci:0.1.0:bafybeib4vn6m2yumwoclh5aatcdt5yxcjc5owxmxy5o7t3nfzormgwkr64
- valory/staking_abci:0.1.0:bafybeicabieii5mlugcq34hk4ylmmti5judectixo4y6kxzolzw7gexgl4
- valory/staking_abci:0.1.0:bafybeiffqyu4plhkkezhz6oabgx6nb6v2ozhs53iruw7p4ucclbgvo5u24
default_ledger: ethereum
required_ledgers:
- ethereum
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/impact_evaluator/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeign56hilwuoa6bgos3uqabss4gew4vadkik7vhj3ucpqw6nxtqtpe
fingerprint_ignore_patterns: []
agent: valory/impact_evaluator:0.1.0:bafybeifp66n4kppy52hovt3tc3an7s5bcqbfrbhfpt3spd4sizb6mcofdi
agent: valory/impact_evaluator:0.1.0:bafybeicsncua573sgxisxkxf3f6xflt2plyxeejh4lbstr6ybywuj6ekqi
number_of_agents: 4
deployment:
agent:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeign56hilwuoa6bgos3uqabss4gew4vadkik7vhj3ucpqw6nxtqtpe
fingerprint_ignore_patterns: []
agent: valory/impact_evaluator:0.1.0:bafybeifp66n4kppy52hovt3tc3an7s5bcqbfrbhfpt3spd4sizb6mcofdi
agent: valory/impact_evaluator:0.1.0:bafybeicsncua573sgxisxkxf3f6xflt2plyxeejh4lbstr6ybywuj6ekqi
number_of_agents: 1
deployment:
agent:
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/skills/decision_making_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fingerprint:
tasks/read_stream_preparation.py: bafybeicmjasiyecopfweobodzbmn3tbluu5q724uzzqkit6urn3lb5q354
tasks/score_preparations.py: bafybeie7cfot24zcyod5becz6t5lasvva77httfkw57qmvgjk35d3qluxa
tasks/signature_validation.py: bafybeihbwrv72hnh3ytko2i5oszqgdky2j6h2wse45wvuhf2j32lo2tsjy
tasks/staking.py: bafybeihg54pf7ekzzped6tulzfv74vkeyfijlgzsgmlr7ndyq642qtixtu
tasks/staking.py: bafybeicpdqbvzx5prfpngb54m5nicisavufapfywtvt33dbmtvkl7fjadu
tasks/task_preparations.py: bafybeihfm3ms665fvz2qwmhmcwgl2ws5mt62pykomowoxpm6a46jlqvsmu
tasks/tweet_validation_preparation.py: bafybeif3wbfskiyuij7unx72euklms7owrzwzgdu462xatvypalm6xrgca
tasks/twitter_preparation.py: bafybeicn7stcvmd6oex55dwptwxpikpssbcwnj2d3xkercikg5nlzqh4k4
Expand Down Expand Up @@ -58,7 +58,7 @@ protocols:
skills:
- valory/abstract_round_abci:0.1.0:bafybeigjddhk7epta7xpnfvv426xedff5abh4xlkwi6cqgp4vkutgkvydm
- valory/ceramic_read_abci:0.1.0:bafybeibph35jhtvn6kgytj6mqdz4lpjkvtfqd75qorrt4onv6i2trxfttu
- valory/staking_abci:0.1.0:bafybeicabieii5mlugcq34hk4ylmmti5judectixo4y6kxzolzw7gexgl4
- valory/staking_abci:0.1.0:bafybeiffqyu4plhkkezhz6oabgx6nb6v2ozhs53iruw7p4ucclbgvo5u24
behaviours:
main:
args: {}
Expand Down
32 changes: 32 additions & 0 deletions packages/valory/skills/decision_making_abci/tasks/staking.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,31 @@ def get_staking_contract(
return None
return staking_contract_address

def get_staked_services(
self, staking_contract_address: str
) -> Generator[None, None, Optional[List]]:
"""Get the services staked on a contract"""
contract_api_msg = yield from self.behaviour.get_contract_api_response(
performative=ContractApiMessage.Performative.GET_STATE, # type: ignore
contract_address=staking_contract_address,
contract_id=str(Staking.contract_id),
contract_callable="get_service_ids",
chain_id=BASE_CHAIN_ID,
)
if contract_api_msg.performative != ContractApiMessage.Performative.STATE:
self.context.logger.error(
f"Error getting the service ids: [{contract_api_msg.performative}]"
)
return None

service_ids = cast(str, contract_api_msg.state.body["service_ids"])

self.context.logger.info(
f"Got {len(service_ids)} staked services for contract {staking_contract_address}"
)

return service_ids


class StakingActivityPreparation(StakingPreparation):
"""StakingActivityPreparation"""
Expand Down Expand Up @@ -363,6 +388,13 @@ def check_extra_conditions(self):
yield

for staking_contract_address in self.params.staking_contract_addresses:
# Check if there is some service staked on this contract
services_staked = yield from self.get_staked_services(
staking_contract_address
)
if not services_staked:
continue

is_checkpoint_callable = yield from self.is_checkpoint_callable(
staking_contract_address
)
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/dynamic_nft_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protocols:
- valory/http:1.0.0:bafybeifugzl63kfdmwrxwphrnrhj7bn6iruxieme3a4ntzejf6kmtuwmae
skills:
- valory/abstract_round_abci:0.1.0:bafybeigjddhk7epta7xpnfvv426xedff5abh4xlkwi6cqgp4vkutgkvydm
- valory/decision_making_abci:0.1.0:bafybeiem7f6g5d72xbtfus52sypg5rykqzf5dzonoxx4s6aonewwmv3jrm
- valory/decision_making_abci:0.1.0:bafybeibovigvsxoq2huixbpeb7z5mxfvkwzf2zltveibj55eqbaepy2a74
behaviours:
main:
args: {}
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/generic_scoring_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contracts: []
protocols: []
skills:
- valory/abstract_round_abci:0.1.0:bafybeigjddhk7epta7xpnfvv426xedff5abh4xlkwi6cqgp4vkutgkvydm
- valory/decision_making_abci:0.1.0:bafybeiem7f6g5d72xbtfus52sypg5rykqzf5dzonoxx4s6aonewwmv3jrm
- valory/decision_making_abci:0.1.0:bafybeibovigvsxoq2huixbpeb7z5mxfvkwzf2zltveibj55eqbaepy2a74
behaviours:
main:
args: {}
Expand Down
12 changes: 6 additions & 6 deletions packages/valory/skills/impact_evaluator_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ protocols: []
skills:
- valory/abstract_round_abci:0.1.0:bafybeigjddhk7epta7xpnfvv426xedff5abh4xlkwi6cqgp4vkutgkvydm
- valory/ceramic_read_abci:0.1.0:bafybeibph35jhtvn6kgytj6mqdz4lpjkvtfqd75qorrt4onv6i2trxfttu
- valory/generic_scoring_abci:0.1.0:bafybeih3zk4zx4ul3rkl5s4yaqxl5wkl723j23t5ggbzsn2u7t5w5abbsy
- valory/twitter_scoring_abci:0.1.0:bafybeibowidqjmxzgvi2s3yocrsolkbofao5sjir6boapyja3s27jbkwc4
- valory/generic_scoring_abci:0.1.0:bafybeiho6p6ahlrbbavssqe6mgigj6lbpkifc2gspzfe2b6ayib3le4oxm
- valory/twitter_scoring_abci:0.1.0:bafybeibpevvo25gngej3mtd3ilkoevieq74d5ag5mevgycgtzd7r3ceemu
- valory/ceramic_write_abci:0.1.0:bafybeihez2zrvvt6cyi5vu3fpomjlbo3v4fzyf4buv7ysxzj4dntr2wy3q
- valory/dynamic_nft_abci:0.1.0:bafybeibjo44mdovoaimfsagxxrvmj2nh7w22wig3xq7xx4x3ksrj3wi3pm
- valory/dynamic_nft_abci:0.1.0:bafybeigyn5xcndifdqceieqotpkhmmadacybojdl4zl3bnpromrg5e4thi
- valory/registration_abci:0.1.0:bafybeiagi6e2h7kochmlemy5c5yk6hwn37tfxiqvk2en74jhowsdwlmrny
- valory/reset_pause_abci:0.1.0:bafybeiezfedmmseox3ce5aucxsiszdmvskrwwbtpb2a3vw3sbmc5jt7nri
- valory/termination_abci:0.1.0:bafybeiea67epwwgngp7b3wavs6hpkaxv6etyaps6g6325bchfnf354mibq
- valory/transaction_settlement_abci:0.1.0:bafybeifmgmwdkx4esemxjacjwzqkqymkuklb5nehkwqkx7v335fllgswcq
- valory/decision_making_abci:0.1.0:bafybeiem7f6g5d72xbtfus52sypg5rykqzf5dzonoxx4s6aonewwmv3jrm
- valory/decision_making_abci:0.1.0:bafybeibovigvsxoq2huixbpeb7z5mxfvkwzf2zltveibj55eqbaepy2a74
- valory/llm_abci:0.1.0:bafybeihpfesi2sjqdcb2j2mqybhz7av7jlvf27ozk32wbwmklkdugycxyq
- valory/twitter_write_abci:0.1.0:bafybeig4dc4cereyshk535pfpparvxiuaimdu4lsm3hnl5li7pxafho6lu
- valory/olas_week_abci:0.1.0:bafybeibzg3jo5ilrii6f5cgk2htuipjueuyzjj6vfcqlnug4ooforjizni
- valory/olas_week_abci:0.1.0:bafybeibjfxhu3j7ww2lxcekwtw7uiq7iptmhkzgjhk2342mbamrmvol7ma
- valory/mech_interact_abci:0.1.0:bafybeib4vn6m2yumwoclh5aatcdt5yxcjc5owxmxy5o7t3nfzormgwkr64
- valory/staking_abci:0.1.0:bafybeicabieii5mlugcq34hk4ylmmti5judectixo4y6kxzolzw7gexgl4
- valory/staking_abci:0.1.0:bafybeiffqyu4plhkkezhz6oabgx6nb6v2ozhs53iruw7p4ucclbgvo5u24
behaviours:
main:
args: {}
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/olas_week_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protocols:
- valory/llm:1.0.0:bafybeihj2orqapokafg7co3wlogwgf6cckaaj2bz3nuv4rm3opkoyhrlp4
skills:
- valory/abstract_round_abci:0.1.0:bafybeigjddhk7epta7xpnfvv426xedff5abh4xlkwi6cqgp4vkutgkvydm
- valory/decision_making_abci:0.1.0:bafybeiem7f6g5d72xbtfus52sypg5rykqzf5dzonoxx4s6aonewwmv3jrm
- valory/decision_making_abci:0.1.0:bafybeibovigvsxoq2huixbpeb7z5mxfvkwzf2zltveibj55eqbaepy2a74
behaviours:
main:
args: {}
Expand Down
5 changes: 5 additions & 0 deletions packages/valory/skills/staking_abci/behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,11 @@ def get_checkpoint_hash(self) -> Generator[None, None, Optional[str]]:

for staking_contract_address in self.params.staking_contract_addresses:

# Check if there is some service staked on this contract
services_staked = yield from self.get_staked_services(staking_contract_address)
if not services_staked:
continue

# Check if this checkpoint needs to be called
is_checkpoint_callable = yield from self.is_checkpoint_callable(staking_contract_address)
if not is_checkpoint_callable:
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/staking_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
aea_version: '>=1.0.0, <2.0.0'
fingerprint:
__init__.py: bafybeie3oujhxxdr5s2lvc6cosbysezqycagw5mbwvxjw24k3dzcbtgg5m
behaviours.py: bafybeihuxzvd2hk27cebcazmudclzdtdr7mjpejqou2q3xbkxlftlso37y
behaviours.py: bafybeih35xwfoigo5c5demf53bxkcbptfks5qzti7rkuokwec4nirljbli
dialogues.py: bafybeifmmpyiwetlcgykczsq4dgwvm7tipdupf2rwcndg5cmtm7jfoxwxm
fsm_specification.yaml: bafybeicjj2blynjtxejcjkr3fmb5mlvfxu4zpymqwurdciqvj5biz37ruu
handlers.py: bafybeiaufft2fwbbjbbc77md6xkq7prnzzi2nkkm2fipapgx54myabmb7y
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/twitter_scoring_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protocols:
- valory/contract_api:1.0.0:bafybeidgu7o5llh26xp3u3ebq3yluull5lupiyeu6iooi2xyymdrgnzq5i
skills:
- valory/abstract_round_abci:0.1.0:bafybeigjddhk7epta7xpnfvv426xedff5abh4xlkwi6cqgp4vkutgkvydm
- valory/decision_making_abci:0.1.0:bafybeiem7f6g5d72xbtfus52sypg5rykqzf5dzonoxx4s6aonewwmv3jrm
- valory/decision_making_abci:0.1.0:bafybeibovigvsxoq2huixbpeb7z5mxfvkwzf2zltveibj55eqbaepy2a74
- valory/mech_interact_abci:0.1.0:bafybeib4vn6m2yumwoclh5aatcdt5yxcjc5owxmxy5o7t3nfzormgwkr64
behaviours:
main:
Expand Down
18 changes: 18 additions & 0 deletions scripts/check_staking.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ def get_contract_info() -> Dict:

contract_info = STAKING_CONTRACTS

table = Table(title="Contribute staking contracts")
columns = ["Name", "Adress", "Epoch", "Epoch end", "Used slots"]

for column in columns:
table.add_column(column)

for contract_name, contract_data in STAKING_CONTRACTS.items():
staking_token_contract = load_contract(
Expand All @@ -148,8 +153,21 @@ def get_contract_info() -> Dict:
contract_info[contract_name]["used_slots"] = len(ids)
contract_info[contract_name]["free_slots"] = contract_data["slots"] - len(ids)

row = [
contract_name,
contract_data["address"],
str(epoch),
next_epoch_start.strftime("%Y-%m-%d %H:%M:%S"),
f"{len(ids):3d} / {contract_data['slots']:3d}"
]
table.add_row(*row, style=GREEN)

console = Console()
console.print(table, justify="center")

return contract_info


def get_user_info(user_data: Dict, contract_info: Dict, contributors_contract: Contract) -> Dict: # pylint: disable=too-many-locals
"""Get user info"""

Expand Down

0 comments on commit 1ec20a1

Please sign in to comment.