Categories
Solana

What’s the solidity equivalent to implement a `mapping(address => bool) is_early_sale` in anchor for solana? I figured out the way to go is PDA, but I was only able to figure out how to generate a PDA and create a PDA account. I wanna know how to store in `is_early_sale` and to retrieve it’s value,

#[derive(Accounts)] #[instruction(user: Pubkey)] pub struct EarlySaleContext { #[account( init, payer = caller, seeds = [user.key().as_ref()], // Use a Pubkey from the vector as the seed bump, space = size_of::() + 16 )] pub set_pda_account: Account, // The PDA account being created #[account(mut)] pub caller: Signer, pub system_program: Program, #[account(mut)] /// CHECK: This account is used to receive SOL. pub program_account: AccountInfo } #[account] pub struct IsEarlySale { pub is_early_sale: bool }#[derive(Accounts)] #[instruction(user: Pubkey)] pub struct EarlySaleContext { #[account( init, payer = caller, seeds = [user.key().as_ref()], // Use a Pubkey from the vector as the seed bump, space = size_of::() + 16 )] pub set_pda_account: Account, // The PDA account being created #[account(mut)] pub caller: Signer, pub system_program: Program, #[account(mut)] /// CHECK: This account is used to receive SOL. pub program_account: AccountInfo } #[account] pub struct IsEarlySale { pub is_early_sale: bool } 

I will be passing the address of users from a vector

submitted by /u/BLACK_BEARD002
[link] [comments]

Join The SmashBotAI Telegram Community Now! Get trade alerts, smashable token trade ideas, and more!

https://t.me/smashbotcommunity

Start Trading Now:

SmashBotAI Telegram Bot

Claim Your $SMASH Airdrop Now!

Join The SmashBotAI Telegram Community Now! Get trade alerts, smashable token trade ideas, and more! https://t.me/smashbotcommunity

Start Trading Now:
SmashBotAI Telegram Bot

Claim Your $SMASH Airdrop Now!

Categories