-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix the bug in deposit
#151
Conversation
feat: implement calculateNormalizedAmount function refactor: move calculateTransferAmount in Helpers refactor: rename all parameters in "deposit" function to "transferAmount"
test: introduce new constants test: add more tests for deposit function test: update tests with new parameter name "transferAmount" test: use Helpers library in tests
refactor: use the new function in _depositViaBroker function refactor: move _safeAssetDecimals in Helpers chore: remove streamId from custom error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR @andreivladbrg. I briefly looked through it and I can see you have moved functions to Helpers
contract which is awesome.
I ended up using your suggestion to not revert in calculateNormalizedAmount.
Thank you.
should we add independent tests for Helpers.calculateNormalizedAmount and Helpers.calculateTransferAmount
I don't think its necessary. A complete test suite for public functions should be sufficient to test these internal functions as well.
Also, I think we should start using unchecked
wherever its safe to do so inspite of it reducing readability. We should save gas on mathematical operations.
PS: This was just a brief review. I will do a full review later.
test: rename asset with 24 decimals
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
refactor: update Helpers calculate functions test: remove assetWith24Decimals from Base_Test test: when the asset has more than 18 decimals in create docs: update natspec in the interface docs: update README
@smol-ninja updated the PR with not allowing assets with more than 18 decimals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes so quickly. Left few comments below.
test: shorten variable names docs: improve README
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Linked issues
deposit
if the asset decimals are less than 18 #148ERC20
tokens withdecimals > 18
#156Changelog
Src
deposit
totransferAmount
ERC20
assets with more than 18 decimalsHelpers
library_calculateTransferAmount
and_safeAssetDecimals
inHelpers
calculateNormalizedAmount
functioncheckAndCalculateBrokerFee
function inHelpers
and use it in_depositViaBroker
Test
create
deposit
Question: should we add independent tests for
Helpers.calculateNormalizedAmount
andHelpers.calculateTransferAmount
?