> For the complete documentation index, see [llms.txt](https://liquorice.gitbook.io/liquorice-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://liquorice.gitbook.io/liquorice-docs/for-solvers/settlement/bebop-jam.md).

# Bebop JAM

### 1. Providing JamSettlement address in the RFQ

From the perspective of Liquorice, trade is performed with the JamSettlement contract, not directly with the trader.

Therefore, a solver must first and foremost provide the [address of the JamSettlement smart contract ](https://docs.bebop.xyz/bebop/smart-contracts/jam-smart-contracts)in both `trader` and `effectiveTrader` fields of the RFQ message.&#x20;

* [REST API RFQ](https://liquorice.gitbook.io/liquorice-docs/for-solvers/settlement/pages/DZxOUYGmZTU7wNZBpgld#id-2.-rfq)
* [WS API RFQ](https://liquorice.gitbook.io/liquorice-docs/for-solvers/settlement/pages/8KNzbv9BjnFq0k00IvQ4#id-2.-sending-rfq)

### 2. Calling [JamSettlement.settle](https://github.com/bebop-dex/bebop-jam-contracts/blob/master/src/JamSettlement.sol#L46) function&#x20;

### 2.1 Solver data argument

During the settlement process, funds from the trader must first be transferred to the JamSettlement contract.

For this reason, `balanceRecipient` of the `ExecInfo.SolverData` has to be set to the [address of the JamSettlement contract](https://docs.bebop.xyz/bebop/smart-contracts/jam-smart-contracts).

#### Solidity example

```solidity
ExecInfo.SolverData memory solverData = ExecInfo.SolverData(<jam-settlement>, 10_000);
```

### 2.2. Jam Interactions argument

To assemble Jam Interactions, solver would need to use following fields from the Quote payload&#x20;

* `baseToken`
* `baseTokenAmount`
* `tx`

*Reference*

* [REST API Quote](/liquorice-docs/for-solvers/rest-api.md#response)
* [WS API Quote](https://liquorice.gitbook.io/liquorice-docs/for-solvers/settlement/pages/8KNzbv9BjnFq0k00IvQ4#id-3.-receiving-quote)

#### Approval

When performing the trade, [Liquorice Balance Manager contract](/liquorice-docs/links/smart-contracts.md) must have a `baseToken` approval given by the JamSettlement contract.

#### Quote interactions

The rest of the interactions must be assembled from the `interactions` and `market` fields.

#### Solidity example

```solidity
struct Transaction {
  address to;
  bytes data;
}

struct Allowance {
  address token;
  address spender;
  uint256 amount;
}

struct LiquoriceRFQQuoteLevel {
  address baseToken;
  uint256 baseTokenAmount;
  Transaction tx;
  Allowance[] allowances;
}

function getJamInteractions(LiquoriceRFQQuoteLevel calldata quoteLevel) public pure returns (JamInteraction.Data[] memory interactions) {
  uint256 allowancesLength = quoteLevel.allowances.length;
  interactions = new JamInteraction.Data[](allowancesLength + 1);

  for (uint256 i = 0; i < allowancesLength; i++) {
    interactions[i] = JamInteraction.Data(
      true,
      quoteLevel.allowances[i].token,
      0,
      abi.encodeWithSelector(IERC20.approve.selector, quoteLevel.allowances[i].spender, quoteLevel.allowances[i].amount)
    );
  }

  interactions[allowancesLength] = JamInteraction.Data(true, quoteLevel.tx.to, 0, quoteLevel.tx.data);

  return interactions;
}
```

### 2.3 Rest arguments

Remaining arguments such as `hooks`, `signature` and `order` provided as is.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://liquorice.gitbook.io/liquorice-docs/for-solvers/settlement/bebop-jam.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
