-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from propeller-heads/zz/uniswap_v4/implement-…
…swap feat(uniswap_v4): Implement `swap()` for `UniswapV4State`
- Loading branch information
Showing
8 changed files
with
282 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
//! Uniswap V3 Decentralized Exchange | ||
pub mod enums; | ||
mod liquidity_math; | ||
mod solidity_math; | ||
mod sqrt_price_math; | ||
pub mod state; | ||
mod swap_math; | ||
pub mod tycho_decoder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...evm/protocol/uniswap_v3/liquidity_math.rs → .../protocol/utils/uniswap/liquidity_math.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,37 @@ | ||
use alloy_primitives::{I256, U256}; | ||
|
||
pub(crate) mod liquidity_math; | ||
mod solidity_math; | ||
pub(crate) mod sqrt_price_math; | ||
pub(crate) mod swap_math; | ||
pub(crate) mod tick_list; | ||
pub(crate) mod tick_math; | ||
|
||
#[derive(Debug)] | ||
pub(crate) struct SwapState { | ||
pub(crate) amount_remaining: I256, | ||
pub(crate) amount_calculated: I256, | ||
pub(crate) sqrt_price: U256, | ||
pub(crate) tick: i32, | ||
pub(crate) liquidity: u128, | ||
} | ||
|
||
#[derive(Debug)] | ||
pub(crate) struct StepComputation { | ||
pub(crate) sqrt_price_start: U256, | ||
pub(crate) tick_next: i32, | ||
pub(crate) initialized: bool, | ||
pub(crate) sqrt_price_next: U256, | ||
pub(crate) amount_in: U256, | ||
pub(crate) amount_out: U256, | ||
pub(crate) fee_amount: U256, | ||
} | ||
|
||
#[derive(Debug)] | ||
pub(crate) struct SwapResults { | ||
pub(crate) amount_calculated: I256, | ||
pub(crate) sqrt_price: U256, | ||
pub(crate) liquidity: u128, | ||
pub(crate) tick: i32, | ||
pub(crate) gas_used: U256, | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.