Skip to content

Commit

Permalink
fix: add 10% to gas price
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed Feb 9, 2024
1 parent 2768f5e commit 30df53e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ekoke/src/app/erc20_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use self::swap_pool::SwapPool;
use super::balance::Balance;
use super::configuration::Configuration;
use crate::app::memory::{ERC20_LOGS_START_BLOCK_MEMORY_ID, MEMORY_MANAGER};
use crate::constants::ERC20_SWAP_FEE_INTEREST;

thread_local! {
/// ERC20 logs start block
Expand Down Expand Up @@ -127,7 +128,9 @@ impl Erc20Bridge {
if !SwapFee::should_update_gas_price() {
return Ok(());
}
let gas_price = GasStation::fetch_gas_price().await?;
// fetch gas price and add 10%
let gas_price =
(GasStation::fetch_gas_price().await? as f64 * ERC20_SWAP_FEE_INTEREST) as u64;
// update price
Self::set_gas_price(gas_price)?;

Expand Down
2 changes: 2 additions & 0 deletions src/ekoke/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ pub const ERC20_SWAPPED_EVENT_FETCH_INTERVAL: Duration = Duration::from_secs(60
#[cfg(target_family = "wasm")]
pub const ERC20_EKOKE_SWAPPED_TOPIC: &str =
"0x73237ca1bbcb09a423f8b6dd74772a03e1ceeaefd48bad90b61d01644355eb28";

pub const ERC20_SWAP_FEE_INTEREST: f64 = 1.1; // 10%

0 comments on commit 30df53e

Please sign in to comment.