1pub mod blind;
21pub use blind::{BaseBlind, Blind, ScalarBlind};
22
23pub mod constants;
25
26pub mod diffie_hellman;
28
29pub mod util;
31pub use util::poseidon_hash;
32
33pub mod keypair;
35pub use keypair::{Keypair, PublicKey, SecretKey};
36
37pub mod contract_id;
39pub use contract_id::{ContractId, DAO_CONTRACT_ID, DEPLOYOOOR_CONTRACT_ID, MONEY_CONTRACT_ID};
40
41pub mod func_ref;
43pub use func_ref::{FuncId, FuncRef};
44
45pub mod merkle_node;
47pub use merkle_node::{MerkleNode, MerkleTree};
48
49pub mod note;
51
52pub mod pedersen;
54pub use pedersen::{pedersen_commitment_base, pedersen_commitment_u64};
55
56pub mod schnorr;
58
59pub mod mimc_vdf;
61
62pub mod ecvrf;
64
65pub mod smt;
67
68pub mod pasta_prelude {
71 pub use pasta_curves::{
72 arithmetic::{CurveAffine, CurveExt},
73 group::{
74 ff::{Field, FromUniformBytes, PrimeField},
75 prime::PrimeCurveAffine,
76 Curve, Group,
77 },
78 };
79}
80
81#[macro_export]
82macro_rules! fp_from_bs58 {
83 ($ty:ident) => {
84 impl FromStr for $ty {
85 type Err = ContractError;
86
87 fn from_str(s: &str) -> Result<Self, Self::Err> {
88 let bytes = match bs58::decode(s).into_vec() {
89 Ok(v) => v,
90 Err(e) => return Err(ContractError::IoError(e.to_string())),
91 };
92
93 if bytes.len() != 32 {
94 return Err(ContractError::IoError(
95 "Length of decoded bytes is not 32".to_string(),
96 ))
97 }
98
99 Self::from_bytes(bytes.try_into().unwrap())
100 }
101 }
102 };
103}
104
105#[macro_export]
106macro_rules! fp_to_bs58 {
107 ($ty:ident) => {
108 impl std::fmt::Display for $ty {
109 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
110 write!(f, "{}", bs58::encode(self.to_bytes()).into_string())
111 }
112 }
113 };
114}
115
116#[macro_export]
117macro_rules! ty_from_fp {
118 ($ty:ident) => {
119 impl From<pallas::Base> for $ty {
120 fn from(x: pallas::Base) -> Self {
121 Self(x)
122 }
123 }
124 };
125}