# call_context

Builds the EVM transaction context attached to one PROGRAM call step.

Canonical HTML: <https://determica.com/docs/functions/call_context>

- Kind: scalar function
- Category: [Simulation](/docs/category/simulation.md)
- Tags: Program Compiler, Simulate

Builds the EVM transaction context attached to one PROGRAM call step.

## Overload 1: call_context(UINT256, STRUCT(address ADDRESS, storage_keys BYTES32\[\])\[\], BYTES32\[\])

```sql
call_context(UINT256, STRUCT(address ADDRESS, storage_keys BYTES32[])[], BYTES32[])
```

Builds the EVM transaction context attached to one PROGRAM call step.

- Kind: scalar
- Execution context: Offline
- Behavior: Transform
- Execution modes: Offline
- Input shape: Scalar Arguments
- Planning contract: Runtime
- Cardinality: One Per Input
- Determinism: Deterministic
- Return shape: Scalar
- Schema stability: Fixed
- Stability: Stable
- Side effects: None documented

### Inputs

- `gas_price` (UINT256; required; positional) — Exact UINT256 gas price, in Wei per gas, exposed to EVM execution.
- `access_list` (STRUCT(address ADDRESS, storage_keys BYTES32[])[]; required; positional) — Non-NULL list of non-NULL address entries; each storage_keys field and each BYTES32 key must be non-NULL.
- `blob_versioned_hashes` (BYTES32[]; required; positional) — Non-NULL list of non-NULL BYTES32 hashes exposed to EVM execution.

### Returns

CALL_CONTEXT value

Returns a CALL_CONTEXT that can be attached to a raw or ABI PROGRAM step; it does not execute the step.

- `context` (CALL_CONTEXT)

CALL_CONTEXT value. Returns a CALL_CONTEXT that can be attached to a raw or ABI PROGRAM step; it does not execute the step.

### Examples

_Local SQL · Local_

```sql
WITH actors AS (
  SELECT
    '0x1000000000000000000000000000000000000001'::ADDRESS AS sender,
    '0x2000000000000000000000000000000000000002'::ADDRESS AS writer
),
authored AS (
  SELECT
    access_list,
    context,
    execute_call(
      sender,
      writer,
      '0x000000000000000000000000000000000000000000000000000000000000002a'::BYTES,
      1::UINT256,
      100000::UBIGINT,
      context
    ) AS step
  FROM (
    SELECT
      *,
      call_context(
        1::UINT256,
        access_list,
        []::BYTES32[]
      ) AS context
    FROM (
      SELECT
        *,
        [{
          address: writer,
          storage_keys: [
            '0x0000000000000000000000000000000000000000000000000000000000000000'::BYTES32
          ]
        }] AS access_list
      FROM actors
    )
  )
)
SELECT
  len(access_list)::INTEGER AS warmed_accounts,
  step IS NOT NULL AS contextual_step
FROM authored;
-- => [{"warmed_accounts":1,"contextual_step":"true"}]
```

## Guidance

### Defaults

A step without CALL_CONTEXT uses a zero gas price and empty access-list and blob-hash lists.

## Related functions

- [assume_native_balance](/docs/functions/assume_native_balance.md) — See Also
- [execute_call](/docs/functions/execute_call.md) — See Also
- [program](/docs/functions/program.md) — See Also
- [observe](/docs/functions/observe.md) — See Also
- [run](/docs/functions/run.md) — See Also
