setFallbackHandler method

  1. @override
Future<SafeContractEncodedCall> setFallbackHandler(
  1. ETHAddress handler
)
override

"stateMutability": "nonpayable", Sets the fallback handler contract (handler) for the Safe.

Notes:

  1. Only fallback calls without value and with data are forwarded.
  2. Changing the fallback handler can only be done through a Safe transaction.
  3. The fallback handler cannot be set to the Safe itself.
  4. ⚠️ IMPORTANT — SECURITY RISK: The fallback handler can be set to any address, and all calls will be forwarded to that address, bypassing the Safe’s normal access control checks. Ensure the handler address is trusted, and if it can modify state, verify it performs proper security and permission checks.

Parameters:

  • handler: Address of the contract that will handle fallback calls.

Implementation

@override
Future<SafeContractEncodedCall> setFallbackHandler(ETHAddress handler) async {
  final params = [handler];
  return encodeTransactionCall(
    functionName: SafeContractFunction.setFallbackHandler,
    params: params,
  );
}