Skip to content

test_call_with_value_mainnet()

Documentation for tests/amsterdam/eip7708_eth_transfer_logs/test_eip_mainnet.py::test_call_with_value_mainnet@87aba1a3.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7708_eth_transfer_logs/test_eip_mainnet.py::test_call_with_value_mainnet --fork Amsterdam

Test that CALL with value emits a transfer log on mainnet.

Source code in tests/amsterdam/eip7708_eth_transfer_logs/test_eip_mainnet.py
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
def test_call_with_value_mainnet(
    state_test: StateTestFiller,
    pre: Alloc,
) -> None:
    """Test that CALL with value emits a transfer log on mainnet."""
    sender = pre.fund_eoa()
    recipient = pre.deploy_contract(Op.STOP)

    contract_code = Op.CALL(gas=50_000, address=recipient, value=100)
    contract = pre.deploy_contract(contract_code, balance=100)

    tx = Transaction(
        ty=0x02,
        sender=sender,
        to=contract,
        value=0,
        gas_limit=100_000,
        expected_receipt=TransactionReceipt(
            logs=[transfer_log(contract, recipient, 100)]
        ),
    )

    post = {recipient: Account(balance=100)}
    state_test(pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.