From 8e5787bfe8af37077b6f6a68732a33d0551eac79 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Tue, 9 Jan 2024 13:24:35 +0530 Subject: [PATCH 1/2] feat: add function to check for non-zero values --- contracts/validators.sol | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/contracts/validators.sol b/contracts/validators.sol index 945c1ed..6456495 100644 --- a/contracts/validators.sol +++ b/contracts/validators.sol @@ -4,6 +4,9 @@ pragma solidity 0.8.13; /// @notice Thrown if the supplied address is a zero address where it is not allowed error ZeroAddressNotAllowed(); +/// @notice Thrown if the supplied value is 0 where it is not allowed +error ZeroValueNotAllowed(); + /// @notice Checks if the provided address is nonzero, reverts otherwise /// @param address_ Address to check /// @custom:error ZeroAddressNotAllowed is thrown if the provided address is a zero address @@ -12,3 +15,12 @@ function ensureNonzeroAddress(address address_) pure { revert ZeroAddressNotAllowed(); } } + +/// @notice Checks if the provided value is nonzero, reverts otherwise +/// @param value_ Value to check +/// @custom:error ZeroValueNotAllowed is thrown if the provided value is 0 +function ensureNonzeroValue(uint256 value_) pure { + if (value_ == 0) { + revert ZeroValueNotAllowed(); + } +} From 6527120b0ea1d9d851d129a6f8db52e4b488e3f3 Mon Sep 17 00:00:00 2001 From: Venus Tools Date: Tue, 9 Jan 2024 16:57:29 +0000 Subject: [PATCH 2/2] chore(release): 1.3.0-dev.1 [skip ci] ## [1.3.0-dev.1](https://github.com/VenusProtocol/solidity-utilities/compare/v1.2.0...v1.3.0-dev.1) (2024-01-09) ### Features * add function to check for non-zero values ([8e5787b](https://github.com/VenusProtocol/solidity-utilities/commit/8e5787bfe8af37077b6f6a68732a33d0551eac79)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77e2415..b5fdf0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.3.0-dev.1](https://github.com/VenusProtocol/solidity-utilities/compare/v1.2.0...v1.3.0-dev.1) (2024-01-09) + + +### Features + +* add function to check for non-zero values ([8e5787b](https://github.com/VenusProtocol/solidity-utilities/commit/8e5787bfe8af37077b6f6a68732a33d0551eac79)) + ## [1.2.0](https://github.com/VenusProtocol/solidity-utilities/compare/v1.1.0...v1.2.0) (2023-12-27) diff --git a/package.json b/package.json index bfc059f..c446284 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@venusprotocol/solidity-utilities", - "version": "1.2.0", + "version": "1.3.0-dev.1", "description": "Solidity code used by other Venus projects", "files": [ "artifacts",