@@ -39,20 +39,18 @@ pub mod token_lottery {
39
39
use super :: * ;
40
40
41
41
pub fn initialize ( ctx : Context < Initialize > , start : u64 , end : u64 , price : u64 ) -> Result < ( ) > {
42
- ctx. accounts . token_lottery . bump = ctx. bumps . token_lottery ;
42
+ /* ctx.accounts.token_lottery.bump = ctx.bumps.token_lottery;
43
43
ctx.accounts.token_lottery.lottery_start = start;
44
44
ctx.accounts.token_lottery.lottery_end = end;
45
45
ctx.accounts.token_lottery.price = price;
46
46
ctx.accounts.token_lottery.authority = ctx.accounts.payer.key();
47
47
ctx.accounts.token_lottery.randomness_account = Pubkey::default();
48
48
49
- let lottery_account_key = & ctx. accounts . token_lottery . key ( ) ;
50
-
51
- ctx. accounts . token_lottery . ticket_num = 0 ;
49
+ ctx.accounts.token_lottery.ticket_num = 0;*/
52
50
53
51
// Create Collection Mint
54
52
let signer_seeds: & [ & [ & [ u8 ] ] ] = & [ & [
55
- lottery_account_key . as_ref ( ) ,
53
+ b"collection_mint" . as_ref ( ) ,
56
54
& [ ctx. bumps . collection_mint ] ,
57
55
] ] ;
58
56
@@ -91,7 +89,7 @@ pub mod token_lottery {
91
89
uri : URI . to_string ( ) ,
92
90
seller_fee_basis_points : 0 ,
93
91
creators : Some ( vec ! [ Creator {
94
- address: ctx. accounts. payer . key( ) ,
92
+ address: ctx. accounts. collection_mint . key( ) ,
95
93
verified: false ,
96
94
share: 100 ,
97
95
} ] ) ,
@@ -124,12 +122,13 @@ pub mod token_lottery {
124
122
) ?;
125
123
126
124
msg ! ( "verifying collection" ) ;
127
- sign_metadata ( CpiContext :: new (
125
+ sign_metadata ( CpiContext :: new_with_signer (
128
126
ctx. accounts . token_metadata_program . to_account_info ( ) ,
129
127
SignMetadata {
130
128
creator : ctx. accounts . collection_mint . to_account_info ( ) ,
131
129
metadata : ctx. accounts . metadata . to_account_info ( ) ,
132
130
} ,
131
+ & signer_seeds,
133
132
) ) ?;
134
133
135
134
@@ -337,21 +336,22 @@ pub struct Initialize<'info> {
337
336
#[ account( mut ) ]
338
337
pub payer : Signer < ' info > ,
339
338
340
- #[ account(
339
+ /* #[account(
341
340
init,
342
341
payer = payer,
343
342
space = 8 + TokenLottery::INIT_SPACE,
344
343
// Challenge: Make this be able to run more than 1 lottery at a time
345
344
seeds = [b"token_lottery".as_ref()],
346
345
bump
347
346
)]
348
- pub token_lottery : Box < Account < ' info , TokenLottery > > ,
347
+ pub token_lottery: Box<Account<'info, TokenLottery>>,*/
349
348
350
349
#[ account(
351
350
init,
352
351
payer = payer,
353
352
mint:: decimals = 0 ,
354
353
mint:: authority = collection_mint,
354
+ mint:: freeze_authority = collection_mint,
355
355
seeds = [ b"collection_mint" . as_ref( ) ] ,
356
356
bump,
357
357
) ]
0 commit comments