You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unexpected error while compiling my contract. Check the second to the last line in the snippet below
ERROR: vyper.exceptions.TypeMismatchException: line 177:8 Unit mismatch: {'wei': 1} {}
Why do I need to convert amount to wei_value again when it has already been declared in the function argument?
Code:
@public
@constant
def func(amounts: wei_value[100]) -> bool:
total: wei_value = as_wei_value(0, "wei")
# calculate total
for amount in amounts:
total += amount # Error: mismatch units
return True
How can it be fixed?
Convert amount to wei_value
@public
@constant
def func(amounts: wei_value[100]) -> bool:
total: wei_value = as_wei_value(0, "wei")
for amount in amounts:
total = as_wei_value(amount, "wei") # No error
return True
Cute Animal Picture
cute animal picture
The text was updated successfully, but these errors were encountered:
eltNEG
changed the title
Unit Mismatch error (vyper.online compiler)
Unit Mismatch error for wei_value operation
Nov 7, 2018
Version Information
and
What's your issue about?
Unexpected error while compiling my contract. Check the second to the last line in the snippet below
ERROR:
vyper.exceptions.TypeMismatchException: line 177:8 Unit mismatch: {'wei': 1} {}
Why do I need to convert amount to wei_value again when it has already been declared in the function argument?
Code:
How can it be fixed?
Convert amount to wei_value
Cute Animal Picture
The text was updated successfully, but these errors were encountered: