Skip to content

Feature introduce portofolio balance#91

Merged
aflament merged 7 commits intomainfrom
feature-introduce-portofolio-balance
Feb 21, 2025
Merged

Feature introduce portofolio balance#91
aflament merged 7 commits intomainfrom
feature-introduce-portofolio-balance

Conversation

@aflament
Copy link
Contributor

No description provided.

Args:
token_out (TokenInfo): The token to be bought (going out from the pool)
token_in (TokenInfo): The token to be sold (going into the pool)
amount_in (Decimal): The amount of the token to be sold
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
amount_in (Decimal): The amount of the token to be sold
amount_in (TokenAmount): The amount of the token to be sold

token_in = quote.token_in
token_out = quote.token_out
wei_in = token_in.convert_to_wei(quote.amount_in)
wei_in = token_in.to_amount(quote.amount_in)
Copy link
Contributor

Choose a reason for hiding this comment

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

names could imply we are having a unit issue: storing token amount in Wei/base unit

token_out = quote.token_out
wei_in = token_in.convert_to_wei(quote.amount_in)
approval_receipt = self._approve_token_spending(token_in, wei_in)
wei_in = token_in.to_amount(quote.amount_in)
Copy link
Contributor

Choose a reason for hiding this comment

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

rename wei_in into amount_in

def test_has_token(portfolio_balance: PortfolioBalance, eth_token: TokenInfo, usdc_token: TokenInfo) -> None:
assert portfolio_balance.has_token(eth_token.address) is True
assert portfolio_balance.has_token(usdc_token.address) is True
assert portfolio_balance.has_token("0x0000000000000000000000000000000000000000") is False
Copy link
Contributor

Choose a reason for hiding this comment

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

using ZeroAddress from EVMClient instead

aflament and others added 3 commits February 20, 2025 15:55
Co-authored-by: Guillaume Koch <39165367+gkoch78@users.noreply.github.com>
Co-authored-by: Guillaume Koch <39165367+gkoch78@users.noreply.github.com>
@aflament aflament marked this pull request as ready for review February 21, 2025 01:46
@aflament aflament merged commit d658061 into main Feb 21, 2025
2 checks passed
@aflament aflament deleted the feature-introduce-portofolio-balance branch February 21, 2025 17:45
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