Skip to content

Commit

Permalink
feat: P-624 added NFP token holding amount VC (#2583)
Browse files Browse the repository at this point in the history
Co-authored-by: higherordertech <higherordertech>
  • Loading branch information
higherordertech committed Mar 17, 2024
1 parent 4cad485 commit 567cb5b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions primitives/core/src/web3_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ pub enum Web3TokenType {
Ton,
#[codec(index = 21)]
Trx,
#[codec(index = 22)]
Nfp,
}

impl Web3TokenType {
Expand All @@ -79,6 +81,7 @@ impl Web3TokenType {
Web3Network::Litentry,
Web3Network::Litmus,
],
Self::Nfp => vec![Web3Network::Bsc],
_ => vec![Web3Network::Ethereum],
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ impl RequestBatchVcCommand {
"gtc" => Ok(Assertion::TokenHoldingAmount(Web3TokenType::Gtc)),
"ton" => Ok(Assertion::TokenHoldingAmount(Web3TokenType::Ton)),
"trx" => Ok(Assertion::TokenHoldingAmount(Web3TokenType::Trx)),
"nfp" => Ok(Assertion::TokenHoldingAmount(Web3TokenType::Nfp)),
_ => Err("TokenHoldingAmount: Wrong parameter".to_string()),
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ pub enum TokenHoldingAmountCommand {
Gtc,
Ton,
Trx,
Nfp,
}

#[derive(Subcommand, Debug)]
Expand Down Expand Up @@ -497,6 +498,7 @@ impl RequestVcCommand {
TokenHoldingAmountCommand::Gtc => Assertion::TokenHoldingAmount(Web3TokenType::Gtc),
TokenHoldingAmountCommand::Ton => Assertion::TokenHoldingAmount(Web3TokenType::Ton),
TokenHoldingAmountCommand::Trx => Assertion::TokenHoldingAmount(Web3TokenType::Trx),
TokenHoldingAmountCommand::Nfp => Assertion::TokenHoldingAmount(Web3TokenType::Nfp),
},
Command::PlatformUser(arg) => match arg {
PlatformUserCommand::KaratDaoUser =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export default {
"Gtc",
"Ton",
"Trx",
"Nfp",
],
},
// PlatformUserType
Expand Down
7 changes: 6 additions & 1 deletion tee-worker/litentry/core/common/src/web3_token/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ impl TokenName for Web3TokenType {
Self::Gtc => "GTC",
Self::Ton => "TON",
Self::Trx => "TRX",
Self::Nfp => "NFP",
}
}
}
Expand Down Expand Up @@ -138,6 +139,8 @@ impl TokenAddress for Web3TokenType {
(Self::Trx, Web3Network::Bsc) => Some("0xCE7de646e7208a4Ef112cb6ed5038FA6cC6b12e3"),
(Self::Trx, Web3Network::Ethereum) =>
Some("0x50327c6c5a14dcade707abad2e27eb517df87ab5"),
// Nfp
(Self::Nfp, Web3Network::Bsc) => Some("0x75e8ddb518bb757b4282cd5b83bb70d4101d12fb"),
_ => None,
}
}
Expand Down Expand Up @@ -185,7 +188,9 @@ impl TokenDecimals for Web3TokenType {
// People
(Self::People, Web3Network::Ethereum) |
// Gtc
(Self::Gtc, Web3Network::Ethereum) => 18,
(Self::Gtc, Web3Network::Ethereum) |
// Nfp
(Self::Nfp, Web3Network::Bsc) => 18,
// Ton
(Self::Ton, Web3Network::Bsc) | (Self::Ton, Web3Network::Ethereum) => 9,
// Wbtc
Expand Down

0 comments on commit 567cb5b

Please sign in to comment.