Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Probably testing setup should be cleaned up a bit.
The core motivation for this chance is that the current data flow of the app:
a) is predictable
b) extremely wasteful
So the changes proposed here make it slightly less wasteful: hear me out
So when
app.aave.com
loads it:fetches data from uiPoolDataProvider including name, symbol, decimals, amount(in wei) for each asset
this data is then formatted so amount is in "units" (so basically shift by decimals)
this amount is then passed to e.g.
supply
which will thenin the case of permit - throw things away 😅 & start over with
fetching decimals again, because why not https://github.com/aave/aave-utilities/pull/455/files#diff-94e2771eec1338274fb2a401a493a9b6822e75f0ffba272f3e3f921e156ec943R75 - it's 3 seperate calls, fetching name, symbol & decimals. Everything is known already. 4th time fetching decimals for a single txn.
check if in fact it is approved (yep we already did in 3.3, but why not https://github.com/aave/aave-utilities/pull/455/files#diff-94e2771eec1338274fb2a401a493a9b6822e75f0ffba272f3e3f921e156ec943R82)
finThis pr removes, 5,6,7,7.1 by assuming:
It does not solve the other problems.
Disclaimer: didn't adjust the tests properly yet for latest changes.
Might make sense to abstract some things there.
My recommendation(not in this pr) would be to have a close look at this behavior (in the context of all transactions) and refactor this in depth as it really doesn't make sense.
I think in all cases of:
You pass amount as
units
, just to fetch decimals , which you fetched 2 lines above in essentially all cases.Probably a first step would be to just directly pass
wei
here. 1 async call less.The next step might be:
a) altering the signature to just accept decimals (as you already know them)
b) expect to already get the wei (not sure how good this fits into the application data flow)