Skip to content

Commit

Permalink
feat(iam, platforms): export all providers as a group
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-schultz committed Dec 22, 2022
1 parent 86bb9bc commit d9f1c46
Show file tree
Hide file tree
Showing 3 changed files with 225 additions and 217 deletions.
3 changes: 2 additions & 1 deletion iam/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import request from "supertest";

// ---- Test subject
import { app, config, providers } from "../src/index";
import { app, config } from "../src/index";
import { providers } from "@gitcoin/passport-platforms";

// ---- Types
import {
Expand Down
195 changes: 1 addition & 194 deletions iam/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,7 @@ import { Providers } from "./utils/providers";
// ---- Identity Providers
import { SimpleProvider } from "./providers/simple";

import {
Twitter,
Ens,
Gitcoin,
Lens,
Github,
Facebook,
Poh,
GitPOAP,
NFT,
GnosisSafe,
Snapshot,
POAP,
ETH,
ZkSync,
Linkedin,
GTC,
GtcStaking,
Discord,
Google,
ClearText,
Brightid,
} from "@gitcoin/passport-platforms";
import { providers } from "@gitcoin/passport-platforms";

import { ClearTextSimpleProvider } from "./providers/clearTextSimple";

Expand All @@ -80,177 +58,6 @@ export const config: {
issuer,
};

// Initiate providers - new Providers should be registered in this array...
export const providers = new Providers([
// Example provider which verifies the payload when `payload.proofs.valid === "true"`
new SimpleProvider(),
new Google.GoogleProvider(),
new Twitter.TwitterAuthProvider(),
new Ens.EnsProvider(),
new Poh.PohProvider(),
new POAP.POAPProvider(),
new Facebook.FacebookProvider(),
new Facebook.FacebookFriendsProvider(),
new Facebook.FacebookProfilePictureProvider(),
new Brightid.BrightIdProvider(),
new Github.GithubProvider(),
new Github.FiveOrMoreGithubRepos(),
new Github.TenOrMoreGithubFollowers(),
new Github.FiftyOrMoreGithubFollowers(),
new Github.ForkedGithubRepoProvider(),
new Github.StarredGithubRepoProvider(),
new ClearText.ClearTextGithubOrgProvider(),
new ClearText.ClearTextTwitterProvider(),
new Linkedin.LinkedinProvider(),
new Discord.DiscordProvider(),
new Twitter.TwitterTweetGT10Provider(),
new Twitter.TwitterFollowerGT100Provider(),
new Twitter.TwitterFollowerGT500Provider(),
new Twitter.TwitterFollowerGTE1000Provider(),
new Twitter.TwitterFollowerGT5000Provider(),
new GtcStaking.SelfStakingBronzeProvider(),
new GtcStaking.SelfStakingSilverProvider(),
new GtcStaking.SelfStakingGoldProvider(),
new GtcStaking.CommunityStakingBronzeProvider(),
new GtcStaking.CommunityStakingSilverProvider(),
new GtcStaking.CommunityStakingGoldProvider(),
new ClearTextSimpleProvider(),
new Snapshot.SnapshotProposalsProvider(),
new Snapshot.SnapshotVotesProvider(),
new ETH.EthGasProvider(),
new ETH.FirstEthTxnProvider(),
new ETH.EthGTEOneTxnProvider(),
new GitPOAP.GitPOAPProvider(),
/////////////////////////////////////////////////////////////
// Start adding the specific gitcoin contributor providers
/////////////////////////////////////////////////////////////
new Gitcoin.GitcoinContributorStatisticsProvider({
threshold: 1,
receivingAttribute: "num_grants_contribute_to",
recordAttribute: "numGrantsContributeToGte",
}),
new Gitcoin.GitcoinContributorStatisticsProvider({
threshold: 10,
receivingAttribute: "num_grants_contribute_to",
recordAttribute: "numGrantsContributeToGte",
}),
new Gitcoin.GitcoinContributorStatisticsProvider({
threshold: 25,
receivingAttribute: "num_grants_contribute_to",
recordAttribute: "numGrantsContributeToGte",
}),
new Gitcoin.GitcoinContributorStatisticsProvider({
threshold: 100,
receivingAttribute: "num_grants_contribute_to",
recordAttribute: "numGrantsContributeToGte",
}),
new Gitcoin.GitcoinContributorStatisticsProvider({
threshold: 10,
receivingAttribute: "total_contribution_amount",
recordAttribute: "totalContributionAmountGte",
}),
new Gitcoin.GitcoinContributorStatisticsProvider({
threshold: 100,
receivingAttribute: "total_contribution_amount",
recordAttribute: "totalContributionAmountGte",
}),
new Gitcoin.GitcoinContributorStatisticsProvider({
threshold: 1000,
receivingAttribute: "total_contribution_amount",
recordAttribute: "totalContributionAmountGte",
}),
new Gitcoin.GitcoinContributorStatisticsProvider({
threshold: 1,
receivingAttribute: "num_rounds_contribute_to",
recordAttribute: "numRoundsContributedToGte",
}),
new Gitcoin.GitcoinContributorStatisticsProvider({
threshold: 1,
receivingAttribute: "num_gr14_contributions",
recordAttribute: "numGr14ContributionsGte",
}),
/////////////////////////////////////////////////////////////
// Start adding the specific gitcoin grantee providers
/////////////////////////////////////////////////////////////
new Gitcoin.GitcoinGranteeStatisticsProvider({
threshold: 1,
receivingAttribute: "num_owned_grants",
recordAttribute: "numOwnedGrants",
}),
new Gitcoin.GitcoinGranteeStatisticsProvider({
threshold: 10,
receivingAttribute: "num_grant_contributors",
recordAttribute: "numGrantContributors",
}),
new Gitcoin.GitcoinGranteeStatisticsProvider({
threshold: 25,
receivingAttribute: "num_grant_contributors",
recordAttribute: "numGrantContributors",
}),
new Gitcoin.GitcoinGranteeStatisticsProvider({
threshold: 100,
receivingAttribute: "num_grant_contributors",
recordAttribute: "numGrantContributors",
}),
new Gitcoin.GitcoinGranteeStatisticsProvider({
threshold: 100,
receivingAttribute: "total_contribution_amount",
recordAttribute: "totalContributionAmount",
}),
new Gitcoin.GitcoinGranteeStatisticsProvider({
threshold: 1000,
receivingAttribute: "total_contribution_amount",
recordAttribute: "totalContributionAmount",
}),
new Gitcoin.GitcoinGranteeStatisticsProvider({
threshold: 10000,
receivingAttribute: "total_contribution_amount",
recordAttribute: "totalContributionAmount",
}),
new Gitcoin.GitcoinGranteeStatisticsProvider({
threshold: 1,
receivingAttribute: "num_grants_in_eco_and_cause_rounds",
recordAttribute: "numGrantsInEcoAndCauseRound",
}),
/////////////////////////////////////////////////////////////
// Start adding ETH/GTC Possession Providers
/////////////////////////////////////////////////////////////
new GTC.EthErc20PossessionProvider({
threshold: 100,
recordAttribute: "gtcPossessionsGte",
contractAddress: "0xde30da39c46104798bb5aa3fe8b9e0e1f348163f",
error: "GTC Possessions >= 100 Provider verify Error",
}),
new GTC.EthErc20PossessionProvider({
threshold: 10,
recordAttribute: "gtcPossessionsGte",
contractAddress: "0xde30da39c46104798bb5aa3fe8b9e0e1f348163f",
error: "GTC Possessions >= 10 Provider verify Error",
}),
new ETH.EthErc20PossessionProvider({
threshold: 32,
recordAttribute: "ethPossessionsGte",
error: "ETH Possessions >= 32 Provider verify Error",
}),
new ETH.EthErc20PossessionProvider({
threshold: 10,
recordAttribute: "ethPossessionsGte",
error: "ETH Possessions >= 10 Provider verify Error",
}),
new ETH.EthErc20PossessionProvider({
threshold: 1,
recordAttribute: "ethPossessionsGte",
error: "ETH Possessions >= 1 Provider verify Error",
}),
/////////////////////////////////////////////////////////////
// END
////////////////////////////////////////////////////////////
new NFT.NFTProvider(),
new Lens.LensProfileProvider(),
new ZkSync.ZkSyncProvider(),
new GnosisSafe.GnosisSafeProvider(),
]);

// create the app and run on port
export const app = express();

Expand Down
Loading

0 comments on commit d9f1c46

Please sign in to comment.