From 071c181697f2fe6629e370e9b4b30f2c7a89dbf3 Mon Sep 17 00:00:00 2001 From: ts0yu <120932697+ts0yu@users.noreply.github.com> Date: Thu, 12 Sep 2024 16:42:25 +0000 Subject: [PATCH] feat: latest --- src/arena.rs | 42 +++++++++++++++++------------------------- src/lib.rs | 2 +- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/arena.rs b/src/arena.rs index 322cd9b..b240552 100644 --- a/src/arena.rs +++ b/src/arena.rs @@ -67,7 +67,7 @@ impl Arena { liquidity_manager: *lp_manager.address(), }; - let currency_0 = ArenaToken::deploy( + let c_0 = ArenaToken::deploy( admin_provider.clone(), String::from("Currency 0"), String::from("C0"), @@ -76,7 +76,7 @@ impl Arena { .await .map_err(ArenaError::ContractError)?; - let currency_1 = ArenaToken::deploy( + let c_1 = ArenaToken::deploy( admin_provider.clone(), String::from("Currency 1"), String::from("C1"), @@ -87,16 +87,15 @@ impl Arena { let liquid_exchange = LiquidExchange::deploy( admin_provider.clone(), - *currency_0.address(), - *currency_1.address(), + *c_0.address(), + *c_1.address(), U256::from(1), ) .await .map_err(ArenaError::ContractError)?; - if *currency_1.address() > *currency_0.address() { - (self.pool.currency0, self.pool.currency1) = - (*currency_0.address(), *currency_1.address()); + if *c_1.address() > *c_0.address() { + (self.pool.currency0, self.pool.currency1) = (*c_0.address(), *c_1.address()); } pool_manager @@ -145,11 +144,14 @@ impl Arena { let strategy_provider = self.providers[&(idx + 1)].clone(); + let currency_0 = ArenaToken::new(*c_0.address(), strategy_provider.clone()); + let currency_1 = ArenaToken::new(*c_1.address(), strategy_provider.clone()); + currency_0 .mint(strategy_provider.default_signer_address(), U256::MAX) .nonce( - admin_provider - .get_transaction_count(admin_provider.default_signer_address()) + strategy_provider + .get_transaction_count(strategy_provider.default_signer_address()) .await .unwrap(), ) @@ -160,13 +162,11 @@ impl Arena { .await .map_err(|e| ArenaError::PendingTransactionError(e))?; - println!("this 1"); - currency_1 .mint(strategy_provider.default_signer_address(), U256::MAX) .nonce( - admin_provider - .get_transaction_count(admin_provider.default_signer_address()) + strategy_provider + .get_transaction_count(strategy_provider.default_signer_address()) .await .unwrap(), ) @@ -177,13 +177,11 @@ impl Arena { .await .map_err(|e| ArenaError::PendingTransactionError(e))?; - println!("this 2"); - currency_0 .approve(*lp_manager.address(), U256::MAX) .nonce( - admin_provider - .get_transaction_count(admin_provider.default_signer_address()) + strategy_provider + .get_transaction_count(strategy_provider.default_signer_address()) .await .unwrap(), ) @@ -194,13 +192,11 @@ impl Arena { .await .map_err(|e| ArenaError::PendingTransactionError(e))?; - println!("this 3"); - currency_1 .approve(*lp_manager.address(), U256::MAX) .nonce( - admin_provider - .get_transaction_count(admin_provider.default_signer_address()) + strategy_provider + .get_transaction_count(strategy_provider.default_signer_address()) .await .unwrap(), ) @@ -211,8 +207,6 @@ impl Arena { .await .map_err(|e| ArenaError::PendingTransactionError(e))?; - println!("this 4"); - strategy .init( self.providers[&(idx + 1)].clone(), @@ -221,8 +215,6 @@ impl Arena { engine.clone(), ) .await; - - println!("this 5"); } self.arbitrageur.init(&signal, admin_provider.clone()).await; diff --git a/src/lib.rs b/src/lib.rs index 7d76715..54163ea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -271,7 +271,7 @@ mod tests { let params = ModifyLiquidityParams { tickLower: Signed::try_from(-20).unwrap(), tickUpper: Signed::try_from(20).unwrap(), - liquidityDelta: Signed::try_from(100000000000_u128).unwrap(), + liquidityDelta: Signed::try_from(1000000_u128).unwrap(), salt: FixedBytes::ZERO, };