Chainfluence is a platform that allows token admins to distribute tokens based on social media engagement

Inspiration

We were inspired by the idea of creating a way to distribute tokens that values peoples net-works instead of peoples net-worths. We believe creating systems like this will allow us to have decentralised token distributions that are not centralized around users previous network (Aka. ICO and Airdrops).

What it does

For admins: We allow them to register their project on our platform, create a campaign where they assign an amount of tokens, a duration of the campaign and add their social media accounts where they want to calculate user engagement.

For users: They will be able to browse available campaigns, register to a campaign with their social media account so we can start calculating his engagement, and also create referral links so that they not only mint tokens based on his own engagement but also on the engagement of his referrals.

How we built it

Deployer contract This contract is deployed by us manually and funded with LINK. Its function is to register campaigns, deploy their contracts and hold the treasury (we take a small fee from the projects that are registered). A token admin can register his campaign by calling the register() function and submitting an amount of his own ERC20 token he wants to distribute on the campaign.

TokenCampaignManager This contract holds all the business logic for the campaign. It keeps track of user registrations, referrals, social media activity, and calculates engagement and referral scores for registered users which are then used to mint tokens.

When created it deploys a GetTweetsConsumer contract which is a Chainlink Function that calls the Twitter API /tweets/search/recent and returns yesterday's tweets. We have a Chainlink Cron Automation which calls this function once per day and store the tweets for each day in a mapping (timestamp, tweetIds).

It also deploys a GetEngagementConsumer contract which uses a combination Chainlink Functions and Chainlink custom logic Automation to calculate the engagement of a list of users over a list of tweetIds, one block at a time (we have return size limits from chainlink and API throttling limits from Twitter which prevent us from doing everything on parallel). This contract acts like a multi-block state-machine that allows you to make requests in series, with a little more time we could definitely do a nicer abstraction to be used by more people.

With this, we periodically fetch Twitter data and calculate scores for registered users which we then use to distribute the tokens from the campaign.

Challenges we ran into

Twitter API limits (Unless we pay 42k+ per month):

  • Twitter has limited access to APIs like /followers and /following
  • Twitter has added very conservative thresholds to use their API (something like 15req/15min)

*Chainlink Function service limits *

  • Chainlink Functions Maximum returned value size limits: 256 bytes limit had a big impact on what we were able to architect.
  • Chainlink Function Maximum callback gas limit: 300,000 gas limit also had a big influence on what we could do, and it was harder to foresee than other limits that are easy to calculate before hand

Accomplishments that we're proud of

  • Team reunited after years
  • First hackathon participation for both
  • We went really deep on crypto infrastructure and now have a good understanding of were is everything going.
  • We created a multi-block serial request state machine to be able to circumvent some of the Chainlink Functions limitations.

What we learned

  • Chainlink Functions
  • Chainlink Automation
  • Chainlink CCIP
  • Supabase web3 authentication

What's next for Chainfluence

Built With

Share this project:

Updates