Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(CA): using the gas estimation from the gas field #923

Merged
merged 1 commit into from
Jan 30, 2025
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: 1 addition & 1 deletion src/handlers/chain_agnostic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ pub async fn get_assets_changes_from_simulation(
metrics,
)
.await?;
let gas_used = simulation_result.transaction.gas_used;
let gas_used = simulation_result.transaction.gas;

if simulation_result
.transaction
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/chain_agnostic/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use {
};

// Slippage for the gas estimation
const ESTIMATED_GAS_SLIPPAGE: i16 = 500; // x5 slippage to cover the volatility
const ESTIMATED_GAS_SLIPPAGE: i16 = 500; // Temporarily x5 slippage to cover the volatility

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -456,7 +456,7 @@ async fn handler_internal(
}

routes[index].gas_limit = U64::from(
(simulation_result.transaction.gas_used * (100 + ESTIMATED_GAS_SLIPPAGE as u64)) / 100,
(simulation_result.transaction.gas * (100 + ESTIMATED_GAS_SLIPPAGE as u64)) / 100,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/providers/tenderly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub struct BundledSimulationResponse {
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct ResponseTransaction {
pub hash: String,
pub gas_used: u64,
pub gas: u64,
pub transaction_info: ResponseTransactionInfo,
pub status: bool, // Was simulating transaction successful
pub nonce: u64,
Expand Down
Loading