Skip to content

Commit

Permalink
feat: update lex price
Browse files Browse the repository at this point in the history
  • Loading branch information
ts0yu authored Sep 14, 2024
1 parent 4331dcb commit 8aa0987
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions contracts/utils/src/ArenaController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ contract ArenaController {

lex = new LiquidExchange(address(currency0), address(currency1), initialPrice);

require(currency0.mint(address(this), type(uint256).max), "Minting currency0 to liquid exchange failed");
require(currency1.mint(address(this), type(uint256).max), "Minting currency1 to liquid exchange failed");
require(currency0.mint(address(this), 100000000000000), "Minting currency0 to liquid exchange failed");
require(currency1.mint(address(this), 100000000000000), "Minting currency1 to liquid exchange failed");
}

function constructSignal() public view returns (Signal memory) {
Expand Down
14 changes: 13 additions & 1 deletion src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ impl<V> Arena<V> {
signal.sqrtPriceX96,
);

controller
.setPrice(
alloy::primitives::utils::parse_ether(&self.feed.step().to_string())
.map_err(ArenaError::ConversionError)?,
)
.send()
.await
.map_err(ArenaError::ContractError)?
.watch()
.await
.map_err(|e| ArenaError::PendingTransactionError(e))?;

self.arbitrageur.init(&signal, admin_provider.clone()).await;

for step in 0..config.steps {
Expand Down Expand Up @@ -216,4 +228,4 @@ impl<V> ArenaBuilder<V> {
providers,
}
}
}
}
2 changes: 1 addition & 1 deletion src/artifacts/ArenaController.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,4 @@ mod tests {

arena.run(Config::new(Uint::from(5000), 5)).await.unwrap();
}
}
}

0 comments on commit 8aa0987

Please sign in to comment.