To prevent gas wars in high-demand NFT drops, the communities are using raffles to allowlist the eligible mint addresses. Current solutions are off-chain (the only web3 part being the web3 login), especially the raffling is a black box. To ensure transparency and fairness, we created a fully on-chain raffle system using the LENS protocol and Chainlink VRF. To enter the raffle, the profiles need to follow the raffle creator account on LENS. To prevent fake entries, the raffle creator can set up parameters to validate the entrants: the number of followers, amount of publications created, and date since the entrant follows the raffle creator account. All the parameters are saved immutable on-chain, and the raffle happens via Chainlink VRF. The raffle winners receive a token (either soulbond or not) that allows them to participate in the future allow listed mint (independent from LENS) by the raffle creator.

Fairymint – the fair mint raffle showcase

How it's made

With the help of data from LENS, we define the user base who can participate in the raffle. The initiator of a raffle needs to have a LENS profile, and the raffle attendee needs to be a follower of the initiator. When creating a raffle, the AllowlisterFactory.sol deploys a clone of the Allowlister.sol and stores the new raffle. The Allowlister.sol contains the functionality to register as a raffle user and execute the raffle. We added several validation modules to prevent bots from registering for a raffle. For example, a user needs a minimum number of followers or has to follow the initiator of the raffle since a predefined date. We used Chainlink VRF to select the winner of the raffle. After executing the raffle the WinnerModule gives the ability to mint a winner token for the winner, either as a tradable or an untradable token. The frontend is built with Next.js and Tailwind. It is connected to the smart contracts with ethers.js