Skip to content

Commit 07caa67

Browse files
committed
fix: lottery
1 parent bd377c9 commit 07caa67

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

project-8-token-lottery/Anchor.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
resolution = true
55
skip-lint = false
66

7-
[programs.localnet]
7+
[programs.devnet]
88
token_lottery = "2RTh2Y4e2N421EbSnUYTKdGqDHJH7etxZb3VrWDMpNMY"
99

1010
[registry]

project-8-token-lottery/programs/token-lottery/src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,18 @@ pub mod token_lottery {
3939
use super::*;
4040

4141
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;
4343
ctx.accounts.token_lottery.lottery_start = start;
4444
ctx.accounts.token_lottery.lottery_end = end;
4545
ctx.accounts.token_lottery.price = price;
4646
ctx.accounts.token_lottery.authority = ctx.accounts.payer.key();
4747
ctx.accounts.token_lottery.randomness_account = Pubkey::default();
4848
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;*/
5250

5351
// Create Collection Mint
5452
let signer_seeds: &[&[&[u8]]] = &[&[
55-
lottery_account_key.as_ref(),
53+
b"collection_mint".as_ref(),
5654
&[ctx.bumps.collection_mint],
5755
]];
5856

@@ -91,7 +89,7 @@ pub mod token_lottery {
9189
uri: URI.to_string(),
9290
seller_fee_basis_points: 0,
9391
creators: Some(vec![Creator {
94-
address: ctx.accounts.payer.key(),
92+
address: ctx.accounts.collection_mint.key(),
9593
verified: false,
9694
share: 100,
9795
}]),
@@ -124,12 +122,13 @@ pub mod token_lottery {
124122
)?;
125123

126124
msg!("verifying collection");
127-
sign_metadata(CpiContext::new(
125+
sign_metadata(CpiContext::new_with_signer(
128126
ctx.accounts.token_metadata_program.to_account_info(),
129127
SignMetadata {
130128
creator: ctx.accounts.collection_mint.to_account_info(),
131129
metadata: ctx.accounts.metadata.to_account_info(),
132130
},
131+
&signer_seeds,
133132
))?;
134133

135134

@@ -337,21 +336,22 @@ pub struct Initialize<'info> {
337336
#[account(mut)]
338337
pub payer: Signer<'info>,
339338

340-
#[account(
339+
/*#[account(
341340
init,
342341
payer = payer,
343342
space = 8 + TokenLottery::INIT_SPACE,
344343
// Challenge: Make this be able to run more than 1 lottery at a time
345344
seeds = [b"token_lottery".as_ref()],
346345
bump
347346
)]
348-
pub token_lottery: Box<Account<'info, TokenLottery>>,
347+
pub token_lottery: Box<Account<'info, TokenLottery>>,*/
349348

350349
#[account(
351350
init,
352351
payer = payer,
353352
mint::decimals = 0,
354353
mint::authority = collection_mint,
354+
mint::freeze_authority = collection_mint,
355355
seeds = [b"collection_mint".as_ref()],
356356
bump,
357357
)]

0 commit comments

Comments
 (0)