- an AST interpreter for Vyper with a custom EVM backend
-
uses the Vyper compiler as a library
-
calls the compiler to get the annotated AST
-
an Account in the EVM doesn't contain the code, but the contract's annotated AST
-
when a tx/call is made to the contract, the AST (instead of bytecode) is interpreted
-
as in
boa
contracts can be deployed usingload
function- it returns a user-facing contract representation for user interaction
-
the interpreter maintains a global state (storage, balances, etc.)
- run:
uv run python -m ivy tests/example_contracts/example.vy
- test:
uv run pytest tests
from ivy.frontend.loader import loads
def test_deploy_and_call():
src = """
@external
def foo(a: uint256=42) -> uint256:
return a
"""
c = loads(src)
assert c.foo() == 42
- the concept of
gas
is not supported (can't map gas costs to AST interpretation) delegatecall
support is basic - it's true semantics are tied to the storage layout, however, inIvy
we used a simplified adressing model.It is thus impossible to properly map variables from the caller to the callee. Therefore,delegatecall
works as expected only if the contracts satisfy specific layout requirements.- frontend of the interpreter is heavily inspired by boa, and it's code is often reused in the frontend parts (user-facing contracts, environment, etc.)