diff --git a/src/lib.rs b/src/lib.rs index dd1bfa1..1cd4446 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,14 @@ //! # uniswap-lens //! //! A library for querying Uniswap V3 using ephemeral lens contracts. + #![cfg_attr(not(any(feature = "std", test)), no_std)] #![warn( missing_copy_implementations, missing_debug_implementations, unreachable_pub, clippy::missing_const_for_fn, + clippy::missing_inline_in_public_items, clippy::redundant_clone, rustdoc::all )] @@ -15,11 +17,7 @@ extern crate alloc; -#[allow( - missing_copy_implementations, - missing_debug_implementations, - clippy::missing_const_for_fn -)] +#[allow(warnings)] pub mod bindings; pub mod caller; pub mod pool_lens; diff --git a/src/pool_lens.rs b/src/pool_lens.rs index cfb4797..b1b10e7 100644 --- a/src/pool_lens.rs +++ b/src/pool_lens.rs @@ -47,6 +47,7 @@ use anyhow::Result; /// ## Returns /// /// A vector of populated ticks within the range +#[inline] pub async fn get_populated_ticks_in_range( pool: Address, tick_lower: I24, @@ -97,6 +98,7 @@ macro_rules! get_pool_storage { /// ## Returns /// /// A vector of slots containing the storage data +#[inline] pub async fn get_static_slots( pool: Address, provider: P, @@ -125,6 +127,7 @@ where /// ## Returns /// /// A vector of slots containing the storage data +#[inline] pub async fn get_ticks_slots( pool: Address, tick_lower: I24, @@ -152,6 +155,7 @@ where /// ## Returns /// /// A vector of slots containing the storage data +#[inline] pub async fn get_tick_bitmap_slots( pool: Address, provider: P, @@ -178,6 +182,7 @@ where /// ## Returns /// /// A vector of slots containing the storage data +#[inline] pub async fn get_positions_slots( pool: Address, positions: Vec, diff --git a/src/position_lens.rs b/src/position_lens.rs index d90d745..64903c8 100644 --- a/src/position_lens.rs +++ b/src/position_lens.rs @@ -48,6 +48,7 @@ use anyhow::Result; /// ## Returns /// /// The position details +#[inline] pub async fn get_position_details( npm: Address, token_id: U256, @@ -77,6 +78,7 @@ where /// ## Returns /// /// The array of position details +#[inline] pub async fn get_positions( npm: Address, token_ids: Vec, @@ -106,6 +108,7 @@ where /// ## Returns /// /// The array of position details +#[inline] pub async fn get_all_positions_by_owner( npm: Address, owner: Address, @@ -274,7 +277,7 @@ mod tests { let provider = PROVIDER.clone(); let _positions = get_positions( NPM_ADDRESS, - (1u64..100) + (1_u64..100) .map(|i| U256::from_limbs([i, 0, 0, 0])) .collect(), provider.clone(), diff --git a/src/storage_lens.rs b/src/storage_lens.rs index dd39bfe..820e8db 100644 --- a/src/storage_lens.rs +++ b/src/storage_lens.rs @@ -9,7 +9,7 @@ use crate::bindings::ephemeralstoragelens::{ use alloc::vec::Vec; use alloy::{ eips::BlockId, - primitives::{Address, FixedBytes}, + primitives::{Address, B256}, providers::Provider, rpc::types::state::{AccountOverride, StateOverride}, transports::Transport, @@ -26,13 +26,16 @@ use anyhow::Result; /// * `provider`: The alloy provider /// * `block_id`: Optional block id to query /// -/// returns: Result, ContractError> +/// ## Returns +/// +/// The storage values at the given slots +#[inline] pub async fn get_storage_at( address: Address, - slots: Vec>, + slots: Vec, provider: P, block_id: Option, -) -> Result>> +) -> Result> where T: Transport + Clone, P: Provider, @@ -71,7 +74,7 @@ mod tests { let slots = get_storage_at( POOL_ADDRESS, (0..10) - .map(|i| FixedBytes::from(U256::from_limbs([i, 0, 0, 0]))) + .map(|i| B256::from(U256::from_limbs([i, 0, 0, 0]))) .collect(), provider.clone(), Some(BLOCK_NUMBER),