Env
package, you need to import it:Safemath
package, you need to import it:y
from x
. The result is validated, so if it becomes negative, an error is returned.x
by y
. The remainder is discarded as it should in integer arithmetic, and the input (y
) is validated not to be zero.x
by y
. The input is validated to be valid (meaning y
is not zero). The resulting number is the reminder.safeuint256
validate
is called automatically on each operation, meaning after using Add
or Sub
or any operation of the safemath library, so there is no need to call it manually.