Skip to content

Commit

Permalink
Increase bump amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
sisuresh committed Jul 10, 2023
1 parent 19a6fb1 commit 4b7a6d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions soroban-env-host/src/native_contract/token/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use soroban_env_common::xdr::{
};
use soroban_env_common::{Env, StorageType, TryIntoVal};

use super::storage_types::{BalanceValue, BUMP_AMOUNT};
use super::storage_types::{BalanceValue, BALANCE_BUMP_AMOUNT};

/// This module handles all balance and authorization related logic for both
/// Accounts and non-Accounts. For Accounts, a trustline is expected (unless this
Expand All @@ -37,7 +37,7 @@ pub fn read_balance(e: &Host, addr: Address) -> Result<i128, HostError> {
e.bump_contract_data(
key.try_into_val(e)?,
StorageType::Persistent,
BUMP_AMOUNT.into(),
BALANCE_BUMP_AMOUNT.into(),
)?;
let balance: BalanceValue = raw_balance.try_into_val(e)?;
Ok(balance.amount)
Expand Down Expand Up @@ -68,7 +68,7 @@ fn write_balance(e: &Host, addr: Address, balance: BalanceValue) -> Result<(), H
e.bump_contract_data(
key.try_into_val(e)?,
StorageType::Persistent,
BUMP_AMOUNT.into(),
BALANCE_BUMP_AMOUNT.into(),
)?;
Ok(())
}
Expand Down
3 changes: 2 additions & 1 deletion soroban-env-host/src/native_contract/token/storage_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use crate::native_contract::base_types::Address;
use soroban_env_common::TryIntoVal;
use soroban_native_sdk_macros::contracttype;

pub(crate) const BUMP_AMOUNT: u32 = 1000;
pub(crate) const INSTANCE_BUMP_AMOUNT: u32 = 34560; // 2 hours
pub(crate) const BALANCE_BUMP_AMOUNT: u32 = 518400; // 30 days

#[contracttype]
pub struct AllowanceDataKey {
Expand Down

0 comments on commit 4b7a6d1

Please sign in to comment.