Video presentation -> https://www.loom.com/share/bb4afcbedafc4fa3b3c3550d08252860

Inspiration

Whenever someone asks us what data Oracles can provide to the blockchain, we respond that almost everything. But one thing is to talk about it and the other thing is to implement it. We saw that Lens Protocol has API and our team instantly thought that we could provide profile statistics to smart contracts. This type of data could be extremely helpful in terms of KYC, whitelisting, or other types of user verification.

What it does

This project consists of two main parts. The first one is a custom Lens profile fetcher build for RedStone Oracle. It retrieves profile statistics from GraphQL API and calculates the score. Currently, we use the easiest way which is summing up values: totalFollowers, totalPosts, totalComments, totalMirrors, totalPublications, and totalCollects multiplied by corresponding weights. The formula is presented below:

Σ = tc * 0.25 + tpo * 0.5 + tpub * 0.5 + tf * 0.75 + tc * 1 + tm * 1

where: tc - total number of comments tpo - total number of posts tpub - total number of publications tf - total number of followers tc - total number of collects tm - total number of mirrors

Fetcher could be easily extended and the formula for the score could be calculated in a more advanced manner f.g. by using Machine learning models or gathering data from any other source. The second part is dApp which presents the possibility of using Lens profiles score. It uses a smart contract prepared for this purpose to check the score value of a specific profile against an arbitrary score passed during contract deployment. The dApp gives the user possibility to provide a Lens handle and then presents the score verification result.

How we built it

First, our team implemented a custom fetcher for RedStone Oracle which retrieves 50 Lens profile statistics and calculated the score. Then we added a new tab to the RedStone app which presents the current and historical values of the score for each profile. Next was to prepare a smart contract with a simple verifier if the profile score is bigger than the one provided during deployment. The last thing implemented was dApp which provides a simple UI to interact with the smart contract and check if the Lens profile with the handle provided has a score high enough.

Challenges we ran into

The biggest challenge was to find out how to calculate the score from the Lens profile. We had a lot of thought but in the end, I decided that for now, the simplest solution would be the best. Also, our team struggled a bit with the Hardhat which is useful in a big project but when working with only one contract it turned out that ethers.js and Remix are more than enough.

Accomplishments that we're proud of

Our team strongly believes this project could be the first step toward a new way of handling the user score. Also, the best users could be provided with additional functionalities or more advanced protocol options.

What we learned

The greatest learning is to become familiar with Lens protocol and how it works under the hood. At the same time, our team had a lot of thoughts on the process of calculating the score of the user, what could be improved, and where it can be used.

What's next for LensScore for DeFi lending and Web3 interactions

The next steps are related to improving the calculation of the score. It could be done by adding new data sources, generating additional data from ML models, or improving the existing formula. Also, consulting protocols that need such functionality can help find the solutions required by the market. At the same time, we would love to connect with Aaave & Lens representatives about further incubation and grant programs.

Built With

+ 38 more
Share this project:

Updates