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
2 changes: 2 additions & 0 deletions tee-worker/omni-executor/rpc-server/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::result_large_err)]

mod auth_token_key_store;
mod auth_utils;
mod config;
Expand Down
24 changes: 23 additions & 1 deletion tee-worker/omni-executor/rpc-server/src/methods/omni/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ pub struct PumpxRpcError {
pub struct PumpxRpcErrorData {
#[serde(skip_serializing_if = "Option::is_none")]
pub backend_response: Option<PumpxRpcErrorBackendResponse>,
#[serde(skip_serializing_if = "Option::is_none")]
pub field: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub expected: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub received: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub suggestion: Option<String>,
}

#[derive(Serialize, Debug)]
Expand Down Expand Up @@ -50,6 +60,11 @@ impl PumpxRpcError {
code: api_response.code as i32,
message: api_response.message,
}),
field: None,
expected: None,
received: None,
reason: None,
suggestion: None,
}),
}
}
Expand All @@ -66,7 +81,14 @@ impl From<DetailedError> for PumpxRpcError {
Self {
code: error.code,
message: error.message,
data: Some(PumpxRpcErrorData { backend_response: None }),
data: Some(PumpxRpcErrorData {
backend_response: None,
field: error.details.field,
expected: error.details.expected,
received: error.details.received,
reason: error.details.reason,
suggestion: error.details.suggestion,
}),
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,6 @@ async fn handle_payback_loan_impl<
initial_margin.min(withdrawable_usdc)
};

info!("Transferring {} USDC from perp to spot", transfer_amount);

// Get initial spot balance BEFORE submitting the transfer
let initial_spot_usdc = hypercore_client
.get_spot_balance(smart_wallet_address_str, "USDC")
Expand Down Expand Up @@ -496,7 +494,10 @@ async fn handle_payback_loan_impl<
)
.await?;

info!("Action 2: USD transfer submitted with tx_hash: {:?}", usd_transfer_tx_hash);
info!(
"Action 2: USD transfer submitted, size: {}, tx_hash: {:?}",
transfer_amount, usd_transfer_tx_hash
);
current_nonce += 1;

hypercore_client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ async fn handle_request_loan_impl<
encode_send_raw_action(usd_transfer_action),
);

let _usd_transfer_tx_hash = submit_corewriter_userop(
let usd_transfer_tx_hash = submit_corewriter_userop(
ctx.clone(),
&omni_account,
&prepare_skeleton_with_nonce(&skeleton_user_op, current_nonce),
Expand All @@ -392,7 +392,10 @@ async fn handle_request_loan_impl<
)
.await?;

info!("Action 2: USD class transfer submitted");
info!(
"Action 2: USD class transfer submitted, size: {}, tx_hash: {:?}",
usdc_for_perp, usd_transfer_tx_hash
);

// Wait for USD transfer to complete
let _actual_perp_balance = hypercore_client
Expand Down Expand Up @@ -439,8 +442,8 @@ async fn handle_request_loan_impl<
let hedge_size = (usdc_for_perp * effective_leverage) / target_hedge_price;

info!(
"Perp hedge open pricing - markPx: {}, midPx: {}, ask (lowest sell): {}, target (with {}x buffer): {}",
perp_mark_price, perp_mid_price, perp_ask_price, PERP_ENTRY_PRICE_RATIO, target_hedge_price
"Perp hedge open pricing - markPx: {}, midPx: {}, ask (lowest sell): {}, target (with {}x buffer): {}, hedge_size: {}",
perp_mark_price, perp_mid_price, perp_ask_price, PERP_ENTRY_PRICE_RATIO, target_hedge_price, hedge_size
);

let clamped_hedge_size = clamp_size(hedge_size, validation_result.perp_sz_decimals);
Expand Down