Skip to content

Commit 79c53e5

Browse files
committed
fix - make new_empty method sync
1 parent ea25b9d commit 79c53e5

5 files changed

Lines changed: 25 additions & 2 deletions

File tree

src/amm/slipstream/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ impl AerodromeCLPool {
653653
}
654654
}
655655

656-
pub async fn new_empty(address: Address, chain: NamedChain) -> Result<Self, AMMError> {
656+
pub fn new_empty(address: Address, chain: NamedChain) -> Result<Self, AMMError> {
657657
let pool = AerodromeCLPool {
658658
address,
659659
factory: Address::ZERO,

src/amm/uniswap_v2/batch_request.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ mod tests {
158158
use std::str::FromStr;
159159
use types::exchange::ExchangeName;
160160

161+
#[allow(unused_variables)]
161162
const POOL_WITH_LARGE_RESERVES: &str = "0x8ff6c0958199a79ac0a619a88ceb6c0c96f16f89";
162163
const WETH_USDC: &str = "0x3548029694fbb241d45fb24ba0cd9c9d4e745f16";
163164

src/amm/uniswap_v2/mod.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,26 @@ impl UniswapV2Pool {
329329
}
330330
}
331331

332+
pub fn new_empty(address: Address, chain: NamedChain) -> Result<Self, AMMError> {
333+
let pool = UniswapV2Pool {
334+
address,
335+
token_a: Address::ZERO,
336+
token_a_decimals: 0,
337+
token_a_symbol: String::new(),
338+
token_b: Address::ZERO,
339+
token_b_decimals: 0,
340+
token_b_symbol: String::new(),
341+
reserve_0: 0,
342+
reserve_1: 0,
343+
fee: 0,
344+
factory: Address::ZERO,
345+
exchange_name: ExchangeName::Unknown,
346+
exchange_type: ExchangeType::Unknown,
347+
chain,
348+
};
349+
Ok(pool)
350+
}
351+
332352
/// Creates a new instance of the pool from the pair address, and syncs the pool data.
333353
pub async fn new_from_address<N, P>(
334354
pair_address: Address,

src/amm/uniswap_v3/batch_request/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ where
195195
Ok((all_tick_data, U256::from(bn)))
196196
}
197197

198+
// TODO: This function is confusing and not very useful since it only syncs the
199+
// tick and liquidity (and not the entire data). Remove or rename this function
198200
pub async fn sync_v3_pool_batch_request<N, P>(
199201
pool: &mut UniswapV3Pool,
200202
provider: Arc<P>,

src/amm/uniswap_v3/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ impl UniswapV3Pool {
654654
}
655655
}
656656

657-
pub async fn new_empty(address: Address, chain: NamedChain) -> Result<Self, AMMError> {
657+
pub fn new_empty(address: Address, chain: NamedChain) -> Result<Self, AMMError> {
658658
let pool = UniswapV3Pool {
659659
address,
660660
factory: Address::ZERO,

0 commit comments

Comments
 (0)