Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf254f47

Browse files
author
Kotsias, Panagiotis-Christos
committed
Added unit conversions
1 parent7caac2a commitf254f47

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎etherscan/conversions.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
fromdecimalimportDecimal
2+
3+
4+
classConversions:
5+
@staticmethod
6+
defto_ticker_unit(val:int,decimals:int=18)->Decimal:
7+
factor=Decimal("10")**Decimal("-{}".format(decimals))
8+
returnDecimal(val)*factor
9+
10+
@staticmethod
11+
defto_smallest_unit(val:int,decimals:int=18)->Decimal:
12+
factor=Decimal("10")**Decimal("+{}".format(decimals))
13+
returnDecimal(val)*factor

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp