Skip to content

Commit

Permalink
check first creator is verified in snapshot holder and mint functions
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelvanderwaal committed Dec 21, 2021
1 parent 9df251f commit b7e5635
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "metaboss"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
description="The Metaplex NFT-standard Swiss Army Knife tool."
repository="https://github.com/samuelvanderwaal/metaboss"
Expand Down
10 changes: 10 additions & 0 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ pub struct SolanaConfig {
pub commitment: String,
}

pub fn first_creator_is_verified(creators_opt: &Option<Vec<Creator>>) -> bool {
// Only add mints with a verified creator.
if let Some(creators) = creators_opt {
if creators[0].verified {
return true;
}
}
false
}

pub fn parse_keypair(path: &String) -> Result<Keypair> {
let secret_string = fs::read_to_string(path).context("Can't find key file")?;

Expand Down
11 changes: 9 additions & 2 deletions src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use std::{
};

use crate::constants::*;
use crate::parse::is_only_one_option;
use crate::parse::{first_creator_is_verified, is_only_one_option};
use crate::spinner::*;

#[derive(Debug, Serialize, Clone)]
Expand Down Expand Up @@ -88,7 +88,9 @@ pub fn snapshot_mints(
for (_, account) in accounts {
let metadata: Metadata = try_from_slice_unchecked(&account.data)?;

mint_accounts.push(metadata.mint.to_string());
if first_creator_is_verified(&metadata.data.creators) {
mint_accounts.push(metadata.mint.to_string());
}
}

let prefix = if let Some(update_authority) = update_authority {
Expand Down Expand Up @@ -143,6 +145,11 @@ pub fn snapshot_holders(
}
};

// Check that first creator is verified
if !first_creator_is_verified(&metadata.data.creators) {
return;
}

let token_accounts = match get_holder_token_accounts(client, metadata.mint.to_string())
{
Ok(token_accounts) => token_accounts,
Expand Down

0 comments on commit b7e5635

Please sign in to comment.