stable_bridge_package/
db_types.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5// TokenMessengerRecord
6#[allow(non_snake_case)]
7#[derive(Debug, Deserialize, Serialize, Clone, Default)]
8pub struct TokenRecord {
9    // {chain_id}--{token_address}
10    pub _id: String,
11    pub address: String,
12    pub chain_id: String,
13    pub name: String,
14    pub symbol: String,
15    pub decimals: u64,
16}
17
18#[allow(non_snake_case)]
19#[derive(Debug, Deserialize, Serialize, Clone, Default)]
20pub struct ChainInfoRecord {
21    // uuid
22    pub _id: String,
23    pub chain_id: String,
24    pub token_manager: String,
25    pub token_messenger: String,
26    pub chain_domain_id: u32,
27    pub chain_type: String,
28    pub validators: Vec<String>,
29    pub version: u64,
30    pub is_active: bool,
31}
32
33#[allow(non_snake_case)]
34#[derive(Debug, Deserialize, Serialize, Clone, Default)]
35pub struct TokenMessengerRecord {
36    // {chain_id}--{token_messenger / address}--{validator}
37    pub _id: String,
38    pub address: String,
39    pub validator: String,
40    pub chain_id: String,
41    pub last_observed_nonce: u64,
42    pub last_observed_block: String,
43    pub last_confirmed_nonce: u64,
44    pub last_confirmed_block: String,
45    pub rpc: String,
46    pub query_range: String,
47    pub blocks_confirmation: String,
48    pub is_active: bool,
49}
50
51#[allow(non_snake_case)]
52#[derive(Debug, Deserialize, Serialize, Clone, Default)]
53pub struct DepositRecord {
54    // {chain_domain_id}* 1000_000_000 + nonce
55    pub _id: u64,
56
57    pub src_chain_id: String,
58    pub src_chain_domain_id: u32,
59    pub dest_chain_id: String,
60    pub dest_chain_domain_id: u32,
61    pub src_txn_hash: String,
62    pub block_number: String,
63
64    pub src_contract: String,
65    pub dest_contract: String,
66    pub src_token: String,
67    pub dest_token: String,
68
69    pub depositor: String,
70    pub recipient: String,
71    pub event_nonce: u64,
72    pub src_amount: String,
73    pub dest_amount: String,
74    pub partner_id: String,
75
76    pub version: u64,
77    pub is_executed: bool,
78    pub dest_txn_hash: String,
79    pub relay_record_id: u64,
80    pub attestation_expiry: u64,
81
82    pub message_hash: String,
83    pub attestations: HashMap<String, String>,
84
85    pub created_at: u64,
86    pub updated_at: u64,
87}
88
89#[allow(non_snake_case)]
90#[derive(Debug, Deserialize, Serialize, Clone, Default)]
91pub struct RelayRecord {
92    // {chain_domain_id}* 1000_000_000 + nonce
93    pub _id: u64,
94
95    pub chain_id: String,
96    pub chain_domain_id: u32,
97    pub relay_nonce: u64,
98    pub deposit_record_id: u64,
99    pub txn_hash: String,
100    pub block_number: String,
101    pub dest_contract: String,
102    pub executor: String,
103    pub recipient: String,
104    pub amount: String,
105    pub created_at: u64,
106    pub updated_at: u64,
107}
108
109#[allow(non_snake_case)]
110#[derive(Debug, Deserialize, Serialize, Clone, Default)]
111pub struct ReattestRecord {
112    // deposit_record_ids
113    pub _id: u64,
114    pub src_chain_domain_id: u32,
115    pub event_nonce: u64,
116    pub created_at: u64,
117}
118
119#[allow(non_snake_case)]
120#[derive(Debug, Deserialize, Serialize, Clone, Default)]
121pub struct AMLRecords {
122    // bytes32 format of address
123    pub _id: String,
124
125    pub wallet_address: String,
126    pub is_blacklisted: bool,
127    pub blacklist_reason: String,
128    pub source: String,
129    pub remarks: String,
130    pub created_at: u64,
131    pub updated_at: u64,
132}
133
134#[allow(non_snake_case)]
135#[derive(Debug, Deserialize, Serialize, Clone, Default)]
136pub struct SolanaAtaRecords {
137    // bytes32 format of address
138    pub _id: String,
139
140    pub mint_pubkey: String,
141    pub user_pubkey: String,
142    pub spl_2022_pubkey: String,
143    pub created_at: u64,
144    pub updated_at: u64,
145}