Skip to content

Commit

Permalink
Update prelude and bump version to 0.6.0
Browse files Browse the repository at this point in the history
This commit removes unused imports across multiple files, updates various dependencies in Cargo.lock, and increments the package version to 0.6.0 in Cargo.toml. Some changes made to the prelude.rs, fraction.rs, and ether.rs files are also included.
  • Loading branch information
shuhuiluo committed Jan 1, 2024
1 parent 3ee2f82 commit df4f5d5
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 109 deletions.
124 changes: 29 additions & 95 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "uniswap-sdk-core-rust"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
authors = ["malik <[email protected]>", "Shuhui Luo <twitter.com/aureliano_law>"]
description = "The Uniswap SDK Core in Rust provides essential functionality for interacting with the Uniswap decentralized exchange"
Expand Down
1 change: 0 additions & 1 deletion src/entities/currency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ impl BaseCurrency for Currency {
#[cfg(test)]
mod tests {
use super::*;
use lazy_static::lazy_static;

const ADDRESS_ZERO: &str = "0x0000000000000000000000000000000000000000";
const ADDRESS_ONE: &str = "0x0000000000000000000000000000000000000001";
Expand Down
2 changes: 1 addition & 1 deletion src/entities/ether.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::prelude::*;

// Lazy static cache for Ether instances
lazy_static! {
static ref ETHER_CACHE: Mutex<HashMap<u32, Ether>> = Mutex::new(HashMap::new());
Expand Down Expand Up @@ -67,7 +68,6 @@ impl Ether {
#[cfg(test)]
mod tests {
use super::*;
use crate::entities::currency::Currency;

#[test]
fn test_static_constructor_uses_cache() {
Expand Down
4 changes: 0 additions & 4 deletions src/entities/fractions/currency_amount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ impl CurrencyAmount<Token> {
#[cfg(test)]
mod tests {
use super::*;
use crate::entities::{
currency::Currency, ether::Ether, fractions::percent::Percent, token::Token,
};
use lazy_static::lazy_static;

// Constants for testing
const ADDRESS_ONE: &str = "0x0000000000000000000000000000000000000001";
Expand Down
2 changes: 1 addition & 1 deletion src/entities/fractions/fraction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl Fraction {
}

// Function to convert the custom Rounding enum to `bigdecimal`'s `RoundingMode`
fn to_rounding_strategy(rounding: Rounding) -> RoundingMode {
const fn to_rounding_strategy(rounding: Rounding) -> RoundingMode {
match rounding {
Rounding::RoundDown => RoundingMode::Down,
Rounding::RoundHalfUp => RoundingMode::HalfUp,
Expand Down
1 change: 0 additions & 1 deletion src/entities/fractions/percent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ impl Percent {
#[cfg(test)]
mod tests {
use super::*;
use crate::constants::Rounding;

#[test]
fn test_add() {
Expand Down
2 changes: 0 additions & 2 deletions src/entities/fractions/price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ where
#[cfg(test)]
mod test {
use super::*;
use crate::entities::{currency::Currency, token::Token};
use lazy_static::lazy_static;

const ADDRESS_ZERO: &str = "0x0000000000000000000000000000000000000000";
const ADDRESS_ONE: &str = "0x0000000000000000000000000000000000000001";
Expand Down
6 changes: 4 additions & 2 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ pub use crate::{
constants::{Rounding, MAX_UINT256},
entities::{
base_currency::{BaseCurrency, CurrencyLike},
currency::CurrencyTrait,
currency::{Currency, CurrencyTrait},
ether::Ether,
fractions::{
currency_amount::CurrencyAmount,
fraction::{Fraction, FractionLike, FractionTrait},
percent::Percent,
price::Price,
},
token::Token,
weth9::WETH9,
},
};
pub use alloy_primitives::Address;
pub use alloy_primitives::{address, Address};
pub use bigdecimal::{BigDecimal, RoundingMode};
pub use lazy_static::lazy_static;
pub use num_bigint::{BigInt, BigUint, ToBigInt, ToBigUint};
Expand Down
1 change: 0 additions & 1 deletion src/utils/sqrt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ pub fn sqrt(value: &BigInt) -> BigInt {
#[cfg(test)]
mod tests {
use super::*;
use num_traits::Num;

#[test]
fn test_sqrt_0_1000() {
Expand Down

0 comments on commit df4f5d5

Please sign in to comment.