Skip to content
Closed
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
16 changes: 16 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool, Error> {
let vault_key = DataKey::Vault(vault_id);
let mut vault: ProductivityVault = env
Expand Down
Loading