I'm trying to compile the Uniswap Exchange contract using the latest vyper compiler.

I first updated the ERC20 references to the new token: ERC20 definition and set up an import from vyper.interfaces import ERC20.

The next issue is with the getExchange() function in the Factory interface.

vyper.exceptions.TypeMismatchException: line 68:15 Typecasting from base type address(ERC20) to address unavailable

This occurs on the following line:

assert self.factory.getExchange(self.token) == self

I tried to solve it by amending the getExchange interface to:

    def getExchange(token_addr: ERC20) -> address: constant

but this produces another error:

vyper.exceptions.InvalidTypeException: line 8: Invalid base type: ERC20
    def getExchange(token_addr: ERC20) -> address: constant

How to get this to compile?

1 Answer 1


Turns out this was a compiler error and is being addressed.

See here: https://github.com/ethereum/vyper/issues/1375

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.