Skip to content

Commit

Permalink
feat: P-924 implemented NFT token holder VC for MVP on Ethereum (#2889)
Browse files Browse the repository at this point in the history
Co-authored-by: higherordertech <higherordertech>
  • Loading branch information
higherordertech committed Jul 12, 2024
1 parent 711a9c1 commit 555315d
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 8 deletions.
4 changes: 3 additions & 1 deletion primitives/core/src/assertion/web3_nft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ pub enum Web3NftType {
Club3Sbt,
#[codec(index = 2)]
MFan,
#[codec(index = 3)]
Mvp,
}

impl Web3NftType {
pub fn get_supported_networks(&self) -> Vec<Web3Network> {
match self {
Self::WeirdoGhostGang => vec![Web3Network::Ethereum],
Self::WeirdoGhostGang | Self::Mvp => vec![Web3Network::Ethereum],
Self::Club3Sbt => vec![Web3Network::Bsc, Web3Network::Polygon, Web3Network::Arbitrum],
Self::MFan => vec![Web3Network::Polygon],
}
Expand Down
1 change: 1 addition & 0 deletions tee-worker/cli/lit_test_dr_vc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ assertion_vec=(
"nft-holder weirdo-ghost-gang"
"nft-holder club3-sbt"
"nft-holder mfan"
"nft-holder mvp"
)

assertions=()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ pub enum NftHolderCommand {
WeirdoGhostGang,
Club3Sbt,
MFan,
Mvp,
}

// positional args (to vec) + required arg + optional arg is a nightmare combination for clap parser,
Expand Down Expand Up @@ -659,6 +660,7 @@ impl Command {
NftHolderCommand::WeirdoGhostGang => NftHolder(Web3NftType::WeirdoGhostGang),
NftHolderCommand::Club3Sbt => NftHolder(Web3NftType::Club3Sbt),
NftHolderCommand::MFan => NftHolder(Web3NftType::MFan),
NftHolderCommand::Mvp => NftHolder(Web3NftType::Mvp),
}),
Command::Dynamic(arg) => {
let decoded_id = hex::decode(&arg.smart_contract_id.clone()).unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export default {
},
// Web3NftType
Web3NftType: {
_enum: ["WeirdoGhostGang", "Club3Sbt", "MFan"],
_enum: ["WeirdoGhostGang", "Club3Sbt", "MFan", "Mvp"],
},
},
};
4 changes: 4 additions & 0 deletions tee-worker/litentry/core/common/src/web3_nft/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl NftName for Web3NftType {
Self::WeirdoGhostGang => "Weirdo Ghost Gang",
Self::Club3Sbt => "Club3 SBT",
Self::MFan => "MFAN",
Self::Mvp => "MEME VIP PASS",
}
}
}
Expand All @@ -58,6 +59,9 @@ impl NftAddress for Web3NftType {
// MFan
(Self::MFan, Web3Network::Polygon) =>
Some("0x9aBc7C604C27622f9CD56bd1628F6321c32bBBf6"),
// Mvp
(Self::Mvp, Web3Network::Ethereum) =>
Some("0xAA813F8691B10Dc62bd616ae90b05A52f0C40C1D"),
_ => None,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub fn get_schema_url(assertion: &Assertion) -> Option<String> {

Assertion::PlatformUser(_) => Some(format!("{BASE_URL}/24-platform-user/1-1-1.json")),

Assertion::NftHolder(_) => Some(format!("{BASE_URL}/26-nft-holder/1-1-1.json")),
Assertion::NftHolder(_) => Some(format!("{BASE_URL}/26-nft-holder/1-1-2.json")),

Assertion::TokenHoldingAmount(_) =>
Some(format!("{BASE_URL}/25-token-holding-amount/1-1-3.json")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ pub fn has_nft(
addresses: Vec<(Web3Network, String)>,
data_provider_config: &DataProviderConfig,
) -> Result<bool, Error> {
match nft_type {
Web3NftType::WeirdoGhostGang =>
common::has_nft_721(addresses, nft_type, data_provider_config),
Web3NftType::Club3Sbt => common::has_nft_1155(addresses, nft_type, data_provider_config),
Web3NftType::MFan => common::has_nft_721(addresses, nft_type, data_provider_config),
if nft_type == Web3NftType::Club3Sbt {
common::has_nft_1155(addresses, nft_type, data_provider_config)
} else {
common::has_nft_721(addresses, nft_type, data_provider_config)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ export const mockAssertions = [
NftHolder: 'MFan',
},
},
{
description: 'You are a holder of a certain kind of NFT',
assertion: {
NftHolder: 'Mvp',
},
},

// TokenHoldingAmount
{
Expand Down

0 comments on commit 555315d

Please sign in to comment.