βš™οΈSmart Contract

Technical reference for the BasedRaid smart contract on Solana.

πŸ“‹ Overview

Property
Value

🌐 Network

Solana Devnet

πŸ”‘ Program ID

DTS66x95eduAtc1pYYemwbE4Ry6riwSBsMTRCmtDPXkE

πŸ› οΈ Framework

Anchor

πŸ¦€ Language

Rust

πŸ“Š Constants

Constant
Value
Description

πŸ“‰ 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:

Parameter
Type
Description

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

Donates SOL to a raid.

Parameters:

Parameter
Type
Description

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

πŸ—³οΈ 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

Type
Cost

πŸ“¦ Base Creation

0.02 SOL

βœ… + Verified

+0.1 SOL

πŸ”₯ + Trending

+0.05 SOL

Withdrawal Fees

Type
Fee

πŸ“‹ Standard

5%

βœ… Verified

3%

Refund Fees

Type
Fee

πŸ”„ All Refunds

0%

⚠️ Error Codes

Code
Message

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

Event
Emitted When

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