Perform

Usage: forc call [OPTIONS]

[FUNCTION] [FUNCTION_ARGS]...

Options:

--abi <ABI>

Path, URI, or raw JSON string for the ABI Required when making function calls or listing functions Can be a file path, HTTP/HTTPS URL, or raw JSON string

--node-url <NODE_URL>

The URL of the Fuel node to which we're submitting the transaction. If unspecified, checks the manifest's network table, then falls back to http://127.0.0.1:4000

You can also use --target, --devnet, --testnet, or --mainnet to specify the Fuel node.

[env: FUEL_NODE_URL=]

--target <TARGET>

Preset configurations for using a specific target.

You can also use --node-url, --devnet, --testnet, or --mainnet to specify the Fuel node.

Possible values are: [local, testnet, mainnet]

--mainnet

Use preset configuration for mainnet.

You can also use --node-url, --target, or --testnet to specify the Fuel node.

--testnet

Use preset configuration for testnet.

You can also use --node-url, --target, or --mainnet to specify the Fuel node.

--devnet

Use preset configuration for devnet.

You can also use --node-url, --target, or --testnet to specify the Fuel node.

--gas-price <PRICE>

Gas price for the transaction

--script-gas-limit <SCRIPT_GAS_LIMIT>

Gas limit for the transaction

--max-fee <MAX_FEE>

Max fee for the transaction

--tip <TIP>

The tip for the transaction

-h, --help

Print help (see a summary with '-h')

-V, --version

Print version

CONTRACT:

--contract-abi <CONTRACT_ABIS>

Additional contract IDs and their ABI paths for better tracing and debugging. Format: contract_id:abi_path (can be used multiple times) Example: --contract-abi 0x123:./abi1.json --contract-abi 0x456:https://example.com/abi2.json Contract IDs can be provided with or without 0x prefix

--external-contracts <EXTERNAL_CONTRACTS>

The external contract addresses to use for the call If none are provided, the call will automatically populate external contracts by making dry-run calls to the node, and extract the contract addresses based on the revert reason. Use an empty string '' to explicitly specify no external contracts. Multiple contract IDs can be provided separated by commas

<ADDRESS> The contract ID to call

OUTPUT:

--label <LABEL>

Label addresses in the trace output for better readability. Format: address:label (can be used multiple times) Example: --label 0x123:MainContract --label 0x456:TokenContract Addresses can be provided with or without 0x prefix

-o, --output <OUTPUT>

Output format for the call result

[default: default]

Possible values:

  • default: Default formatted output
  • raw: Raw unformatted output
  • json: JSON output with full tracing information (logs, errors, and result)

-v...

Set verbosity levels; currently only supports max 2 levels - -v=1: Print decoded logs - -v=2: Additionally print receipts and script json

FUNCTION: [FUNCTION] The function selector to call. The function selector is the name of the function to call (e.g. "transfer"). Not required when --list-functions is specified or when --amount is provided for direct transfer

[FUNCTION_ARGS]... Arguments to pass to the function

ACCOUNT OPTIONS:

--signing-key <SIGNING_KEY>

Derive an account from a secret key to make the call

[env: SIGNING_KEY=]

--wallet

Use forc-wallet to make the call

CALL PARAMETERS:

--amount <AMOUNT>

Amount of native assets to forward with the call

[default: 0]

--asset-id <ASSET_ID>

Asset ID to forward with the call

--gas-forwarded <GAS_FORWARDED>

Amount of gas to forward with the call

EXECUTION:

--mode <MODE>

Execution mode - determines if state changes are applied - dry-run: No state changes, no gas fees, wallet is not used or validated - simulate: No state changes, estimates gas, wallet is used but not validated - live: State changes, gas fees apply, wallet is used and validated

[default: dry-run]

Possible values:

  • dry-run: Execute a dry run - no state changes, no gas fees, wallet is not used or validated
  • simulate: Execute in simulation mode - no state changes, estimates gas, wallet is used but not validated
  • live: Execute live on chain - state changes, gas fees apply, wallet is used and validated

OPERATION:

--list-functions

List all available functions in the contract

VARIABLE OUTPUT:

--variable-output <VARIABLE_OUTPUT>

Contract call variable output count

DEBUG:

-d, --debug

Start interactive debugger after transaction execution

EXAMPLES:

Call a contract with function parameters

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--abi` 

./contract-abi.json \
get_balance 0x0087675439e10a8351b1d5e4cf9d0ea6da77675623ff6b16470b5e3c58998423

Call a contract with function parameters; additionally print logs, receipts and script json

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--abi` 

./contract-abi.json \
get_balance 0x0087675439e10a8351b1d5e4cf9d0ea6da77675623ff6b16470b5e3c58998423 \

`-vv` 


Call a contract with address labels for better trace readability

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--abi` 

./contract-abi.json \
transfer 0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07 \

`--label` 

0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97:MainContract \

`--label` 

0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07:TokenContract \

`-vv` 


Call a contract without function parameters

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--abi` 

./contract-abi.json \
get_name

Call a contract that makes external contract calls

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--abi` 

./contract-abi.json \
transfer 0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07 \

`--contracts` 

0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07

Call a contract with additional contract ABIs for better tracing

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--abi` 

./contract-abi.json \
transfer 0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07 \

`--contract-abi` 

0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07:./external-abi.json \

`--contract-abi` 

0x1234:https://example.com/abi.json

Call a contract in simulation mode

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--abi` 

./contract-abi.json \
add 1 2 \

`--mode` 

simulate

Call a contract in dry-run mode on custom node URL using explicit signing-key

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--node-url` 

"http://127.0.0.1:4000/v1/graphql" \

`--signing-key` 

0x... \

`--abi` 

./contract-abi.json \
add 1 2 \

`--mode` 

dry-run

Call a contract in live mode which performs state changes on testnet using forc-wallet

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--testnet` 

\

`--wallet` 

\

`--abi` 

./contract-abi.json \
add 1 2 \

`--mode` 

live

Call a contract payable function which transfers value of native asset on mainnet

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--abi` 

./contract-abi.json \
transfer 0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07 \

`--mode` 

live \

`--amount` 

100

Call a contract payable function which transfers value of custom asset

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--abi` 

./contract-abi.json \
transfer 0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07 \

`--amount` 

100 \

`--asset-id` 

0x0087675439e10a8351b1d5e4cf9d0ea6da77675623ff6b16470b5e3c58998423 \

`--live` 


List all available functions in a contract

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--abi` 

./contract-abi.json \

`--list-functions` 


Call a contract with inline ABI JSON string

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--abi` 

'{"functions":[{"inputs":[],"name":"get_balance","output":{"name":"","type":"u64","typeArguments":null}}]}' \
get_balance

Direct transfer of asset to a contract or address

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--amount` 

100 \

`--mode` 

live

Call a contract with interactive debugger after transaction

forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97 \

`--abi` 

./contract-abi.json \
get_balance 0x0087675439e10a8351b1d5e4cf9d0ea6da77675623ff6b16470b5e3c58998423 \

`--debug`