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.
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
Improve Token Math #114
Improve Token Math #114
Changes from all commits
333bb35
bf254eb
1e07504
b11013c
e3a0423
bc5d908
99a25df
7bf568c
8e79154
9550ce8
aaa42d3
fcdcf79
5efd90b
0c0a614
aa7543a
da58d28
d81d944
bc82469
99440ce
37656f3
d2fd4c6
a9109b5
75157e4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Can you explain the specific benefit that using fixedpointmath here gives us over doing it the native way?
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.
seems like it's just
safer
?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.
There's control over rounding down or up. I think we need to figure out which parts of the contract are potentially rounding and decide which should round up or down. I took a stab at it in the contract as well as testing, but for minting for example I couldn't get a test case that was affected by either using
mulDivUp
mulDivDown
(a * b) / c
but I did notice some rounding errors in repayment maybe? The place where I'm adding or removing
.sub(1)
.add(1)
a single "unit" which does get rounded away.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.
I liked peteris' idea here https://canary.discord.com/channels/903094151002857492/930939338425008208/954303204609372191 - I'd recommend a follow up PR for that
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.
peteris suggested a few things there - my takeaway was rename to
previewRedeemAtMaturity
and remove the maturityDate business. Is that what you would want to see in a follow up PR?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.
I'm pretty sure he suggested one thing and outlined exactly how that one thing would work with 4 example use cases
Yes