How metatheory-dev/presale-smartcontracts works
This Anchor program manages an SPL-token presale: an administrator configures and funds a sale, buyers purchase during its configured window, and users or the administrator claim or withdraw assets. The tree contains two parallel Rust source trees; the graph shows the programs/palm-presale implementation, with the root palm-presale tree as its duplicate. README-described allocation tickets are not represented as a separate stage because the sampled code does not establish their implementation. Edges are limited to documented dispatches and source-index or excerpt evidence.
Main entry points: lib.rs Anchor program · presale_info.rs Sale account · buy_token.rs Buy tokens · deposit_token.rs Fund inventory
Components 16
Program entry
- Anchor program
programs/palm-presale/src/lib.rs - Mirrored Rust implementation
palm-presale/src
Sale management
- Create presale
programs/palm-presale/src/instructions/create_presale.rs - Update presale
programs/palm-presale/src/instructions/update_presale.rs - Start presale
programs/palm-presale/src/instructions/start_presale.rs - Fund inventory
programs/palm-presale/src/instructions/deposit_token.rs
Purchasing
- Buy tokens
programs/palm-presale/src/instructions/buy_token.rs
Settlement
- Claim tokens
programs/palm-presale/src/instructions/claim_token.rs - Withdraw SOL
programs/palm-presale/src/instructions/withdraw_sol.rs - Withdraw tokens
programs/palm-presale/src/instructions/withdraw_token.rs
On-chain state
- Sale account
programs/palm-presale/src/state/presale_info.rs - Buyer account
programs/palm-presale/src/state/user_info.rs
Other components
- Administrator
- Buyer
- Solana token and system programs
- Presale vault
Connections 28
- Administrator → Anchor program: invokes
README.md - Buyer → Anchor program: invokes
README.md - Anchor program → Create presale: dispatches
programs/palm-presale/src/lib.rs - Anchor program → Update presale: dispatches
programs/palm-presale/src/lib.rs - Anchor program → Start presale: dispatches
programs/palm-presale/src/lib.rs - Anchor program → Fund inventory: dispatches
programs/palm-presale/src/lib.rs - Anchor program → Buy tokens: dispatches
programs/palm-presale/src/lib.rs - Anchor program → Claim tokens: dispatches
programs/palm-presale/src/lib.rs - Anchor program → Withdraw SOL: dispatches
programs/palm-presale/src/lib.rs - Anchor program → Withdraw tokens: dispatches
programs/palm-presale/src/lib.rs - Create presale → Sale account: initializes
programs/palm-presale/src/instructions/create_presale.rs - Update presale → Sale account: updates
programs/palm-presale/src/instructions/update_presale.rs - Start presale → Sale account: updates
programs/palm-presale/src/instructions/start_presale.rs - Fund inventory → Sale account: updates inventory
programs/palm-presale/src/instructions/deposit_token.rs - Fund inventory → Solana token and system programs: transfers tokens
programs/palm-presale/src/instructions/deposit_token.rs - Fund inventory → Presale vault: funds rent
programs/palm-presale/src/instructions/deposit_token.rs - Buy tokens → Sale account: checks and updates
programs/palm-presale/src/instructions/buy_token.rs - Buy tokens → Buyer account: records purchase
programs/palm-presale/src/instructions/buy_token.rs - Buy tokens → Presale vault: transfers SOL
programs/palm-presale/src/instructions/buy_token.rs - Buy tokens → Solana token and system programs: calls system transfer
programs/palm-presale/src/instructions/buy_token.rs - Claim tokens → Sale account: reads sale state
programs/palm-presale/src/instructions/claim_token.rs - Claim tokens → Buyer account: reads buyer state
programs/palm-presale/src/instructions/claim_token.rs - Claim tokens → Solana token and system programs: transfers tokens
programs/palm-presale/src/instructions/claim_token.rs - Withdraw SOL → Sale account: reads sale state
programs/palm-presale/src/instructions/withdraw_sol.rs - Withdraw SOL → Presale vault: withdraws SOL
programs/palm-presale/src/instructions/withdraw_sol.rs - Withdraw SOL → Solana token and system programs: calls system transfer
programs/palm-presale/src/instructions/withdraw_sol.rs - Withdraw tokens → Sale account: reads sale state
programs/palm-presale/src/instructions/withdraw_token.rs - Withdraw tokens → Solana token and system programs: transfers tokens
programs/palm-presale/src/instructions/withdraw_token.rs