Skip to content

Commit

Permalink
feat: latest
Browse files Browse the repository at this point in the history
  • Loading branch information
ts0yu authored Sep 12, 2024
1 parent 6f82389 commit 071c181
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 26 deletions.
42 changes: 17 additions & 25 deletions src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl<V> Arena<V> {
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"),
Expand All @@ -76,7 +76,7 @@ impl<V> Arena<V> {
.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"),
Expand All @@ -87,16 +87,15 @@ impl<V> Arena<V> {

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
Expand Down Expand Up @@ -145,11 +144,14 @@ impl<V> Arena<V> {

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(),
)
Expand All @@ -160,13 +162,11 @@ impl<V> Arena<V> {
.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(),
)
Expand All @@ -177,13 +177,11 @@ impl<V> Arena<V> {
.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(),
)
Expand All @@ -194,13 +192,11 @@ impl<V> Arena<V> {
.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(),
)
Expand All @@ -211,8 +207,6 @@ impl<V> Arena<V> {
.await
.map_err(|e| ArenaError::PendingTransactionError(e))?;

println!("this 4");

strategy
.init(
self.providers[&(idx + 1)].clone(),
Expand All @@ -221,8 +215,6 @@ impl<V> Arena<V> {
engine.clone(),
)
.await;

println!("this 5");
}

self.arbitrageur.init(&signal, admin_provider.clone()).await;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down

0 comments on commit 071c181

Please sign in to comment.