Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
890 changes: 407 additions & 483 deletions Cargo.lock

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@ cpi = []
default = ["cpi"]

[dependencies]
solana-program = "2.2.1"
light-compressed-account = { git = "https://github.com/lightprotocol/light-protocol", rev = "128b191ba", features = ["anchor"] }
light-compressed-token-sdk = { git = "https://github.com/lightprotocol/light-protocol", rev = "128b191ba", features = ["anchor"] }
solana-program = "=2.2.1"
light-compressed-account = { git = "https://github.com/lightprotocol/light-protocol", rev = "52437b6f281225b8546b2671ccc6dae2b3d5f0b6" }
light-compressed-token-sdk = { git = "https://github.com/lightprotocol/light-protocol", rev = "52437b6f281225b8546b2671ccc6dae2b3d5f0b6" }
thiserror = "2.0.11"
borsh = "0.10.0"
light-sdk = { git = "https://github.com/lightprotocol/light-protocol", rev = "52437b6f281225b8546b2671ccc6dae2b3d5f0b6" }


[dev-dependencies]
solana-sdk = "2.2.1"
light-compressed-token = { git = "https://github.com/lightprotocol/light-protocol", rev = "128b191ba" }
light-compressed-token-client = { git = "https://github.com/lightprotocol/light-protocol", rev = "128b191ba" }
light-program-test = { git = "https://github.com/lightprotocol/light-protocol", rev = "128b191ba", features = ["v2"] }
solana-program-test = "2.2.1"
light-client = { git = "https://github.com/lightprotocol/light-protocol", rev = "128b191ba", features = ["v2"] }
solana-sdk = "=2.2.1"
light-compressed-token = { git = "https://github.com/lightprotocol/light-protocol", rev = "52437b6f281225b8546b2671ccc6dae2b3d5f0b6" }
light-compressed-token-client = { git = "https://github.com/lightprotocol/light-protocol", rev = "52437b6f281225b8546b2671ccc6dae2b3d5f0b6" }
light-program-test = { git = "https://github.com/lightprotocol/light-protocol", rev = "52437b6f281225b8546b2671ccc6dae2b3d5f0b6", features = ["v2"] }
solana-program-test = "=2.2.1"
light-client = { git = "https://github.com/lightprotocol/light-protocol", rev = "52437b6f281225b8546b2671ccc6dae2b3d5f0b6", features = ["v2"] }

spl-token = "5.0.0"
light-sdk = { git = "https://github.com/lightprotocol/light-protocol", rev = "128b191ba" }

[lib]
crate-type = ["cdylib", "lib"]
Expand Down
22 changes: 22 additions & 0 deletions program/src/check_pda.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use crate::error::ClaimError;
use solana_program::{msg, program_error::ProgramError, pubkey::Pubkey};

pub fn check_claim_pda(
seeds: &[&[u8]],
claim_program: &Pubkey,
airdrop_account: &Pubkey,
) -> Result<(), ProgramError> {
let derived_pda =
Pubkey::create_program_address(seeds, claim_program).expect("Invalid PDA seeds.");

if derived_pda != *airdrop_account {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can probably use the light-account-checks method for this check.

msg!(
"Invalid airdrop PDA provided. Expected: {}. Found: {}.",
derived_pda,
airdrop_account
);
return Err(ClaimError::InvalidPDA.into());
}

Ok(())
}
3 changes: 3 additions & 0 deletions program/src/constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use solana_program::{pubkey, pubkey::Pubkey};

pub const CTOKEN_PROGRAM_ID: Pubkey = pubkey!("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m");
Loading