prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add uint256 decimal support for convert
  ### What's your issue about?
  
  Convert should allow conversion of uint256 -> decimal.
  
  ### How can it be fixed?
  
  convert.py:57
  
  #### Cute Animal Picture
  ^.^
  
  </issue>
  <code>
  [start of vyper/types/convert.py]
  1 from vyper.functions.signature import (
  2     signature
  3 )
  4 from vyper.parser.parser_utils import (
  5     LLLnode,
  6     getpos,
  7     byte_array_to_num
  8 )
  9 from vyper.exceptions import (
  10     InvalidLiteralException,
  11     TypeMismatchException,
  12 )
  13 from vyper.types import (
  14     BaseType,
  15 )
  16 from vyper.types import (
  17     get_type,
  18 )
  19 from vyper.utils import (
  20     DECIMAL_DIVISOR,
  21     MemoryPositions,
  22     SizeLimits
  23 )
  24 
  25 
  26 @signature(('int128', 'uint256', 'bytes32', 'bytes'), 'str_literal')
  27 def to_int128(expr, args, kwargs, context):
  28     in_node = args[0]
  29     typ, len = get_type(in_node)
  30     if typ in ('int128', 'uint256', 'bytes32'):
  31         if in_node.typ.is_literal and not SizeLimits.in_bounds('int128', in_node.value):
  32             raise InvalidLiteralException("Number out of range: {}".format(in_node.value), expr)
  33         return LLLnode.from_list(
  34             ['clamp', ['mload', MemoryPositions.MINNUM], in_node,
  35                         ['mload', MemoryPositions.MAXNUM]], typ=BaseType('int128', in_node.typ.unit), pos=getpos(expr)
  36         )
  37     else:
  38         return byte_array_to_num(in_node, expr, 'int128')
  39 
  40 
  41 @signature(('num_literal', 'int128', 'bytes32'), 'str_literal')
  42 def to_uint256(expr, args, kwargs, context):
  43     in_node = args[0]
  44     typ, len = get_type(in_node)
  45     if isinstance(in_node, int):
  46 
  47         if not SizeLimits.in_bounds('uint256', in_node):
  48             raise InvalidLiteralException("Number out of range: {}".format(in_node))
  49         _unit = in_node.typ.unit if typ == 'int128' else None
  50         return LLLnode.from_list(in_node, typ=BaseType('uint256', _unit), pos=getpos(expr))
  51     elif isinstance(in_node, LLLnode) and typ in ('int128', 'num_literal'):
  52         _unit = in_node.typ.unit if typ == 'int128' else None
  53         return LLLnode.from_list(['clampge', in_node, 0], typ=BaseType('uint256', _unit), pos=getpos(expr))
  54     elif isinstance(in_node, LLLnode) and typ in ('bytes32'):
  55         return LLLnode(value=in_node.value, args=in_node.args, typ=BaseType('uint256'), pos=getpos(expr))
  56     else:
  57         raise InvalidLiteralException("Invalid input for uint256: %r" % in_node, expr)
  58 
  59 
  60 @signature('int128', 'str_literal')
  61 def to_decimal(expr, args, kwargs, context):
  62     input = args[0]
  63     return LLLnode.from_list(['mul', input, DECIMAL_DIVISOR], typ=BaseType('decimal', input.typ.unit, input.typ.positional),
  64                              pos=getpos(expr))
  65 
  66 
  67 @signature(('int128', 'uint256', 'address', 'bytes'), 'str_literal')
  68 def to_bytes32(expr, args, kwargs, context):
  69     input = args[0]
  70     typ, len = get_type(input)
  71     if typ == 'bytes':
  72         if len != 32:
  73             raise TypeMismatchException("Unable to convert bytes[{}] to bytes32".format(len))
  74         if input.location == "memory":
  75             return LLLnode.from_list(
  76             ['mload', ['add', input, 32]], typ=BaseType('bytes32')
  77             )
  78         elif input.location == "storage":
  79             return LLLnode.from_list(
  80                 ['sload', ['add', ['sha3_32', input], 1]], typ=BaseType('bytes32')
  81             )
  82     else:
  83         return LLLnode(value=input.value, args=input.args, typ=BaseType('bytes32'), pos=getpos(expr))
  84 
  85 
  86 def convert(expr, context):
  87     output_type = expr.args[1].s
  88     if output_type in conversion_table:
  89         return conversion_table[output_type](expr, context)
  90     else:
  91         raise Exception("Conversion to {} is invalid.".format(output_type))
  92 
  93 
  94 conversion_table = {
  95     'int128': to_int128,
  96     'uint256': to_uint256,
  97     'decimal': to_decimal,
  98     'bytes32': to_bytes32,
  99 }
  100
  [end of vyper/types/convert.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/vyper/types/convert.py b/vyper/types/convert.py
  --- a/vyper/types/convert.py
  +++ b/vyper/types/convert.py
  @@ -57,11 +57,20 @@
           raise InvalidLiteralException("Invalid input for uint256: %r" % in_node, expr)
   
   
  -@signature('int128', 'str_literal')
  +@signature(('int128', 'uint256'), 'str_literal')
   def to_decimal(expr, args, kwargs, context):
       input = args[0]
  -    return LLLnode.from_list(['mul', input, DECIMAL_DIVISOR], typ=BaseType('decimal', input.typ.unit, input.typ.positional),
  -                             pos=getpos(expr))
  +    if input.typ.typ == 'uint256':
  +        return LLLnode.from_list(
  +            ['uclample', ['mul', input, DECIMAL_DIVISOR], ['mload', MemoryPositions.MAXDECIMAL]],
  +            typ=BaseType('decimal', input.typ.unit, input.typ.positional), pos=getpos(expr)
  +        )
  +    else:
  +        return LLLnode.from_list(
  +            ['mul', input, DECIMAL_DIVISOR],
  +            typ=BaseType('decimal', input.typ.unit, input.typ.positional),
  +            pos=getpos(expr)
  +        )
   
   
   @signature(('int128', 'uint256', 'address', 'bytes'), 'str_literal')
  
verification_info: {"golden_diff": "diff --git a/vyper/types/convert.py b/vyper/types/convert.py\n--- a/vyper/types/convert.py\n+++ b/vyper/types/convert.py\n@@ -57,11 +57,20 @@\n         raise InvalidLiteralException(\"Invalid input for uint256: %r\" % in_node, expr)\n \n \n-@signature('int128', 'str_literal')\n+@signature(('int128', 'uint256'), 'str_literal')\n def to_decimal(expr, args, kwargs, context):\n     input = args[0]\n-    return LLLnode.from_list(['mul', input, DECIMAL_DIVISOR], typ=BaseType('decimal', input.typ.unit, input.typ.positional),\n-                             pos=getpos(expr))\n+    if input.typ.typ == 'uint256':\n+        return LLLnode.from_list(\n+            ['uclample', ['mul', input, DECIMAL_DIVISOR], ['mload', MemoryPositions.MAXDECIMAL]],\n+            typ=BaseType('decimal', input.typ.unit, input.typ.positional), pos=getpos(expr)\n+        )\n+    else:\n+        return LLLnode.from_list(\n+            ['mul', input, DECIMAL_DIVISOR],\n+            typ=BaseType('decimal', input.typ.unit, input.typ.positional),\n+            pos=getpos(expr)\n+        )\n \n \n @signature(('int128', 'uint256', 'address', 'bytes'), 'str_literal')\n", "issue": "Add uint256 decimal support for convert\n### What's your issue about?\r\n\r\nConvert should allow conversion of uint256 -> decimal.\r\n\r\n### How can it be fixed?\r\n\r\nconvert.py:57\r\n\r\n#### Cute Animal Picture\r\n^.^\n", "before_files": [{"content": "from vyper.functions.signature import (\n    signature\n)\nfrom vyper.parser.parser_utils import (\n    LLLnode,\n    getpos,\n    byte_array_to_num\n)\nfrom vyper.exceptions import (\n    InvalidLiteralException,\n    TypeMismatchException,\n)\nfrom vyper.types import (\n    BaseType,\n)\nfrom vyper.types import (\n    get_type,\n)\nfrom vyper.utils import (\n    DECIMAL_DIVISOR,\n    MemoryPositions,\n    SizeLimits\n)\n\n\n@signature(('int128', 'uint256', 'bytes32', 'bytes'), 'str_literal')\ndef to_int128(expr, args, kwargs, context):\n    in_node = args[0]\n    typ, len = get_type(in_node)\n    if typ in ('int128', 'uint256', 'bytes32'):\n        if in_node.typ.is_literal and not SizeLimits.in_bounds('int128', in_node.value):\n            raise InvalidLiteralException(\"Number out of range: {}\".format(in_node.value), expr)\n        return LLLnode.from_list(\n            ['clamp', ['mload', MemoryPositions.MINNUM], in_node,\n                        ['mload', MemoryPositions.MAXNUM]], typ=BaseType('int128', in_node.typ.unit), pos=getpos(expr)\n        )\n    else:\n        return byte_array_to_num(in_node, expr, 'int128')\n\n\n@signature(('num_literal', 'int128', 'bytes32'), 'str_literal')\ndef to_uint256(expr, args, kwargs, context):\n    in_node = args[0]\n    typ, len = get_type(in_node)\n    if isinstance(in_node, int):\n\n        if not SizeLimits.in_bounds('uint256', in_node):\n            raise InvalidLiteralException(\"Number out of range: {}\".format(in_node))\n        _unit = in_node.typ.unit if typ == 'int128' else None\n        return LLLnode.from_list(in_node, typ=BaseType('uint256', _unit), pos=getpos(expr))\n    elif isinstance(in_node, LLLnode) and typ in ('int128', 'num_literal'):\n        _unit = in_node.typ.unit if typ == 'int128' else None\n        return LLLnode.from_list(['clampge', in_node, 0], typ=BaseType('uint256', _unit), pos=getpos(expr))\n    elif isinstance(in_node, LLLnode) and typ in ('bytes32'):\n        return LLLnode(value=in_node.value, args=in_node.args, typ=BaseType('uint256'), pos=getpos(expr))\n    else:\n        raise InvalidLiteralException(\"Invalid input for uint256: %r\" % in_node, expr)\n\n\n@signature('int128', 'str_literal')\ndef to_decimal(expr, args, kwargs, context):\n    input = args[0]\n    return LLLnode.from_list(['mul', input, DECIMAL_DIVISOR], typ=BaseType('decimal', input.typ.unit, input.typ.positional),\n                             pos=getpos(expr))\n\n\n@signature(('int128', 'uint256', 'address', 'bytes'), 'str_literal')\ndef to_bytes32(expr, args, kwargs, context):\n    input = args[0]\n    typ, len = get_type(input)\n    if typ == 'bytes':\n        if len != 32:\n            raise TypeMismatchException(\"Unable to convert bytes[{}] to bytes32\".format(len))\n        if input.location == \"memory\":\n            return LLLnode.from_list(\n            ['mload', ['add', input, 32]], typ=BaseType('bytes32')\n            )\n        elif input.location == \"storage\":\n            return LLLnode.from_list(\n                ['sload', ['add', ['sha3_32', input], 1]], typ=BaseType('bytes32')\n            )\n    else:\n        return LLLnode(value=input.value, args=input.args, typ=BaseType('bytes32'), pos=getpos(expr))\n\n\ndef convert(expr, context):\n    output_type = expr.args[1].s\n    if output_type in conversion_table:\n        return conversion_table[output_type](expr, context)\n    else:\n        raise Exception(\"Conversion to {} is invalid.\".format(output_type))\n\n\nconversion_table = {\n    'int128': to_int128,\n    'uint256': to_uint256,\n    'decimal': to_decimal,\n    'bytes32': to_bytes32,\n}\n", "path": "vyper/types/convert.py"}]}