# Direct

Direct is an abstract implementation of [MangroveOffer](/mangrove-core/explanations/offer-maker/mangrove-offer.md), if you don't have a good understanding of MangroveOffer we recommend reading that page first.

Direct should be seen as an implementation that only works for one user, the admin of the contract. This means most calls are guarded, so only the admin can call them. Having only one user, simplifies the uses of the contract, since there is no need to keep track of who is posting offer, updating offers or retracting offers, it is always the admin.

Direct does many of the same things as MangroveOffer with a few key differences.

**How inbound tokens are handled (from the taker):** After the funds have been transferred from the taker to the Direct contract, it chooses to leave received funds on the contract's balance, until `makerPosthook` is called. The reason for leaving the funds on the contract is that multiple offers posted by this contract may be taken in the same market order. This will result in a cumulative amount of inbound tokens being on the contract's balance. Instead of transferring them during each call to `makerExecute`, it is cheaper in gas to wait until after all offers are taken, and then transfer all the funds left on the contract to the reserve.

**How outbound tokens are handled (for the taker):** When transferring the funds from the contract to the taker, Direct first tries to check if it itself has the funds, otherwise tries to get the funds from the reserve either by using a router or by using the contract itself. This means that if the contract already has the funds, no extra transfers are needed.

**Reserve:** When setting the reserve using a Direct contract, the Direct checks whether the caller is the admin of the contract and if so, the reserve is set. Since the contract can only be used by the admin, there is no need to check anything else. Setting the reserve to the Direct contracts address will save gas, since it saves the transfers between the Direct contract and the reserve.

MangroveOffer has no implementations of how to post a new offer, update an offer or retract an offer. Direct offers default implementations for this. Posting a new offer and updating an offer, is very simply done by forwarding the call to Mangroves own methods for post a new offer and updating an offer. Retracting a offer using Direct, will also forward the call to Mangroves own retract offer method. But since the Direct contract is the actual address that posts the offers on Mangrove, then if one chooses to deprovision the offer, all provisions will be return to the Direct contract. The Direct contract therefore implements an option to transfer the provision back to the admin of the contract.

![Flow of taking a offer made by Direct](/files/paSGiQSWXRJhlHQkUOwU)


---

# Agent Instructions: 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:

```
GET https://docs.oxium.xyz/mangrove-core/explanations/offer-maker/direct.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
