βοΈSmart Contract
Technical reference for the BasedRaid smart contract on Solana.
π Overview
π Network
Solana Devnet
π Program ID
DTS66x95eduAtc1pYYemwbE4Ry6riwSBsMTRCmtDPXkE
π οΈ Framework
Anchor
π¦ Language
Rust
π Constants
π MIN_TARGET_AMOUNT
0.1 SOL
Minimum fundraising target
π MAX_TARGET_AMOUNT
1000 SOL
Maximum fundraising target
β° MAX_DEADLINE_DURATION
30 days
Maximum time until deadline
π WITHDRAWAL_DELAY_STANDARD
1 hour
Lock period for standard raids
β
WITHDRAWAL_DELAY_VERIFIED
30 min
Lock period for verified raids
π° BASE_FEE
0.02 SOL
Creation fee
β
VERIFIED_FEE
0.1 SOL
Verified badge cost
π₯ PROMOTED_FEE
0.05 SOL
Trending boost cost
ποΈ Account Structures
Raid Account
Donation Account
π Instructions
π― initialize_raid
Creates a new raid.
Parameters:
raid_id
u64
Unique ID
contract_address
Pubkey
Token CA
ticker
String
Token symbol
raid_goal
String
Goal description
twitter_link
String
Social link
title
String
Raid title
description
String
Description
target_amount
u64
Target in lamports
deadline
i64
Unix timestamp
is_verified
bool
Pay for verified
is_promoted
bool
Pay for promotion
πΈ donate
Donates SOL to a raid.
Parameters:
amount
u64
Amount in lamports
Requirements:
Raid not expired
Raid target not met
π΅ withdraw_funds
Withdraws funds after target is met.
Requirements:
Caller is creator
Target is met
Lock period has passed
Not already withdrawn
Raid NOT aborted by community vote
β cancel_raid
Cancels a raid and returns rent.
Requirements:
Caller is creator
No donations received
π refund
Claims refund from failed or aborted raid.
Requirements:
Raid expired AND target not met, OR
Raid was aborted by community vote
Caller made donation
Refunds are 100% - Donors receive full amount back with 0% fee.
π³οΈ vote_abort
Votes to abort a raid during the time-lock period.
Requirements:
Target is met
Within time-lock window (before withdrawal unlocks)
Caller made donation
Not already voted
Raid not already aborted
Effect:
Adds donor's donation amount to abort vote tally
If 51%+ of raised SOL votes abort, raid is marked aborted
Aborted raids enable refunds for all donors
π° Fee Structure
Creation Fees
π¦ Base Creation
0.02 SOL
β + Verified
+0.1 SOL
π₯ + Trending
+0.05 SOL
Withdrawal Fees
π Standard
5%
β Verified
3%
Refund Fees
π All Refunds
0%
β οΈ Error Codes
InvalidDeadline
Deadline must be in the future
TargetTooLow
Target amount too low (min 0.1 SOL)
TargetTooHigh
Target amount too high (max 1000 SOL)
DeadlineTooFar
Deadline too far (max 30 days)
RaidExpired
Raid has expired
TargetNotMet
Target has not been met
TargetMet
Target already met
AlreadyWithdrawn
Funds already withdrawn
WithdrawalTooEarly
Lock period not finished
CannotCancelWithDonations
Cannot cancel with donations
Unauthorized
Not authorized for this action
RaidAborted
Raid aborted by community vote
RaidAlreadyAborted
Raid was already aborted
AlreadyVoted
Already voted to abort
VotingWindowClosed
Time-lock expired, voting closed
RefundNotAvailable
Refund not available yet
π‘ Events
RaidCreated
New raid initialized
DonationMade
Donation received
FundsWithdrawn
Creator withdraws
RefundClaimed
Donor claims refund
RaidCancelled
Creator cancels raid
AbortVoteCast
Donor votes to abort
RaidAborted
51%+ voted to abort
Last updated