Skip to content

Commit a230413

Browse files
committed
refactor - update to alloy 0.11.1 / use DynProvider
1 parent 6e05909 commit a230413

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/amm/uniswap_v2/batch_request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ mod tests {
167167
async fn test_get_amm_data_batch_request() {
168168
// Get RPC URL from environment variable, or use default
169169
dotenv::dotenv().ok();
170-
let provider = get_basic_provider(Chain::from_named(NamedChain::Base)).await;
170+
let provider = Arc::new(get_basic_provider(Chain::from_named(NamedChain::Base)).await);
171171

172172
// Create a test pool
173173
let pool_address = Address::from_str(WETH_USDC).expect("Invalid address");

src/amm/ve33/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -811,16 +811,16 @@ pub fn q64_to_f64(x: u128) -> f64 {
811811
#[cfg(test)]
812812
mod tests {
813813
use super::*;
814-
use provider::get_anvil_signer_provider;
814+
use provider::get_anvil_provider_arc;
815815
use std::str::FromStr;
816816

817817
#[tokio::test]
818818
async fn test_stable_swap_calculations() -> Result<(), AMMError> {
819819
// Setup
820-
let provider = get_anvil_signer_provider().await;
820+
let provider = get_anvil_provider_arc().await;
821821
let pool_address = Address::from_str("0x6d0b9C9E92a3De30081563c3657B5258b3fFa38B").unwrap();
822822

823-
let pool = Ve33Pool::new_from_address(pool_address, 10, Arc::new(provider.clone())).await?;
823+
let pool = Ve33Pool::new_from_address(pool_address, 10, provider).await?;
824824

825825
let amount_in_1 = U256::from(1000000000);
826826

@@ -854,12 +854,11 @@ mod tests {
854854
#[tokio::test]
855855
async fn test_volatile_swap_calculations() -> Result<(), AMMError> {
856856
// Setup
857-
let provider = get_anvil_signer_provider().await;
857+
let provider = get_anvil_provider_arc().await;
858858
// WETH/fBOMB pool
859859
let pool_address = Address::from_str("0x4f9dc2229f2357b27c22db56cb39582c854ad6d5").unwrap();
860860

861-
let pool =
862-
Ve33Pool::new_from_address(pool_address, 300, Arc::new(provider.clone())).await?;
861+
let pool = Ve33Pool::new_from_address(pool_address, 300, provider).await?;
863862

864863
let amount_in_0 = U256::from(1000000000); // WETH amount
865864
let amount_out_1 = pool

0 commit comments

Comments
 (0)