From e3984d2ed66fc0a45a67dbbf88d386b2b243c945 Mon Sep 17 00:00:00 2001 From: silentgeckoaudit3801 Date: Tue, 28 Jul 2026 21:21:52 -0600 Subject: [PATCH] Document release_funds preconditions and errors --- src/lib.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 9893393..7bbe254 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -254,6 +254,22 @@ impl DisciplrVault { // ----------------------------------------------------------------------- /// Release vault funds to `success_destination`. + /// + /// The vault creator must authorize this call. Release is allowed only while + /// the vault is active and either the milestone has already been validated + /// or the current ledger timestamp has reached/passed `end_timestamp`. + /// + /// # Preconditions + /// - `vault_id` must identify an existing vault. + /// - The vault must still be `VaultStatus::Active`. + /// - The caller must be the vault creator. + /// - Either `milestone_validated` is true or the deadline has been reached. + /// + /// # Errors + /// - Returns `Error::VaultNotFound` when the vault id is unknown. + /// - Returns `Error::VaultNotActive` for terminal vault states. + /// - Returns `Error::NotAuthorized` before validation and before the deadline. + /// - Soroban authorization fails if the creator does not authorize the call. pub fn release_funds(env: Env, vault_id: u32, usdc_token: Address) -> Result { let vault_key = DataKey::Vault(vault_id); let mut vault: ProductivityVault = env