Vyper theorytheory 0/50 · 0%
Testing · hard

38. Testing Vyper contracts with Titanoboa

A Python-native way to run and inspect Vyper contracts.

Titanoboa is a Vyper-focused testing/interpreter framework that lets you deploy and call Vyper contracts directly from Python, with full tracebacks pointing back into your Vyper source — much friendlier than decoding raw revert bytes.

import boa

source = '''
counter: public(uint256)

@external
def increment():
    self.counter += 1
'''

contract = boa.loads(source)
contract.increment()
assert contract.counter() == 1

Because it runs an interpreter rather than only the compiled EVM bytecode, Titanoboa can also give richer debugging output (line-level stack traces) during test failures.

Check your understanding

  1. 1. What is Titanoboa primarily used for?

  2. 2. What advantage does it offer over reading raw revert bytes?

  3. 3. How do you load Vyper source in Titanoboa?