> For the complete documentation index, see [llms.txt](https://docs.mangrove.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mangrove.exchange/dev/protocol/technical-references/makers/gas-requirement.md).

# Gas Requirement

### Overview

The gas requirement (`gasreq`) defines how much gas an offer's logic may consume when executed by Mangrove. It plays a critical role in the [provision](/dev/protocol/technical-references/makers/offer-provisions.md) calculation, which determines the amount of native tokens locked to compensate the taker if the offer fails.

`gasreq` represents the total gas needed for the offer logic to run successfully, including both execution callbacks:

* `makerExecute` — the main trade execution logic
* `makerPostHook` — optional logic that runs after successful execution

The `gasreq` value directly affects:

* The provision locked with the offer (higher `gasreq` -> higher provision).
* The bounty amount paid to takers when an offer fails.
* The density constraint, since higher `gasreq` increases the minimal required offer size.  &#x20;

The gas requirement should be estimated to cover the worst-case successful execution path in your maker contract.

#### Underestimating `gasreq`

If your estimate is too low:

* The offer may run out of gas during `makerExecute`.
* The trade fails, and the maker is penalized (their provision pays the taker's bounty).
* If `makerPostHook` runs out of gas, it does not execute, and any expected bookkeeping or offer updates will be lost.

#### Overestimating `gasreq`

If your estimate is too high:&#x20;

* The offer becomes less attractive to takers because of the higher apparent provision cost.
* The required locked funds (provision) increase unnecessarily.
* The minimum offer size (due to density requirements) also increases.

To get an idea of the `gasreq` for your contract, see [Determining gas requirements](/dev/strat-lib/guides/determining-gas-requirements.md) which also covers extra details when using the [StratLibrary](/dev/strat-lib/what-is-the-strat-library.md).
