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:
| Field | Type | Description |
|---|---|---|
id | string | Generated id. Use it with update / remove / enable / disable. |
contractAddress | string | Lowercased contract address |
functionAbi | string | JSON-encoded ABI fragment for the overridden function |
inputParams | string[] | null | When non-null, the override only matches calls whose ABI-encoded inputs match these values exactly. null is a wildcard. |
returnValues | string[] | String-encoded values matching the fragment’s outputs |
enabled | boolean | Disabled overrides remain in the DB but are not applied |
createdAt | string | ISO 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.
| Parameter | Type | Description |
|---|---|---|
input | object | See fields below |
Input fields:
| Field | Type | Description |
|---|---|---|
contractAddress | string | Target contract |
functionAbi | string | object | JSON-encoded ABI fragment (or the fragment object — both accepted) |
inputParams | string[]? | Omit (or pass null/[]) for a wildcard; pass values to match only that input |
returnValues | string[] | 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.
| Parameter | Type | Description |
|---|---|---|
id | string | Override id |
returnValues | string[] | 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.
| Parameter | Type | Description |
|---|---|---|
id | string | Override 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.
| Parameter | Type | Description |
|---|---|---|
id | string | Override 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.
| Parameter | Type | Description |
|---|---|---|
contractAddress | string | 0x-prefixed Ethereum address |
Returns an array of overrides.