diff --git a/docs/index.md b/docs/index.md index 7f5173bf..83c5956e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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:bafybeidw7kxgdzltrkrfrfvplsmw6xkpx2mzbgapdq6nxe7fd57gu22zku --service + autonomy fetch valory/impact_evaluator:0.1.0:bafybeibagmo33sm6mcetjplelsfyflxj74flwsl4kglsg4oolxvvctx47u --service ``` 3. Build the Docker image of the service agents diff --git a/packages/packages.json b/packages/packages.json index 1f280ebc..d7f95725 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -19,7 +19,7 @@ "skill/valory/twitter_scoring_abci/0.1.0": "bafybeidwoqhgrppbmi25vxgy54gd2ord4ojmcr6b4k7dh4gqju3zy4oeuq", "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": "bafybeifcxcemrjt3trmwwfu3a36wbg7tbofgwuxedwqmrypf7jxmqo4u54", + "skill/valory/impact_evaluator_abci/0.1.0": "bafybeidtmy2dcqj2qaacqngzlblxrur4mk5nbl6qslgsa5mibiljxzweha", "skill/valory/generic_scoring_abci/0.1.0": "bafybeiej5iwzfvoan4kp4erfxva3h5vrrmon6ahbyupa2jdfypy5i25t5y", "skill/valory/twitter_write_abci/0.1.0": "bafybeig4dc4cereyshk535pfpparvxiuaimdu4lsm3hnl5li7pxafho6lu", "skill/valory/llm_abci/0.1.0": "bafybeihpfesi2sjqdcb2j2mqybhz7av7jlvf27ozk32wbwmklkdugycxyq", @@ -29,10 +29,10 @@ "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": "bafybeie3wypei4kt35trwpa26ocn3zvxb6a45ch2wzbsaev3fxg6lj7yqm", - "agent/valory/impact_evaluator/0.1.0": "bafybeifqhhy7fgxommu45e7yuigixavzifzelvirkadcj72llgzp3bpswe", + "agent/valory/impact_evaluator/0.1.0": "bafybeigrcdnosmbyw4sqzs64vx5w3esfixi2nddyz4qhp4rleuc5ld26qm", "agent/valory/farcaster_test/0.1.0": "bafybeig6yilme5s7fvru2b44dtr5xxqz3gf7p56swr7c5hip775l5wally", - "service/valory/impact_evaluator/0.1.0": "bafybeidw7kxgdzltrkrfrfvplsmw6xkpx2mzbgapdq6nxe7fd57gu22zku", - "service/valory/impact_evaluator_local/0.1.0": "bafybeibay3ctdmrrfoxymxcdraruekh4qslmk7dogatjpkvuz5jmmabsue" + "service/valory/impact_evaluator/0.1.0": "bafybeibagmo33sm6mcetjplelsfyflxj74flwsl4kglsg4oolxvvctx47u", + "service/valory/impact_evaluator_local/0.1.0": "bafybeihdj5thh5l2a5eho45ivygvrtsbs7ydqwh7svyyzqap4nld2gsmii" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/impact_evaluator/aea-config.yaml b/packages/valory/agents/impact_evaluator/aea-config.yaml index a2d5f8f3..a7dcc2bd 100644 --- a/packages/valory/agents/impact_evaluator/aea-config.yaml +++ b/packages/valory/agents/impact_evaluator/aea-config.yaml @@ -46,7 +46,7 @@ protocols: skills: - valory/abstract_abci:0.1.0:bafybeif2naoydlrqkdpnig34uejedwgurjwyvmbpcz53tif7pyukfdophq - valory/abstract_round_abci:0.1.0:bafybeigjddhk7epta7xpnfvv426xedff5abh4xlkwi6cqgp4vkutgkvydm -- valory/impact_evaluator_abci:0.1.0:bafybeifcxcemrjt3trmwwfu3a36wbg7tbofgwuxedwqmrypf7jxmqo4u54 +- valory/impact_evaluator_abci:0.1.0:bafybeidtmy2dcqj2qaacqngzlblxrur4mk5nbl6qslgsa5mibiljxzweha - valory/generic_scoring_abci:0.1.0:bafybeiej5iwzfvoan4kp4erfxva3h5vrrmon6ahbyupa2jdfypy5i25t5y - valory/twitter_scoring_abci:0.1.0:bafybeidwoqhgrppbmi25vxgy54gd2ord4ojmcr6b4k7dh4gqju3zy4oeuq - valory/ceramic_read_abci:0.1.0:bafybeibph35jhtvn6kgytj6mqdz4lpjkvtfqd75qorrt4onv6i2trxfttu diff --git a/packages/valory/services/impact_evaluator/service.yaml b/packages/valory/services/impact_evaluator/service.yaml index 52e87379..9a170579 100644 --- a/packages/valory/services/impact_evaluator/service.yaml +++ b/packages/valory/services/impact_evaluator/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeign56hilwuoa6bgos3uqabss4gew4vadkik7vhj3ucpqw6nxtqtpe fingerprint_ignore_patterns: [] -agent: valory/impact_evaluator:0.1.0:bafybeifqhhy7fgxommu45e7yuigixavzifzelvirkadcj72llgzp3bpswe +agent: valory/impact_evaluator:0.1.0:bafybeigrcdnosmbyw4sqzs64vx5w3esfixi2nddyz4qhp4rleuc5ld26qm number_of_agents: 4 deployment: agent: diff --git a/packages/valory/services/impact_evaluator_local/service.yaml b/packages/valory/services/impact_evaluator_local/service.yaml index da034eb2..b3faabfd 100644 --- a/packages/valory/services/impact_evaluator_local/service.yaml +++ b/packages/valory/services/impact_evaluator_local/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeign56hilwuoa6bgos3uqabss4gew4vadkik7vhj3ucpqw6nxtqtpe fingerprint_ignore_patterns: [] -agent: valory/impact_evaluator:0.1.0:bafybeifqhhy7fgxommu45e7yuigixavzifzelvirkadcj72llgzp3bpswe +agent: valory/impact_evaluator:0.1.0:bafybeigrcdnosmbyw4sqzs64vx5w3esfixi2nddyz4qhp4rleuc5ld26qm number_of_agents: 1 deployment: agent: diff --git a/packages/valory/skills/impact_evaluator_abci/models.py b/packages/valory/skills/impact_evaluator_abci/models.py index 9b6bcba3..5df72143 100644 --- a/packages/valory/skills/impact_evaluator_abci/models.py +++ b/packages/valory/skills/impact_evaluator_abci/models.py @@ -97,6 +97,7 @@ MARGIN = 5 MULTIPLIER = 5 +CERAMIC_TIMEOUT_MULTIPLIER = 10 class RandomnessApi(ApiSpecs): @@ -112,11 +113,11 @@ def setup(self) -> None: """Set up.""" super().setup() ImpactEvaluatorSkillAbciApp.event_to_timeout[CeramicReadEvent.ROUND_TIMEOUT] = ( - self.context.params.round_timeout_seconds * MULTIPLIER + self.context.params.round_timeout_seconds * CERAMIC_TIMEOUT_MULTIPLIER ) ImpactEvaluatorSkillAbciApp.event_to_timeout[ CeramicWriteEvent.ROUND_TIMEOUT - ] = (self.context.params.round_timeout_seconds * MULTIPLIER) + ] = (self.context.params.round_timeout_seconds * CERAMIC_TIMEOUT_MULTIPLIER) ImpactEvaluatorSkillAbciApp.event_to_timeout[ TwitterScoringEvent.ROUND_TIMEOUT ] = self.context.params.round_timeout_seconds diff --git a/packages/valory/skills/impact_evaluator_abci/skill.yaml b/packages/valory/skills/impact_evaluator_abci/skill.yaml index df9f2f5b..381fadd1 100644 --- a/packages/valory/skills/impact_evaluator_abci/skill.yaml +++ b/packages/valory/skills/impact_evaluator_abci/skill.yaml @@ -12,7 +12,7 @@ fingerprint: dialogues.py: bafybeigybns7lilv57day366bo6kri5ehu3nbrfjk6x7a7pz3xq4wc5r6e fsm_specification.yaml: bafybeies2gqemrvigszvpg7l733gyyyck3ieeidc5jfdnwqwwvgyumhiha handlers.py: bafybeihnfjtuusm65o76lr4q6rdawq6xjc7d7hywmcdabop7vgvuxdry3e - models.py: bafybeif7unc573kd5bpot3vjfmoktbkeervsms72cqobd52y74txcwq55y + models.py: bafybeicqkdvwyekxx6qx26dv3guf36r2wwqf74lfmna5comlr5jjbzlhmm tests/__init__.py: bafybeievwzwojvq4aofk5kjpf4jzygfes7ew6s6svc6b6frktjnt3sicce tests/test_behaviours.py: bafybeifkazsevd6vsfaapulouxepez3rl24y3rxgja5zhmj7s323zdjlmq tests/test_dialogues.py: bafybeieaos2byphju6i6xvytppqqcuqqvnpilnflsy73l3wqazzjttbg7m diff --git a/scripts/check_rewards.py b/scripts/check_staking.py similarity index 96% rename from scripts/check_rewards.py rename to scripts/check_staking.py index ac99fab5..a4a0747b 100644 --- a/scripts/check_rewards.py +++ b/scripts/check_staking.py @@ -39,13 +39,14 @@ EPOCH = "latest" -BASE_LEDGER_RPC = os.getenv("BASE_LEDGER_RPC") +BASE_LEDGER_RPC = os.getenv("BASE_LEDGER_RPC_ALCHEMY") GREEN = "bold green" RED = "bold red" YELLOW = "bold yellow" POINTS_PER_UPDATE = 200 web3 = Web3(Web3.HTTPProvider(BASE_LEDGER_RPC)) -UNSTAKED = "unstaked" +UNSTAKED = "UNSTAKED" +EVICTED = "EVICTED" STAKING_CONTRACTS = { @@ -166,6 +167,8 @@ def get_user_info(user_data: Dict, contract_info: Dict, contributors_contract: C ) staking_contract_name = get_contract_by_address(staking_contract_address) + is_evicted = staking_token_contract.functions.getStakingState(service_id).call() == 2 + accrued_rewards = staking_token_contract.functions.calculateStakingReward(service_id).call() # this_epoch_rewards = staking_token_contract.functions.calculateStakingLastReward(service_id).call() # needs fixing this_epoch = contract_info[staking_contract_name]["epoch"] @@ -175,9 +178,12 @@ def get_user_info(user_data: Dict, contract_info: Dict, contributors_contract: C required_points = POINTS_PER_UPDATE * contract_info[staking_contract_name]['required_updates'] color = GREEN if this_epoch_points >= required_points else YELLOW + if is_evicted: + color = RED user_info = { "staked": True, + "evicted": is_evicted, "staking_contract_name": staking_contract_name, "epoch": str(this_epoch), "this_epoch_tweets": str(len(this_epoch_tweets)), @@ -227,7 +233,7 @@ def print_table(): "@" + user_data["twitter_handle"], shorten_address(user_data["service_multisig"]), user_info["staking_contract_name"], - user_info["epoch"] + f" [{user_info['next_epoch_start']}]", + user_info["epoch"] + f" [{user_info['next_epoch_start']}]" if not user_info["evicted"] else EVICTED, user_info["this_epoch_tweets"], user_info["this_epoch_points"] + " / " + user_info["required_points"], # user_info["this_epoch_rewards"],