MuneraMUNERA

Docs

Smart contract reference

Program ID, PDA seeds, accounts, instructions, errors and events, straight from lib.rs.

Program

Item
Program ID
48KEXpcdXgpeqTaZW2whYrWz823yewZxAr3x4cYh4S3W
Item
Framework
Anchor 0.30.1
Item
Cluster
Devnet
Item
Source

PDA seeds

Account
Bounty
[b"bounty", sponsor, bounty_id.to_le_bytes()]
Account
Vault
[b"vault", bounty] (SPL token account, authority = Bounty PDA)
Account
Submission
[b"submission", bounty, creator] (one per creator per bounty)
ts
const bounty = PublicKey.findProgramAddressSync(
  [Buffer.from("bounty"), sponsor.toBuffer(), bountyId.toArrayLike(Buffer, "le", 8)],
  programId
)[0];
const vault = PublicKey.findProgramAddressSync([Buffer.from("vault"), bounty.toBuffer()], programId)[0];
const submission = PublicKey.findProgramAddressSync(
  [Buffer.from("submission"), bounty.toBuffer(), creator.toBuffer()],
  programId
)[0];

Account data

Bounty

Field
sponsor
Type
Pubkey
Notes
Creator of the bounty; the only wallet that can approve, reject and reclaim
Field
mint
Type
Pubkey
Notes
Token mint of the prize
Field
reward_per_winner
Type
u64
Notes
Base units (USDC has 6 decimals)
Field
max_winners
Type
u16
Field
paid_count
Type
u16
Notes
Number of approved submissions
Field
submission_count
Type
u32
Field
deadline
Type
i64
Notes
Unix seconds
Field
status
Type
enum
Notes
Open or Closed
Field
title
Type
String
Notes
≤ 64 bytes
Field
description
Type
String
Notes
≤ 280 bytes
Field
bump / vault_bump
Type
u8
Notes
PDA bumps
Field
bounty_id
Type
u64
Notes
Part of the PDA seeds

Submission

Field
bounty
Type
Pubkey
Field
creator
Type
Pubkey
Field
link
Type
String
Notes
1–200 bytes
Field
status
Type
enum
Notes
Pending, Approved or Rejected
Field
paid_amount
Type
u64
Notes
0 until approved
Field
paid_at
Type
i64
Notes
Unix seconds, 0 until approved
Field
bump
Type
u8

create_bounty

rust
create_bounty(bounty_id: u64, title: String, description: String,
               reward_per_winner: u64, max_winners: u16, deadline: i64)

Accounts: sponsor (signer, mut), mint, bounty (init PDA), vault (init token account, authority = bounty), sponsor_ata (mut, mint = mint, authority = sponsor), token_program, system_program.

  • reward_per_winner > 0, max_winners > 0.
  • title is 1–64 bytes; description is at most 280 bytes.
  • deadline is later than the current chain time.
  • total = reward_per_winner × max_winners is checked for overflow, then transferred from sponsor_ata to vault with transfer_checked.
  • Emits BountyCreated.

submit_clip

rust
submit_clip(link: String)

Accounts: creator (signer, mut), bounty (mut), submission (init PDA), system_program.

  • link is 1–200 bytes.
  • Bounty status is Open and the current time is before deadline.
  • Creating the submission PDA fails if the creator already entered, which enforces one entry per creator.
  • Increments submission_count. Emits SubmissionCreated.

approve_submission

rust
approve_submission()

Accounts: sponsor (signer, mut), bounty (mut, has_one = sponsor, has_one = mint), submission (mut, has_one = bounty, has_one = creator), creator, mint, vault (mut), creator_ata (init_if_needed associated token account, payer = sponsor), token_program, associated_token_program, system_program.

  • Bounty is Open, submission is Pending, and paid_count < max_winners.
  • Transfers reward_per_winner from the vault to the creator's token account, signed by the Bounty PDA.
  • Sets the submission to Approved with paid_amount and paid_at, then increments paid_count.
  • Allowed after the deadline until the sponsor reclaims. Emits PayoutEvent.

reject_submission

rust
reject_submission()

Accounts: sponsor (signer), bounty (has_one = sponsor), submission (mut, has_one = bounty). Requires the submission to be Pending; sets it to Rejected. Emits RejectEvent.

reclaim_unspent

rust
reclaim_unspent()

Accounts: sponsor (signer), bounty (mut, has_one = sponsor, has_one = mint), mint, vault (mut), sponsor_ata (mut), token_program.

  • Bounty is Open and the current time is at or after deadline.
  • Sets the bounty to Closed before transferring the entire remaining vault balance to sponsor_ata. A second call fails with BountyClosed.
  • Emits ReclaimEvent with the amount returned.

Errors

Code
6000
Name
InvalidReward
Message
Reward per winner must be greater than zero
Code
6001
Name
InvalidMaxWinners
Message
Max winners must be greater than zero
Code
6002
Name
DeadlineInPast
Message
Deadline must be in the future
Code
6003
Name
TitleTooLong
Message
Title must be 1-64 bytes
Code
6004
Name
DescriptionTooLong
Message
Description must be at most 280 bytes
Code
6005
Name
LinkTooLong
Message
Link must be 1-200 bytes
Code
6006
Name
MathOverflow
Message
Arithmetic overflow
Code
6007
Name
Unauthorized
Message
Only the bounty sponsor can do this
Code
6008
Name
BountyClosed
Message
Bounty is closed
Code
6009
Name
DeadlinePassed
Message
Submission deadline has passed
Code
6010
Name
DeadlineNotReached
Message
Deadline has not been reached yet
Code
6011
Name
SubmissionNotPending
Message
Submission is not pending
Code
6012
Name
MaxWinnersReached
Message
Maximum number of winners already paid

Events

Event
BountyCreated
bounty, sponsor, mint, bounty_id, reward_per_winner, max_winners, deadline, total_escrowed
Event
SubmissionCreated
bounty, creator, submission
Event
PayoutEvent
bounty, submission, creator, amount, paid_count, timestamp
Event
RejectEvent
bounty, submission, creator
Event
ReclaimEvent
bounty, sponsor, amount