Add "available since" comments in documentation

(cherry picked from commit 63a0343dda)
This commit is contained in:
Francisco Giordano
2021-02-01 21:44:58 -03:00
parent ff300b10e1
commit a0e2bca79a
10 changed files with 28 additions and 2 deletions

View File

@ -18,6 +18,8 @@ pragma solidity >=0.6.0 <0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
@ -27,6 +29,8 @@ library SafeMath {
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
@ -35,6 +39,8 @@ library SafeMath {
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
@ -48,6 +54,8 @@ library SafeMath {
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
@ -56,6 +64,8 @@ library SafeMath {
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);