1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
use solana_program::pubkey::Pubkey;
#[cfg(not(feature = "no-entrypoint"))]
pub mod entrypoint;
pub mod account_map;
pub mod accounts;
pub mod balance;
pub mod error;
pub mod instruction;
pub(crate) mod logic;
pub mod metrics;
pub(crate) mod process_management;
pub mod processor;
pub mod stake_account;
pub mod state;
pub mod token;
pub mod util;
mod vote_instruction;
mod vote_state;
pub const RESERVE_ACCOUNT: &[u8] = b"reserve_account";
pub const MINT_AUTHORITY: &[u8] = b"mint_authority";
pub const STAKE_AUTHORITY: &[u8] = b"stake_authority";
pub const VALIDATOR_STAKE_ACCOUNT: &[u8] = b"validator_stake_account";
pub const VALIDATOR_UNSTAKE_ACCOUNT: &[u8] = b"validator_unstake_account";
pub const REWARDS_WITHDRAW_AUTHORITY: &[u8] = b"rewards_withdraw_authority";
pub fn find_authority_program_address(
program_id: &Pubkey,
lido_address: &Pubkey,
authority: &[u8],
) -> (Pubkey, u8) {
Pubkey::find_program_address(&[&lido_address.to_bytes(), authority], program_id)
}
pub const MINIMUM_STAKE_ACCOUNT_BALANCE: token::Lamports = token::Lamports(1_000_000_000);
pub const MAXIMUM_UNSTAKE_ACCOUNTS: u64 = 3;
#[cfg(test)]
mod test {
use super::*;
#[test]
fn minimum_stake_account_balance_is_at_least_rent_exempt() {
use crate::token::Lamports;
use solana_program::rent::Rent;
use solana_program::stake::state::StakeState;
let rent = Rent::default();
let minimum_rent_exempt_balance =
Lamports(rent.minimum_balance(std::mem::size_of::<StakeState>()));
assert!(minimum_rent_exempt_balance > Lamports(0));
assert!(MINIMUM_STAKE_ACCOUNT_BALANCE > minimum_rent_exempt_balance);
}
}