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(sol): default decimal adjustment to 1 #57

Closed

Conversation

0xmichalis
Copy link
Member

Currently the pool contract is converting the underlying decimals to the pool token decimals before calling the fee calculator so there is no need to adjust the amount in the fee calculator, hence default feeToUnderlyingDecimalsScale to 1.

Currently the pool contract is converting the underlying
decimals to the pool token decimals before calling the
fee calculator so there is no need to adjust the amount
in the fee calculator, hence default feeToUnderlyingDecimalsScale to 1.
@0xmichalis 0xmichalis requested review from aspiers and lirona June 10, 2024 10:58
@0xmichalis
Copy link
Member Author

We should also consider reverting #55 and treat amounts sent to the fee calculator as pool amounts. Anyway users shouldn't need to interact directly with the fee calculator, instead the pool contract offers a holistic interface that handles conversions.

@0xmichalis
Copy link
Member Author

0xmichalis commented Jun 10, 2024

If we revert #55 at the very least we should document that callers should be converting the provided amounts to the pool token's precision in NatSpec.

We should also consider reverting #55 and treat amounts sent to the fee calculator as pool amounts. Anyway users shouldn't need to interact directly with the fee calculator, instead the pool contract offers a holistic interface that handles conversions.

A few arguments against reverting:

  • the amounts provided to the fee calculator are underlying token amounts so it's clearer to allow accepting amounts in their native precision. Without deep knowledge of all the pool contracts, I can see how the conversion happening in the pool and keeping the fee calculator oblivious to the underlying's decimals can be confusing and harder to debug
  • with the extra functionality the calculator can be reused by other protocols without the need to force those protocols to do their own conversions before having to use the calculator

@lirona
Copy link

lirona commented Jun 10, 2024

can you please add "distributed" to this line while you're at it? it's hurting my eyes :))

Copy link

@lirona lirona left a comment

Choose a reason for hiding this comment

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

how are no tests affected by this change?

@0xmichalis
Copy link
Member Author

can you please add "distributed" to this line while you're at it? it's hurting my eyes :))

Feel free to open a PR for it please as it's not related to my changes.

@0xmichalis
Copy link
Member Author

how are no tests affected by this change?

I think this is because the fuzzing test suite was already setting the underlying decimals to 1 here.

@sirnicolaz
Copy link
Contributor

@0xmichalis i in principle also don't have a strong opinion, but defaulting to 1 seems to be a half baked solution between delegating the conversion to the Pool vs having the calculator taking this responsibility.

My preferred way to go (assuming it's THE WAY) would be to either remove the knowledge of the underlying decimals completely from the calculator, or leave it all there. But like it is here, it's a half step, which if left untouched will leave even more confusion around.

Do you think we can just roll back #55 at this point?

@0xmichalis
Copy link
Member Author

My preferred way to go (assuming it's THE WAY) would be to either remove the knowledge of the underlying decimals completely from the calculator, or leave it all there. But like it is here, it's a half step, which if left untouched will leave even more confusion around.

Not sure what you mean exactly by "leave it all there"? Presumably you mean that the pool should stop sending converted amounts to the fee calculator and the fee calculator should be configured to work with the underlying decimals? Agreed that as it stands it's half-baked, it's likely fine to revert #55 at the expense of making the calculator less reusable for ERC-1155 use cases.

@0xmichalis
Copy link
Member Author

Closing in favor of #58

@0xmichalis 0xmichalis closed this Jun 11, 2024
@0xmichalis 0xmichalis deleted the default-adjustment-to-1 branch June 11, 2024 08:53
@sirnicolaz
Copy link
Contributor

Not sure what you mean exactly by "leave it all there"? Presumably you mean that the pool should stop sending converted amounts to the fee calculator and the fee calculator should be configured to work with the underlying decimals?

that's what I meant.

it's likely fine to revert #55 at the expense of making the calculator less reusable for ERC-1155 use cases

true, but we can still roll out a new calculator in the future if we see the need/demand, and make it more flexible in case...

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.

3 participants