Perform

Usage: forc call [OPTIONS] --abi <CONTRACT_ID> [FUNCTION_ARGS]...

Arguments:

<CONTRACT_ID> The contract ID to call

<FUNCTION> The function selector to call. The function selector is the name of the function to call (e.g. "transfer"). It must be a valid selector present in the ABI file

[FUNCTION_ARGS]... Arguments to pass into the function to be called

Options:

--abi <ABI>

Path or URI to a JSON ABI file

--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.

--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

--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

--mode <MODE>

The execution mode to use for the call; defaults to dry-run; possible values: dry-run, simulate, live

[default: dry-run]

--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

--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 a dry-run calls to the node, and extract the contract addresses based on the revert reason

--output <OUTPUT>

The output format to use; possible values: default, raw

[default: default]

-h, --help

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

-V, --version

Print version

EXAMPLES:

Call a contract with function parameters

» forc call 0x0dcba78d7b09a1f77353f51367afd8b8ab94b5b2bb6c9437d9ba9eea47dede97

--abi

./contract-abi.json
get_balance 0x0087675439e10a8351b1d5e4cf9d0ea6da77675623ff6b16470b5e3c58998423

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 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