> For the complete documentation index, see [llms.txt](https://docs.nucleusearn.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nucleusearn.io/nucleus-architecture/smart-contracts/contracts/atomic-queue/iatomicsolver.md).

# IAtomicSolver

[Git Source](https://github.com/Ion-Protocol/nucleus-boring-vault/blob/cc0b494b83e17b9b169a73b96050d2810b690477/src/atomic-queue/IAtomicSolver.sol)

## Functions

### finishSolve

This function must be implemented in order for an address to be a `solver` for the AtomicQueue

```solidity
function finishSolve(
    bytes calldata runData,
    address initiator,
    ERC20 offer,
    ERC20 want,
    uint256 assetsToOffer,
    uint256 assetsForWant
)
    external;
```

**Parameters**

| Name            | Type      | Description                                                                                                              |
| --------------- | --------- | ------------------------------------------------------------------------------------------------------------------------ |
| `runData`       | `bytes`   | arbitrary bytes data that is dependent on how each solver is setup it could contain swap data, or flash loan data, etc.. |
| `initiator`     | `address` | the address that initiated a solve                                                                                       |
| `offer`         | `ERC20`   | the ERC20 asset sent to the solver                                                                                       |
| `want`          | `ERC20`   | the ERC20 asset the solver must approve the queue for                                                                    |
| `assetsToOffer` | `uint256` | the amount of `offer` sent to the solver                                                                                 |
| `assetsForWant` | `uint256` | the amount of `want` the solver must approve the queue for                                                               |


---

# 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://docs.nucleusearn.io/nucleus-architecture/smart-contracts/contracts/atomic-queue/iatomicsolver.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.
