Skip to Content
RPC RoutesFunction Overrides

Function Overrides

RPC methods for intercepting the return value of a contract function on your Stagenet.

When an override is active, every call to that function — whether through eth_call or as an inner call from another contract — returns the fixed value you set, regardless of the contract’s actual code or storage. The override is applied inside the EVM, so a contract that staticcalls the overridden function sees the override too.

These methods back the SDK’s addFunctionOverride family.

Override shape

Every override has these fields:

FieldTypeDescription
idstringGenerated id. Use it with update / remove / enable / disable.
contractAddressstringLowercased contract address
functionAbistringJSON-encoded ABI fragment for the overridden function
inputParamsstring[] | nullWhen non-null, the override only matches calls whose ABI-encoded inputs match these values exactly. null is a wildcard.
returnValuesstring[]String-encoded values matching the fragment’s outputs
enabledbooleanDisabled overrides remain in the DB but are not applied
createdAtstringISO timestamp

When both a wildcard and an exact-input override exist for the same selector, the exact-input one takes precedence.

dev_addFunctionOverride

Install an override.

ParameterTypeDescription
inputobjectSee fields below

Input fields:

FieldTypeDescription
contractAddressstringTarget contract
functionAbistring | objectJSON-encoded ABI fragment (or the fragment object — both accepted)
inputParamsstring[]?Omit (or pass null/[]) for a wildcard; pass values to match only that input
returnValuesstring[]One entry per output in the fragment

Returns the created override (see Override shape).

Example — override getCount() to always return 42:

curl -X POST <YOUR_STAGENET_RPC_URL> \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "dev_addFunctionOverride", "params": [{ "contractAddress": "0x1111111111111111111111111111111111111111", "functionAbi": "{\"type\":\"function\",\"name\":\"getCount\",\"inputs\":[],\"outputs\":[{\"type\":\"uint256\"}],\"stateMutability\":\"view\"}", "returnValues": ["42"] }] }'

Example — override balanceOf(0xabc…) to a specific value, leaving every other account untouched:

curl -X POST <YOUR_STAGENET_RPC_URL> \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "dev_addFunctionOverride", "params": [{ "contractAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "functionAbi": "{\"type\":\"function\",\"name\":\"balanceOf\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"outputs\":[{\"type\":\"uint256\"}],\"stateMutability\":\"view\"}", "inputParams": ["0x1111111111111111111111111111111111111111"], "returnValues": ["1000000000"] }] }'

dev_updateFunctionOverride

Replace the returnValues of an existing override. contractAddress, the function selector, and inputParams are immutable — to change them, remove and re-add the override.

ParameterTypeDescription
idstringOverride id
returnValuesstring[]New return values

Returns the updated override.

curl -X POST <YOUR_STAGENET_RPC_URL> \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "dev_updateFunctionOverride", "params": ["ckxyz...", ["100"]] }'

dev_removeFunctionOverride

Delete an override.

ParameterTypeDescription
idstringOverride id

Returns:

{ "id": "ckxyz...", "removed": true }

dev_enableFunctionOverride / dev_disableFunctionOverride

Toggle an override without deleting it. A disabled override stays in the DB but is not applied, so calls go through to the real contract.

ParameterTypeDescription
idstringOverride id

Returns the updated override.

curl -X POST <YOUR_STAGENET_RPC_URL> \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "dev_disableFunctionOverride", "params": ["ckxyz..."] }'

dev_getFunctionOverrides

List every override on the Stagenet, most recent first.

Returns an array of overrides (see Override shape).

curl -X POST <YOUR_STAGENET_RPC_URL> \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "dev_getFunctionOverrides", "params": [] }'

dev_getFunctionOverridesByContract

List overrides for a single contract.

ParameterTypeDescription
contractAddressstring0x-prefixed Ethereum address

Returns an array of overrides.

Last updated on