Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion contracts/async-vault/src/deposit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use bindings::ShareClient;
use soroban_sdk::{panic_with_error, token::TokenClient, Address, Env};

use crate::epoch;
use crate::error::VaultError;
use crate::event::{DepositCancelled, DepositClaimed, DepositRequested};
use crate::keys::DataKey;
Expand Down Expand Up @@ -140,7 +141,7 @@ pub(crate) fn cancel(e: &Env, from: &Address, epoch_id: u64) -> i128 {
// sealed epoch, the price is knowable and the only way out is to take it.
// Fulfilment is closed during a wind-down, so this epoch will never take a
// price. There is nothing to decline.
if !wind_down::is_active(e) && crate::epoch::is_priceable(e, &epoch) {
if !wind_down::is_active(e) && epoch::is_priceable(e, &epoch) {
panic_with_error!(e, VaultError::PriceAvailable);
}

Expand Down
6 changes: 4 additions & 2 deletions contracts/async-vault/src/redeem.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use bindings::ShareClient;
use soroban_sdk::{panic_with_error, token::TokenClient, Address, Env};

use crate::epoch;
use crate::error::VaultError;
use crate::event::{RedeemCancelled, RedeemClaimed, RedeemRequested};
use crate::keys::DataKey;
use crate::pricing::{Pricing, PricingScheme};
use crate::state::{self, EpochStatus, RedeemRequest};
use crate::treasury;
use crate::wind_down;

pub(crate) fn request(e: &Env, from: &Address, shares: i128) -> u64 {
Expand Down Expand Up @@ -87,7 +89,7 @@ pub(crate) fn claim(e: &Env, caller: &Address, epoch_id: u64) -> i128 {

// Against liquid reserve, not the raw balance: escrow a depositor can still
// cancel is not available to pay an exit.
if crate::treasury::liquid_reserve(e) < assets {
if treasury::liquid_reserve(e) < assets {
panic_with_error!(e, VaultError::ClaimNotCovered);
}

Expand Down Expand Up @@ -153,7 +155,7 @@ pub(crate) fn cancel(e: &Env, from: &Address, epoch_id: u64) -> i128 {
// sealed epoch, the price is knowable and the only way out is to take it.
// Fulfilment is closed during a wind-down, so this epoch will never take a
// price. There is nothing to decline.
if !wind_down::is_active(e) && crate::epoch::is_priceable(e, &epoch) {
if !wind_down::is_active(e) && epoch::is_priceable(e, &epoch) {
panic_with_error!(e, VaultError::PriceAvailable);
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/async-vault/src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub(crate) fn distinct_roles(e: &Env) -> VaultRoles {
/// type and the vault's variant converts into it.
pub(crate) fn refused<T: core::fmt::Debug + PartialEq, E: core::fmt::Debug + PartialEq>(
result: Result<Result<T, E>, Result<soroban_sdk::Error, soroban_sdk::InvokeError>>,
expected: crate::VaultError,
expected: VaultError,
) {
assert_eq!(result, Err(Ok(expected.into())));
}
Expand Down
Loading