1use crate::data_contract::TokenContractPosition;
2use crate::prelude::{
3 DerivationEncryptionKeyIndex, RecipientKeyIndex, RootEncryptionKeyIndex, SenderKeyIndex,
4};
5use crate::util::hash::hash_double;
6
7pub mod allowed_currency;
8pub mod contract_info;
9pub mod emergency_action;
10pub mod errors;
11pub mod gas_fees_paid_by;
12pub mod info;
13pub mod status;
14pub mod token_amount_on_contract_token;
15pub mod token_event;
16pub mod token_payment_info;
17pub mod token_pricing_schedule;
18
19pub const MAX_TOKEN_NOTE_LEN: usize = 2048;
20pub type SharedEncryptedNote = (SenderKeyIndex, RecipientKeyIndex, Vec<u8>);
21pub type PrivateEncryptedNote = (
22 RootEncryptionKeyIndex,
23 DerivationEncryptionKeyIndex,
24 Vec<u8>,
25);
26
27pub fn calculate_token_id(contract_id: &[u8; 32], token_pos: TokenContractPosition) -> [u8; 32] {
28 let mut bytes = b"dash_token".to_vec();
29 bytes.extend_from_slice(contract_id);
30 bytes.extend_from_slice(&token_pos.to_be_bytes());
31 hash_double(bytes)
32}