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: function isPercentagesSum100 #357

Merged
merged 6 commits into from
Jun 21, 2024
Merged

feat: function isPercentagesSum100 #357

merged 6 commits into from
Jun 21, 2024

Conversation

smol-ninja
Copy link
Member

@smol-ninja smol-ninja commented Jun 20, 2024

Changelog

/// @notice Verifies if the sum of percentages in `tranches` equals 100% , i.e. 1e18.
/// @dev Reverts if the sum of percentages overflows.
/// @param tranches The tranches with their respective unlock percentages.
/// @return result True if the sum of percentages equals 100%, otherwise false.
function isPercentagesSum100(MerkleLT.TrancheWithPercentage[] calldata tranches)
    external
    pure
    returns (bool result);

Copy link
Member

@andreivladbrg andreivladbrg left a comment

Choose a reason for hiding this comment

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

LGTM, except that I believe the name isn’t that accurate. What if we say areValidPercentages?

@razgraf, requesting your suggestions here

src/interfaces/ISablierV2MerkleLockupFactory.sol Outdated Show resolved Hide resolved
@smol-ninja
Copy link
Member Author

I agree that name isn't the best. It was hard to find a name for it. Even 'areValidPercentages' isn't that intuitive. How about 'isSum100'?

@andreivladbrg
Copy link
Member

isPercentagesSum100 works for me

@PaulRBerg PaulRBerg changed the title feat: function isValidMerkleLT feat: function isPercentagesSum100 Jun 20, 2024
test: polish tests
Copy link
Member

@PaulRBerg PaulRBerg left a comment

Choose a reason for hiding this comment

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

lgtm, feedback below but already addressed by me

@smol-ninja smol-ninja merged commit 78835c5 into staging Jun 21, 2024
7 checks passed
@smol-ninja smol-ninja deleted the validate-mlt branch June 21, 2024 08:45
@razgraf
Copy link
Member

razgraf commented Jun 21, 2024

isPercentagesSum100 works 👍 GPT suggested "isTotalPercentage100" as a possible alternative for what it's worth (to avoid the sS)

@PaulRBerg
Copy link
Member

I prefer isPercentagesSum100 over isTotalPercentage100 because the former indicates that the input is an array. The latter may give off the indication that the input is a single item.

to avoid the sS

minor issue in the grand scheme of things

@andreivladbrg andreivladbrg mentioned this pull request Jul 2, 2024
2 tasks
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.

4 participants