1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#![allow(clippy::result_large_err)]
use anchor_lang::prelude::*;
pub use errors::CandyError;
use instructions::*;
pub use state::*;
pub use utils::*;
pub mod constants;
pub mod errors;
mod instructions;
mod state;
mod utils;
declare_id!("CMACYFENjoBMHzapRXyo1JZkVS6EtaDDzkjMrmQLvr4J");
#[program]
pub mod candy_machine_core {
use super::*;
/// Add the configuration (name + uri) of each NFT to the account data.
///
/// # Accounts
///
/// 0. `[writable]` Candy Machine account
/// 1. `[signer]` Candy Machine authority
pub fn add_config_lines(
ctx: Context<AddConfigLines>,
index: u32,
config_lines: Vec<ConfigLine>,
) -> Result<()> {
instructions::add_config_lines(ctx, index, config_lines)
}
/// Initialize the candy machine account with the specified data and token standard.
///
/// # Accounts
///
/// 0. `[writable]` Candy Machine account (must be pre-allocated but zero content)
/// 1. `[writable]` Authority PDA (seeds `["candy_machine", candy machine id]`)
/// 2. `[]` Candy Machine authority
/// 3. `[signer]` Payer
/// 4. `[]` Collection metadata
/// 5. `[]` Collection mint
/// 6. `[]` Collection master edition
/// 7. `[signer]` Collection update authority
/// 8. `[writable]` Collection metadata delegate record
/// 9. `[]` Token Metadata program
/// 10. `[]` System program
/// 11. `[]` Instructions sysvar account
/// 12. `[optional]` Token Authorization Rules program
/// 13. `[optional]` Token authorization rules account
pub fn initialize(ctx: Context<Initialize>, data: CandyMachineData) -> Result<()> {
instructions::initialize(ctx, data)
}
/// Mint an NFT.
///
/// Only the candy machine mint authority is allowed to mint. This handler mints both
/// NFTs and Programmable NFTs.
///
/// # Accounts
///
/// 0. `[writable]` Candy Machine account (must be pre-allocated but zero content)
/// 1. `[writable]` Authority PDA (seeds `["candy_machine", candy machine id]`)
/// 2. `[signer]` Candy Machine mint authority
/// 3. `[signer]` Payer
/// 4. `[]` Asset Owner
/// 5. `[writable]` Asset account
/// 6. `[]` Collection
/// 7. `[]` Collection delegate or update authority
/// 8. `[]` Asset program
/// 9. `[]` System program
/// 10. `[optional]` Instructions sysvar account
/// 11. `[]` SlotHashes sysvar cluster data.
pub fn mint_asset<'info>(
ctx: Context<'_, '_, '_, 'info, MintAsset<'info>>,
args: MintAssetArgs,
) -> Result<()> {
instructions::mint_asset(ctx, args)
}
/// Set a new authority of the candy machine.
///
/// # Accounts
///
/// 0. `[writable]` Candy Machine account
/// 1. `[signer]` Candy Machine authority
pub fn set_authority(ctx: Context<SetAuthority>, new_authority: Pubkey) -> Result<()> {
instructions::set_authority(ctx, new_authority)
}
/// Set the collection mint for the candy machine.
///
/// # Accounts
///
/// 0. `[writable]` Candy Machine account (must be pre-allocated but zero content)
/// 1. `[signer]` Candy Machine authority
/// 2. `[]` Authority PDA (seeds `["candy_machine", candy machine id]`)
/// 3. `[signer]` Payer
/// 4. `[]` Collection update authority
/// 5. `[]` Collection mint
/// 6. `[]` Collection metadata
/// 7. `[optional, writable]` Metadata delegate record
/// 8. `[optional, writable]` Collection authority record
/// 9. `[signer]` New collection update authority
/// 10. `[]` New collection mint
/// 11. `[]` New collection metadata
/// 12. `[]` New collection master edition
/// 13. `[writable]` New collection metadata delegate record
/// 14. `[]` Token Metadata program
/// 15. `[]` System program
/// 16. `[]` Instructions sysvar account
/// 17. `[optional]` Token Authorization Rules program
/// 18. `[optional]` Token authorization rules account
pub fn set_collection(ctx: Context<SetCollection>) -> Result<()> {
instructions::set_collection(ctx)
}
/// Set a new mint authority of the candy machine.
///
/// # Accounts
///
/// 0. `[writable]` Candy Machine account
/// 1. `[signer]` Candy Machine authority
/// 1. `[signer]` New candy machine authority
pub fn set_mint_authority(ctx: Context<SetMintAuthority>) -> Result<()> {
instructions::set_mint_authority(ctx)
}
/// Update the candy machine configuration.
///
/// # Accounts
///
/// 0. `[writable]` Candy Machine account
/// 1. `[signer]` Candy Machine authority
pub fn update(ctx: Context<Update>, data: CandyMachineData) -> Result<()> {
instructions::update(ctx, data)
}
/// Withdraw the rent lamports and send them to the authority address.
///
/// # Accounts
///
/// 0. `[writable]` Candy Machine account
/// 1. `[signer]` Candy Machine authority
pub fn withdraw(ctx: Context<Withdraw>) -> Result<()> {
instructions::withdraw(ctx)
}
}