diff --git a/src/main.rs b/src/main.rs index dedf9397f..888acb7ae 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,13 +7,16 @@ use kakarot_rpc::{ constants::{KAKAROT_RPC_CONFIG, RPC_CONFIG}, eth_rpc::{rpc::KakarotRpcModuleBuilder, run_server}, pool::mempool::{maintain_transaction_pool, AccountManager}, - providers::eth_provider::database::Database, + providers::eth_provider::{ + database::Database, + starknet::kakarot_core::{core::KakarotCoreReader, KAKAROT_ADDRESS}, + }, }; use mongodb::options::{DatabaseOptions, ReadConcern, WriteConcern}; use opentelemetry_sdk::runtime::Tokio; use reth_transaction_pool::PoolConfig; use starknet::{ - core::types::Felt, + core::types::{BlockId, BlockTag, Felt}, providers::{jsonrpc::HttpTransport, JsonRpcClient}, }; use tracing_opentelemetry::MetricsLayer; @@ -46,9 +49,12 @@ async fn main() -> Result<()> { let starknet_provider = Arc::new(starknet_provider); // Get the pool config - // TODO call Kakarot.get_base_fee - let config = PoolConfig { minimal_protocol_basefee: 0, ..Default::default() }; + let contract_reader = KakarotCoreReader::new(*KAKAROT_ADDRESS, starknet_provider.clone()); + let base_fee = contract_reader.get_base_fee().block_id(BlockId::Tag(BlockTag::Pending)).call().await?.base_fee; + let base_fee = base_fee.try_into()?; + let config = PoolConfig { minimal_protocol_basefee: base_fee, ..Default::default() }; + // Init the Ethereum Client let eth_client = EthClient::new(starknet_provider, config, db.clone()); let eth_client = Arc::new(eth_client);