We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a401698 commit 8599556Copy full SHA for 8599556
src/aleph/sdk/evm_utils.py
@@ -1,4 +1,4 @@
1
-from decimal import Decimal
+from decimal import ROUND_CEILING, Decimal
2
from enum import Enum
3
from typing import List, Optional, Union
4
@@ -37,6 +37,11 @@ def to_wei_token(amount: Decimal) -> Decimal:
37
return amount * Decimal(10) ** Decimal(settings.TOKEN_DECIMALS)
38
39
40
+def ether_rounding(amount: Decimal) -> Decimal:
41
+ """Rounds the given value to 18 decimals."""
42
+ return amount.quantize(Decimal(1) / 10**18, rounding=ROUND_CEILING)
43
+
44
45
def get_chain_id(chain: Union[Chain, str, None]) -> Optional[int]:
46
"""Returns the CHAIN_ID of a given EVM blockchain"""
47
if chain:
0 commit comments