Skip to content

Refactor tools to use token address#62

Merged
gkoch78 merged 9 commits intomainfrom
refactor-tools-to-use-token-address
Feb 11, 2025
Merged

Refactor tools to use token address#62
gkoch78 merged 9 commits intomainfrom
refactor-tools-to-use-token-address

Conversation

@gkoch78
Copy link
Contributor

@gkoch78 gkoch78 commented Feb 10, 2025

No description provided.

@gkoch78 gkoch78 marked this pull request as ready for review February 11, 2025 00:28
Comment on lines +31 to +34
"Get the current price of a token pair from available DEXes. "
"Returns a list of TokenPriceResult object. "
"Result is expressed in amount of token_out per token_in. "
"Examples: 'Get the price of ETH in USDC on ethereum', 'Get the price of GIGA in SOL on solana'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Get the current price of a token pair from available DEXes. "
"Returns a list of TokenPriceResult object. "
"Result is expressed in amount of token_out per token_in. "
"Examples: 'Get the price of ETH in USDC on ethereum', 'Get the price of GIGA in SOL on solana'"
"Get the current price of a token pair from available DEXes."
"Returns a list of TokenPriceResult object."
"Result is expressed in amount of token_out per token_in."
"Examples: 'Get the price of ETH in USDC on ethereum', 'Get the price of GIGA in SOL on solana'"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This multiline string would actually render better with the extra spaces at the end


def get_token_info_by_address_or_none(self, address: str) -> Optional[TokenInfo]:
"""Get token info from its address, returning None if not found"""
return next((token for token in self.tokens.values() if token.address == address), None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to_lower() to compare addresses?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not as some chains or contracts may be case sensitive

Copy link
Contributor

@aflament aflament left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w/ 2 comments

@gkoch78 gkoch78 merged commit 727c80a into main Feb 11, 2025
2 checks passed
@gkoch78 gkoch78 deleted the refactor-tools-to-use-token-address branch February 11, 2025 00:36
ethancjackson added a commit that referenced this pull request Feb 12, 2025
* Add new API endpoint for AlchemyClient (#54)

alchemy_getAssetTransfers

* Update ruff and mypi (#55)

* README improvements (#52)

* Improvements to README

* improved prompt for token price tool (#57)

* Fix LLMFunction caching test (#58)

* Refactor replace quote base (#56)

* token_in and token_out for quote

* replace base and quote in swap

* clean up

* fix IT

* Update alphaswarm/services/exchanges/base.py

Co-authored-by: Arnaud Flament <17051690+aflament@users.noreply.github.com>

* Update alphaswarm/services/exchanges/base.py

Co-authored-by: Arnaud Flament <17051690+aflament@users.noreply.github.com>

* Update alphaswarm/services/exchanges/uniswap/uniswap_client_base.py

Co-authored-by: Arnaud Flament <17051690+aflament@users.noreply.github.com>

* Update alphaswarm/services/exchanges/uniswap/uniswap_client_v2.py

Co-authored-by: Arnaud Flament <17051690+aflament@users.noreply.github.com>

* Update alphaswarm/services/exchanges/uniswap/uniswap_client_v3.py

Co-authored-by: Arnaud Flament <17051690+aflament@users.noreply.github.com>

* Update alphaswarm/tools/exchanges/get_token_price_tool.py

Co-authored-by: Arnaud Flament <17051690+aflament@users.noreply.github.com>

* Update tests/integration/services/exchanges/uniswap/test_uniswap_client_v3.py

Co-authored-by: Arnaud Flament <17051690+aflament@users.noreply.github.com>

* Update uniswap_client_base.py

* clean up

---------

Co-authored-by: Arnaud Flament <17051690+aflament@users.noreply.github.com>

* Feature modify PriceTool with token address (#60)

* Use contract address for token price tool

* Update description

* Doctring typo

* [Portfolio] Add support to `alchemy_getTokenBalances` (#61)

* [Portfolio] Add support to `alchemy_getTokenBalances`

* Update test_alchemy_client.py

* Add UT

* Update test_alchemy.py

* Refactor tools to use token address (#62)

* add `GetTokenAddress` tool

* Update terminal.py

* token addresses for get_token_price and dex quote

* swap tool to use token address

* revert services to use TokenInfo

* Update test_get_token_address.py

* lint

* Update test_web3_client.py

* lint

* fix (#63)

* Feature readme improvements (#59)

* Add links & notes

* Add docstring to AlphaSwarmAgent

* Updates for usage

* Return model_id parameter for clarity

* Organize examples/ and more instructions into separate README.md

* Address comments

* Example script modifications (#65)

* Update telegram_bot.py

* Update telegram_bot.py

* Update telegram_bot.py

* Update telegram_bot.py

* Update telegram_bot.py

* Update telegram_bot.py

* Update telegram_bot.py

---------

Co-authored-by: Arnaud Flament <arnaud.flament@gmail.com>

* add retries for some EVM functions (#66)

* add retries for some EVM functions

* add retry delay

* refactor and more test related to PR-66 (#68)

* refactor and add more tests on EVMClient

* lint

* Update .env.example

* Update python.yaml

* Update test_evm_client.py

---------

Co-authored-by: Arnaud Flament <17051690+aflament@users.noreply.github.com>
Co-authored-by: david <dvdmllr@outlook.com>
Co-authored-by: Nikolaiev Dmytro <nikolaevdmitryprog@gmail.com>
Co-authored-by: Guillaume Koch <39165367+gkoch78@users.noreply.github.com>
Co-authored-by: dan-kur <95598696+dan-kur@users.noreply.github.com>
Co-authored-by: PM <70244162+pandaring2you@users.noreply.github.com>
Co-authored-by: Arnaud Flament <arnaud.flament@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants