Struct solana_program::rent::Rent
source · #[repr(C)]pub struct Rent {
pub lamports_per_byte_year: u64,
pub exemption_threshold: f64,
pub burn_percent: u8,
}
Fields§
§lamports_per_byte_year: u64
Rental rate
exemption_threshold: f64
exemption threshold, in years
burn_percent: u8
Implementations§
source§impl Rent
impl Rent
sourcepub fn calculate_burn(&self, rent_collected: u64) -> (u64, u64)
pub fn calculate_burn(&self, rent_collected: u64) -> (u64, u64)
calculate how much rent to burn from the collected rent
sourcepub fn minimum_balance(&self, data_len: usize) -> u64
pub fn minimum_balance(&self, data_len: usize) -> u64
minimum balance due for rent-exemption of a given size Account::data.len()
Note: a stripped-down version of this calculation is used in calculate_split_rent_exempt_reserve in the stake program. When this function is updated, – eg. when making rent variable – the stake program will need to be refactored
sourcepub fn is_exempt(&self, balance: u64, data_len: usize) -> bool
pub fn is_exempt(&self, balance: u64, data_len: usize) -> bool
whether a given balance and data_len would be exempt
sourcepub fn due(&self, balance: u64, data_len: usize, years_elapsed: f64) -> RentDue
pub fn due(&self, balance: u64, data_len: usize, years_elapsed: f64) -> RentDue
rent due on account’s data_len with balance
sourcepub fn due_amount(&self, data_len: usize, years_elapsed: f64) -> u64
pub fn due_amount(&self, data_len: usize, years_elapsed: f64) -> u64
rent due for account that is known to be not exempt
pub fn free() -> Self
pub fn with_slots_per_epoch(slots_per_epoch: u64) -> Self
Trait Implementations§
source§impl<'de> Deserialize<'de> for Rent
impl<'de> Deserialize<'de> for Rent
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<Rent> for Rent
impl PartialEq<Rent> for Rent
source§impl Sysvar for Rent
impl Sysvar for Rent
fn get() -> Result<Self, ProgramError>
fn size_of() -> usize
source§fn from_account_info(
account_info: &AccountInfo<'_>
) -> Result<Self, ProgramError>
fn from_account_info( account_info: &AccountInfo<'_> ) -> Result<Self, ProgramError>
Deserializes a sysvar from its
AccountInfo
. Read more