Farcaster users OpenRank scores are now available on base. You can read more about how these scores are computed here. For now, the scores are updated weekly.
The implementation contract cannot be queried directly, because all the scores are in the proxy contract under the Transparent Proxy pattern.
Interface
// SPDX-License-Identifier: MITpragma solidity ^0.8.10;interfaceIFarcasterOpenRank {/// @notice One leaderboard entry. struct User {/// @notice Farcaster ID of the user uint256 fid; // Farcaster ID of the user/// @notice OpenRank score of the user./// The value is scaled so that score range [0.0, 1.0) maps to/// [0, 2**256), e.g. 0x8000...0000 == 0.5, 0x4000...0000 == 0.25, etc./// 1.0 is an exception: it maps not to 2**256 but to 2**256-1/// because 2**256 is out of uint256 range./// Instead, type(uint256).max (2**256-1) unambiguously identifies 1.0./// 1-2**-256, which is the score value that would otherwise map to/// the same type(uint256).max, cannot be represented,/// which is okay because it cannot be represented in IEEE 754 either. uint256 score; // OpenRank score of the user }// Events/// @notice Emitted when a leaderboard entry has been set (added)./// @param fid Farcaster ID./// @param rank Rank (position) in the leaderboard./// @param score The score value. event ScoreSet(uint256 indexed fid, uint256 rank, uint256 score);/// @notice Emitted when a leaderboard entry has been deleted./// @param fid Farcaster ID./// @param rank Rank (position) in the leaderboard./// @param score The score value. event ScoreDeleted(uint256 indexed fid, uint256 rank, uint256 score);// Functions/// @notice Gets the given FID's rank./// @param fid Farcaster ID./// @return rank Rank (position) in the leaderboard.functionfidRank(uint256 fid) externalviewreturns (uint256 rank);/// @notice Returns number of entries in the leaderboard.functionleaderboardLength() externalviewreturns (uint256);/// @notice Returns user (FID and score) at the given rank./// @param rank The rank. One-based, i.e. 1 is the top user.functiongetUserAtRank(uint256 rank) externalviewreturns (User memory user);/// @notice Returns users (FIDs and scores) at the given ranks./// @param ranks The ranks. One-based, i.e. 1 is the top user./// Nonexistent ranks result in empty user (fid = 0, score = 0).functiongetUsersAtRanks(uint256[] calldata ranks) externalviewreturns (User[] memory users);/// @notice Returns users (FIDs and scores) in the given rank range./// @param start The first rank to return. One-based, i.e. 1 is the top user./// @param count The number of users to return./// If start/count is too large, only those that are in the leaderboard are returned,/// e.g. on a 100-user leaderboard (ranks 1-100), start=91, count=20 (ranks 91-110) returns only 10 users/// (ranks 91-100), and start=101, count=10 (ranks 101-110) returns no users.functiongetUsersInRankRange(uint256 start, uint256 count) externalviewreturns (User[] memory users);/// @notice Returns the rank and score of the given FID./// @param fid Farcaster ID./// @return rank (One-based) rank; 0 means unranked./// @return score Score value; 0 if unranked.functiongetRankAndScoreForFID(uint256 fid) externalviewreturns (uint256 rank, uint256 score);/// @notice Returns the ranks and scores of the given FIDs./// @param fids Farcaster IDs./// @return ranks (One-based) ranks, i.e. 1 is the top user. 0 means unranked./// @return scores Scores; 0 if unranked.functiongetRanksAndScoresForFIDs(uint256[] calldata fids)externalviewreturns (uint256[] memory ranks, uint256[] memory scores);/// @notice Returns the FID, rank, and score for the given verifier address./// @param verifier Verifier address./// @return fid Farcaster ID; 0 if no FID is associated with the given verifier address./// @return rank (One-based) rank; 0 if unranked or no FID is associated with the given verifier address./// @return score Score value; 0 if unranked or no FID is associated with the given verifier address.functiongetFIDRankAndScoreForVerifier(address verifier)externalviewreturns (uint256 fid, uint256 rank, uint256 score);/// @notice Returns the FIDs, ranks, and scores for the given verifier addresses./// @param verifiers Verifier addresses./// @return fids Farcaster IDs; 0 if no FID is associated with the given verifier address./// @return ranks (One-based) ranks; 0 if unranked or no FID is associated with the given verifier address./// @return scores Score values; 0 if unranked or no FID is associated with the given verifier address.functiongetFIDsRanksAndScoresForVerifiers(address[] calldata verifiers)externalviewreturns (uint256[] memory fids, uint256[] memory ranks, uint256[] memory scores);}
Example Implementation
In the following snippet, isTop100 returns whether the given address is one of the top 100.