A configurable‑share fundraising raffle smart‑contract built with Solady and Chainlink VRF V2 Plus. Participants buy $1 USDC “tickets”; when the deadline passes an on‑chain RNG picks a winner and the contract splits the pot between three parties in whatever proportions the pot creator specifies:
Unlike a classic 50 / 50 raffle—where exactly half the pot goes to the fundraiser and half to the winner—Farpot supports any split whose parts add up to 100 %. This flexibility lets creators run 60 / 30 / 10 raffles, 70 / 25 / 5, or any other combination to fit their campaign.
create– anyone opens a new pot, settinggoal(optional),deadline,fundraiserShare,raffleShare,referralShare,fundraiser, and metadata strings.enter– users buyntickets; a first‑time referral address can be attached to their wallet.startResolve– callable by anyone once the deadline passes; triggers a Chainlink VRF request.fulfillRandomWords– VRF wrapper callback stores the randomseedand marks the pot seeded.finishResolve– calculates the winning ticket (pot.tickets[seed % tickets.length]), then transfers funds according to the configured shares.emergencyRecovery– owner safeguard: afterdeadline + 100 days, sweep funds to a rescue address if the pot is still unresolved.
struct Pot {
bool resolved;
bool seeded;
uint16 fundraiserShare; // x
uint16 raffleShare; // y
uint16 referralShare; // z
uint40 deadline;
uint152 goal;
uint256 seed; // VRF result
address creator;
address fundraiser;
string title;
string description;
string longDescription;
address[] tickets; // each ticket = entrant address
address[] referrals; // optional referral list
}These smart contracts and testing suite are being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of anything provided herein or through related user interfaces. This repository and related code have not been audited and as such there can be no assurance anything will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information or loss of funds. The creators are not liable for any of the foregoing. Users should proceed with caution and use at their own risk.