stable_bridge_package/
solana_types.rs

1use borsh::{BorshDeserialize, BorshSerialize};
2use solana_program::pubkey::Pubkey;
3
4#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
5pub struct MessageEmitted {
6    pub local_domain: u32,
7    pub remote_domain: u32,
8    pub amount: u64,
9    pub dest_amount: u64,
10    pub event_nonce: u64,
11    pub depositer: Pubkey,
12    pub recipient: String,
13}
14
15#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
16pub struct MessageReceived {
17    pub deposit_record_id: u64,
18    pub event_nonce: u64,
19    pub recipient: String,
20    pub amount: u64,
21}
22
23#[repr(C)]
24#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
25pub struct DepositCrossChainInputs {
26    pub remote_domain: u32,
27    pub recipient: String,
28    pub amount: u64,
29}
30
31#[repr(C)]
32#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
33pub struct RelayMessageInputs {
34    pub src_domain: u32,
35    pub amount: u64,
36    pub nonce: u64,
37    pub timestamp: u64,
38    pub recipient: String,
39    pub signatures: Vec<String>,
40}
41
42#[repr(C)]
43#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
44pub struct WithdrawFunds {
45    pub amount: u64,
46    pub token_address: Pubkey,
47    pub recipient: Pubkey,
48    pub decimals: u8,
49}
50
51#[repr(C)]
52#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
53pub struct RemoteNonceState {
54    pub remote_domain: u32,
55    pub used_nonces: [u8; 100],
56}
57
58impl RemoteNonceState {
59    pub const LEN: usize = 104;
60}
61
62#[repr(C)]
63#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
64pub struct ContractState {
65    pub is_initialized: bool,
66    pub local_domain: u32,
67    pub token_address: Pubkey,
68    pub token_manager: Pubkey,
69    pub admin_address: Pubkey,
70    pub event_nonce: u64,
71    pub transfer_fees: [u8; 100],
72    pub trusted_attestor_len: u8,
73    pub trusted_attestor: Vec<String>,
74}
75
76impl ContractState {
77    pub const LEN: usize = 1 + 4 + 32 + 32 + 32 + 8 + 100 + 1 + 20 * 32;
78}