-
For uint256 specifically, let's say I have some uint256 with a value (ie, If this is a common use-case, on small request might be to have a Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
PaulRBerg
Feb 15, 2022
Replies: 1 comment 6 replies
-
Hey @kenvogg, there are examples in the README. In your case, you would write: function takePercentage(uint256 x) external pure returns (uint256 result) {
const percentage = .25e18; // 0.25 means 25%
result = x.mul(percentage);
} To be honest I don't see the value of a |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
decafboba
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @kenvogg, there are examples in the README.
In your case, you would write:
To be honest I don't see the value of a
perc
function. It'd be just syntactic sugar formul
.