use darkfi_sdk::error::ContractError;
#[repr(u8)]
pub enum MoneyFunction {
GenesisMintV1 = 0x01,
TransferV1 = 0x02,
OtcSwapV1 = 0x03,
TokenMintV1 = 0x04,
TokenFreezeV1 = 0x05,
StakeV1 = 0x06,
UnstakeV1 = 0x07,
}
impl TryFrom<u8> for MoneyFunction {
type Error = ContractError;
fn try_from(b: u8) -> core::result::Result<Self, Self::Error> {
match b {
0x01 => Ok(Self::GenesisMintV1),
0x02 => Ok(Self::TransferV1),
0x03 => Ok(Self::OtcSwapV1),
0x04 => Ok(Self::TokenMintV1),
0x05 => Ok(Self::TokenFreezeV1),
0x06 => Ok(Self::StakeV1),
0x07 => Ok(Self::UnstakeV1),
_ => Err(ContractError::InvalidFunction),
}
}
}
pub mod error;
pub mod model;
#[cfg(not(feature = "no-entrypoint"))]
pub mod entrypoint;
#[cfg(feature = "client")]
pub mod client;
pub const MONEY_CONTRACT_INFO_TREE: &str = "info";
pub const MONEY_CONTRACT_COINS_TREE: &str = "coins";
pub const MONEY_CONTRACT_COIN_ROOTS_TREE: &str = "coin_roots";
pub const MONEY_CONTRACT_NULLIFIERS_TREE: &str = "nullifiers";
pub const MONEY_CONTRACT_TOKEN_FREEZE_TREE: &str = "token_freezes";
pub const MONEY_CONTRACT_DB_VERSION: &str = env!("CARGO_PKG_VERSION");
pub const MONEY_CONTRACT_COIN_MERKLE_TREE: &str = "coin_tree";
pub const MONEY_CONTRACT_FAUCET_PUBKEYS: &str = "faucet_pubkeys";
pub const MONEY_CONTRACT_ZKAS_MINT_NS_V1: &str = "Mint_V1";
pub const MONEY_CONTRACT_ZKAS_BURN_NS_V1: &str = "Burn_V1";
pub const MONEY_CONTRACT_ZKAS_TOKEN_MINT_NS_V1: &str = "TokenMint_V1";
pub const MONEY_CONTRACT_ZKAS_TOKEN_FRZ_NS_V1: &str = "TokenFreeze_V1";
pub const CONSENSUS_CONTRACT_INFO_TREE: &str = "consensus_info";
pub const CONSENSUS_CONTRACT_COINS_TREE: &str = "consensus_coins";
pub const CONSENSUS_CONTRACT_COIN_ROOTS_TREE: &str = "consensus_coin_roots";
pub const CONSENSUS_CONTRACT_NULLIFIERS_TREE: &str = "consensus_nullifiers";
pub const CONSENSUS_CONTRACT_UNSTAKED_COINS_TREE: &str = "consensus_unstaked_coins";
pub const CONSENSUS_CONTRACT_DB_VERSION: &str = "db_version";
pub const CONSENSUS_CONTRACT_COIN_MERKLE_TREE: &str = "consensus_coin_tree";
pub const CONSENSUS_CONTRACT_ZKAS_MINT_NS_V1: &str = "ConsensusMint_V1";
pub const CONSENSUS_CONTRACT_ZKAS_BURN_NS_V1: &str = "ConsensusBurn_V1";
pub const CONSENSUS_CONTRACT_ZKAS_PROPOSAL_NS_V1: &str = "ConsensusProposal_V1";