diff --git a/Cargo.toml b/Cargo.toml index 2a26079..b5232d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uniswap-sdk-core" -version = "0.16.1" +version = "0.17.0" edition = "2021" authors = ["malik ", "Shuhui Luo "] description = "The Uniswap SDK Core in Rust provides essential functionality for interacting with the Uniswap decentralized exchange" @@ -12,14 +12,14 @@ license = "MIT" alloy-primitives = "0.6" bigdecimal = "0.4.2" eth_checksum = { version = "0.1.2", optional = true } -lazy_static = "1.4.0" +lazy_static = "1.4" num-bigint = "0.4.4" num-integer = "0.1.45" num-rational = "0.4.1" num-traits = "0.2.17" regex = { version = "1.10", optional = true } -syn = "2.0.48" -thiserror = "1.0.56" +syn = "2.0" +thiserror = "1.0" [features] validate_parse_address = ["eth_checksum", "regex"] diff --git a/README.md b/README.md index 435d9eb..a3897e5 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Add this to your Cargo.toml ``` [dependencies] -uniswap-sdk-core = "0.14.0"; +uniswap-sdk-core = "0.17.0"; ``` And this to your code: @@ -43,17 +43,24 @@ fn main() { } ``` -## Acknowledgments - -The Uniswap SDK Core in Rust is inspired by the original [Uniswap SDK]() and aims to provide similar functionality in -the Rust programming language. - ## License -This project is licensed under the MIT License - see the [LICENSE](https://github.com/Uniswap/sdk-core/tree/main) file -for details. +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. ## Contribution Contributions are welcome! If you find a bug or have suggestions for improvements, feel free to open an issue or submit a pull request on the [GitHub repository](https://github.com/malik672/uniswap-sdk-core-rust). + +## Acknowledgments + +The Uniswap SDK Core in Rust is inspired by the original [Uniswap SDK](https://github.com/Uniswap/sdk-core) and aims to +provide similar functionality in the Rust programming language. + +## Used by + +- [Uniswap V3 SDK Rust](https://github.com/shuhuiluo/uniswap-v3-sdk-rs): Opinionated Rust implementation of the Uniswap + V3 SDK with a focus on readability and performance +- ... + +*(If you want to add project to the list, dm or open a PR)* diff --git a/src/entities/token.rs b/src/entities/token.rs index 3cfc469..8c8162c 100644 --- a/src/entities/token.rs +++ b/src/entities/token.rs @@ -40,9 +40,9 @@ impl CurrencyTrait for Token { } impl Token { - pub fn new( + pub const fn new( chain_id: u64, - address: String, + address: Address, decimals: u8, symbol: Option, name: Option, @@ -58,7 +58,7 @@ impl Token { symbol, name, meta: TokenMeta { - address: address.parse().unwrap(), + address, buy_fee_bps, sell_fee_bps, }, @@ -83,13 +83,13 @@ impl Token { } } -/// Short hand macro to create a token +/// Shorthand macro to create a token #[macro_export] macro_rules! token { ($chain_id:expr, $address:expr, $decimals:expr) => { Token::new( $chain_id, - $address.to_string(), + $address.parse::
().unwrap(), $decimals, None, None, @@ -100,7 +100,7 @@ macro_rules! token { ($chain_id:expr, $address:expr, $decimals:expr, $symbol:expr) => { Token::new( $chain_id, - $address.to_string(), + $address.parse::
().unwrap(), $decimals, Some($symbol.to_string()), None, @@ -111,7 +111,7 @@ macro_rules! token { ($chain_id:expr, $address:expr, $decimals:expr, $symbol:expr, $name:expr) => { Token::new( $chain_id, - $address.to_string(), + $address.parse::
().unwrap(), $decimals, Some($symbol.to_string()), Some($name.to_string()),