Skip to content

Commit

Permalink
fix: check wether twitter handle already exists during registration
Browse files Browse the repository at this point in the history
  • Loading branch information
dvilelaf committed Sep 4, 2023
1 parent 46a100d commit 5f90285
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 17 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:bafybeidasru64g2t3xkskacqh52fyspmzeq4drpzmrx33wvoczv5rjsxhu --service
autonomy fetch valory/impact_evaluator:0.1.0:bafybeic5ysbusmwc67lhh6wnjb6dolkkt4hucdo3anbaa67hk7wajkzhrm --service
```

3. Build the Docker image of the service agents
Expand Down
8 changes: 4 additions & 4 deletions packages/packages.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"dev": {
"agent/valory/impact_evaluator/0.1.0": "bafybeigmv2eajssol2zl5pplol6byjfwsngdzzzoxbat6kou5h4q3gisyi",
"agent/valory/impact_evaluator/0.1.0": "bafybeihwtrqr5tn33pyvtrrtzv4uuop6jygyf74wzpvfxpz5trznohfl5u",
"contract/valory/dynamic_contribution/0.1.0": "bafybeie76ynpueo3hh2ujzcfgpqcsbyqwa4pdcc6g44a4he6bueyb4tqiy",
"service/valory/impact_evaluator/0.1.0": "bafybeidasru64g2t3xkskacqh52fyspmzeq4drpzmrx33wvoczv5rjsxhu",
"service/valory/impact_evaluator/0.1.0": "bafybeic5ysbusmwc67lhh6wnjb6dolkkt4hucdo3anbaa67hk7wajkzhrm",
"skill/valory/dynamic_nft_abci/0.1.0": "bafybeie5vfscnjpvuwqe5vk7i2rzzlqciojswdg7uh34fjnuk3bspca5zq",
"skill/valory/twitter_scoring_abci/0.1.0": "bafybeigdvdj2hsdbbqmumk2ztzfzthdtkynuyvtfdthg5s2lsqpeg76pju",
"skill/valory/twitter_scoring_abci/0.1.0": "bafybeihhw725klhxb4zkihn4f6rscihmarcxlapo4z2ya6sfz4udv7qprq",
"skill/valory/ceramic_read_abci/0.1.0": "bafybeidruvxgpbggchuvlnssuswdxuoz2ep6sjvzzqjeyckybb6gpjx3ia",
"skill/valory/ceramic_write_abci/0.1.0": "bafybeigtkv57h5suaqqpjfknimfegbidovxna7cok7znsgzrfb4nftqvay",
"skill/valory/impact_evaluator_abci/0.1.0": "bafybeicrweqh6n62vn5houbkjf275a5lniuadrjd3kkaptdcqcukyisrcq",
"skill/valory/impact_evaluator_abci/0.1.0": "bafybeicy2sozm5ggg5feaolmdqoj57ktrotevppgux4mtolhqr5wxcxygm",
"skill/valory/generic_scoring_abci/0.1.0": "bafybeiemmcnduhdj427kgafkxcbn2rfhaihabtpda34yqnks7utm3g4xiq",
"protocol/valory/twitter/0.1.0": "bafybeib4eyf7qbs7kdntqzhwqsaaj4o2mzcokcztaza6qgwt7sbxgkqu2m",
"protocol/valory/llm/1.0.0": "bafybeigqybmg75vsxexmp57hkms7lkp7iwpf54r7wpygizxryvrhfqqpb4",
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/agents/impact_evaluator/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ protocols:
skills:
- valory/abstract_abci:0.1.0:bafybeicg7dv7cff34nv2k2z47c4yp4kddsxp3wozonzow6tnvfvwndz3cy
- valory/abstract_round_abci:0.1.0:bafybeigxjcci53vwytymzlhr37436yvenh7jup4astrn7dgyixo24aq2pq
- valory/impact_evaluator_abci:0.1.0:bafybeicrweqh6n62vn5houbkjf275a5lniuadrjd3kkaptdcqcukyisrcq
- valory/impact_evaluator_abci:0.1.0:bafybeicy2sozm5ggg5feaolmdqoj57ktrotevppgux4mtolhqr5wxcxygm
- valory/generic_scoring_abci:0.1.0:bafybeiemmcnduhdj427kgafkxcbn2rfhaihabtpda34yqnks7utm3g4xiq
- valory/twitter_scoring_abci:0.1.0:bafybeigdvdj2hsdbbqmumk2ztzfzthdtkynuyvtfdthg5s2lsqpeg76pju
- valory/twitter_scoring_abci:0.1.0:bafybeihhw725klhxb4zkihn4f6rscihmarcxlapo4z2ya6sfz4udv7qprq
- valory/ceramic_read_abci:0.1.0:bafybeidruvxgpbggchuvlnssuswdxuoz2ep6sjvzzqjeyckybb6gpjx3ia
- valory/ceramic_write_abci:0.1.0:bafybeigtkv57h5suaqqpjfknimfegbidovxna7cok7znsgzrfb4nftqvay
- valory/dynamic_nft_abci:0.1.0:bafybeie5vfscnjpvuwqe5vk7i2rzzlqciojswdg7uh34fjnuk3bspca5zq
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:bafybeigmv2eajssol2zl5pplol6byjfwsngdzzzoxbat6kou5h4q3gisyi
agent: valory/impact_evaluator:0.1.0:bafybeihwtrqr5tn33pyvtrrtzv4uuop6jygyf74wzpvfxpz5trznohfl5u
number_of_agents: 4
deployment:
agent:
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/impact_evaluator_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ skills:
- valory/abstract_round_abci:0.1.0:bafybeigxjcci53vwytymzlhr37436yvenh7jup4astrn7dgyixo24aq2pq
- valory/ceramic_read_abci:0.1.0:bafybeidruvxgpbggchuvlnssuswdxuoz2ep6sjvzzqjeyckybb6gpjx3ia
- valory/generic_scoring_abci:0.1.0:bafybeiemmcnduhdj427kgafkxcbn2rfhaihabtpda34yqnks7utm3g4xiq
- valory/twitter_scoring_abci:0.1.0:bafybeigdvdj2hsdbbqmumk2ztzfzthdtkynuyvtfdthg5s2lsqpeg76pju
- valory/twitter_scoring_abci:0.1.0:bafybeihhw725klhxb4zkihn4f6rscihmarcxlapo4z2ya6sfz4udv7qprq
- valory/ceramic_write_abci:0.1.0:bafybeigtkv57h5suaqqpjfknimfegbidovxna7cok7znsgzrfb4nftqvay
- valory/dynamic_nft_abci:0.1.0:bafybeie5vfscnjpvuwqe5vk7i2rzzlqciojswdg7uh34fjnuk3bspca5zq
- valory/registration_abci:0.1.0:bafybeibc4kczqbh23sc6tufrzn3axmhp3vjav7fa3u6cnpvolrbbc2fd7i
Expand Down
19 changes: 12 additions & 7 deletions packages/valory/skills/twitter_scoring_abci/behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,18 +743,23 @@ def get_registration(self, text: str) -> Optional[str]:

wallet_address = None

registered_addresses = [
user["wallet_address"]
for user in self.synchronized_data.ceramic_db["users"]
if user["wallet_address"]
]

address_match = re.search(ADDRESS_REGEX, text)
tagline_match = re.search(TAGLINE, text, re.IGNORECASE)

if address_match and tagline_match:
wallet_address = Web3.to_checksum_address(address_match.group())
if wallet_address in registered_addresses:

address_to_twitter_handles = {
user["wallet_address"]: user["twitter_handle"]
for user in self.synchronized_data.ceramic_db["users"]
if user["wallet_address"]
}

# Ignore registration if both address and Twitter handle already exist
if (
wallet_address in address_to_twitter_handles
and address_to_twitter_handles[wallet_address]
):
return None

return wallet_address
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 @@ -8,7 +8,7 @@ license: Apache-2.0
aea_version: '>=1.0.0, <2.0.0'
fingerprint:
__init__.py: bafybeifudgakkjoyahuewp2o4gvqayw7nsgpyxw2ayrpgmzexurh2xomaq
behaviours.py: bafybeidv4khcl4rzqjiev2qga5o6pqpgugauyjw25pbdgoyxgadrsjfid4
behaviours.py: bafybeig3vogejxlrpalgdjy6ztf27plbookhpsmtunrddl7hmwqvfelsyq
ceramic_db.py: bafybeicusdonrdq6kirgkpdqmi3a6kmeal4nctnm5ozjqf5s5se6jpitjm
dialogues.py: bafybeibdqzn37hbo2cq4skww4uh2zvvsjyaxxvdhxisefbdvmjp7rh53si
fsm_specification.yaml: bafybeietfinv3lvmyon3bk5f4gu2qf4hjlrqogfiombqnncyme5qrpbffa
Expand Down

0 comments on commit 5f90285

Please sign in to comment.