# `execTransaction`

Executes a Safe transaction to `to` with `value` (native currency) and pays `gasPrice` \* `gasLimit` in `gasToken` token to `refundReceiver`.

<Callout type='warning'>
  The fees are always transferred, even if the user transaction fails. This
  method doesn't perform any sanity check of the transaction, such as if the
  contract at `to` address has code or not. It is the responsibility of the
  caller to perform such checks.
</Callout>

## Usage


<Tabs items={['example.sol']}>
  <Tabs.Tab>
    ```solidity
    interface ISafe {
        function execTransaction(
            address to,
            uint256 value,
            bytes data,
            Enum.Operation operation,
            uint256 safeTxGas,
            uint256 baseGas,
            uint256 gasPrice,
            address gasToken,
            address payable refundReceiver,
            bytes signatures
        ) external payable returns (bool success);
    }

    contract Example {
        function example() ... {
            (ISafe safe).execTransaction(
                0x...,
                0,
                "0x...",
                Enum.Operation.Call,
                0,
                0,
                0,
                0x...,
                0x...,
                "0x..."
            );
        }
    }
    ```
  </Tabs.Tab>
</Tabs>


## Returns

- **Type:** `bool`

Boolean indicating transaction's success.

## Parameters

### `to`

- **Type:** `address`

Destination address of Safe transaction.

```solidity focus=2
(ISafe safe).execTransaction(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    0,
    0,
    0,
    0x...,
    0x...,
    "0x..."
);
```

### `value`

- **Type:** `uint256`

Native token value of Safe transaction.

```solidity focus=3
(ISafe safe).execTransaction(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    0,
    0,
    0,
    0x...,
    0x...,
    "0x..."
);
```

### `data`

- **Type:** `bytes`

Data payload of Safe transaction.

```solidity focus=4
(ISafe safe).execTransaction(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    0,
    0,
    0,
    0x...,
    0x...,
    "0x..."
);
```

### `operation`

- **Type:** `Enum.Operation`

Operation type of Safe transaction.

```solidity focus=5
(ISafe safe).execTransaction(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    0,
    0,
    0,
    0x...,
    0x...,
    "0x..."
);
```

### `safeTxGas`

- **Type:** `uint256`

Gas that should be used for the Safe transaction.

```solidity focus=6
(ISafe safe).execTransaction(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    0,
    0,
    0,
    0x...,
    0x...,
    "0x..."
);
```

### `baseGas`

- **Type:** `uint256`

Gas costs that are independent of the transaction execution (for example, the base transaction fee, signature check, and refund payment).

```solidity focus=7
(ISafe safe).execTransaction(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    0,
    0,
    0,
    0x...,
    0x...,
    "0x..."
);
```

### `gasPrice`

- **Type:** `uint256`

Gas price that should be used for the payment calculation.

```solidity focus=8
(ISafe safe).execTransaction(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    0,
    0,
    0,
    0x...,
    0x...,
    "0x..."
);
```

### `gasToken`

- **Type:** `address`

Token address (or `0x` if native token) that is used for the payment.

```solidity focus=9
(ISafe safe).execTransaction(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    0,
    0,
    0,
    0x...,
    0x...,
    "0x..."
);
```

### `refundReceiver`

- **Type:** `address payable`

Address of receiver of gas payment (or `0` if `tx.origin`).

```solidity focus=10
(ISafe safe).execTransaction(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    0,
    0,
    0,
    0x...,
    0x...,
    "0x..."
);
```

### `signatures`

- **Type:** `bytes`

Signature data that should be verified. Can be packed ECDSA signature `((bytes32 r)(bytes32 s)(uint8 v))`, contract signature ([EIP-1271](../../home/glossary.md#eip-1271)), or approved hash.

```solidity focus=11
(ISafe safe).execTransaction(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    0,
    0,
    0,
    0x...,
    0x...,
    "0x..."
);
```

## Events

### `ExecutionSuccess`

```solidity
event ExecutionSuccess(bytes32 txHash, uint256 payment);
```

Emitted when a transaction is executed successfully.
### `ExecutionFailure`

```solidity
event ExecutionFailure(bytes32 txHash, uint256 payment);
```

Emitted when a transaction fails.
