2021-05-19 07:31:47 -07:00
|
|
|
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))]
|
2021-02-16 13:48:20 -08:00
|
|
|
#![allow(clippy::integer_arithmetic)]
|
2021-06-15 09:04:00 -07:00
|
|
|
#[deprecated(
|
|
|
|
since = "1.8.0",
|
|
|
|
note = "Please use `solana_sdk::stake::program::id` or `solana_program::stake::program::id` instead"
|
|
|
|
)]
|
|
|
|
pub use solana_sdk::stake::program::{check_id, id};
|
2022-05-07 16:01:05 -07:00
|
|
|
use solana_sdk::{
|
|
|
|
feature_set::{self, FeatureSet},
|
|
|
|
genesis_config::GenesisConfig,
|
|
|
|
native_token::LAMPORTS_PER_SOL,
|
|
|
|
};
|
2021-06-15 09:04:00 -07:00
|
|
|
|
2019-08-15 14:35:48 -07:00
|
|
|
pub mod config;
|
2019-04-01 16:45:53 -07:00
|
|
|
pub mod stake_instruction;
|
|
|
|
pub mod stake_state;
|
|
|
|
|
2019-11-25 15:11:55 -08:00
|
|
|
pub fn add_genesis_accounts(genesis_config: &mut GenesisConfig) -> u64 {
|
|
|
|
config::add_genesis_account(genesis_config)
|
2019-08-15 14:35:48 -07:00
|
|
|
}
|
2022-04-01 22:11:10 -07:00
|
|
|
|
|
|
|
/// The minimum stake amount that can be delegated, in lamports.
|
|
|
|
/// NOTE: This is also used to calculate the minimum balance of a stake account, which is the
|
|
|
|
/// rent exempt reserve _plus_ the minimum stake delegation.
|
|
|
|
#[inline(always)]
|
2022-05-07 16:01:05 -07:00
|
|
|
pub fn get_minimum_delegation(feature_set: &FeatureSet) -> u64 {
|
|
|
|
if feature_set.is_active(&feature_set::stake_raise_minimum_delegation_to_1_sol::id()) {
|
|
|
|
const MINIMUM_DELEGATION_SOL: u64 = 1;
|
|
|
|
MINIMUM_DELEGATION_SOL * LAMPORTS_PER_SOL
|
|
|
|
} else {
|
|
|
|
#[allow(deprecated)]
|
|
|
|
solana_sdk::stake::MINIMUM_STAKE_DELEGATION
|
|
|
|
}
|
2022-04-01 22:11:10 -07:00
|
|
|
}
|