-
Notifications
You must be signed in to change notification settings - Fork 5
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
[FEA-792] added multiplier #127
Conversation
ran forge fmt |
} else if (flightClass == 5) { | ||
multiplier = 300; // 3x (scaled by 100) | ||
} else if (flightClass == 6) { | ||
multiplier = 500; // 5x (scaled by 100) |
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.
Add comments on what each flight class is (Economy, Plus, etc.)
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 must be a more efficient way of doing this? e.g. uint256[] constant multipliers = [0, 1, 11, 125, 200, 300, 500];
- check if this actually saves gas
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.
maybe something like this.
uint256[6] memory multipliers = [100, 110, 125, 200, 300, 500];
if (flightClass == 0 || flightClass > 6) {
revert InvalidFlightClass(flightClass);
}
return (baseAmount * multipliers[flightClass - 1]) / 100;```
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 install the latest version of Foundry and run forge fmt
again?
} else if (flightClass == 5) { | ||
multiplier = 300; // 3x (scaled by 100) | ||
} else if (flightClass == 6) { | ||
multiplier = 500; // 5x (scaled by 100) |
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 must be a more efficient way of doing this? e.g. uint256[] constant multipliers = [0, 1, 11, 125, 200, 300, 500];
- check if this actually saves gas
made it to array, for 6 classes it's better Upgraded forge |
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
What's new in this PR?
Add multiplier for flight class