Move fn to sdk

This commit is contained in:
Tyera Eulberg
2021-02-16 10:26:02 -07:00
committed by Michael Vines
parent 817f2fe1ad
commit 8c66f4d6d7
2 changed files with 8 additions and 8 deletions

View File

@@ -13,7 +13,7 @@ use solana_sdk::{
account::Account,
account_utils::{State, StateMut},
clock::{Clock, Epoch, UnixTimestamp},
instruction::InstructionError,
instruction::{checked_add, InstructionError},
keyed_account::KeyedAccount,
pubkey::Pubkey,
rent::{Rent, ACCOUNT_STORAGE_OVERHEAD},
@@ -52,13 +52,6 @@ impl Default for StakeState {
}
}
fn checked_add(a: u64, b: u64) -> Result<u64, InstructionError> {
match a.checked_add(b) {
Some(sum) => Ok(sum),
None => Err(InstructionError::InsufficientFunds),
}
}
impl StakeState {
pub fn get_rent_exempt_reserve(rent: &Rent) -> u64 {
rent.minimum_balance(std::mem::size_of::<StakeState>())