Skip to content
Merged
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
10 changes: 8 additions & 2 deletions COMEBACKHERE-contracts/contracts/treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ impl TreasuryContract {
/// * `e` - Soroban environment handle.
/// * `admin` - Admin address (must authenticate).
/// * `token` - Token being withdrawn; used to look up the daily cap.
/// * `_to` - Target recipient address.
/// * `to` - Target recipient address that receives the withdrawn funds.
/// * `amount` - Amount to withdraw.
///
/// # Errors
Expand All @@ -1139,7 +1139,7 @@ impl TreasuryContract {
e: Env,
admin: Address,
token: Address,
_to: Address,
to: Address,
amount: u64,
) -> Result<(), TreasuryError> {
check_not_paused(&e)?;
Expand Down Expand Up @@ -1181,6 +1181,12 @@ impl TreasuryContract {
);
}

token::Client::new(&e, &token).transfer(
&e.current_contract_address(),
&to,
&(amount as i128),
);

Ok(())
}

Expand Down
12 changes: 12 additions & 0 deletions backend/src/soroban.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,18 @@ impl SorobanClient {
}

let result = resp.result.ok_or_else(|| anyhow!("Empty RPC result"))?;

// `simulateTransaction` reports simulation-level failures (e.g. the
// transaction's ledger footprint has expired) inside `result.error`,
// not as a top-level JSON-RPC error, so `resp.error` above never sees
// them. Surface that message directly instead of silently falling
// through to `parse_invoice_result`, which would otherwise read a
// missing "map" field as an all-defaulted invoice.
if let Some(sim_error) = result.get("error").and_then(|e| e.as_str()) {
tracing::warn!(error = sim_error, "simulateTransaction reported a simulation error");
return Err(anyhow!("simulation failed: {sim_error}"));
}

let invoice = parse_invoice_result(&result, invoice_id)?;

tracing::debug!(status = ?invoice.status, "get_invoice RPC call succeeded");
Expand Down