From 1a792df22686cc465c0c40abfdf794154f26ea45 Mon Sep 17 00:00:00 2001 From: hpmaxi <358059+hpmaxi@users.noreply.github.com> Date: Thu, 24 Sep 2026 12:54:47 -0300 Subject: [PATCH] refactor(vault): clean up inline crate imports --- contracts/async-vault/src/deposit.rs | 3 ++- contracts/async-vault/src/redeem.rs | 6 ++++-- contracts/async-vault/src/test/mod.rs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/contracts/async-vault/src/deposit.rs b/contracts/async-vault/src/deposit.rs index 14a2b3a..df332ff 100644 --- a/contracts/async-vault/src/deposit.rs +++ b/contracts/async-vault/src/deposit.rs @@ -2,6 +2,7 @@ use bindings::ShareClient; use soroban_sdk::{panic_with_error, token::TokenClient, Address, Env}; use stellar_contract_utils::math::{i128_fixed_point::checked_mul_div_floor, wad::WAD_SCALE}; +use crate::epoch; use crate::error::VaultError; use crate::event::{DepositCancelled, DepositClaimed, DepositRequested}; use crate::keys::DataKey; @@ -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); } diff --git a/contracts/async-vault/src/redeem.rs b/contracts/async-vault/src/redeem.rs index ceed31b..dd7b42d 100644 --- a/contracts/async-vault/src/redeem.rs +++ b/contracts/async-vault/src/redeem.rs @@ -2,10 +2,12 @@ use bindings::ShareClient; use soroban_sdk::{panic_with_error, token::TokenClient, Address, Env}; use stellar_contract_utils::math::{i128_fixed_point::checked_mul_div_floor, wad::WAD_SCALE}; +use crate::epoch; use crate::error::VaultError; use crate::event::{RedeemCancelled, RedeemClaimed, RedeemRequested}; use crate::keys::DataKey; use crate::state::{self, EpochStatus, RedeemRequest}; +use crate::treasury; use crate::wind_down; pub(crate) fn request(e: &Env, from: &Address, shares: i128) -> u64 { @@ -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); } @@ -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); } diff --git a/contracts/async-vault/src/test/mod.rs b/contracts/async-vault/src/test/mod.rs index d890a37..21f68ae 100644 --- a/contracts/async-vault/src/test/mod.rs +++ b/contracts/async-vault/src/test/mod.rs @@ -145,7 +145,7 @@ pub(crate) fn distinct_roles(e: &Env) -> VaultRoles { /// type and the vault's variant converts into it. pub(crate) fn refused( result: Result, Result>, - expected: crate::VaultError, + expected: VaultError, ) { assert_eq!(result, Err(Ok(expected.into()))); }