Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(refactor): Update Token constructor and rearrange README #51

Merged
merged 2 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "uniswap-sdk-core"
version = "0.16.1"
version = "0.17.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 All @@ -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"]
Expand Down
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)*
14 changes: 7 additions & 7 deletions src/entities/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
name: Option<String>,
Expand All @@ -58,7 +58,7 @@ impl Token {
symbol,
name,
meta: TokenMeta {
address: address.parse().unwrap(),
address,
buy_fee_bps,
sell_fee_bps,
},
Expand All @@ -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::<Address>().unwrap(),
$decimals,
None,
None,
Expand All @@ -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::<Address>().unwrap(),
$decimals,
Some($symbol.to_string()),
None,
Expand All @@ -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::<Address>().unwrap(),
$decimals,
Some($symbol.to_string()),
Some($name.to_string()),
Expand Down
Loading