diff --git a/.example.env b/.example.env index e9427d583..30887eff2 100644 --- a/.example.env +++ b/.example.env @@ -8,4 +8,5 @@ export JSON_RPC_URL="" export DUNE_API_KEY="" export ALCHEMY_API_KEY="" export GITCOIN_API_KEY="" -export ANKR_API_KEY="" \ No newline at end of file +export ANKR_API_KEY="" +export TALLY_API_KEY="" diff --git a/.github/actions/deploy/action.yml b/.github/actions/deploy/action.yml index f52837177..7150d47a0 100644 --- a/.github/actions/deploy/action.yml +++ b/.github/actions/deploy/action.yml @@ -43,6 +43,9 @@ inputs: github-token: required: true description: "github token" + tally-api-key: + required: true + description: "tally api key" twitter-api-key: required: true description: "api key for twitter resolver" @@ -111,6 +114,7 @@ runs: GITCOIN_API_KEY: ${{ inputs.gitcoin-api-key }} ANKR_API_KEY: ${{ inputs.ankr-api-key }} SH_GITHUB_TOKEN: ${{ inputs.github-token }} + TALLY_API_KEY: ${{ inputs.tally-api-key }} TWITTER_API_KEY: ${{ inputs.twitter-api-key }} TELEGRAM_API_HASH: ${{ inputs.telegram-api-hash }} TELEGRAM_API_ID: ${{ inputs.telegram-api-id }} diff --git a/.github/actions/generate-group-send-on-chain/action.yml b/.github/actions/generate-group-send-on-chain/action.yml index 75bce2505..501dc7ce2 100644 --- a/.github/actions/generate-group-send-on-chain/action.yml +++ b/.github/actions/generate-group-send-on-chain/action.yml @@ -84,6 +84,9 @@ inputs: github-token: required: true description: "token for github provider" + tally-api-key: + required: true + description: "tally api key" twitter-api-key: required: true description: "api key for twitter resolver" @@ -145,6 +148,7 @@ runs: DUNE_API_KEY: ${{inputs.dune-api-key}} GITCOIN_API_KEY: ${{ inputs.gitcoin-api-key }} ANKR_API_KEY: ${{ inputs.ankr-api-key }} + TALLY_API_KEY: ${{ inputs.tally-api-key }} TELEGRAM_API_HASH: ${{ inputs.telegram-api-hash }} TELEGRAM_API_ID: ${{ inputs.telegram-api-id }} TELEGRAM_BOT_TOKEN: ${{ inputs.telegram-bot-token }} diff --git a/.github/actions/generate-groups/action.yml b/.github/actions/generate-groups/action.yml index c665e20be..b151b0d93 100644 --- a/.github/actions/generate-groups/action.yml +++ b/.github/actions/generate-groups/action.yml @@ -78,6 +78,9 @@ inputs: github-token: required: true description: "token for github provider" + tally-api-key: + required: true + description: "tally api key" twitter-api-key: required: true description: "api key for twitter resolver" @@ -152,6 +155,7 @@ runs: DUNE_API_KEY: ${{inputs.dune-api-key}} GITCOIN_API_KEY: ${{ inputs.gitcoin-api-key }} ANKR_API_KEY: ${{ inputs.ankr-api-key }} + TALLY_API_KEY: ${{ inputs.tally-api-key }} TELEGRAM_API_HASH: ${{ inputs.telegram-api-hash }} TELEGRAM_API_ID: ${{ inputs.telegram-api-id }} TELEGRAM_BOT_TOKEN: ${{ inputs.telegram-bot-token }} @@ -159,7 +163,7 @@ runs: ROCI_API_KEY: ${{ inputs.roci-api-key }} run: | if [[ -n "${{ inputs.sh-group-generator-name }}" ]]; then - yarn generate-group ${{ inputs.sh-group-generator-name }} --storage-type aws + yarn generate-group ${{ inputs.sh-group-generator-name }} --storage-type aws else - yarn cli generate-all-groups --storage-type aws + yarn cli generate-all-groups --storage-type aws fi diff --git a/.github/actions/update-groups-metadata/action.yml b/.github/actions/update-groups-metadata/action.yml index 7f832154a..ab2216ebd 100644 --- a/.github/actions/update-groups-metadata/action.yml +++ b/.github/actions/update-groups-metadata/action.yml @@ -60,6 +60,9 @@ inputs: github-token: required: true description: "token for github provider" + tally-api-key: + required: true + description: "tally api key" twitter-api-key: required: true description: "api key for twitter resolver" @@ -115,6 +118,7 @@ runs: DUNE_API_KEY: ${{inputs.dune-api-key}} GITCOIN_API_KEY: ${{ inputs.gitcoin-api-key }} ANKR_API_KEY: ${{ inputs.ankr-api-key }} + TALLY_API_KEY: ${{ inputs.tally-api-key }} TELEGRAM_API_HASH: ${{ inputs.telegram-api-hash }} TELEGRAM_API_ID: ${{ inputs.telegram-api-id }} TELEGRAM_BOT_TOKEN: ${{ inputs.telegram-bot-token }} diff --git a/.github/actions/update-groups-send-on-chain/action.yml b/.github/actions/update-groups-send-on-chain/action.yml index c1959c782..790b47cd7 100644 --- a/.github/actions/update-groups-send-on-chain/action.yml +++ b/.github/actions/update-groups-send-on-chain/action.yml @@ -87,6 +87,9 @@ inputs: github-token: required: true description: "token for github provider" + tally-api-key: + required: true + description: "tally api key" twitter-api-key: required: true description: "api key for twitter resolver" @@ -150,6 +153,7 @@ runs: DUNE_API_KEY: ${{inputs.dune-api-key}} GITCOIN_API_KEY: ${{ inputs.gitcoin-api-key }} ANKR_API_KEY: ${{ inputs.ankr-api-key }} + TALLY_API_KEY: ${{ inputs.tally-api-key }} TELEGRAM_API_HASH: ${{ inputs.telegram-api-hash }} TELEGRAM_API_ID: ${{ inputs.telegram-api-id }} TELEGRAM_BOT_TOKEN: ${{ inputs.telegram-bot-token }} diff --git a/.github/workflows/check-new-groups-generation-with-auto-merge.yml b/.github/workflows/check-new-groups-generation-with-auto-merge.yml index f07849ac8..17e2ec66b 100644 --- a/.github/workflows/check-new-groups-generation-with-auto-merge.yml +++ b/.github/workflows/check-new-groups-generation-with-auto-merge.yml @@ -29,6 +29,7 @@ jobs: FARCASTER_API_KEY: ${{ secrets.FARCASTER_API_KEY }} ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }} SH_GITHUB_TOKEN: ${{ secrets.SH_GITHUB_TOKEN }} + TALLY_API_KEY: ${{ secrets.TALLY_API_KEY }} TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }} TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_API_HASH }} TELEGRAM_API_ID: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/check-new-groups-generation.yml b/.github/workflows/check-new-groups-generation.yml index e48cd3b27..5dfab5944 100644 --- a/.github/workflows/check-new-groups-generation.yml +++ b/.github/workflows/check-new-groups-generation.yml @@ -32,6 +32,7 @@ jobs: GITCOIN_API_KEY: ${{ secrets.GITCOIN_API_KEY }} ANKR_API_KEY: ${{ secrets.ANKR_API_KEY }} SH_GITHUB_TOKEN: ${{ secrets.SH_GITHUB_TOKEN }} + TALLY_API_KEY: ${{ secrets.TALLY_API_KEY }} TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }} TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_API_HASH }} TELEGRAM_API_ID: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/deploy_dev.yml b/.github/workflows/deploy_dev.yml index e0c74d8e7..44d2de85d 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/workflows/deploy_dev.yml @@ -34,6 +34,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ANKR_API_KEY: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/deploy_prod.yml b/.github/workflows/deploy_prod.yml index b31447a52..4baafa382 100644 --- a/.github/workflows/deploy_prod.yml +++ b/.github/workflows/deploy_prod.yml @@ -36,6 +36,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/deploy_staging.yml b/.github/workflows/deploy_staging.yml index 40e79cdfb..4f4f9a025 100644 --- a/.github/workflows/deploy_staging.yml +++ b/.github/workflows/deploy_staging.yml @@ -38,6 +38,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/deploy_testnets.yml b/.github/workflows/deploy_testnets.yml index e900d55f3..7f0d31a7f 100644 --- a/.github/workflows/deploy_testnets.yml +++ b/.github/workflows/deploy_testnets.yml @@ -34,6 +34,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/generate_group_prod.yml b/.github/workflows/generate_group_prod.yml index e6ed3c7c4..09633abe3 100644 --- a/.github/workflows/generate_group_prod.yml +++ b/.github/workflows/generate_group_prod.yml @@ -45,6 +45,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/generate_group_staging.yml b/.github/workflows/generate_group_staging.yml index f550e1055..b3e5ce08c 100644 --- a/.github/workflows/generate_group_staging.yml +++ b/.github/workflows/generate_group_staging.yml @@ -50,6 +50,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/generate_group_testnets.yml b/.github/workflows/generate_group_testnets.yml index d74ef8561..5b225280c 100644 --- a/.github/workflows/generate_group_testnets.yml +++ b/.github/workflows/generate_group_testnets.yml @@ -45,6 +45,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/generate_groups_send_on_chain_prod.yml b/.github/workflows/generate_groups_send_on_chain_prod.yml index acf0bf000..eb3d29ec5 100644 --- a/.github/workflows/generate_groups_send_on_chain_prod.yml +++ b/.github/workflows/generate_groups_send_on_chain_prod.yml @@ -44,6 +44,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/generate_groups_send_on_chain_staging.yml b/.github/workflows/generate_groups_send_on_chain_staging.yml index 6bc4c3a3b..081ec4df3 100644 --- a/.github/workflows/generate_groups_send_on_chain_staging.yml +++ b/.github/workflows/generate_groups_send_on_chain_staging.yml @@ -44,6 +44,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f749c3fa3..c6b36dc55 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -79,4 +79,5 @@ jobs: GITCOIN_API_KEY: test ANKR_API_KEY: test ROCI_API_KEY: test + TALLY_API_KEY: test run: npx serverless webpack diff --git a/.github/workflows/update_groups_daily_prod.yml b/.github/workflows/update_groups_daily_prod.yml index dc93932df..7c0eb17bf 100644 --- a/.github/workflows/update_groups_daily_prod.yml +++ b/.github/workflows/update_groups_daily_prod.yml @@ -43,6 +43,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/update_groups_daily_staging.yml b/.github/workflows/update_groups_daily_staging.yml index c3fbed480..9e3a74b43 100644 --- a/.github/workflows/update_groups_daily_staging.yml +++ b/.github/workflows/update_groups_daily_staging.yml @@ -49,6 +49,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/update_groups_daily_testnets.yml b/.github/workflows/update_groups_daily_testnets.yml index d7548f13c..3616df268 100644 --- a/.github/workflows/update_groups_daily_testnets.yml +++ b/.github/workflows/update_groups_daily_testnets.yml @@ -43,6 +43,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/update_groups_metadata_prod.yml b/.github/workflows/update_groups_metadata_prod.yml index e108c4b5c..a30d2de5b 100644 --- a/.github/workflows/update_groups_metadata_prod.yml +++ b/.github/workflows/update_groups_metadata_prod.yml @@ -37,6 +37,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/update_groups_metadata_staging.yml b/.github/workflows/update_groups_metadata_staging.yml index 49572bf61..65ec20f43 100644 --- a/.github/workflows/update_groups_metadata_staging.yml +++ b/.github/workflows/update_groups_metadata_staging.yml @@ -37,6 +37,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/update_groups_metadata_testnets.yml b/.github/workflows/update_groups_metadata_testnets.yml index ec5bdd11f..98ff1e311 100644 --- a/.github/workflows/update_groups_metadata_testnets.yml +++ b/.github/workflows/update_groups_metadata_testnets.yml @@ -37,6 +37,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/update_groups_weekly_prod.yml b/.github/workflows/update_groups_weekly_prod.yml index a212ad66f..92c700acd 100644 --- a/.github/workflows/update_groups_weekly_prod.yml +++ b/.github/workflows/update_groups_weekly_prod.yml @@ -44,6 +44,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/update_groups_weekly_staging.yml b/.github/workflows/update_groups_weekly_staging.yml index 2613501be..6a7c9c589 100644 --- a/.github/workflows/update_groups_weekly_staging.yml +++ b/.github/workflows/update_groups_weekly_staging.yml @@ -48,6 +48,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/.github/workflows/update_groups_weekly_testnets.yml b/.github/workflows/update_groups_weekly_testnets.yml index 23ff5d10f..08606b4d6 100644 --- a/.github/workflows/update_groups_weekly_testnets.yml +++ b/.github/workflows/update_groups_weekly_testnets.yml @@ -43,6 +43,7 @@ jobs: gitcoin-api-key: ${{ secrets.GITCOIN_API_KEY }} ankr-api-key: ${{ secrets.ANKR_API_KEY }} github-token: ${{ secrets.SH_GITHUB_TOKEN }} + tally-api-key: ${{ secrets.TALLY_API_KEY }} twitter-api-key: ${{ secrets.TWITTER_API_KEY }} telegram-api-hash: ${{ secrets.TELEGRAM_API_HASH }} telegram-api-id: ${{ secrets.TELEGRAM_API_ID }} diff --git a/group-generators/generators/index.ts b/group-generators/generators/index.ts index ef90a0baf..adff4cf3f 100644 --- a/group-generators/generators/index.ts +++ b/group-generators/generators/index.ts @@ -708,6 +708,7 @@ import t0xci from "./t0xci"; import talentOfTheMonthSolidityMarch2023 from "./talent-of-the-month-solidity-march-2023"; import talentlayer from "./talentlayer"; import talentofthemonthDesignMarch from "./talentofthemonth-design-march"; +import tally from './tally'; import tallyHoGithubStargazers from "./tally-ho-github-stargazers"; import tarozzy from "./tarozzy"; import tayaFans from "./taya-fans"; @@ -1564,6 +1565,7 @@ export const groupGenerators: GroupGeneratorsLibrary = { "talent-of-the-month-solidity-march-2023": talentOfTheMonthSolidityMarch2023, "talentlayer": talentlayer, "talentofthemonth-design-march": talentofthemonthDesignMarch, + "tally": tally, "tally-ho-github-stargazers": tallyHoGithubStargazers, "tarozzy": tarozzy, "taya-fans": tayaFans, diff --git a/group-generators/generators/tally/index.ts b/group-generators/generators/tally/index.ts new file mode 100644 index 000000000..f04ce1fbc --- /dev/null +++ b/group-generators/generators/tally/index.ts @@ -0,0 +1,33 @@ +import { dataProviders } from "@group-generators/helpers/data-providers"; +import { GroupWithData, Tags, ValueType } from "topics/group"; +import { GenerationContext, GenerationFrequency, GroupGenerator } from "topics/group-generator"; + +// Generated from factory.sismo.io + +const generator: GroupGenerator = { + generationFrequency: GenerationFrequency.Daily, + + generate: async (context: GenerationContext): Promise => { + const TallyProvider = new dataProviders.TallyProvider(); + + const input = { + governance: "Aave", + // proposalId: 315, + }; + const tallyGetGovernanceProposers = await TallyProvider.getGovernanceProposers(input); + + return [ + { + name: "example-tally", + timestamp: context.timestamp, + description: "Tally governance", + specs: "", + data: tallyGetGovernanceProposers, + valueType: ValueType.Score, + tags: [Tags.Vote], + }, + ]; + }, +}; + +export default generator; diff --git a/group-generators/helpers/data-providers/index.ts b/group-generators/helpers/data-providers/index.ts index 385910306..cacc2a287 100644 --- a/group-generators/helpers/data-providers/index.ts +++ b/group-generators/helpers/data-providers/index.ts @@ -47,6 +47,8 @@ import snapshotInterfaceSchema from "./snapshot/interface-schema.json"; import { SubgraphHostedServiceProvider, SubgraphDecentralizedServiceProvider } from "./subgraph"; import { TalentLayerProvider } from "./talentlayer"; import talentLayerProviderInterfaceSchema from "./talentlayer/interface-schema.json"; +import { TallyProvider } from "./tally"; +import tallyProviderInterfaceSchema from "./tally/interface-schema.json"; import { TokenProvider } from "./token-provider"; import tokenProviderInterfaceSchema from "./token-provider/interface-schema.json"; import { TransposeProvider } from "./transpose"; @@ -59,7 +61,6 @@ import { DataProviders, supportedArgTypesInterfaces, } from "topics/data-provider"; - export const dataProviders = { AlchemyProvider, AttestationStationProvider, @@ -95,6 +96,7 @@ export const dataProviders = { SubgraphDecentralizedServiceProvider, SnapshotProvider, TalentLayerProvider, + TallyProvider, TokenProvider, TransposeProvider, UnlockSubgraphProvider, @@ -119,6 +121,7 @@ export const dataProvidersInterfacesSchemas: DataProviderInterface[] = [ snapshotInterfaceSchema, subgraph101InterfaceSchema, talentLayerProviderInterfaceSchema, + tallyProviderInterfaceSchema, tokenProviderInterfaceSchema, unlockProviderInterfaceSchema, wiwBadgeInterfaceSchema, @@ -242,6 +245,12 @@ export const dataProvidersAPIEndpoints = { getTalentOfTheMonthCount: async (_: any) => new TalentLayerProvider().getTalentOfTheMonthCount(_), }, + TallyProvider: { + getGovernanceProposersCount: async (_: any) => + new TallyProvider().getGovernanceProposersCount(_), + getGovernanceVotersCount: async (_: any) => new TallyProvider().getGovernanceVotersCount(_), + getProposalVotersCount: async (_: any) => new TallyProvider().getProposalVotersCount(_), + }, TokenProvider: { getERC20HoldersCount: async (_: any) => new TokenProvider().getERC20HoldersCount(_), getERC721HoldersCount: async (_: any) => new TokenProvider().getERC721HoldersCount(_), diff --git a/group-generators/helpers/data-providers/tally/index.ts b/group-generators/helpers/data-providers/tally/index.ts new file mode 100644 index 000000000..4b96b8c7e --- /dev/null +++ b/group-generators/helpers/data-providers/tally/index.ts @@ -0,0 +1,5 @@ +import TallyProvider from "./provider"; + +import { ITallyProvider } from "./types"; + +export { TallyProvider, ITallyProvider }; diff --git a/group-generators/helpers/data-providers/tally/interface-schema.json b/group-generators/helpers/data-providers/tally/interface-schema.json new file mode 100644 index 000000000..377cc0799 --- /dev/null +++ b/group-generators/helpers/data-providers/tally/interface-schema.json @@ -0,0 +1,59 @@ +{ + "name": "Tally", + "iconUrl": "", + "providerClassName": "TallyProvider", + "functions": [ + { + "name": "Get voters of proposal", + "functionName": "getProposalVoters", + "countFunctionName": "getProposalVotersCount", + "description": "Returns all voters of a specific proposal on Tally.", + "args": [ + { + "name": "DAO", + "argName": "governance", + "type": "string", + "example": "Aave", + "description": "A specific DAO" + }, + { + "name": "proposal ID", + "argName": "proposalId", + "type": "number", + "example": "193", + "description": "A specific proposal identifier" + } + ] + }, + { + "name": "Get voters of a DAO", + "functionName": "getGovernanceVoters", + "countFunctionName": "getGovernanceVotersCount", + "description": "Returns all voters of a specific governance on Tally. The values of the accounts correspond to their number of votes.", + "args": [ + { + "name": "DAO", + "argName": "governance", + "type": "string", + "example": "Aave", + "description": "A specific DAO" + } + ] + }, + { + "name": "Get proposers of a DAO", + "functionName": "getGovernanceProposers", + "countFunctionName": "getGovernanceProposersCount", + "description": "Returns all proposals proposers of a specific DAO on Tally. The values of the accounts correspond to their number of proposal proposed.", + "args": [ + { + "name": "DAO", + "argName": "governance", + "type": "string", + "example": "Aave", + "description": "A specific DAO" + } + ] + } + ] +} diff --git a/group-generators/helpers/data-providers/tally/provider.ts b/group-generators/helpers/data-providers/tally/provider.ts new file mode 100644 index 000000000..fd2dab272 --- /dev/null +++ b/group-generators/helpers/data-providers/tally/provider.ts @@ -0,0 +1,179 @@ +import { gql } from "graphql-request"; + +import { + ITallyProvider, + inputGetGovernanceProposers, + inputGetProposalVoters, + queryData, +} from "./types"; +import { GraphQLProvider } from "@group-generators/helpers/data-providers/graphql"; +import { FetchedData } from "topics/group"; + +export default class TallyProvider extends GraphQLProvider implements ITallyProvider { + public constructor() { + super({ + url: "https://api.tally.xyz/query", + headers: { + "Api-Key": process.env.TALLY_API_KEY as string, + accept: "application/json", + }, + }); + } + + private async _queryNameToGovernorAddress(): Promise { + return this.query( + gql` + query Governors { + governors(chainIds: "eip155:1") { + id + type + name + proposals { + id + title + description + proposer { + address + } + votes { + id + voter { + id + address + } + } + } + } + } + `, + {} + ); + } + + public async getProposalVoters({ + governance, + proposalId, + }: inputGetProposalVoters): Promise { + const data = await this._queryNameToGovernorAddress(); + + const fetchedData: { [address: string]: number } = {}; + + if (data && Array.isArray(data.governors)) { + const matchingGovernors = data.governors.filter( + (governor: { name: string }) => governor.name === governance + ); + + for (const governor of matchingGovernors) { + for (const proposals of governor.proposals) { + const propId = proposals.id; + if (propId === proposalId.toString()) { + const allVotes = proposals.votes; + + allVotes.forEach((voteItem: { id: string; voter: { address: string } }) => { + const { voter } = voteItem; + const { address } = voter; + if (fetchedData[address]) { + fetchedData[address]++; + } else { + fetchedData[address] = 1; + } + }); + } + } + } + + return fetchedData; + } + + return fetchedData; + } + + public async getProposalVotersCount({ + governance, + proposalId, + }: inputGetProposalVoters): Promise { + const ProposalVoterData = await this.getProposalVoters({ governance, proposalId }); + + const ProposalVoterCount = Object.keys(ProposalVoterData).length; + return ProposalVoterCount; + } + + public async getGovernanceVoters({ + governance, + }: inputGetGovernanceProposers): Promise { + const data: queryData = await this._queryNameToGovernorAddress(); + const fetchedData: { [address: string]: number } = {}; + + if (data && Array.isArray(data.governors)) { + const matchingGovernors = data.governors.filter( + (governor: { name: string }) => governor.name === governance + ); + + for (const governor of matchingGovernors) { + for (const proposals of governor.proposals) { + const votesArray = proposals?.votes; + + votesArray.forEach((item: { id: string; voter: any }) => { + const { voter } = item; + const { address } = voter; + if (fetchedData[address]) { + fetchedData[address]++; + } else { + fetchedData[address] = 1; + } + }); + } + } + + return fetchedData; + } + + return fetchedData; + } + + public async getGovernanceVotersCount({ + governance, + }: inputGetGovernanceProposers): Promise { + const VoterData = await this.getGovernanceVoters({ governance }); + + const VoterCount = Object.keys(VoterData).length; + return VoterCount; + } + + public async getGovernanceProposers({ + governance, + }: inputGetGovernanceProposers): Promise { + const data: queryData = await this._queryNameToGovernorAddress(); + const fetchedData: { [address: string]: number } = {}; + + if (data && Array.isArray(data.governors)) { + const matchingGovernors = data.governors.filter( + (governor: { name: string }) => governor.name === governance + ); + + for (const governor of matchingGovernors) { + for (const proposal of governor.proposals) { + const proposerAddress = proposal.proposer.address; + + if (fetchedData[proposerAddress]) { + fetchedData[proposerAddress]++; + } else { + fetchedData[proposerAddress] = 1; + } + } + } + + return fetchedData; + } + return fetchedData; + } + + public async getGovernanceProposersCount({ + governance, + }: inputGetGovernanceProposers): Promise { + const proposersData = await this.getGovernanceProposers({ governance }); + + const proposerCount = Object.keys(proposersData).length; + return proposerCount; + } +} diff --git a/group-generators/helpers/data-providers/tally/types.ts b/group-generators/helpers/data-providers/tally/types.ts new file mode 100644 index 000000000..bcd9686fe --- /dev/null +++ b/group-generators/helpers/data-providers/tally/types.ts @@ -0,0 +1,36 @@ +import { IGraphQLProvider } from "@group-generators/helpers/data-providers/graphql/types"; + +export type ITallyProvider = IGraphQLProvider; + +export interface inputGetGovernanceProposers { + governance: string; +} + +export interface inputGetProposalVoters { + governance: string; + proposalId: number; +} + +export interface Delegate { + id: string; + account: { address: string }; + stats: { + voteCount: number; + }; +} + +export interface govArray { + id: string; + type: string; + name: string; + proposals: { + id: string; + votes: { id: string; voter: { address: string } }[]; + proposer: { address: string }; + }[]; + delegates: Delegate[]; +} + +export interface queryData { + governors?: govArray[]; +} diff --git a/serverless.yaml b/serverless.yaml index 3112c2eae..d317b29d8 100644 --- a/serverless.yaml +++ b/serverless.yaml @@ -20,6 +20,7 @@ custom: SH_STORAGE_TYPE: "aws" SH_DEFAULT_CONFIGURATION_ENV: dev SH_GITHUB_TOKEN: ${env:SH_GITHUB_TOKEN} + TALLY_API_KEY: ${env:TALLY_API_KEY} TWITTER_API_KEY: ${env:TWITTER_API_KEY} TELEGRAM_API_HASH: ${env:TELEGRAM_API_HASH} TELEGRAM_API_ID: ${env:TELEGRAM_API_ID} @@ -39,6 +40,7 @@ custom: SH_STORAGE_TYPE: "aws" SH_DEFAULT_CONFIGURATION_ENV: staging SH_GITHUB_TOKEN: ${env:SH_GITHUB_TOKEN} + TALLY_API_KEY: ${env:TALLY_API_KEY} TWITTER_API_KEY: ${env:TWITTER_API_KEY} TELEGRAM_API_HASH: ${env:TELEGRAM_API_HASH} TELEGRAM_API_ID: ${env:TELEGRAM_API_ID} @@ -58,6 +60,7 @@ custom: SH_STORAGE_TYPE: "aws" SH_DEFAULT_CONFIGURATION_ENV: playground SH_GITHUB_TOKEN: ${env:SH_GITHUB_TOKEN} + TALLY_API_KEY: ${env:TALLY_API_KEY} TWITTER_API_KEY: ${env:TWITTER_API_KEY} TELEGRAM_API_HASH: ${env:TELEGRAM_API_HASH} TELEGRAM_API_ID: ${env:TELEGRAM_API_ID} @@ -77,6 +80,7 @@ custom: SH_STORAGE_TYPE: "aws" SH_DEFAULT_CONFIGURATION_ENV: testnets SH_GITHUB_TOKEN: ${env:SH_GITHUB_TOKEN} + TALLY_API_KEY: ${env:TALLY_API_KEY} TWITTER_API_KEY: ${env:TWITTER_API_KEY} TELEGRAM_API_HASH: ${env:TELEGRAM_API_HASH} TELEGRAM_API_ID: ${env:TELEGRAM_API_ID} @@ -96,6 +100,7 @@ custom: SH_STORAGE_TYPE: "aws" SH_DEFAULT_CONFIGURATION_ENV: prod SH_GITHUB_TOKEN: ${env:SH_GITHUB_TOKEN} + TALLY_API_KEY: ${env:TALLY_API_KEY} TWITTER_API_KEY: ${env:TWITTER_API_KEY} TELEGRAM_API_HASH: ${env:TELEGRAM_API_HASH} TELEGRAM_API_ID: ${env:TELEGRAM_API_ID} diff --git a/static/providers/tallyprovider.svg b/static/providers/tallyprovider.svg new file mode 100644 index 000000000..8ff65cead --- /dev/null +++ b/static/providers/tallyprovider.svg @@ -0,0 +1,6 @@ + + + + + +