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

feat: early return dutch decay if none #241

Merged
merged 1 commit into from
Apr 18, 2024
Merged

feat: early return dutch decay if none #241

merged 1 commit into from
Apr 18, 2024

Conversation

marktoda
Copy link
Collaborator

@marktoda marktoda commented Apr 5, 2024

If startAmount == endAmount, early return. This is always true for
either the inputs or outputs of an order, so saves the decay calculation
half the time

zhongeric
zhongeric previously approved these changes Apr 9, 2024
@@ -28,7 +28,9 @@ library DutchDecayLib {
view
returns (uint256 decayedAmount)
{
if (decayEndTime <= decayStartTime) {
if (startAmount == endAmount) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

a little strange that the decay times are not validated if startAmount==endAmount

Copy link
Collaborator

Choose a reason for hiding this comment

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

wdyt about putting this check after the time based ones?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

part of the point of this issue is that the time-based ones are irrelevant if startamount == endamount, which is always true for one of inputs or outputs. timings will be validated for whichever one is decaying

zhongeric
zhongeric previously approved these changes Apr 15, 2024
If startAmount == endAmount, early return. This is always true for
either the inputs or outputs of an order, so saves the decay calculation
half the time
@marktoda marktoda merged commit f867c13 into main Apr 18, 2024
3 checks passed
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