How to send value in an external contract call with Vyper

Sam Richards
1 min readJul 13, 2019

--

Vyper supports parameters for setting both gas and value in your function calls to external contracts. This is provided via thevalue= and gas= kwargs.

For example, here’s one way to call a function on a Uniswap exchange and send value (note: you’ll need to create an interface to reference the external contract first).

If you need to cast your value into wei, there’s the as_wei_value built-in function:

FYI, these code examples use vyper version: 0.1.0b10

Happy coding! Leave a comment if you have any thoughts or questions.

--

--