docs/src/calling-contracts/low-level-calls.md
With low-level calls, you can specify the parameters of your calls at runtime and make indirect calls through other contracts.
Your caller contract should call std::low_level_call::call_with_function_selector, providing:
BytesBytesu64)std::low_level_call::CallParams{{#include ../../../e2e/sway/contracts/low_level_caller/src/main.sw:low_level_call_contract}}
On the SDK side, you can construct an encoded function selector using fuels::core::encode_fn_selector, and encoded calldata using the fuels::core::calldata! macro.
E.g. to call the following function on the target contract:
{{#include ../../../e2e/sway/contracts/contract_test/src/main.sw:low_level_call}}
you would construct the function selector and the calldata as such, and provide them to the caller contract (like the one above):
{{#include ../../../examples/contracts/src/lib.rs:low_level_call}}
Note: the
calldata!macro uses the defaultEncoderConfigconfiguration under the hood.