|
|
@ -240,30 +240,31 @@ def filter_name(value): |
|
|
|
def convert_subdenomination(value, sub): |
|
|
|
def convert_subdenomination(value, sub): |
|
|
|
if sub is None: |
|
|
|
if sub is None: |
|
|
|
return value |
|
|
|
return value |
|
|
|
value = int(value) |
|
|
|
# to allow 0.1 ether conversion |
|
|
|
|
|
|
|
value = float(value) |
|
|
|
if sub == 'wei': |
|
|
|
if sub == 'wei': |
|
|
|
return value |
|
|
|
return int(value) |
|
|
|
if sub == 'szabo': |
|
|
|
if sub == 'szabo': |
|
|
|
return value * int(1e12) |
|
|
|
return int(value * int(1e12)) |
|
|
|
if sub == 'finney': |
|
|
|
if sub == 'finney': |
|
|
|
return value * int(1e15) |
|
|
|
return int(value * int(1e15)) |
|
|
|
if sub == 'ether': |
|
|
|
if sub == 'ether': |
|
|
|
return value * int(1e18) |
|
|
|
return int(value * int(1e18)) |
|
|
|
if sub == 'seconds': |
|
|
|
if sub == 'seconds': |
|
|
|
return value |
|
|
|
return int(value) |
|
|
|
if sub == 'minutes': |
|
|
|
if sub == 'minutes': |
|
|
|
return value * 60 |
|
|
|
return int(value * 60) |
|
|
|
if sub == 'hours': |
|
|
|
if sub == 'hours': |
|
|
|
return value * 60 * 60 |
|
|
|
return int(value * 60 * 60) |
|
|
|
if sub == 'days': |
|
|
|
if sub == 'days': |
|
|
|
return value * 60 * 60 * 24 |
|
|
|
return int(value * 60 * 60 * 24) |
|
|
|
if sub == 'weeks': |
|
|
|
if sub == 'weeks': |
|
|
|
return value * 60 * 60 * 24 * 7 |
|
|
|
return int(value * 60 * 60 * 24 * 7) |
|
|
|
if sub == 'years': |
|
|
|
if sub == 'years': |
|
|
|
return value * 60 * 60 * 24 * 7 * 365 |
|
|
|
return int(value * 60 * 60 * 24 * 7 * 365) |
|
|
|
|
|
|
|
|
|
|
|
logger.error('Subdemoniation not found {}'.format(sub)) |
|
|
|
logger.error('Subdemoniation not found {}'.format(sub)) |
|
|
|
return value |
|
|
|
return int(value) |
|
|
|
|
|
|
|
|
|
|
|
def parse_expression(expression, caller_context): |
|
|
|
def parse_expression(expression, caller_context): |
|
|
|
""" |
|
|
|
""" |
|
|
|