> For the complete documentation index, see [llms.txt](https://deepswap.gitbook.io/deepswap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://deepswap.gitbook.io/deepswap/swapping-trading/cross-chain-swaps.md).

# Cross-chain swaps

(v1.0)

### State-Changing Functions[​](https://docs.sushi.com/docs/Products/SushiXSwap%20-%20Crosschain%20AMM/Contracts/SushiXSwap#state-changing-functions) <a href="#state-changing-functions" id="state-changing-functions"></a>

#### - dps[​](https://docs.sushi.com/docs/Products/SushiXSwap%20-%20Crosschain%20AMM/Contracts/SushiXSwap#cook) <a href="#cook" id="cook"></a>

```
function dps(
  uint8[] memory actions,
  uint256[] memory values,
  bytes[] memory datas
) public payable override;
```

This function is designed for executing multiple actions in a single transaction. Each action is defined by an integer, and the corresponding value and data are provided in separate arrays.

Possible actions include but are not limited to: approving a master contract, depositing to BentoBox, transferring tokens from BentoBox, transferring tokens from this contract, withdrawing tokens, wrapping tokens, and performing token swaps.

Each action is decoded and executed in the order they appear in the `actions` array. The `values` and `datas` arrays must have the same length as the `actions` array, and each index corresponds to the same action.

The function is payable, which means it can receive native token (e.g. Ether) along with the transaction. The received value is used in actions that require transferring native token.\
\
-**Parameters**<br>

| Name      | Type       | Description                                                                                                                                    |
| --------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `actions` | uint8\[]   | An array of actions to execute. The actions correspond to predefined constants that define a specific behavior.                                |
| `values`  | uint256\[] | An array with the same length as `actions`. Each value is the amount of native token (e.g. Ether) to send along with the corresponding action. |
| `datas`   | bytes\[]   | An array with the same length as `actions`. Each data element is ABI encoded data of the function arguments for the corresponding action.      |

* **Modifiers**[**​**](https://docs.sushi.com/docs/Products/SushiXSwap%20-%20Crosschain%20AMM/Contracts/SushiXSwap#modifiers)

This function uses the `override` modifier, indicating that it overrides a function or modifier in the base contract.

* **Reverts**[**​**](https://docs.sushi.com/docs/Products/SushiXSwap%20-%20Crosschain%20AMM/Contracts/SushiXSwap#reverts)

This function reverts if the number of actions does not match the number of values or datas. It also reverts if an action is not recognized or if a specific action fails to execute.

* **Events**[**​**](https://docs.sushi.com/docs/Products/SushiXSwap%20-%20Crosschain%20AMM/Contracts/SushiXSwap#events)

No specific events are emitted by this function. However, depending on the executed actions, various events might be emitted.

* **Functions called**[**​**](https://docs.sushi.com/docs/Products/SushiXSwap%20-%20Crosschain%20AMM/Contracts/SushiXSwap#functions-called)

This function calls a variety of other functions based on the provided actions. These might include functions in the same contract or in other contracts, such as BentoBox.

* **Example**[**​**](https://docs.sushi.com/docs/Products/SushiXSwap%20-%20Crosschain%20AMM/Contracts/SushiXSwap#example)

The following is an example of how to call the dps function:

```
uint8[] memory actions = new uint8[](1);
uint256[] memory values = new uint256[](1);
bytes[] memory datas = new bytes[](1);

// Define the action, value, and data
actions[0] = ACTION_MASTER_CONTRACT_APPROVAL;
values[0] = 0; // No native token sent with this action
datas[0] = abi.encode(user, approved, v, r, s);

// Call the dps function
myContract.dps(actions, values, datas);
```
