vocdoni / census3

Golang library and a HTTP/API service that can be used to fetch an updated list of token holders for a Ethereum ERC20, ERC721, ERC777, or other external providers (ex. POAPs or GitcoinPassport).
GNU Affero General Public License v3.0
9 stars 2 forks source link

feature: background farcaster provider #161

Closed lucasmenendez closed 9 months ago

lucasmenendez commented 9 months ago

To better handling of Too Many Requests Optimism RPC endpoints, the Farcaster provider implements an internal scanner that runs in background. The scanner will receive the last changes directly from the database.

Also closes #158

Summary by CodeRabbit

github-actions[bot] commented 9 months ago

Image description CodeRabbit

Walkthrough

This update introduces new functionalities to handle token holders with zero balance and manage application keys for Farcaster. It also includes a migration script for the latest_blocks table, and updates SQL queries and methods in the scanner and database files. The sqlc version has been updated from v1.23.0 to v1.25.0.

Changes

Files Summary
db/queries/holders.sql, db/sqlc/holders.sql.go, scanner/scanner.go Added a new SQL query and function GetTokenHolderEvenZero to retrieve token holders even with zero balance. Modified the GetTokenHolder function call to GetTokenHolderEvenZero in the SaveHolders method of the Scanner struct.
db/sqlc/.go, scanner/providers/farcaster/sqlc/.go Updated the sqlc version from v1.23.0 to v1.25.0 in the generated code. No significant changes affecting the external interface or behavior of the code.
scanner/providers/farcaster/db.go, scanner/providers/farcaster/types.go Introduced two new methods addAppKeys and deleteAppKeys to the FarcasterProvider struct. These methods handle adding and deleting application keys for specific FIDs based on input parameters.
scanner/providers/farcaster/migrations/0002_farcaster.sql, scanner/providers/farcaster/queries/latests_blocks.sql, scanner/providers/farcaster/sqlc/latests_blocks.sql.go Added a migration file for creating a table named latest_blocks. Introduced new SQL queries and corresponding functions to interact with the database for handling latest block information.

🐰 "In the land of code, where logic is king,

A rabbit hopped by, making updates sing.

Zero balance holders, now in our sight,

And app keys managed, oh what a delight!

With blocks latest, and sqlc anew,

Our code's ever stronger, and to best practices true!" 🎉


Uplevel your code reviews with CodeRabbit Pro ### CodeRabbit Pro If you like this project, please support us by purchasing the [Pro version](https://coderabbit.ai). The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.