From ecdeeaaf7c1965345a6849f7f3dff6b574bcbd3b Mon Sep 17 00:00:00 2001 From: Josselin Date: Sun, 7 Mar 2021 17:31:33 +0100 Subject: [PATCH 1/3] Add gwei support (fix #748, fix #772) --- slither/utils/arithmetic.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slither/utils/arithmetic.py b/slither/utils/arithmetic.py index 3bcb2c121..6e754081b 100644 --- a/slither/utils/arithmetic.py +++ b/slither/utils/arithmetic.py @@ -14,6 +14,8 @@ def convert_subdenomination( decimal_value = Decimal(value) if sub == "wei": return int(decimal_value) + if sub == "gwei": + return int(decimal_value * int(1e9)) if sub == "szabo": return int(decimal_value * int(1e12)) if sub == "finney": From 273e40ee2096965e626d3fd0fcf888c00979c1ab Mon Sep 17 00:00:00 2001 From: Josselin Date: Sun, 7 Mar 2021 17:42:34 +0100 Subject: [PATCH 2/3] fix pylint --- slither/utils/arithmetic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slither/utils/arithmetic.py b/slither/utils/arithmetic.py index 6e754081b..7a7b1372f 100644 --- a/slither/utils/arithmetic.py +++ b/slither/utils/arithmetic.py @@ -5,7 +5,7 @@ from slither.exceptions import SlitherException def convert_subdenomination( value: str, sub: str -) -> int: # pylint: disable=too-many-return-statements +) -> int: # pylint: disable=too-many-return-statements, too-many-branches # to allow 0.1 ether conversion if value[0:2] == "0x": From 3f462482e723709438eca7f6a3764eb57ed88ab1 Mon Sep 17 00:00:00 2001 From: Josselin Date: Sun, 7 Mar 2021 17:43:20 +0100 Subject: [PATCH 3/3] fix pylint --- slither/utils/arithmetic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slither/utils/arithmetic.py b/slither/utils/arithmetic.py index 7a7b1372f..06e8956dd 100644 --- a/slither/utils/arithmetic.py +++ b/slither/utils/arithmetic.py @@ -2,10 +2,10 @@ from decimal import Decimal from slither.exceptions import SlitherException - +# pylint: disable=too-many-branches def convert_subdenomination( value: str, sub: str -) -> int: # pylint: disable=too-many-return-statements, too-many-branches +) -> int: # pylint: disable=too-many-return-statements # to allow 0.1 ether conversion if value[0:2] == "0x":